code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static int invertedCompare(Solution s1, Solution s2) {
int flag = InvertedCompareUtils.ConstraintCompare(s1, s2);
if (flag == 0)
{
flag = InvertedCompareUtils.ParetoObjectiveCompare(s1, s2);
}
return flag;
} }
|
public class class_name {
public static int invertedCompare(Solution s1, Solution s2) {
int flag = InvertedCompareUtils.ConstraintCompare(s1, s2);
if (flag == 0)
{
flag = InvertedCompareUtils.ParetoObjectiveCompare(s1, s2); // depends on control dependency: [if], data = [none]
}
return flag;
} }
|
public class class_name {
public static GooglePlacesException parse(String statusCode, String errorMessage) {
Class<?> clazz = statusClassMap.get(statusCode);
if (clazz == null)
return null;
try {
if (errorMessage == null || errorMessage.isEmpty())
return (GooglePlacesException) clazz.newInstance();
else {
Constructor<?> constructor = clazz.getConstructor(String.class);
return (GooglePlacesException) constructor.newInstance(errorMessage);
}
} catch (Exception e) {
// Should never happen!
throw new GooglePlacesException(e);
}
} }
|
public class class_name {
public static GooglePlacesException parse(String statusCode, String errorMessage) {
Class<?> clazz = statusClassMap.get(statusCode);
if (clazz == null)
return null;
try {
if (errorMessage == null || errorMessage.isEmpty())
return (GooglePlacesException) clazz.newInstance();
else {
Constructor<?> constructor = clazz.getConstructor(String.class);
return (GooglePlacesException) constructor.newInstance(errorMessage); // depends on control dependency: [if], data = [(errorMessage]
}
} catch (Exception e) {
// Should never happen!
throw new GooglePlacesException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String resolveTimeZoneId(String zoneId) {
String alias = _CalendarUtils.getTimeZoneAlias(zoneId);
if (alias != null) {
zoneId = alias;
}
alias = TimeZoneAliases.getAlias(zoneId);
if (alias != null) {
zoneId = alias;
}
return zoneId;
} }
|
public class class_name {
public String resolveTimeZoneId(String zoneId) {
String alias = _CalendarUtils.getTimeZoneAlias(zoneId);
if (alias != null) {
zoneId = alias; // depends on control dependency: [if], data = [none]
}
alias = TimeZoneAliases.getAlias(zoneId);
if (alias != null) {
zoneId = alias; // depends on control dependency: [if], data = [none]
}
return zoneId;
} }
|
public class class_name {
@Override
public void addCallback(Callback callback) {
if (manager != null) {
callback.initialize(manager);
}
callbacks.add(callback);
} }
|
public class class_name {
@Override
public void addCallback(Callback callback) {
if (manager != null) {
callback.initialize(manager); // depends on control dependency: [if], data = [(manager]
}
callbacks.add(callback);
} }
|
public class class_name {
protected boolean readMeta(@NotNull final WireIn wireIn) {
final StringBuilder event = Wires.acquireStringBuilder();
@NotNull ValueIn valueIn = wireIn.readEventName(event);
if (csp.contentEquals(event)) {
@Nullable final String csp = valueIn.text();
long cid;
event.setLength(0);
valueIn = wireIn.readEventName(event);
if (CoreFields.cid.contentEquals(event))
cid = valueIn.int64();
else
throw new IllegalStateException("expecting 'cid' but eventName=" + event);
event.setLength(0);
valueIn = wireIn.readEventName(event);
if (CoreFields.handler.contentEquals(event)) {
if (cidToHandle.containsKey(cid)) {
String registeredCsp = cidToHandle.get(cid).csp();
if (!csp.equals(registeredCsp))
Jvm.warn().on(getClass(), "cid: " + cid + " already has handler registered with different csp, registered csp:" + registeredCsp + ", received csp: " + csp);
// already has it registered
return false;
}
handler = valueIn.typedMarshallable();
handler.nc(nc());
handler.closeable(this);
try {
if (handler instanceof Registerable) {
Registerable registerable = (Registerable) this.handler;
registry.put(registerable.registryKey(), this.handler);
registerable.registry(registry);
}
} catch (Exception e) {
Jvm.warn().on(getClass(), e);
}
if (handler instanceof ConnectionListener)
nc().addConnectionListener((ConnectionListener) handler);
if (handler() instanceof HeartbeatEventHandler) {
assert heartbeatEventHandler == null : "its assumed that you will only have a " +
"single heartbeatReceiver per connection";
heartbeatEventHandler = (HeartbeatEventHandler) handler();
}
handler.cid(cid);
handler.csp(csp);
lastCid = cid;
cidToHandle.put(cid, handler);
if (handler instanceof WritableSubHandler)
writers.add(((WritableSubHandler) handler).writer());
} else
throw new IllegalStateException("expecting 'cid' but eventName=" + event);
return true;
} else if (CoreFields.cid.contentEquals(event)) {
final long cid = valueIn.int64();
if (cid == lastCid)
return false;
lastCid = cid;
handler = cidToHandle.get(cid);
if (handler == null) {
throw new IllegalStateException("handler not found : for CID=" + cid + ", " +
"known cids=" + cidToHandle.keySet());
}
} else {
throw new IllegalStateException("expecting either csp or cid, event=" + event);
}
return false;
} }
|
public class class_name {
protected boolean readMeta(@NotNull final WireIn wireIn) {
final StringBuilder event = Wires.acquireStringBuilder();
@NotNull ValueIn valueIn = wireIn.readEventName(event);
if (csp.contentEquals(event)) {
@Nullable final String csp = valueIn.text();
long cid;
event.setLength(0); // depends on control dependency: [if], data = [none]
valueIn = wireIn.readEventName(event); // depends on control dependency: [if], data = [none]
if (CoreFields.cid.contentEquals(event))
cid = valueIn.int64();
else
throw new IllegalStateException("expecting 'cid' but eventName=" + event);
event.setLength(0); // depends on control dependency: [if], data = [none]
valueIn = wireIn.readEventName(event); // depends on control dependency: [if], data = [none]
if (CoreFields.handler.contentEquals(event)) {
if (cidToHandle.containsKey(cid)) {
String registeredCsp = cidToHandle.get(cid).csp();
if (!csp.equals(registeredCsp))
Jvm.warn().on(getClass(), "cid: " + cid + " already has handler registered with different csp, registered csp:" + registeredCsp + ", received csp: " + csp);
// already has it registered
return false; // depends on control dependency: [if], data = [none]
}
handler = valueIn.typedMarshallable(); // depends on control dependency: [if], data = [none]
handler.nc(nc()); // depends on control dependency: [if], data = [none]
handler.closeable(this); // depends on control dependency: [if], data = [none]
try {
if (handler instanceof Registerable) {
Registerable registerable = (Registerable) this.handler;
registry.put(registerable.registryKey(), this.handler); // depends on control dependency: [if], data = [none]
registerable.registry(registry); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
Jvm.warn().on(getClass(), e);
} // depends on control dependency: [catch], data = [none]
if (handler instanceof ConnectionListener)
nc().addConnectionListener((ConnectionListener) handler);
if (handler() instanceof HeartbeatEventHandler) {
assert heartbeatEventHandler == null : "its assumed that you will only have a " +
"single heartbeatReceiver per connection";
heartbeatEventHandler = (HeartbeatEventHandler) handler(); // depends on control dependency: [if], data = [none]
}
handler.cid(cid); // depends on control dependency: [if], data = [none]
handler.csp(csp); // depends on control dependency: [if], data = [none]
lastCid = cid; // depends on control dependency: [if], data = [none]
cidToHandle.put(cid, handler); // depends on control dependency: [if], data = [none]
if (handler instanceof WritableSubHandler)
writers.add(((WritableSubHandler) handler).writer());
} else
throw new IllegalStateException("expecting 'cid' but eventName=" + event);
return true; // depends on control dependency: [if], data = [none]
} else if (CoreFields.cid.contentEquals(event)) {
final long cid = valueIn.int64();
if (cid == lastCid)
return false;
lastCid = cid; // depends on control dependency: [if], data = [none]
handler = cidToHandle.get(cid); // depends on control dependency: [if], data = [none]
if (handler == null) {
throw new IllegalStateException("handler not found : for CID=" + cid + ", " +
"known cids=" + cidToHandle.keySet());
}
} else {
throw new IllegalStateException("expecting either csp or cid, event=" + event);
}
return false;
} }
|
public class class_name {
public static boolean hasDefaultConstructor(Class<?> cls) {
if (cls == null) {
return false;
}
try {
cls.getConstructor(new Class<?>[0]);
} catch (NoSuchMethodException e2) {
return false;
} catch (SecurityException e2) {
throw new IllegalArgumentException(e2.getMessage(), e2);
}
return true;
} }
|
public class class_name {
public static boolean hasDefaultConstructor(Class<?> cls) {
if (cls == null) {
return false; // depends on control dependency: [if], data = [none]
}
try {
cls.getConstructor(new Class<?>[0]); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e2) {
return false;
} catch (SecurityException e2) { // depends on control dependency: [catch], data = [none]
throw new IllegalArgumentException(e2.getMessage(), e2);
} // depends on control dependency: [catch], data = [none]
return true;
} }
|
public class class_name {
public I addPages(Collection<WebPage> webPages) {
for (WebPage webPage : webPages) {
addPage(webPage);
}
return getThis();
} }
|
public class class_name {
public I addPages(Collection<WebPage> webPages) {
for (WebPage webPage : webPages) {
addPage(webPage); // depends on control dependency: [for], data = [webPage]
}
return getThis();
} }
|
public class class_name {
private void startQueuedNonPersistentTimerAlarms() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (EJSPlatformHelper.isZOSCRA()) // d684950
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "startQueuedNonPersistentTimerAlarms: skipped in adjunct process");
return;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "startQueuedNonPersistentTimers");
for (TimerNpImpl timer : ivQueuedNonPersistentTimers) {
timer.schedule(); // d589357
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "startQueuedNonPersistentTimers");
} }
|
public class class_name {
private void startQueuedNonPersistentTimerAlarms() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (EJSPlatformHelper.isZOSCRA()) // d684950
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "startQueuedNonPersistentTimerAlarms: skipped in adjunct process");
return; // depends on control dependency: [if], data = [none]
}
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "startQueuedNonPersistentTimers");
for (TimerNpImpl timer : ivQueuedNonPersistentTimers) {
timer.schedule(); // d589357 // depends on control dependency: [for], data = [timer]
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "startQueuedNonPersistentTimers");
} }
|
public class class_name {
public int getRequiredInt(String key) {
Optional<Integer> value = getInteger(key);
if (value.isPresent()) {
return value.get();
}
throw new IllegalStateException(String.format("required key [%s] not found", key));
} }
|
public class class_name {
public int getRequiredInt(String key) {
Optional<Integer> value = getInteger(key);
if (value.isPresent()) {
return value.get(); // depends on control dependency: [if], data = [none]
}
throw new IllegalStateException(String.format("required key [%s] not found", key));
} }
|
public class class_name {
public void onReceivedAuthCode(String code, String baseDomain) {
if (authType == AUTH_TYPE_WEBVIEW) {
oauthView.setVisibility(View.INVISIBLE);
}
startMakingOAuthAPICall(code, baseDomain);
} }
|
public class class_name {
public void onReceivedAuthCode(String code, String baseDomain) {
if (authType == AUTH_TYPE_WEBVIEW) {
oauthView.setVisibility(View.INVISIBLE); // depends on control dependency: [if], data = [none]
}
startMakingOAuthAPICall(code, baseDomain);
} }
|
public class class_name {
void stop() {
if (!configuration.customExecutor) {
((ExecutorService) taskExecutor).shutdownNow();
}
if (!configuration.customExecutorForCachedImages) {
((ExecutorService) taskExecutorForCachedImages).shutdownNow();
}
cacheKeysForImageAwares.clear();
uriLocks.clear();
} }
|
public class class_name {
void stop() {
if (!configuration.customExecutor) {
((ExecutorService) taskExecutor).shutdownNow(); // depends on control dependency: [if], data = [none]
}
if (!configuration.customExecutorForCachedImages) {
((ExecutorService) taskExecutorForCachedImages).shutdownNow(); // depends on control dependency: [if], data = [none]
}
cacheKeysForImageAwares.clear();
uriLocks.clear();
} }
|
public class class_name {
public void loadJarClassifier(String modelName, Properties props) {
Timing.startDoing("Loading JAR-internal classifier " + modelName);
try {
InputStream is = getClass().getResourceAsStream(modelName);
if (modelName.endsWith(".gz")) {
is = new GZIPInputStream(is);
}
is = new BufferedInputStream(is);
loadClassifier(is, props);
is.close();
Timing.endDoing();
} catch (Exception e) {
String msg = "Error loading classifier from jar file (most likely you are not running this code from a jar file or the named classifier is not stored in the jar file)";
throw new RuntimeException(msg, e);
}
} }
|
public class class_name {
public void loadJarClassifier(String modelName, Properties props) {
Timing.startDoing("Loading JAR-internal classifier " + modelName);
try {
InputStream is = getClass().getResourceAsStream(modelName);
if (modelName.endsWith(".gz")) {
is = new GZIPInputStream(is);
// depends on control dependency: [if], data = [none]
}
is = new BufferedInputStream(is);
// depends on control dependency: [try], data = [none]
loadClassifier(is, props);
// depends on control dependency: [try], data = [none]
is.close();
// depends on control dependency: [try], data = [none]
Timing.endDoing();
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
String msg = "Error loading classifier from jar file (most likely you are not running this code from a jar file or the named classifier is not stored in the jar file)";
throw new RuntimeException(msg, e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public BitSet projectG1(BitSet set) {
BitSet projection = new BitSet(firstGraphSize);
RNode xNode = null;
for (int x = set.nextSetBit(0); x >= 0; x = set.nextSetBit(x + 1)) {
xNode = (RNode) graph.get(x);
projection.set(xNode.rMap.id1);
}
return projection;
} }
|
public class class_name {
public BitSet projectG1(BitSet set) {
BitSet projection = new BitSet(firstGraphSize);
RNode xNode = null;
for (int x = set.nextSetBit(0); x >= 0; x = set.nextSetBit(x + 1)) {
xNode = (RNode) graph.get(x); // depends on control dependency: [for], data = [x]
projection.set(xNode.rMap.id1); // depends on control dependency: [for], data = [none]
}
return projection;
} }
|
public class class_name {
private int _checkInlineHtml (final MarkdownHCStack out, final String in, final int nStart)
{
final StringBuilder aTmp = new StringBuilder ();
// Check for auto links
aTmp.setLength (0);
int nPos = MarkdownHelper.readUntil (aTmp, in, nStart + 1, ':', ' ', '>', '\n');
if (nPos != -1 && in.charAt (nPos) == ':' && MarkdownHTML.isLinkPrefix (aTmp.toString ()))
{
nPos = MarkdownHelper.readUntil (aTmp, in, nPos, '>');
if (nPos != -1)
{
final String sLink = aTmp.toString ();
final HCA aLink = m_aConfig.getDecorator ().openLink (out);
aLink.setHref (new SimpleURL (sLink)).addChild (sLink);
m_aConfig.getDecorator ().closeLink (out);
return nPos;
}
}
// Check for mailto or address auto link
aTmp.setLength (0);
nPos = MarkdownHelper.readUntil (aTmp, in, nStart + 1, '@', ' ', '>', '\n');
if (nPos != -1 && in.charAt (nPos) == '@')
{
nPos = MarkdownHelper.readUntil (aTmp, in, nPos, '>');
if (nPos != -1)
{
final String sLink = aTmp.toString ();
final HCA aLink = m_aConfig.getDecorator ().openLink (out);
if (sLink.startsWith ("@"))
{
// address auto links
final String sAddress = sLink.substring (1);
final ISimpleURL aUrl = new SimpleURL ("https://maps.google.com/maps").add ("q", sAddress);
aLink.setHref (aUrl).addChild (sAddress);
}
else
{
// mailto auto links
aLink.setHref (new SimpleURL ("mailto:" + sLink)).addChild (sLink);
}
m_aConfig.getDecorator ().closeLink (out);
return nPos;
}
}
// Check for inline html
if (nStart + 2 < in.length ())
{
nPos = nStart;
if (nStart + 3 < in.length () &&
in.charAt (nStart + 1) == '!' &&
in.charAt (nStart + 2) == '-' &&
in.charAt (nStart + 3) == '-')
{
nPos = nStart + 4;
final int nCommentStartPos = nPos;
while (true)
{
while (nPos < in.length () && in.charAt (nPos) != '-')
nPos++;
if (nPos == in.length ())
{
// FIXME End of line in comment
return -1;
}
if (nPos + 2 < in.length () && in.charAt (nPos + 1) == '-' && in.charAt (nPos + 2) == '>')
{
// XML comment inline
out.append (new HCCommentNode (in.substring (nCommentStartPos, nPos)));
return nPos + 2;
}
nPos++;
}
}
aTmp.setLength (0);
final int nNewPos = MarkdownHelper.readXMLElement (aTmp, in, nStart, m_aConfig.isSafeMode ());
if (nNewPos != -1)
{
final String sElement = aTmp.toString ();
if (sElement.endsWith ("/>"))
{
// Self closed tag - can be parsed
final IMicroDocument aXML = MicroReader.readMicroXML (sElement);
if (aXML == null)
throw new MarkdownException ("Failed to parse XML: " + sElement);
// And use the root element
out.append (new HCDOMWrapper (aXML.getDocumentElement ().detachFromParent ()));
}
else
if (sElement.startsWith ("</"))
{
// Closing tag
out.pop ();
}
else
{
// Opening tag - parse as self-closed tag and push to stack
final String sParseCode = sElement.substring (0, sElement.length () - 1) + "/>";
final IMicroDocument aXML = MicroReader.readMicroXML (sParseCode);
if (aXML == null)
throw new MarkdownException ("Failed to parse XML: " + sParseCode);
final IMicroElement eRoot = aXML.getDocumentElement ();
// And use the root element
final IHCElement <?> aHC = HCExtHelper.createHCElementFromName (eRoot.getTagName ());
if (aHC == null)
throw new MarkdownException ("Failed to get HC element: " + eRoot.getTagName ());
// Clone all attributes
eRoot.forAllAttributes (aAttr -> aHC.customAttrs ().putIn (aAttr.getAttributeQName (),
aAttr.getAttributeValue ()));
if (aHC.getElement ().mayBeSelfClosed ())
{
// e.g. <hr />
out.append (aHC);
}
else
{
// Push
out.push (aHC);
}
}
return nNewPos - 1;
}
}
return -1;
} }
|
public class class_name {
private int _checkInlineHtml (final MarkdownHCStack out, final String in, final int nStart)
{
final StringBuilder aTmp = new StringBuilder ();
// Check for auto links
aTmp.setLength (0);
int nPos = MarkdownHelper.readUntil (aTmp, in, nStart + 1, ':', ' ', '>', '\n');
if (nPos != -1 && in.charAt (nPos) == ':' && MarkdownHTML.isLinkPrefix (aTmp.toString ()))
{
nPos = MarkdownHelper.readUntil (aTmp, in, nPos, '>'); // depends on control dependency: [if], data = [none]
if (nPos != -1)
{
final String sLink = aTmp.toString ();
final HCA aLink = m_aConfig.getDecorator ().openLink (out);
aLink.setHref (new SimpleURL (sLink)).addChild (sLink); // depends on control dependency: [if], data = [none]
m_aConfig.getDecorator ().closeLink (out); // depends on control dependency: [if], data = [none]
return nPos; // depends on control dependency: [if], data = [none]
}
}
// Check for mailto or address auto link
aTmp.setLength (0);
nPos = MarkdownHelper.readUntil (aTmp, in, nStart + 1, '@', ' ', '>', '\n');
if (nPos != -1 && in.charAt (nPos) == '@')
{
nPos = MarkdownHelper.readUntil (aTmp, in, nPos, '>'); // depends on control dependency: [if], data = [none]
if (nPos != -1)
{
final String sLink = aTmp.toString ();
final HCA aLink = m_aConfig.getDecorator ().openLink (out);
if (sLink.startsWith ("@"))
{
// address auto links
final String sAddress = sLink.substring (1);
final ISimpleURL aUrl = new SimpleURL ("https://maps.google.com/maps").add ("q", sAddress);
aLink.setHref (aUrl).addChild (sAddress);
}
else
{
// mailto auto links
aLink.setHref (new SimpleURL ("mailto:" + sLink)).addChild (sLink); // depends on control dependency: [if], data = [none]
}
m_aConfig.getDecorator ().closeLink (out); // depends on control dependency: [if], data = [none]
return nPos; // depends on control dependency: [if], data = [none]
}
}
// Check for inline html
if (nStart + 2 < in.length ())
{
nPos = nStart; // depends on control dependency: [if], data = [none]
if (nStart + 3 < in.length () &&
in.charAt (nStart + 1) == '!' &&
in.charAt (nStart + 2) == '-' &&
in.charAt (nStart + 3) == '-')
{
nPos = nStart + 4; // depends on control dependency: [if], data = [none]
final int nCommentStartPos = nPos;
while (true)
{
while (nPos < in.length () && in.charAt (nPos) != '-')
nPos++;
if (nPos == in.length ())
{
// FIXME End of line in comment
return -1; // depends on control dependency: [if], data = [none]
}
if (nPos + 2 < in.length () && in.charAt (nPos + 1) == '-' && in.charAt (nPos + 2) == '>')
{
// XML comment inline
out.append (new HCCommentNode (in.substring (nCommentStartPos, nPos))); // depends on control dependency: [if], data = [none]
return nPos + 2; // depends on control dependency: [if], data = [none]
}
nPos++; // depends on control dependency: [while], data = [none]
}
}
aTmp.setLength (0); // depends on control dependency: [if], data = [none]
final int nNewPos = MarkdownHelper.readXMLElement (aTmp, in, nStart, m_aConfig.isSafeMode ());
if (nNewPos != -1)
{
final String sElement = aTmp.toString ();
if (sElement.endsWith ("/>"))
{
// Self closed tag - can be parsed
final IMicroDocument aXML = MicroReader.readMicroXML (sElement);
if (aXML == null)
throw new MarkdownException ("Failed to parse XML: " + sElement);
// And use the root element
out.append (new HCDOMWrapper (aXML.getDocumentElement ().detachFromParent ())); // depends on control dependency: [if], data = [none]
}
else
if (sElement.startsWith ("</"))
{
// Closing tag
out.pop (); // depends on control dependency: [if], data = [none]
}
else
{
// Opening tag - parse as self-closed tag and push to stack
final String sParseCode = sElement.substring (0, sElement.length () - 1) + "/>";
final IMicroDocument aXML = MicroReader.readMicroXML (sParseCode);
if (aXML == null)
throw new MarkdownException ("Failed to parse XML: " + sParseCode);
final IMicroElement eRoot = aXML.getDocumentElement ();
// And use the root element
final IHCElement <?> aHC = HCExtHelper.createHCElementFromName (eRoot.getTagName ());
if (aHC == null)
throw new MarkdownException ("Failed to get HC element: " + eRoot.getTagName ());
// Clone all attributes
eRoot.forAllAttributes (aAttr -> aHC.customAttrs ().putIn (aAttr.getAttributeQName (),
aAttr.getAttributeValue ())); // depends on control dependency: [if], data = [none]
if (aHC.getElement ().mayBeSelfClosed ())
{
// e.g. <hr />
out.append (aHC); // depends on control dependency: [if], data = [none]
}
else
{
// Push
out.push (aHC); // depends on control dependency: [if], data = [none]
}
}
return nNewPos - 1; // depends on control dependency: [if], data = [none]
}
}
return -1;
} }
|
public class class_name {
protected DateFormat guessDateFormat(int dateStyle, int timeStyle) {
DateFormat result;
ULocale dfLocale = getAvailableLocale(TYPE_DATEFORMAT);
if (dfLocale == null) {
dfLocale = ULocale.ROOT;
}
if (timeStyle == DF_NONE) {
result = DateFormat.getDateInstance(getCalendar(), dateStyle, dfLocale);
} else if (dateStyle == DF_NONE) {
result = DateFormat.getTimeInstance(getCalendar(), timeStyle, dfLocale);
} else {
result = DateFormat.getDateTimeInstance(getCalendar(), dateStyle, timeStyle, dfLocale);
}
return result;
} }
|
public class class_name {
protected DateFormat guessDateFormat(int dateStyle, int timeStyle) {
DateFormat result;
ULocale dfLocale = getAvailableLocale(TYPE_DATEFORMAT);
if (dfLocale == null) {
dfLocale = ULocale.ROOT; // depends on control dependency: [if], data = [none]
}
if (timeStyle == DF_NONE) {
result = DateFormat.getDateInstance(getCalendar(), dateStyle, dfLocale); // depends on control dependency: [if], data = [none]
} else if (dateStyle == DF_NONE) {
result = DateFormat.getTimeInstance(getCalendar(), timeStyle, dfLocale); // depends on control dependency: [if], data = [none]
} else {
result = DateFormat.getDateTimeInstance(getCalendar(), dateStyle, timeStyle, dfLocale); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
private int handleNext(short stateTable[]) {
if (TRACE) {
System.out.println("Handle Next pos char state category");
}
// No matter what, handleNext alway correctly sets the break tag value.
fLastStatusIndexValid = true;
fLastRuleStatusIndex = 0;
// caches for quicker access
CharacterIterator text = fText;
CharTrie trie = fRData.fTrie;
// Set up the starting char
int c = text.current();
if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE) {
c = nextTrail32(text, c);
if (c == DONE32) {
return BreakIterator.DONE;
}
}
int initialPosition = text.getIndex();
int result = initialPosition;
// Set the initial state for the state machine
int state = START_STATE;
int row = fRData.getRowIndex(state);
short category = 3;
int flagsState = fRData.getStateTableFlags(stateTable);
int mode = RBBI_RUN;
if ((flagsState & RBBIDataWrapper.RBBI_BOF_REQUIRED) != 0) {
category = 2;
mode = RBBI_START;
if (TRACE) {
System.out.print(" " + RBBIDataWrapper.intToString(text.getIndex(), 5));
System.out.print(RBBIDataWrapper.intToHexString(c, 10));
System.out.println(RBBIDataWrapper.intToString(state,7) + RBBIDataWrapper.intToString(category,6));
}
}
fLookAheadMatches.reset();
// loop until we reach the end of the text or transition to state 0
while (state != STOP_STATE) {
if (c == DONE32) {
// Reached end of input string.
if (mode == RBBI_END) {
// We have already run the loop one last time with the
// character set to the pseudo {eof} value. Now it is time
// to unconditionally bail out.
break;
}
// Run the loop one last time with the fake end-of-input character category
mode = RBBI_END;
category = 1;
}
else if (mode == RBBI_RUN) {
// Get the char category. An incoming category of 1 or 2 mens that
// we are preset for doing the beginning or end of input, and
// that we shouldn't get a category from an actual text input character.
//
// look up the current character's character category, which tells us
// which column in the state table to look at.
//
category = (short) trie.getCodePointValue(c);
// Check the dictionary bit in the character's category.
// Counter is only used by dictionary based iterators (subclasses).
// Chars that need to be handled by a dictionary have a flag bit set
// in their category values.
//
if ((category & 0x4000) != 0) {
fDictionaryCharCount++;
// And off the dictionary flag bit.
category &= ~0x4000;
}
if (TRACE) {
System.out.print(" " + RBBIDataWrapper.intToString(text.getIndex(), 5));
System.out.print(RBBIDataWrapper.intToHexString(c, 10));
System.out.println(RBBIDataWrapper.intToString(state,7) + RBBIDataWrapper.intToString(category,6));
}
// Advance to the next character.
// If this is a beginning-of-input loop iteration, don't advance.
// The next iteration will be processing the first real input character.
c = text.next();
if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE) {
c = nextTrail32(text, c);
}
}
else {
mode = RBBI_RUN;
}
// look up a state transition in the state table
state = stateTable[row + RBBIDataWrapper.NEXTSTATES + category];
row = fRData.getRowIndex(state);
if (stateTable[row + RBBIDataWrapper.ACCEPTING] == -1) {
// Match found, common case
result = text.getIndex();
if (c >= UTF16.SUPPLEMENTARY_MIN_VALUE && c <= UTF16.CODEPOINT_MAX_VALUE) {
// The iterator has been left in the middle of a surrogate pair.
// We want the start of it.
result--;
}
// Remember the break status (tag) values.
fLastRuleStatusIndex = stateTable[row + RBBIDataWrapper.TAGIDX];
}
int completedRule = stateTable[row + RBBIDataWrapper.ACCEPTING];
if (completedRule > 0) {
// Lookahead match is completed
int lookaheadResult = fLookAheadMatches.getPosition(completedRule);
if (lookaheadResult >= 0) {
fLastRuleStatusIndex = stateTable[row + RBBIDataWrapper.TAGIDX];
text.setIndex(lookaheadResult);
return lookaheadResult;
}
}
int rule = stateTable[row + RBBIDataWrapper.LOOKAHEAD];
if (rule != 0) {
// At the position of a '/' in a look-ahead match. Record it.
int pos = text.getIndex();
if (c >= UTF16.SUPPLEMENTARY_MIN_VALUE && c <= UTF16.CODEPOINT_MAX_VALUE) {
// The iterator has been left in the middle of a surrogate pair.
// We want the beginning of it.
pos--;
}
fLookAheadMatches.setPosition(rule, pos);
}
} // End of state machine main loop
// The state machine is done. Check whether it found a match...
// If the iterator failed to advance in the match engine force it ahead by one.
// This indicates a defect in the break rules, which should always match
// at least one character.
if (result == initialPosition) {
if (TRACE) {
System.out.println("Iterator did not move. Advancing by 1.");
}
text.setIndex(initialPosition);
next32(text);
result = text.getIndex();
}
else {
// Leave the iterator at our result position.
// (we may have advanced beyond the last accepting position chasing after
// longer matches that never completed.)
text.setIndex(result);
}
if (TRACE) {
System.out.println("result = " + result);
}
return result;
} }
|
public class class_name {
private int handleNext(short stateTable[]) {
if (TRACE) {
System.out.println("Handle Next pos char state category"); // depends on control dependency: [if], data = [none]
}
// No matter what, handleNext alway correctly sets the break tag value.
fLastStatusIndexValid = true;
fLastRuleStatusIndex = 0;
// caches for quicker access
CharacterIterator text = fText;
CharTrie trie = fRData.fTrie;
// Set up the starting char
int c = text.current();
if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE) {
c = nextTrail32(text, c); // depends on control dependency: [if], data = [none]
if (c == DONE32) {
return BreakIterator.DONE; // depends on control dependency: [if], data = [none]
}
}
int initialPosition = text.getIndex();
int result = initialPosition;
// Set the initial state for the state machine
int state = START_STATE;
int row = fRData.getRowIndex(state);
short category = 3;
int flagsState = fRData.getStateTableFlags(stateTable);
int mode = RBBI_RUN;
if ((flagsState & RBBIDataWrapper.RBBI_BOF_REQUIRED) != 0) {
category = 2; // depends on control dependency: [if], data = [none]
mode = RBBI_START; // depends on control dependency: [if], data = [none]
if (TRACE) {
System.out.print(" " + RBBIDataWrapper.intToString(text.getIndex(), 5)); // depends on control dependency: [if], data = [none]
System.out.print(RBBIDataWrapper.intToHexString(c, 10)); // depends on control dependency: [if], data = [none]
System.out.println(RBBIDataWrapper.intToString(state,7) + RBBIDataWrapper.intToString(category,6)); // depends on control dependency: [if], data = [none]
}
}
fLookAheadMatches.reset();
// loop until we reach the end of the text or transition to state 0
while (state != STOP_STATE) {
if (c == DONE32) {
// Reached end of input string.
if (mode == RBBI_END) {
// We have already run the loop one last time with the
// character set to the pseudo {eof} value. Now it is time
// to unconditionally bail out.
break;
}
// Run the loop one last time with the fake end-of-input character category
mode = RBBI_END; // depends on control dependency: [if], data = [none]
category = 1; // depends on control dependency: [if], data = [none]
}
else if (mode == RBBI_RUN) {
// Get the char category. An incoming category of 1 or 2 mens that
// we are preset for doing the beginning or end of input, and
// that we shouldn't get a category from an actual text input character.
//
// look up the current character's character category, which tells us
// which column in the state table to look at.
//
category = (short) trie.getCodePointValue(c); // depends on control dependency: [if], data = [none]
// Check the dictionary bit in the character's category.
// Counter is only used by dictionary based iterators (subclasses).
// Chars that need to be handled by a dictionary have a flag bit set
// in their category values.
//
if ((category & 0x4000) != 0) {
fDictionaryCharCount++; // depends on control dependency: [if], data = [none]
// And off the dictionary flag bit.
category &= ~0x4000; // depends on control dependency: [if], data = [none]
}
if (TRACE) {
System.out.print(" " + RBBIDataWrapper.intToString(text.getIndex(), 5)); // depends on control dependency: [if], data = [none]
System.out.print(RBBIDataWrapper.intToHexString(c, 10)); // depends on control dependency: [if], data = [none]
System.out.println(RBBIDataWrapper.intToString(state,7) + RBBIDataWrapper.intToString(category,6)); // depends on control dependency: [if], data = [none]
}
// Advance to the next character.
// If this is a beginning-of-input loop iteration, don't advance.
// The next iteration will be processing the first real input character.
c = text.next(); // depends on control dependency: [if], data = [none]
if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE) {
c = nextTrail32(text, c); // depends on control dependency: [if], data = [none]
}
}
else {
mode = RBBI_RUN; // depends on control dependency: [if], data = [none]
}
// look up a state transition in the state table
state = stateTable[row + RBBIDataWrapper.NEXTSTATES + category]; // depends on control dependency: [while], data = [none]
row = fRData.getRowIndex(state); // depends on control dependency: [while], data = [(state]
if (stateTable[row + RBBIDataWrapper.ACCEPTING] == -1) {
// Match found, common case
result = text.getIndex(); // depends on control dependency: [if], data = [none]
if (c >= UTF16.SUPPLEMENTARY_MIN_VALUE && c <= UTF16.CODEPOINT_MAX_VALUE) {
// The iterator has been left in the middle of a surrogate pair.
// We want the start of it.
result--; // depends on control dependency: [if], data = [none]
}
// Remember the break status (tag) values.
fLastRuleStatusIndex = stateTable[row + RBBIDataWrapper.TAGIDX]; // depends on control dependency: [if], data = [none]
}
int completedRule = stateTable[row + RBBIDataWrapper.ACCEPTING];
if (completedRule > 0) {
// Lookahead match is completed
int lookaheadResult = fLookAheadMatches.getPosition(completedRule);
if (lookaheadResult >= 0) {
fLastRuleStatusIndex = stateTable[row + RBBIDataWrapper.TAGIDX]; // depends on control dependency: [if], data = [none]
text.setIndex(lookaheadResult); // depends on control dependency: [if], data = [(lookaheadResult]
return lookaheadResult; // depends on control dependency: [if], data = [none]
}
}
int rule = stateTable[row + RBBIDataWrapper.LOOKAHEAD];
if (rule != 0) {
// At the position of a '/' in a look-ahead match. Record it.
int pos = text.getIndex();
if (c >= UTF16.SUPPLEMENTARY_MIN_VALUE && c <= UTF16.CODEPOINT_MAX_VALUE) {
// The iterator has been left in the middle of a surrogate pair.
// We want the beginning of it.
pos--; // depends on control dependency: [if], data = [none]
}
fLookAheadMatches.setPosition(rule, pos); // depends on control dependency: [if], data = [(rule]
}
} // End of state machine main loop
// The state machine is done. Check whether it found a match...
// If the iterator failed to advance in the match engine force it ahead by one.
// This indicates a defect in the break rules, which should always match
// at least one character.
if (result == initialPosition) {
if (TRACE) {
System.out.println("Iterator did not move. Advancing by 1."); // depends on control dependency: [if], data = [none]
}
text.setIndex(initialPosition); // depends on control dependency: [if], data = [initialPosition)]
next32(text); // depends on control dependency: [if], data = [none]
result = text.getIndex(); // depends on control dependency: [if], data = [none]
}
else {
// Leave the iterator at our result position.
// (we may have advanced beyond the last accepting position chasing after
// longer matches that never completed.)
text.setIndex(result); // depends on control dependency: [if], data = [(result]
}
if (TRACE) {
System.out.println("result = " + result); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
@Override
public Map<String, String> getUserDefinedVariableDefaults() {
HashMap<String, String> userDefinedVariables = new HashMap<String, String>();
for (Map.Entry<String, ConfigVariable> entry : configVariables.entrySet()) {
ConfigVariable var = entry.getValue();
if (var.getValue() == null && var.getDefaultValue() != null) {
userDefinedVariables.put(var.getName(), var.getDefaultValue());
}
}
return userDefinedVariables;
} }
|
public class class_name {
@Override
public Map<String, String> getUserDefinedVariableDefaults() {
HashMap<String, String> userDefinedVariables = new HashMap<String, String>();
for (Map.Entry<String, ConfigVariable> entry : configVariables.entrySet()) {
ConfigVariable var = entry.getValue();
if (var.getValue() == null && var.getDefaultValue() != null) {
userDefinedVariables.put(var.getName(), var.getDefaultValue()); // depends on control dependency: [if], data = [none]
}
}
return userDefinedVariables;
} }
|
public class class_name {
private void copyLanguageNodes() {
CmsObject cms = getCms();
CmsMultiplexReport report = (CmsMultiplexReport)getReport();
CmsFile file;
CmsXmlContent content;
int totalFiles = m_copyresources.length;
int processedFiles = 0;
Locale sourceLocale = CmsLocaleManager.getLocale(m_sourceLanguage);
Locale targetLocale = CmsLocaleManager.getLocale(m_targetLanguage);
for (int i = 0; i < m_copyresources.length; i++) {
processedFiles++;
report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
new Object[] {String.valueOf(processedFiles), String.valueOf(totalFiles)}),
I_CmsReport.FORMAT_NOTE);
report.print(
Messages.get().container(Messages.RPT_LOCALIZATION_BYPASS_1, new Object[] {m_copyresources[i]}));
report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
try {
file = cms.readFile(m_copyresources[i]);
content = CmsXmlContentFactory.unmarshal(cms, file);
if (!content.hasLocale(sourceLocale)) {
report.println(
Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_WARN_SOURCELOCALE_MISSING_1,
new Object[] {sourceLocale}),
I_CmsReport.FORMAT_WARNING);
CmsMessageContainer container = Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_WARN_SOURCELOCALE_MISSING_2,
new Object[] {m_copyresources[i], sourceLocale});
report.addWarning(container);
} else if (content.hasLocale(targetLocale)) {
report.println(
Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_WARN_TARGETLOCALE_EXISTS_1,
new Object[] {targetLocale}),
I_CmsReport.FORMAT_WARNING);
CmsMessageContainer container = Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_WARN_TARGETLOCALE_EXISTS_2,
new Object[] {m_copyresources[i], targetLocale});
report.addWarning(container);
} else {
content.copyLocale(sourceLocale, targetLocale);
if (m_delete) {
content.removeLocale(sourceLocale);
}
file.setContents(content.marshal());
CmsLock lock = cms.getLock(file);
if (lock.isInherited()) {
unlockInherited(file.getRootPath());
cms.lockResource(m_copyresources[i]);
} else {
if (lock.isNullLock()) {
cms.lockResource(m_copyresources[i]);
} else {
if (!lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
cms.changeLock(m_copyresources[i]);
}
}
}
cms.writeFile(file);
cms.unlockResource(m_copyresources[i]);
report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
}
} catch (Throwable f) {
CmsMessageContainer error = Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_ERROR_2,
new String[] {m_copyresources[i], CmsException.getStackTraceAsString(f)});
report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
I_CmsReport.FORMAT_ERROR);
// report.println(f);
report.addError(error);
}
}
} }
|
public class class_name {
private void copyLanguageNodes() {
CmsObject cms = getCms();
CmsMultiplexReport report = (CmsMultiplexReport)getReport();
CmsFile file;
CmsXmlContent content;
int totalFiles = m_copyresources.length;
int processedFiles = 0;
Locale sourceLocale = CmsLocaleManager.getLocale(m_sourceLanguage);
Locale targetLocale = CmsLocaleManager.getLocale(m_targetLanguage);
for (int i = 0; i < m_copyresources.length; i++) {
processedFiles++; // depends on control dependency: [for], data = [none]
report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
new Object[] {String.valueOf(processedFiles), String.valueOf(totalFiles)}),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [for], data = [none]
report.print(
Messages.get().container(Messages.RPT_LOCALIZATION_BYPASS_1, new Object[] {m_copyresources[i]})); // depends on control dependency: [for], data = [none]
report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); // depends on control dependency: [for], data = [none]
try {
file = cms.readFile(m_copyresources[i]); // depends on control dependency: [try], data = [none]
content = CmsXmlContentFactory.unmarshal(cms, file); // depends on control dependency: [try], data = [none]
if (!content.hasLocale(sourceLocale)) {
report.println(
Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_WARN_SOURCELOCALE_MISSING_1,
new Object[] {sourceLocale}),
I_CmsReport.FORMAT_WARNING); // depends on control dependency: [if], data = [none]
CmsMessageContainer container = Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_WARN_SOURCELOCALE_MISSING_2,
new Object[] {m_copyresources[i], sourceLocale});
report.addWarning(container); // depends on control dependency: [if], data = [none]
} else if (content.hasLocale(targetLocale)) {
report.println(
Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_WARN_TARGETLOCALE_EXISTS_1,
new Object[] {targetLocale}),
I_CmsReport.FORMAT_WARNING); // depends on control dependency: [if], data = [none]
CmsMessageContainer container = Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_WARN_TARGETLOCALE_EXISTS_2,
new Object[] {m_copyresources[i], targetLocale});
report.addWarning(container); // depends on control dependency: [if], data = [none]
} else {
content.copyLocale(sourceLocale, targetLocale); // depends on control dependency: [if], data = [none]
if (m_delete) {
content.removeLocale(sourceLocale); // depends on control dependency: [if], data = [none]
}
file.setContents(content.marshal()); // depends on control dependency: [if], data = [none]
CmsLock lock = cms.getLock(file);
if (lock.isInherited()) {
unlockInherited(file.getRootPath()); // depends on control dependency: [if], data = [none]
cms.lockResource(m_copyresources[i]); // depends on control dependency: [if], data = [none]
} else {
if (lock.isNullLock()) {
cms.lockResource(m_copyresources[i]); // depends on control dependency: [if], data = [none]
} else {
if (!lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
cms.changeLock(m_copyresources[i]); // depends on control dependency: [if], data = [none]
}
}
}
cms.writeFile(file); // depends on control dependency: [if], data = [none]
cms.unlockResource(m_copyresources[i]); // depends on control dependency: [if], data = [none]
report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [if], data = [none]
}
} catch (Throwable f) {
CmsMessageContainer error = Messages.get().container(
Messages.GUI_REPORT_LANGUAGEC0PY_ERROR_2,
new String[] {m_copyresources[i], CmsException.getStackTraceAsString(f)});
report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
I_CmsReport.FORMAT_ERROR);
// report.println(f);
report.addError(error);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static void awaitRoute(URL routeUrl, int timeout, TimeUnit timeoutUnit, int repetitions, int... statusCodes) {
AtomicInteger successfulAwaitsInARow = new AtomicInteger(0);
await().atMost(timeout, timeoutUnit).until(() -> {
if (tryConnect(routeUrl, statusCodes)) {
successfulAwaitsInARow.incrementAndGet();
} else {
successfulAwaitsInARow.set(0);
}
return successfulAwaitsInARow.get() >= repetitions;
});
} }
|
public class class_name {
public static void awaitRoute(URL routeUrl, int timeout, TimeUnit timeoutUnit, int repetitions, int... statusCodes) {
AtomicInteger successfulAwaitsInARow = new AtomicInteger(0);
await().atMost(timeout, timeoutUnit).until(() -> {
if (tryConnect(routeUrl, statusCodes)) {
successfulAwaitsInARow.incrementAndGet(); // depends on control dependency: [if], data = [none]
} else {
successfulAwaitsInARow.set(0); // depends on control dependency: [if], data = [none]
}
return successfulAwaitsInARow.get() >= repetitions;
});
} }
|
public class class_name {
@Override
public Injector getInjector() {
Injector injector = Guice.createInjector(Stage.PRODUCTION, CucumberModules.SCENARIO, new SpeedRegulatorModule(), new TimeModule(), new NoraUiModule());
try {
NoraUiInjector.createInjector(injector);
} catch (TechnicalException e) {
logger.error("error NoraUiInjectorSource.getInjector()", e);
}
return injector;
} }
|
public class class_name {
@Override
public Injector getInjector() {
Injector injector = Guice.createInjector(Stage.PRODUCTION, CucumberModules.SCENARIO, new SpeedRegulatorModule(), new TimeModule(), new NoraUiModule());
try {
NoraUiInjector.createInjector(injector); // depends on control dependency: [try], data = [none]
} catch (TechnicalException e) {
logger.error("error NoraUiInjectorSource.getInjector()", e);
} // depends on control dependency: [catch], data = [none]
return injector;
} }
|
public class class_name {
public static double[] getOutRectangle( double latitude, double longitude, double r )
{
double boundLat = latitude + (180 * r) / (Math.PI * EARTH_RADIUS) * (latitude > 0 ? 1 : -1);
double littleRadius = countLittleRadius( boundLat );
double westLong, eastLong, northLat, southLat;
if( littleRadius > r )
{
westLong = longitude - (180 * r) / littleRadius;
eastLong = 2 * longitude - westLong;
westLong = updateDegree( westLong );
eastLong = eastLong % 360 == 180 ? 180 : updateDegree( eastLong );
}
else
{
westLong = -180;
eastLong = 180;
}
if( latitude > 0 )
{
northLat = boundLat;
southLat = 2 * latitude - boundLat;
}
else
{
southLat = boundLat;
northLat = 2 * latitude - boundLat;
}
return new double[] { Math.min( northLat, 90 ), westLong, Math.max( southLat, -90 ), eastLong };
} }
|
public class class_name {
public static double[] getOutRectangle( double latitude, double longitude, double r )
{
double boundLat = latitude + (180 * r) / (Math.PI * EARTH_RADIUS) * (latitude > 0 ? 1 : -1);
double littleRadius = countLittleRadius( boundLat );
double westLong, eastLong, northLat, southLat;
if( littleRadius > r )
{
westLong = longitude - (180 * r) / littleRadius; // depends on control dependency: [if], data = [none]
eastLong = 2 * longitude - westLong; // depends on control dependency: [if], data = [none]
westLong = updateDegree( westLong ); // depends on control dependency: [if], data = [none]
eastLong = eastLong % 360 == 180 ? 180 : updateDegree( eastLong ); // depends on control dependency: [if], data = [none]
}
else
{
westLong = -180; // depends on control dependency: [if], data = [none]
eastLong = 180; // depends on control dependency: [if], data = [none]
}
if( latitude > 0 )
{
northLat = boundLat; // depends on control dependency: [if], data = [none]
southLat = 2 * latitude - boundLat; // depends on control dependency: [if], data = [none]
}
else
{
southLat = boundLat; // depends on control dependency: [if], data = [none]
northLat = 2 * latitude - boundLat; // depends on control dependency: [if], data = [none]
}
return new double[] { Math.min( northLat, 90 ), westLong, Math.max( southLat, -90 ), eastLong };
} }
|
public class class_name {
@Override
public void setHopByHopIdentifier(long hopByHopId) {
if (hopByHopId < 0) {
this.hopByHopId = -hopByHopId;
this.notMutableHopByHop = true;
}
else {
if (!this.notMutableHopByHop) {
this.hopByHopId = hopByHopId;
}
}
} }
|
public class class_name {
@Override
public void setHopByHopIdentifier(long hopByHopId) {
if (hopByHopId < 0) {
this.hopByHopId = -hopByHopId;
// depends on control dependency: [if], data = [none]
this.notMutableHopByHop = true;
// depends on control dependency: [if], data = [none]
}
else {
if (!this.notMutableHopByHop) {
this.hopByHopId = hopByHopId;
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
static Geometry simplifyOGC(/* const */Geometry geometry, /* const */
SpatialReference spatialReference, boolean bForce,
ProgressTracker progressTracker) {
if (geometry.isEmpty())
return geometry;
Geometry.Type gt = geometry.getType();
if (gt == Geometry.Type.Point)
return geometry;
double tolerance = InternalUtils.calculateToleranceFromGeometry(
spatialReference, geometry, false);
if (gt == Geometry.Type.Envelope) {
Envelope env = (Envelope) geometry;
Envelope2D env2D = new Envelope2D();
env.queryEnvelope2D(env2D);
if (env2D.isDegenerate(tolerance)) {
return (Geometry) (env.createInstance()); // return empty
// geometry
}
return geometry;
} else if (Geometry.isSegment(gt.value())) {
Segment seg = (Segment) geometry;
Polyline polyline = new Polyline(seg.getDescription());
polyline.addSegment(seg, true);
return simplifyOGC(polyline, spatialReference, bForce,
progressTracker);
}
if (!Geometry.isMultiVertex(gt.value())) {
throw new GeometryException("OGC simplify is not implemented for this geometry type" + gt);
}
MultiVertexGeometry result = TopologicalOperations.simplifyOGC(
(MultiVertexGeometry) geometry, tolerance, false, progressTracker);
return result;
} }
|
public class class_name {
static Geometry simplifyOGC(/* const */Geometry geometry, /* const */
SpatialReference spatialReference, boolean bForce,
ProgressTracker progressTracker) {
if (geometry.isEmpty())
return geometry;
Geometry.Type gt = geometry.getType();
if (gt == Geometry.Type.Point)
return geometry;
double tolerance = InternalUtils.calculateToleranceFromGeometry(
spatialReference, geometry, false);
if (gt == Geometry.Type.Envelope) {
Envelope env = (Envelope) geometry;
Envelope2D env2D = new Envelope2D();
env.queryEnvelope2D(env2D); // depends on control dependency: [if], data = [none]
if (env2D.isDegenerate(tolerance)) {
return (Geometry) (env.createInstance()); // return empty // depends on control dependency: [if], data = [none]
// geometry
}
return geometry; // depends on control dependency: [if], data = [none]
} else if (Geometry.isSegment(gt.value())) {
Segment seg = (Segment) geometry;
Polyline polyline = new Polyline(seg.getDescription());
polyline.addSegment(seg, true); // depends on control dependency: [if], data = [none]
return simplifyOGC(polyline, spatialReference, bForce,
progressTracker); // depends on control dependency: [if], data = [none]
}
if (!Geometry.isMultiVertex(gt.value())) {
throw new GeometryException("OGC simplify is not implemented for this geometry type" + gt);
}
MultiVertexGeometry result = TopologicalOperations.simplifyOGC(
(MultiVertexGeometry) geometry, tolerance, false, progressTracker);
return result;
} }
|
public class class_name {
public static long makeReasonable(long expectedTimeoutMillis, long bufferMillis) {
checkArgument(expectedTimeoutMillis > 0,
"expectedTimeoutMillis: %s (expected: > 0)", expectedTimeoutMillis);
checkArgument(bufferMillis >= 0,
"bufferMillis: %s (expected: > 0)", bufferMillis);
final long timeout = Math.min(expectedTimeoutMillis, MAX_MILLIS);
if (bufferMillis == 0) {
return timeout;
}
if (timeout > MAX_MILLIS - bufferMillis) {
return MAX_MILLIS;
} else {
return bufferMillis + timeout;
}
} }
|
public class class_name {
public static long makeReasonable(long expectedTimeoutMillis, long bufferMillis) {
checkArgument(expectedTimeoutMillis > 0,
"expectedTimeoutMillis: %s (expected: > 0)", expectedTimeoutMillis);
checkArgument(bufferMillis >= 0,
"bufferMillis: %s (expected: > 0)", bufferMillis);
final long timeout = Math.min(expectedTimeoutMillis, MAX_MILLIS);
if (bufferMillis == 0) {
return timeout; // depends on control dependency: [if], data = [none]
}
if (timeout > MAX_MILLIS - bufferMillis) {
return MAX_MILLIS; // depends on control dependency: [if], data = [none]
} else {
return bufferMillis + timeout; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Observable<ServiceResponse<Page<SasDefinitionItem>>> getSasDefinitionsWithServiceResponseAsync(final String vaultBaseUrl, final String storageAccountName, final Integer maxresults) {
return getSasDefinitionsSinglePageAsync(vaultBaseUrl, storageAccountName, maxresults)
.concatMap(new Func1<ServiceResponse<Page<SasDefinitionItem>>, Observable<ServiceResponse<Page<SasDefinitionItem>>>>() {
@Override
public Observable<ServiceResponse<Page<SasDefinitionItem>>> call(ServiceResponse<Page<SasDefinitionItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getSasDefinitionsNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<SasDefinitionItem>>> getSasDefinitionsWithServiceResponseAsync(final String vaultBaseUrl, final String storageAccountName, final Integer maxresults) {
return getSasDefinitionsSinglePageAsync(vaultBaseUrl, storageAccountName, maxresults)
.concatMap(new Func1<ServiceResponse<Page<SasDefinitionItem>>, Observable<ServiceResponse<Page<SasDefinitionItem>>>>() {
@Override
public Observable<ServiceResponse<Page<SasDefinitionItem>>> call(ServiceResponse<Page<SasDefinitionItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(getSasDefinitionsNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public static Map<Character, Long> charsCount(String input) {
if (isNullOrEmpty(input)) {
return Collections.emptyMap();
}
return input.chars().mapToObj(c -> (char) c).collect(groupingBy(identity(), counting()));
} }
|
public class class_name {
public static Map<Character, Long> charsCount(String input) {
if (isNullOrEmpty(input)) {
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
return input.chars().mapToObj(c -> (char) c).collect(groupingBy(identity(), counting()));
} }
|
public class class_name {
public void setExpires(int seconds) throws IllegalArgumentException {
javax.sip.address.URI uri = this.getAddress().getURI();
if (uri instanceof SipURI) {
/*
SipURI sipUri = (SipURI) uri;
try {
sipUri.setParameter(EXPIRES_PARAM_NAME, Integer.toString(seconds));
} catch (ParseException e) {
throw new IllegalArgumentException("Problem setting parameter",
e);
}*/
if(seconds == -1) {
this.removeParameter(EXPIRES_PARAM_NAME);
return;
}
this.setParameter(EXPIRES_PARAM_NAME, Integer.toString(seconds));
} else {
throw new IllegalArgumentException(
"Can only set parameter for Sip URI");
}
} }
|
public class class_name {
public void setExpires(int seconds) throws IllegalArgumentException {
javax.sip.address.URI uri = this.getAddress().getURI();
if (uri instanceof SipURI) {
/*
SipURI sipUri = (SipURI) uri;
try {
sipUri.setParameter(EXPIRES_PARAM_NAME, Integer.toString(seconds));
} catch (ParseException e) {
throw new IllegalArgumentException("Problem setting parameter",
e);
}*/
if(seconds == -1) {
this.removeParameter(EXPIRES_PARAM_NAME);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
this.setParameter(EXPIRES_PARAM_NAME, Integer.toString(seconds));
} else {
throw new IllegalArgumentException(
"Can only set parameter for Sip URI");
}
} }
|
public class class_name {
public void publish(TaskEvent event) {
synchronized (listeners) {
for (EventListener<TaskEvent> listener : listeners.get(event.getClass())) {
listener.onEvent(event);
}
}
} }
|
public class class_name {
public void publish(TaskEvent event) {
synchronized (listeners) {
for (EventListener<TaskEvent> listener : listeners.get(event.getClass())) {
listener.onEvent(event); // depends on control dependency: [for], data = [listener]
}
}
} }
|
public class class_name {
public void setHighlightedBond(IBond highlightedBond) {
if ((this.highlightedBond != null) || (highlightedBond != null)) {
this.highlightedBond = highlightedBond;
fireChange();
}
} }
|
public class class_name {
public void setHighlightedBond(IBond highlightedBond) {
if ((this.highlightedBond != null) || (highlightedBond != null)) {
this.highlightedBond = highlightedBond; // depends on control dependency: [if], data = [none]
fireChange(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Optional<String> createWindSymbolName(PointForecast pointForecast) {
if (pointForecast == null || pointForecast.getWindDirection() == null || pointForecast.getWindSpeed() == null) {
return Optional.empty();
}
return Optional.of(
pointForecast.getWindDirection().getName().toLowerCase()
+ idFormat.format(pointForecast.getWindSpeed().getBeaufort()));
} }
|
public class class_name {
public static Optional<String> createWindSymbolName(PointForecast pointForecast) {
if (pointForecast == null || pointForecast.getWindDirection() == null || pointForecast.getWindSpeed() == null) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
return Optional.of(
pointForecast.getWindDirection().getName().toLowerCase()
+ idFormat.format(pointForecast.getWindSpeed().getBeaufort()));
} }
|
public class class_name {
public void info( String format, Object arg1, Object arg2 )
{
if( m_delegate.isInfoEnabled() )
{
FormattingTuple tuple = MessageFormatter.format( format, arg1, arg2 );
m_delegate.inform( tuple.getMessage(), tuple.getThrowable() );
}
} }
|
public class class_name {
public void info( String format, Object arg1, Object arg2 )
{
if( m_delegate.isInfoEnabled() )
{
FormattingTuple tuple = MessageFormatter.format( format, arg1, arg2 );
m_delegate.inform( tuple.getMessage(), tuple.getThrowable() ); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private JvmOperation getJvmOperation(IMethod method, JvmType context)
throws JavaModelException {
if (context instanceof JvmDeclaredType) {
final JvmDeclaredType declaredType = (JvmDeclaredType) context;
final ActionParameterTypes jdtSignature = this.actionPrototypeProvider.createParameterTypes(
Flags.isVarargs(method.getFlags()),
getFormalParameterProvider(method));
for (final JvmOperation jvmOperation : declaredType.getDeclaredOperations()) {
final ActionParameterTypes jvmSignature = this.actionPrototypeProvider.createParameterTypesFromJvmModel(
jvmOperation.isVarArgs(),
jvmOperation.getParameters());
if (jvmSignature.equals(jdtSignature)) {
return jvmOperation;
}
}
}
return null;
} }
|
public class class_name {
private JvmOperation getJvmOperation(IMethod method, JvmType context)
throws JavaModelException {
if (context instanceof JvmDeclaredType) {
final JvmDeclaredType declaredType = (JvmDeclaredType) context;
final ActionParameterTypes jdtSignature = this.actionPrototypeProvider.createParameterTypes(
Flags.isVarargs(method.getFlags()),
getFormalParameterProvider(method));
for (final JvmOperation jvmOperation : declaredType.getDeclaredOperations()) {
final ActionParameterTypes jvmSignature = this.actionPrototypeProvider.createParameterTypesFromJvmModel(
jvmOperation.isVarArgs(),
jvmOperation.getParameters());
if (jvmSignature.equals(jdtSignature)) {
return jvmOperation; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
public Optional<AuthenticationResultBuilder> buildSurrogateAuthenticationResult(final AuthenticationResultBuilder authenticationResultBuilder,
final Credential credential,
final String surrogateTargetId,
final RegisteredService registeredService) {
val currentAuthn = authenticationResultBuilder.getInitialAuthentication();
if (currentAuthn.isPresent()) {
val authentication = currentAuthn.get();
val surrogatePrincipal = buildSurrogatePrincipal(surrogateTargetId, authentication.getPrincipal(), credential, registeredService);
val auth = DefaultAuthenticationBuilder.newInstance(authentication).setPrincipal(surrogatePrincipal).build();
return Optional.of(authenticationResultBuilder.collect(auth));
}
return Optional.empty();
} }
|
public class class_name {
public Optional<AuthenticationResultBuilder> buildSurrogateAuthenticationResult(final AuthenticationResultBuilder authenticationResultBuilder,
final Credential credential,
final String surrogateTargetId,
final RegisteredService registeredService) {
val currentAuthn = authenticationResultBuilder.getInitialAuthentication();
if (currentAuthn.isPresent()) {
val authentication = currentAuthn.get();
val surrogatePrincipal = buildSurrogatePrincipal(surrogateTargetId, authentication.getPrincipal(), credential, registeredService);
val auth = DefaultAuthenticationBuilder.newInstance(authentication).setPrincipal(surrogatePrincipal).build();
return Optional.of(authenticationResultBuilder.collect(auth)); // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} }
|
public class class_name {
public DescribeJobQueuesResult withJobQueues(JobQueueDetail... jobQueues) {
if (this.jobQueues == null) {
setJobQueues(new java.util.ArrayList<JobQueueDetail>(jobQueues.length));
}
for (JobQueueDetail ele : jobQueues) {
this.jobQueues.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeJobQueuesResult withJobQueues(JobQueueDetail... jobQueues) {
if (this.jobQueues == null) {
setJobQueues(new java.util.ArrayList<JobQueueDetail>(jobQueues.length)); // depends on control dependency: [if], data = [none]
}
for (JobQueueDetail ele : jobQueues) {
this.jobQueues.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void marshall(GetContactRequest getContactRequest, ProtocolMarshaller protocolMarshaller) {
if (getContactRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getContactRequest.getContactArn(), CONTACTARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GetContactRequest getContactRequest, ProtocolMarshaller protocolMarshaller) {
if (getContactRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getContactRequest.getContactArn(), CONTACTARN_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 setTableState(CmsFileExplorerSettings state) {
if (state != null) {
m_fileTable.setSortContainerPropertyId(state.getSortColumnId());
m_fileTable.setSortAscending(state.isSortAscending());
Object[] visibleCols = m_fileTable.getVisibleColumns();
for (int i = 0; i < visibleCols.length; i++) {
m_fileTable.setColumnCollapsed(visibleCols[i], state.getCollapsedColumns().contains(visibleCols[i]));
}
}
} }
|
public class class_name {
public void setTableState(CmsFileExplorerSettings state) {
if (state != null) {
m_fileTable.setSortContainerPropertyId(state.getSortColumnId()); // depends on control dependency: [if], data = [(state]
m_fileTable.setSortAscending(state.isSortAscending()); // depends on control dependency: [if], data = [(state]
Object[] visibleCols = m_fileTable.getVisibleColumns();
for (int i = 0; i < visibleCols.length; i++) {
m_fileTable.setColumnCollapsed(visibleCols[i], state.getCollapsedColumns().contains(visibleCols[i])); // depends on control dependency: [for], data = [i]
}
}
} }
|
public class class_name {
protected String getCognizantFederalAgency(RolodexContract rolodex) {
StringBuilder agency = new StringBuilder();
if(rolodex.getOrganization()!=null){
agency.append(rolodex.getOrganization());
}agency.append(COMMA_SEPERATOR);
if(rolodex.getFirstName()!=null){
agency.append(rolodex.getFirstName());
}agency.append(EMPTY_STRING);
if(rolodex.getLastName()!=null){
agency.append(rolodex.getLastName());
}agency.append(EMPTY_STRING);
if(rolodex.getPhoneNumber()!=null){
agency.append(rolodex.getPhoneNumber());
}return agency.toString();
} }
|
public class class_name {
protected String getCognizantFederalAgency(RolodexContract rolodex) {
StringBuilder agency = new StringBuilder();
if(rolodex.getOrganization()!=null){
agency.append(rolodex.getOrganization()); // depends on control dependency: [if], data = [(rolodex.getOrganization()]
}agency.append(COMMA_SEPERATOR);
if(rolodex.getFirstName()!=null){
agency.append(rolodex.getFirstName()); // depends on control dependency: [if], data = [(rolodex.getFirstName()]
}agency.append(EMPTY_STRING);
if(rolodex.getLastName()!=null){
agency.append(rolodex.getLastName()); // depends on control dependency: [if], data = [(rolodex.getLastName()]
}agency.append(EMPTY_STRING);
if(rolodex.getPhoneNumber()!=null){
agency.append(rolodex.getPhoneNumber()); // depends on control dependency: [if], data = [(rolodex.getPhoneNumber()]
}return agency.toString();
} }
|
public class class_name {
private PublicKey readKey(InputStream is) {
InputStreamReader isr = new InputStreamReader(is);
PEMParser r = new PEMParser(isr);
try {
Object o = r.readObject();
if (o instanceof PEMKeyPair) {
PEMKeyPair keyPair = (PEMKeyPair) o;
if (keyPair.getPublicKeyInfo() != null &&
keyPair.getPublicKeyInfo().getEncoded().length > 0) {
return provider.getPublicKey(keyPair.getPublicKeyInfo());
}
} else if (o instanceof SubjectPublicKeyInfo) {
return provider.getPublicKey((SubjectPublicKeyInfo) o);
}
} catch (IOException e) {
// Ignoring, returning null
log.warn("Failed to get key from PEM file", e);
} finally {
IoUtils.closeQuietly(isr,r);
}
return null;
} }
|
public class class_name {
private PublicKey readKey(InputStream is) {
InputStreamReader isr = new InputStreamReader(is);
PEMParser r = new PEMParser(isr);
try {
Object o = r.readObject();
if (o instanceof PEMKeyPair) {
PEMKeyPair keyPair = (PEMKeyPair) o;
if (keyPair.getPublicKeyInfo() != null &&
keyPair.getPublicKeyInfo().getEncoded().length > 0) {
return provider.getPublicKey(keyPair.getPublicKeyInfo()); // depends on control dependency: [if], data = [(keyPair.getPublicKeyInfo()]
}
} else if (o instanceof SubjectPublicKeyInfo) {
return provider.getPublicKey((SubjectPublicKeyInfo) o); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
// Ignoring, returning null
log.warn("Failed to get key from PEM file", e);
} finally { // depends on control dependency: [catch], data = [none]
IoUtils.closeQuietly(isr,r);
}
return null;
} }
|
public class class_name {
protected static PropertyDescriptor findPropertyDescriptor(Class aClass, String aPropertyName)
{
BeanInfo info;
PropertyDescriptor[] pd;
PropertyDescriptor descriptor = null;
try
{
info = Introspector.getBeanInfo(aClass);
pd = info.getPropertyDescriptors();
for (int i = 0; i < pd.length; i++)
{
if (pd[i].getName().equals(aPropertyName))
{
descriptor = pd[i];
break;
}
}
if (descriptor == null)
{
/*
* Daren Drummond: Throw here so we are consistent
* with PersistentFieldDefaultImpl.
*/
throw new MetadataException("Can't find property " + aPropertyName + " in " + aClass.getName());
}
return descriptor;
}
catch (IntrospectionException ex)
{
/*
* Daren Drummond: Throw here so we are consistent
* with PersistentFieldDefaultImpl.
*/
throw new MetadataException("Can't find property " + aPropertyName + " in " + aClass.getName(), ex);
}
} }
|
public class class_name {
protected static PropertyDescriptor findPropertyDescriptor(Class aClass, String aPropertyName)
{
BeanInfo info;
PropertyDescriptor[] pd;
PropertyDescriptor descriptor = null;
try
{
info = Introspector.getBeanInfo(aClass);
pd = info.getPropertyDescriptors();
for (int i = 0; i < pd.length; i++)
{
if (pd[i].getName().equals(aPropertyName))
{
descriptor = pd[i];
// depends on control dependency: [if], data = [none]
break;
}
}
if (descriptor == null)
{
/*
* Daren Drummond: Throw here so we are consistent
* with PersistentFieldDefaultImpl.
*/
throw new MetadataException("Can't find property " + aPropertyName + " in " + aClass.getName());
}
return descriptor;
}
catch (IntrospectionException ex)
{
/*
* Daren Drummond: Throw here so we are consistent
* with PersistentFieldDefaultImpl.
*/
throw new MetadataException("Can't find property " + aPropertyName + " in " + aClass.getName(), ex);
}
} }
|
public class class_name {
public JComponent learn() {
JPanel pane = new JPanel(new GridLayout(1, 2));
double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
String[] labels = dataset[datasetIndex].toArray(new String[dataset[datasetIndex].size()]);
if (labels[0] == null) {
Attribute[] attr = dataset[datasetIndex].attributes();
labels = new String[attr.length];
for (int i = 0; i < labels.length; i++) {
labels[i] = attr[i].getName();
}
}
long clock = System.currentTimeMillis();
SammonMapping sammon = new SammonMapping(data, 2);
System.out.format("Learn Sammon's Mapping (k=2) from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);
PlotCanvas plot = ScatterPlot.plot(sammon.getCoordinates(), labels);
plot.setTitle("Sammon's Mapping (k = 2)");
pane.add(plot);
clock = System.currentTimeMillis();
sammon = new SammonMapping(data, 3);
System.out.format("Learn Sammon's Mapping (k=3) from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);
plot = ScatterPlot.plot(sammon.getCoordinates(), labels);
plot.setTitle("Sammon's Mapping (k = 3)");
pane.add(plot);
return pane;
} }
|
public class class_name {
public JComponent learn() {
JPanel pane = new JPanel(new GridLayout(1, 2));
double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
String[] labels = dataset[datasetIndex].toArray(new String[dataset[datasetIndex].size()]);
if (labels[0] == null) {
Attribute[] attr = dataset[datasetIndex].attributes();
labels = new String[attr.length]; // depends on control dependency: [if], data = [none]
for (int i = 0; i < labels.length; i++) {
labels[i] = attr[i].getName(); // depends on control dependency: [for], data = [i]
}
}
long clock = System.currentTimeMillis();
SammonMapping sammon = new SammonMapping(data, 2);
System.out.format("Learn Sammon's Mapping (k=2) from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);
PlotCanvas plot = ScatterPlot.plot(sammon.getCoordinates(), labels);
plot.setTitle("Sammon's Mapping (k = 2)");
pane.add(plot);
clock = System.currentTimeMillis();
sammon = new SammonMapping(data, 3);
System.out.format("Learn Sammon's Mapping (k=3) from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);
plot = ScatterPlot.plot(sammon.getCoordinates(), labels);
plot.setTitle("Sammon's Mapping (k = 3)");
pane.add(plot);
return pane;
} }
|
public class class_name {
public void stopPageWriteInCacheTimer() {
final long endTs = nanoTimer.getNano();
final long timeDiff = (endTs - timeStamps.pop());
performanceCountersHolder.pageWriteToCacheTime += timeDiff;
performanceCountersHolder.pageWriteToCacheCount++;
for (Component component : componentsStack) {
final String componentName = component.name;
PerformanceCountersHolder cHolder = countersByComponent
.computeIfAbsent(componentName, k -> component.type.newCountersHolder());
cHolder.pageWriteToCacheTime += timeDiff;
cHolder.pageWriteToCacheCount++;
}
makeSnapshotIfNeeded(endTs);
} }
|
public class class_name {
public void stopPageWriteInCacheTimer() {
final long endTs = nanoTimer.getNano();
final long timeDiff = (endTs - timeStamps.pop());
performanceCountersHolder.pageWriteToCacheTime += timeDiff;
performanceCountersHolder.pageWriteToCacheCount++;
for (Component component : componentsStack) {
final String componentName = component.name;
PerformanceCountersHolder cHolder = countersByComponent
.computeIfAbsent(componentName, k -> component.type.newCountersHolder());
cHolder.pageWriteToCacheTime += timeDiff; // depends on control dependency: [for], data = [none]
cHolder.pageWriteToCacheCount++; // depends on control dependency: [for], data = [none]
}
makeSnapshotIfNeeded(endTs);
} }
|
public class class_name {
int run(String... args) {
if (log == null) {
log = new PrintWriter(System.out);
}
try {
handleOptions(args);
if (options.help) {
showHelp();
}
if (options.version || options.fullVersion) {
showVersion(options.fullVersion);
}
if (options.help || options.version || options.fullVersion) {
return EXIT_OK;
}
if (options.numFilters() > 1) {
reportError("err.invalid.filters");
return EXIT_CMDERR;
}
// default command to analyze dependences
if (command == null) {
command = analyzeDeps();
}
if (!command.checkOptions()) {
return EXIT_CMDERR;
}
boolean ok = run();
return ok ? EXIT_OK : EXIT_ERROR;
} catch (BadArgs|UncheckedBadArgs e) {
reportError(e.getKey(), e.getArgs());
if (e.showUsage()) {
log.println(getMessage("main.usage.summary", PROGNAME));
}
return EXIT_CMDERR;
} catch (ResolutionException e) {
reportError("err.exception.message", e.getMessage());
return EXIT_CMDERR;
} catch (IOException e) {
e.printStackTrace();
return EXIT_CMDERR;
} catch (MultiReleaseException e) {
reportError(e.getKey(), e.getParams());
return EXIT_CMDERR; // could be EXIT_ABNORMAL sometimes
} finally {
log.flush();
}
} }
|
public class class_name {
int run(String... args) {
if (log == null) {
log = new PrintWriter(System.out); // depends on control dependency: [if], data = [none]
}
try {
handleOptions(args); // depends on control dependency: [try], data = [none]
if (options.help) {
showHelp(); // depends on control dependency: [if], data = [none]
}
if (options.version || options.fullVersion) {
showVersion(options.fullVersion); // depends on control dependency: [if], data = [options.fullVersion)]
}
if (options.help || options.version || options.fullVersion) {
return EXIT_OK; // depends on control dependency: [if], data = [none]
}
if (options.numFilters() > 1) {
reportError("err.invalid.filters"); // depends on control dependency: [if], data = [none]
return EXIT_CMDERR; // depends on control dependency: [if], data = [none]
}
// default command to analyze dependences
if (command == null) {
command = analyzeDeps(); // depends on control dependency: [if], data = [none]
}
if (!command.checkOptions()) {
return EXIT_CMDERR; // depends on control dependency: [if], data = [none]
}
boolean ok = run();
return ok ? EXIT_OK : EXIT_ERROR; // depends on control dependency: [try], data = [none]
} catch (BadArgs|UncheckedBadArgs e) {
reportError(e.getKey(), e.getArgs());
if (e.showUsage()) {
log.println(getMessage("main.usage.summary", PROGNAME)); // depends on control dependency: [if], data = [none]
}
return EXIT_CMDERR;
} catch (ResolutionException e) { // depends on control dependency: [catch], data = [none]
reportError("err.exception.message", e.getMessage());
return EXIT_CMDERR;
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
return EXIT_CMDERR;
} catch (MultiReleaseException e) { // depends on control dependency: [catch], data = [none]
reportError(e.getKey(), e.getParams());
return EXIT_CMDERR; // could be EXIT_ABNORMAL sometimes
} finally { // depends on control dependency: [catch], data = [none]
log.flush();
}
} }
|
public class class_name {
private static String convertFromWindowsPath(String path)
{
int colon = path.indexOf(':');
int length = path.length();
char ch;
if (colon == 1 && (ch = path.charAt(0)) != '/' && ch != '\\')
return "/" + path.charAt(0) + ":/" + path.substring(2);
else if (length > 1
&& ((ch = path.charAt(0)) == '/' || ch == '\\')
&& ((ch = path.charAt(1)) == '/' || ch == '\\')) {
if (colon < 0)
return "/:" + path;
for (int i = colon - 2; i > 1; i--) {
if ((ch = path.charAt(i)) != '/' && ch != '\\')
return "/:" + path;
}
ch = path.charAt(colon - 1);
if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z')
return path.substring(colon - 2);
else
return "/:" + path;
}
else
return path;
} }
|
public class class_name {
private static String convertFromWindowsPath(String path)
{
int colon = path.indexOf(':');
int length = path.length();
char ch;
if (colon == 1 && (ch = path.charAt(0)) != '/' && ch != '\\')
return "/" + path.charAt(0) + ":/" + path.substring(2);
else if (length > 1
&& ((ch = path.charAt(0)) == '/' || ch == '\\')
&& ((ch = path.charAt(1)) == '/' || ch == '\\')) {
if (colon < 0)
return "/:" + path;
for (int i = colon - 2; i > 1; i--) {
if ((ch = path.charAt(i)) != '/' && ch != '\\')
return "/:" + path;
}
ch = path.charAt(colon - 1); // depends on control dependency: [if], data = [1]
if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z')
return path.substring(colon - 2);
else
return "/:" + path;
}
else
return path;
} }
|
public class class_name {
public List getForwardRoutingPath()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getForwardRoutingPath");
SibTr.exit(tc, "getForwardRoutingPath", null);
}
// No op for foreign destinations
return null;
} }
|
public class class_name {
public List getForwardRoutingPath()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getForwardRoutingPath"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "getForwardRoutingPath", null); // depends on control dependency: [if], data = [none]
}
// No op for foreign destinations
return null;
} }
|
public class class_name {
public static void loadCache(Map<String, String> cache, File file, int maxSize) {
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line = null;
while ((line = br.readLine()) != null) {
int sepIndex = line.indexOf(" ");
String hash = line.substring(0, sepIndex);
String urlExternalForm = line.substring(sepIndex + 1);
cache.put(urlExternalForm, hash);
}
} catch (FileNotFoundException e) {
// Nothing: New cache will be used.
} catch (IOException e) {
e.printStackTrace();
} finally {
FileUtil.closeAndIgnoreExceptions(br);
}
} }
|
public class class_name {
public static void loadCache(Map<String, String> cache, File file, int maxSize) {
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file))); // depends on control dependency: [try], data = [none]
String line = null;
while ((line = br.readLine()) != null) {
int sepIndex = line.indexOf(" ");
String hash = line.substring(0, sepIndex);
String urlExternalForm = line.substring(sepIndex + 1);
cache.put(urlExternalForm, hash); // depends on control dependency: [while], data = [none]
}
} catch (FileNotFoundException e) {
// Nothing: New cache will be used.
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
} finally { // depends on control dependency: [catch], data = [none]
FileUtil.closeAndIgnoreExceptions(br);
}
} }
|
public class class_name {
public static JSONObject toJSONObject(String string) throws JSONException {
String name;
JSONObject jo = new JSONObject();
Object value;
JSONTokener x = new JSONTokener(string);
jo.put("name", x.nextTo('='));
x.next('=');
jo.put("value", x.nextTo(';'));
x.next();
while (x.more()) {
name = unescape(x.nextTo("=;"));
if (x.next() != '=') {
if (name.equals("secure")) {
value = Boolean.TRUE;
} else {
throw x.syntaxError("Missing '=' in cookie parameter.");
}
} else {
value = unescape(x.nextTo(';'));
x.next();
}
jo.put(name, value);
}
return jo;
} }
|
public class class_name {
public static JSONObject toJSONObject(String string) throws JSONException {
String name;
JSONObject jo = new JSONObject();
Object value;
JSONTokener x = new JSONTokener(string);
jo.put("name", x.nextTo('='));
x.next('=');
jo.put("value", x.nextTo(';'));
x.next();
while (x.more()) {
name = unescape(x.nextTo("=;"));
if (x.next() != '=') {
if (name.equals("secure")) {
value = Boolean.TRUE; // depends on control dependency: [if], data = [none]
} else {
throw x.syntaxError("Missing '=' in cookie parameter.");
}
} else {
value = unescape(x.nextTo(';'));
x.next();
}
jo.put(name, value);
}
return jo;
} }
|
public class class_name {
public String getContextStr(Sentence sent, int wordIdx){
String cpStr = "";
for (int i = 0; i < cntxGenVector.size(); ++i){
String [] context = cntxGenVector.get(i).getContext(sent, wordIdx);
if (context != null){
for (int j = 0; j < context.length; ++j){
if (context[j].trim().equals("")) continue;
cpStr += context[j] + " ";
}
}
}
return cpStr.trim();
} }
|
public class class_name {
public String getContextStr(Sentence sent, int wordIdx){
String cpStr = "";
for (int i = 0; i < cntxGenVector.size(); ++i){
String [] context = cntxGenVector.get(i).getContext(sent, wordIdx);
if (context != null){
for (int j = 0; j < context.length; ++j){
if (context[j].trim().equals("")) continue;
cpStr += context[j] + " ";
// depends on control dependency: [for], data = [j]
}
}
}
return cpStr.trim();
} }
|
public class class_name {
@Nullable
public static BasicAuthClientCredentials getBasicAuthClientCredentials (@Nullable final String sAuthHeader)
{
final String sRealHeader = StringHelper.trim (sAuthHeader);
if (StringHelper.hasNoText (sRealHeader))
return null;
final String [] aElements = RegExHelper.getSplitToArray (sRealHeader, "\\s+", 2);
if (aElements.length != 2)
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("String is not Basic Auth: " + sRealHeader);
return null;
}
if (!aElements[0].equals (HEADER_VALUE_PREFIX_BASIC))
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("String does not start with 'Basic': " + sRealHeader);
return null;
}
// Apply Base64 decoding
final String sEncodedCredentials = aElements[1];
final String sUsernamePassword = Base64.safeDecodeAsString (sEncodedCredentials, CHARSET);
if (sUsernamePassword == null)
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("Illegal Base64 encoded value '" + sEncodedCredentials + "'");
return null;
}
// Do we have a username/password separator?
final int nIndex = sUsernamePassword.indexOf (USERNAME_PASSWORD_SEPARATOR);
if (nIndex >= 0)
return new BasicAuthClientCredentials (sUsernamePassword.substring (0, nIndex),
sUsernamePassword.substring (nIndex + 1));
return new BasicAuthClientCredentials (sUsernamePassword);
} }
|
public class class_name {
@Nullable
public static BasicAuthClientCredentials getBasicAuthClientCredentials (@Nullable final String sAuthHeader)
{
final String sRealHeader = StringHelper.trim (sAuthHeader);
if (StringHelper.hasNoText (sRealHeader))
return null;
final String [] aElements = RegExHelper.getSplitToArray (sRealHeader, "\\s+", 2);
if (aElements.length != 2)
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("String is not Basic Auth: " + sRealHeader);
return null; // depends on control dependency: [if], data = [none]
}
if (!aElements[0].equals (HEADER_VALUE_PREFIX_BASIC))
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("String does not start with 'Basic': " + sRealHeader);
return null;
}
// Apply Base64 decoding
final String sEncodedCredentials = aElements[1];
final String sUsernamePassword = Base64.safeDecodeAsString (sEncodedCredentials, CHARSET);
if (sUsernamePassword == null)
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("Illegal Base64 encoded value '" + sEncodedCredentials + "'");
return null; // depends on control dependency: [if], data = [none]
}
// Do we have a username/password separator?
final int nIndex = sUsernamePassword.indexOf (USERNAME_PASSWORD_SEPARATOR);
if (nIndex >= 0)
return new BasicAuthClientCredentials (sUsernamePassword.substring (0, nIndex),
sUsernamePassword.substring (nIndex + 1));
return new BasicAuthClientCredentials (sUsernamePassword);
} }
|
public class class_name {
private JavaFileObject getOverviewPath() {
for (String[] opt : options) {
if (opt[0].equals("-overview")) {
if (env.fileManager instanceof StandardJavaFileManager) {
StandardJavaFileManager fm = (StandardJavaFileManager) env.fileManager;
return fm.getJavaFileObjects(opt[1]).iterator().next();
}
}
}
return null;
} }
|
public class class_name {
private JavaFileObject getOverviewPath() {
for (String[] opt : options) {
if (opt[0].equals("-overview")) {
if (env.fileManager instanceof StandardJavaFileManager) {
StandardJavaFileManager fm = (StandardJavaFileManager) env.fileManager;
return fm.getJavaFileObjects(opt[1]).iterator().next(); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
public static void displayMatrix(double[][] matrix) {
String line;
for (int f = 0; f < matrix.length; f++) {
line = "";
for (int g = 0; g < matrix.length; g++) {
line += matrix[g][f] + " | ";
}
logger.debug(line);
}
} }
|
public class class_name {
public static void displayMatrix(double[][] matrix) {
String line;
for (int f = 0; f < matrix.length; f++) {
line = ""; // depends on control dependency: [for], data = [none]
for (int g = 0; g < matrix.length; g++) {
line += matrix[g][f] + " | "; // depends on control dependency: [for], data = [g]
}
logger.debug(line); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public void flush() throws IOException {
if (unflushed.get() == 0) return;
synchronized (lock) {
if (logger.isTraceEnabled()) {
logger.debug("Flushing log '" + name + "' last flushed: " + getLastFlushedTime() + " current time: " + System
.currentTimeMillis());
}
segments.getLastView().getMessageSet().flush();
unflushed.set(0);
lastflushedTime.set(System.currentTimeMillis());
}
} }
|
public class class_name {
public void flush() throws IOException {
if (unflushed.get() == 0) return;
synchronized (lock) {
if (logger.isTraceEnabled()) {
logger.debug("Flushing log '" + name + "' last flushed: " + getLastFlushedTime() + " current time: " + System
.currentTimeMillis()); // depends on control dependency: [if], data = [none]
}
segments.getLastView().getMessageSet().flush();
unflushed.set(0);
lastflushedTime.set(System.currentTimeMillis());
}
} }
|
public class class_name {
@Override
public void update(double extrp)
{
fhOld = fh;
fvOld = fv;
updateLastForce();
// Not arrived
if (!arrivedH)
{
updateNotArrivedH(extrp);
}
else
{
fh = fhDest;
}
if (!arrivedV)
{
updateNotArrivedV(extrp);
}
else
{
fv = fvDest;
}
fixForce();
} }
|
public class class_name {
@Override
public void update(double extrp)
{
fhOld = fh;
fvOld = fv;
updateLastForce();
// Not arrived
if (!arrivedH)
{
updateNotArrivedH(extrp); // depends on control dependency: [if], data = [none]
}
else
{
fh = fhDest; // depends on control dependency: [if], data = [none]
}
if (!arrivedV)
{
updateNotArrivedV(extrp); // depends on control dependency: [if], data = [none]
}
else
{
fv = fvDest; // depends on control dependency: [if], data = [none]
}
fixForce();
} }
|
public class class_name {
public static String diff(IChemObject first, IChemObject second) {
IDifference diff = difference(first, second);
if (diff == null) {
return "";
} else {
return diff.toString();
}
} }
|
public class class_name {
public static String diff(IChemObject first, IChemObject second) {
IDifference diff = difference(first, second);
if (diff == null) {
return ""; // depends on control dependency: [if], data = [none]
} else {
return diff.toString(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setVersionStages(java.util.Collection<String> versionStages) {
if (versionStages == null) {
this.versionStages = null;
return;
}
this.versionStages = new java.util.ArrayList<String>(versionStages);
} }
|
public class class_name {
public void setVersionStages(java.util.Collection<String> versionStages) {
if (versionStages == null) {
this.versionStages = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.versionStages = new java.util.ArrayList<String>(versionStages);
} }
|
public class class_name {
public static int getMinY(Graphics g) {
// 获取允许文字最小高度
FontMetrics metrics = null;
try {
metrics = g.getFontMetrics();
} catch (Exception e) {
// 此处报告bug某些情况下会抛出IndexOutOfBoundsException,在此做容错处理
}
int minY;
if (null != metrics) {
minY = metrics.getAscent() - metrics.getLeading() - metrics.getDescent();
} else {
minY = -1;
}
return minY;
} }
|
public class class_name {
public static int getMinY(Graphics g) {
// 获取允许文字最小高度
FontMetrics metrics = null;
try {
metrics = g.getFontMetrics();
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
// 此处报告bug某些情况下会抛出IndexOutOfBoundsException,在此做容错处理
}
// depends on control dependency: [catch], data = [none]
int minY;
if (null != metrics) {
minY = metrics.getAscent() - metrics.getLeading() - metrics.getDescent();
// depends on control dependency: [if], data = [none]
} else {
minY = -1;
// depends on control dependency: [if], data = [none]
}
return minY;
} }
|
public class class_name {
public void marshall(DeleteDatasetContentRequest deleteDatasetContentRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDatasetContentRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDatasetContentRequest.getDatasetName(), DATASETNAME_BINDING);
protocolMarshaller.marshall(deleteDatasetContentRequest.getVersionId(), VERSIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteDatasetContentRequest deleteDatasetContentRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDatasetContentRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDatasetContentRequest.getDatasetName(), DATASETNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteDatasetContentRequest.getVersionId(), VERSIONID_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 List<UIRow> getValues()
throws EFapsException
{
List<UIRow> ret = new ArrayList<>();
if (isFiltered()) {
for (final UIRow row : this.values) {
boolean filtered = false;
for (final TableFilter filter : this.filters.values()) {
filtered = filter.filterRow(row);
if (filtered) {
break;
}
}
if (!filtered) {
ret.add(row);
}
}
} else {
ret = this.values;
}
setSize(ret.size());
return ret;
} }
|
public class class_name {
public List<UIRow> getValues()
throws EFapsException
{
List<UIRow> ret = new ArrayList<>();
if (isFiltered()) {
for (final UIRow row : this.values) {
boolean filtered = false;
for (final TableFilter filter : this.filters.values()) {
filtered = filter.filterRow(row); // depends on control dependency: [for], data = [filter]
if (filtered) {
break;
}
}
if (!filtered) {
ret.add(row); // depends on control dependency: [if], data = [none]
}
}
} else {
ret = this.values;
}
setSize(ret.size());
return ret;
} }
|
public class class_name {
public Configuration createConfiguration()
{
if (crackingHardwareCost == null)
{
crackingHardwareCost = getDefaultCrackingHardwareCost();
}
if (passwordMatchers == null)
{
passwordMatchers = getDefaultPasswordMatchers();
}
if (guessTypes == null)
{
guessTypes = getDefaultGuessTypes(crackingHardwareCost);
}
if (dictionaries == null)
{
dictionaries = getDefaultDictionaries();
}
if (adjacencyGraphs == null)
{
adjacencyGraphs = getDefaultAdjacencyGraphs();
}
if (leetTable == null)
{
leetTable = getDefaultLeetTable();
}
if (yearPattern == null)
{
yearPattern = getDefaultYearPattern();
}
if (minimumEntropy == null)
{
minimumEntropy = getDefaultMinimumEntropy();
}
if (locale == null)
{
locale = Locale.getDefault();
}
if (distanceCalc == null)
{
distanceCalc = getDefaultDistanceCalc();
}
if (combinationAlgorithmTimeout == null)
{
combinationAlgorithmTimeout = getDefaultCombinationAlgorithmTimeout();
}
return new Configuration(passwordMatchers, guessTypes, dictionaries, adjacencyGraphs, leetTable, yearPattern, minimumEntropy, locale, distanceCalc, combinationAlgorithmTimeout);
} }
|
public class class_name {
public Configuration createConfiguration()
{
if (crackingHardwareCost == null)
{
crackingHardwareCost = getDefaultCrackingHardwareCost(); // depends on control dependency: [if], data = [none]
}
if (passwordMatchers == null)
{
passwordMatchers = getDefaultPasswordMatchers(); // depends on control dependency: [if], data = [none]
}
if (guessTypes == null)
{
guessTypes = getDefaultGuessTypes(crackingHardwareCost); // depends on control dependency: [if], data = [none]
}
if (dictionaries == null)
{
dictionaries = getDefaultDictionaries(); // depends on control dependency: [if], data = [none]
}
if (adjacencyGraphs == null)
{
adjacencyGraphs = getDefaultAdjacencyGraphs(); // depends on control dependency: [if], data = [none]
}
if (leetTable == null)
{
leetTable = getDefaultLeetTable(); // depends on control dependency: [if], data = [none]
}
if (yearPattern == null)
{
yearPattern = getDefaultYearPattern(); // depends on control dependency: [if], data = [none]
}
if (minimumEntropy == null)
{
minimumEntropy = getDefaultMinimumEntropy(); // depends on control dependency: [if], data = [none]
}
if (locale == null)
{
locale = Locale.getDefault(); // depends on control dependency: [if], data = [none]
}
if (distanceCalc == null)
{
distanceCalc = getDefaultDistanceCalc(); // depends on control dependency: [if], data = [none]
}
if (combinationAlgorithmTimeout == null)
{
combinationAlgorithmTimeout = getDefaultCombinationAlgorithmTimeout(); // depends on control dependency: [if], data = [none]
}
return new Configuration(passwordMatchers, guessTypes, dictionaries, adjacencyGraphs, leetTable, yearPattern, minimumEntropy, locale, distanceCalc, combinationAlgorithmTimeout);
} }
|
public class class_name {
private void tableKeyShortcutsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableKeyShortcutsMouseClicked
if (evt.getClickCount()>1){
this.buttonEditKeyCode.requestFocus();
this.buttonEditKeyCode.doClick();
}
} }
|
public class class_name {
private void tableKeyShortcutsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableKeyShortcutsMouseClicked
if (evt.getClickCount()>1){
this.buttonEditKeyCode.requestFocus(); // depends on control dependency: [if], data = [none]
this.buttonEditKeyCode.doClick(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public @Nonnull PluginDisableResult disable(@Nonnull PluginDisableStrategy strategy) {
PluginDisableResult result = new PluginDisableResult(shortName);
if (!this.isEnabled()) {
result.setMessage(Messages.PluginWrapper_Already_Disabled(shortName));
result.setStatus(ALREADY_DISABLED);
return result;
}
// Act as a flag indicating if this plugin, finally, can be disabled. If there is a not-disabled-dependent
// plugin, this one couldn't be disabled.
String aDependentNotDisabled = null;
// List of dependents plugins to 'check'. 'Check' means disable for mandatory or all strategies, or review if
// this dependent-mandatory plugin is enabled in order to return an error for the NONE strategy.
Set<String> dependentsToCheck = dependentsToCheck(strategy);
// Review all the dependents and add to the plugin result what happened with its dependents
for (String dependent : dependentsToCheck) {
PluginWrapper dependentPlugin = parent.getPlugin(dependent);
// The dependent plugin doesn't exist, add an error to the report
if (dependentPlugin == null) {
PluginDisableResult dependentStatus = new PluginDisableResult(dependent, NO_SUCH_PLUGIN, Messages.PluginWrapper_NoSuchPlugin(dependent));
result.addDependentDisableStatus(dependentStatus);
// If the strategy is none and there is some enabled dependent plugin, the plugin cannot be disabled. If
// this dependent plugin is not enabled, continue searching for one enabled.
} else if (strategy.equals(PluginDisableStrategy.NONE)) {
if (dependentPlugin.isEnabled()) {
aDependentNotDisabled = dependent;
break; // in this case, we don't need to continue with the rest of its dependents
}
// If the strategy is not none and this dependent plugin is not enabled, add it as already disabled
} else if (!dependentPlugin.isEnabled()) {
PluginDisableResult dependentStatus = new PluginDisableResult(dependent, ALREADY_DISABLED, Messages.PluginWrapper_Already_Disabled(dependent));
result.addDependentDisableStatus(dependentStatus);
// If the strategy is not none and this dependent plugin is enabled, disable it
} else {
// As there is no cycles in the plugin dependencies, the recursion shouldn't be infinite. The
// strategy used is the same for its dependents plugins
PluginDisableResult dependentResult = dependentPlugin.disable(strategy);
PluginDisableStatus dependentStatus = dependentResult.status;
// If something wrong happened, flag this dependent plugin to set the plugin later as not-disabled due
// to its dependents plugins.
if (ERROR_DISABLING.equals(dependentStatus) || NOT_DISABLED_DEPENDANTS.equals(dependentStatus)) {
aDependentNotDisabled = dependent;
break; // we found a dependent plugin enabled, stop looking for dependent plugins to disable.
}
result.addDependentDisableStatus(dependentResult);
}
}
// If there is no enabled-dependent plugin, disable this plugin and add it to the result
if (aDependentNotDisabled == null) {
try {
this.disableWithoutCheck();
result.setMessage(Messages.PluginWrapper_Plugin_Disabled(shortName));
result.setStatus(DISABLED);
} catch (IOException io) {
result.setMessage(Messages.PluginWrapper_Error_Disabling(shortName, io.toString()));
result.setStatus(ERROR_DISABLING);
}
// if there is yet some not disabled dependent plugin (only possible with none strategy), this plugin cannot
// be disabled.
} else {
result.setMessage(Messages.PluginWrapper_Plugin_Has_Dependent(shortName, aDependentNotDisabled, strategy));
result.setStatus(NOT_DISABLED_DEPENDANTS);
}
return result;
} }
|
public class class_name {
public @Nonnull PluginDisableResult disable(@Nonnull PluginDisableStrategy strategy) {
PluginDisableResult result = new PluginDisableResult(shortName);
if (!this.isEnabled()) {
result.setMessage(Messages.PluginWrapper_Already_Disabled(shortName)); // depends on control dependency: [if], data = [none]
result.setStatus(ALREADY_DISABLED); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
// Act as a flag indicating if this plugin, finally, can be disabled. If there is a not-disabled-dependent
// plugin, this one couldn't be disabled.
String aDependentNotDisabled = null;
// List of dependents plugins to 'check'. 'Check' means disable for mandatory or all strategies, or review if
// this dependent-mandatory plugin is enabled in order to return an error for the NONE strategy.
Set<String> dependentsToCheck = dependentsToCheck(strategy);
// Review all the dependents and add to the plugin result what happened with its dependents
for (String dependent : dependentsToCheck) {
PluginWrapper dependentPlugin = parent.getPlugin(dependent);
// The dependent plugin doesn't exist, add an error to the report
if (dependentPlugin == null) {
PluginDisableResult dependentStatus = new PluginDisableResult(dependent, NO_SUCH_PLUGIN, Messages.PluginWrapper_NoSuchPlugin(dependent));
result.addDependentDisableStatus(dependentStatus); // depends on control dependency: [if], data = [none]
// If the strategy is none and there is some enabled dependent plugin, the plugin cannot be disabled. If
// this dependent plugin is not enabled, continue searching for one enabled.
} else if (strategy.equals(PluginDisableStrategy.NONE)) {
if (dependentPlugin.isEnabled()) {
aDependentNotDisabled = dependent; // depends on control dependency: [if], data = [none]
break; // in this case, we don't need to continue with the rest of its dependents
}
// If the strategy is not none and this dependent plugin is not enabled, add it as already disabled
} else if (!dependentPlugin.isEnabled()) {
PluginDisableResult dependentStatus = new PluginDisableResult(dependent, ALREADY_DISABLED, Messages.PluginWrapper_Already_Disabled(dependent));
result.addDependentDisableStatus(dependentStatus); // depends on control dependency: [if], data = [none]
// If the strategy is not none and this dependent plugin is enabled, disable it
} else {
// As there is no cycles in the plugin dependencies, the recursion shouldn't be infinite. The
// strategy used is the same for its dependents plugins
PluginDisableResult dependentResult = dependentPlugin.disable(strategy);
PluginDisableStatus dependentStatus = dependentResult.status;
// If something wrong happened, flag this dependent plugin to set the plugin later as not-disabled due
// to its dependents plugins.
if (ERROR_DISABLING.equals(dependentStatus) || NOT_DISABLED_DEPENDANTS.equals(dependentStatus)) {
aDependentNotDisabled = dependent; // depends on control dependency: [if], data = [none]
break; // we found a dependent plugin enabled, stop looking for dependent plugins to disable.
}
result.addDependentDisableStatus(dependentResult); // depends on control dependency: [if], data = [none]
}
}
// If there is no enabled-dependent plugin, disable this plugin and add it to the result
if (aDependentNotDisabled == null) {
try {
this.disableWithoutCheck(); // depends on control dependency: [try], data = [none]
result.setMessage(Messages.PluginWrapper_Plugin_Disabled(shortName)); // depends on control dependency: [try], data = [none]
result.setStatus(DISABLED); // depends on control dependency: [try], data = [none]
} catch (IOException io) {
result.setMessage(Messages.PluginWrapper_Error_Disabling(shortName, io.toString()));
result.setStatus(ERROR_DISABLING);
} // depends on control dependency: [catch], data = [none]
// if there is yet some not disabled dependent plugin (only possible with none strategy), this plugin cannot
// be disabled.
} else {
result.setMessage(Messages.PluginWrapper_Plugin_Has_Dependent(shortName, aDependentNotDisabled, strategy)); // depends on control dependency: [if], data = [none]
result.setStatus(NOT_DISABLED_DEPENDANTS); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
protected void moveExtraProperties( String oldNodeId,
String newNodeId ) {
ExtraPropertiesStore extraPropertiesStore = extraPropertiesStore();
if (extraPropertiesStore == null || !extraPropertiesStore.contains(oldNodeId)) {
return;
}
Map<Name, Property> existingExtraProps = extraPropertiesStore.getProperties(oldNodeId);
extraPropertiesStore.removeProperties(oldNodeId);
extraPropertiesStore.storeProperties(newNodeId, existingExtraProps);
} }
|
public class class_name {
protected void moveExtraProperties( String oldNodeId,
String newNodeId ) {
ExtraPropertiesStore extraPropertiesStore = extraPropertiesStore();
if (extraPropertiesStore == null || !extraPropertiesStore.contains(oldNodeId)) {
return; // depends on control dependency: [if], data = [none]
}
Map<Name, Property> existingExtraProps = extraPropertiesStore.getProperties(oldNodeId);
extraPropertiesStore.removeProperties(oldNodeId);
extraPropertiesStore.storeProperties(newNodeId, existingExtraProps);
} }
|
public class class_name {
public void setIfFirst(Throwable t) {
try {
lock.writeLock().lock();
if (this.t == null)
this.t = t;
} finally {
lock.writeLock().unlock();
}
} }
|
public class class_name {
public void setIfFirst(Throwable t) {
try {
lock.writeLock().lock(); // depends on control dependency: [try], data = [none]
if (this.t == null)
this.t = t;
} finally {
lock.writeLock().unlock();
}
} }
|
public class class_name {
public String getLicenseKey() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new HazelcastRuntimePermission("com.hazelcast.config.Config.getLicenseKey"));
}
return licenseKey;
} }
|
public class class_name {
public String getLicenseKey() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new HazelcastRuntimePermission("com.hazelcast.config.Config.getLicenseKey")); // depends on control dependency: [if], data = [none]
}
return licenseKey;
} }
|
public class class_name {
private Map<Long, DataPoint> _getRow(String counterName, int yyyymm, int dd) {
Map<Long, DataPoint> result = new HashMap<Long, DataPoint>();
ResultSet rs = CqlUtils.execute(sessionHelper.getSession(), cqlGetRow,
getConsistencyLevelForRead(), counterName, yyyymm, dd);
for (Iterator<Row> it = rs.iterator(); it.hasNext();) {
Row row = it.next();
long key = row.getLong(CqlTemplate.COL_COUNTER_TIMESTAMP);
long value = row.getLong(CqlTemplate.COL_COUNTER_VALUE);
DataPoint dp = new DataPoint(Type.SUM, key, value, RESOLUTION_MS);
result.put(key, dp);
}
return result;
} }
|
public class class_name {
private Map<Long, DataPoint> _getRow(String counterName, int yyyymm, int dd) {
Map<Long, DataPoint> result = new HashMap<Long, DataPoint>();
ResultSet rs = CqlUtils.execute(sessionHelper.getSession(), cqlGetRow,
getConsistencyLevelForRead(), counterName, yyyymm, dd);
for (Iterator<Row> it = rs.iterator(); it.hasNext();) {
Row row = it.next();
long key = row.getLong(CqlTemplate.COL_COUNTER_TIMESTAMP);
long value = row.getLong(CqlTemplate.COL_COUNTER_VALUE);
DataPoint dp = new DataPoint(Type.SUM, key, value, RESOLUTION_MS);
result.put(key, dp); // depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
public static int getProcessId() {
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
String runtimeMxBeanName = runtimeMxBean.getName();
Throwable cause = null;
if (hasText(runtimeMxBeanName)) {
int atSignIndex = runtimeMxBeanName.indexOf('@');
if (atSignIndex > 0) {
try {
return Integer.parseInt(runtimeMxBeanName.substring(0, atSignIndex));
}
catch (NumberFormatException e) {
cause = e;
}
}
}
throw new PidUnknownException(String.format("Process ID (PID) unknown [%s]", runtimeMxBeanName), cause);
} }
|
public class class_name {
public static int getProcessId() {
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
String runtimeMxBeanName = runtimeMxBean.getName();
Throwable cause = null;
if (hasText(runtimeMxBeanName)) {
int atSignIndex = runtimeMxBeanName.indexOf('@');
if (atSignIndex > 0) {
try {
return Integer.parseInt(runtimeMxBeanName.substring(0, atSignIndex)); // depends on control dependency: [try], data = [none]
}
catch (NumberFormatException e) {
cause = e;
} // depends on control dependency: [catch], data = [none]
}
}
throw new PidUnknownException(String.format("Process ID (PID) unknown [%s]", runtimeMxBeanName), cause);
} }
|
public class class_name {
public int partition(int k, int minPts) {
List<Neuron> data = new ArrayList<>();
for (Neuron neuron : neurons) {
neuron.y = OUTLIER;
if (neuron.n >= minPts) {
data.add(neuron);
}
}
double[][] proximity = new double[data.size()][];
for (int i = 0; i < data.size(); i++) {
proximity[i] = new double[i + 1];
for (int j = 0; j < i; j++) {
proximity[i][j] = Math.distance(data.get(i).w, data.get(j).w);
}
}
Linkage linkage = new UPGMALinkage(proximity);
HierarchicalClustering hc = new HierarchicalClustering(linkage);
int[] y = hc.partition(k);
for (int i = 0; i < data.size(); i++) {
data.get(i).y = y[i];
}
return data.size();
} }
|
public class class_name {
public int partition(int k, int minPts) {
List<Neuron> data = new ArrayList<>();
for (Neuron neuron : neurons) {
neuron.y = OUTLIER; // depends on control dependency: [for], data = [neuron]
if (neuron.n >= minPts) {
data.add(neuron); // depends on control dependency: [if], data = [none]
}
}
double[][] proximity = new double[data.size()][];
for (int i = 0; i < data.size(); i++) {
proximity[i] = new double[i + 1]; // depends on control dependency: [for], data = [i]
for (int j = 0; j < i; j++) {
proximity[i][j] = Math.distance(data.get(i).w, data.get(j).w); // depends on control dependency: [for], data = [j]
}
}
Linkage linkage = new UPGMALinkage(proximity);
HierarchicalClustering hc = new HierarchicalClustering(linkage);
int[] y = hc.partition(k);
for (int i = 0; i < data.size(); i++) {
data.get(i).y = y[i]; // depends on control dependency: [for], data = [i]
}
return data.size();
} }
|
public class class_name {
protected static File getJarFile( File basedir, String finalName, String classifier )
{
if ( classifier == null )
{
classifier = "";
}
else if ( classifier.trim().length() > 0 && !classifier.startsWith( "-" ) )
{
classifier = "-" + classifier;
}
return new File( basedir, finalName + classifier + ".jar" );
} }
|
public class class_name {
protected static File getJarFile( File basedir, String finalName, String classifier )
{
if ( classifier == null )
{
classifier = ""; // depends on control dependency: [if], data = [none]
}
else if ( classifier.trim().length() > 0 && !classifier.startsWith( "-" ) )
{
classifier = "-" + classifier; // depends on control dependency: [if], data = [none]
}
return new File( basedir, finalName + classifier + ".jar" );
} }
|
public class class_name {
protected void initEditOverlay(Element element) {
CmsInlineEditOverlay.removeAll();
m_editOverlay = CmsInlineEditOverlay.addOverlayForElement(element);
if (m_resizeHandlerRegistration != null) {
m_resizeHandlerRegistration.removeHandler();
}
// add a handler to ensure the edit overlays get adjusted to changed window size
m_resizeHandlerRegistration = Window.addResizeHandler(new ResizeHandler() {
private Timer m_resizeTimer;
public void onResize(ResizeEvent event) {
if (m_resizeTimer == null) {
m_resizeTimer = new Timer() {
@Override
public void run() {
handleResize();
}
};
m_resizeTimer.schedule(300);
}
}
/**
* Handles the window resize.<p>
*/
void handleResize() {
m_resizeTimer = null;
CmsInlineEditOverlay.updateCurrentOverlayPosition();
}
});
} }
|
public class class_name {
protected void initEditOverlay(Element element) {
CmsInlineEditOverlay.removeAll();
m_editOverlay = CmsInlineEditOverlay.addOverlayForElement(element);
if (m_resizeHandlerRegistration != null) {
m_resizeHandlerRegistration.removeHandler();
// depends on control dependency: [if], data = [none]
}
// add a handler to ensure the edit overlays get adjusted to changed window size
m_resizeHandlerRegistration = Window.addResizeHandler(new ResizeHandler() {
private Timer m_resizeTimer;
public void onResize(ResizeEvent event) {
if (m_resizeTimer == null) {
m_resizeTimer = new Timer() {
@Override
public void run() {
handleResize();
}
};
// depends on control dependency: [if], data = [none]
m_resizeTimer.schedule(300);
// depends on control dependency: [if], data = [none]
}
}
/**
* Handles the window resize.<p>
*/
void handleResize() {
m_resizeTimer = null;
CmsInlineEditOverlay.updateCurrentOverlayPosition();
}
});
} }
|
public class class_name {
@FFDCIgnore({ InterruptedException.class })
public synchronized void waitForComplete() {
// Don't bother waiting if the vm has been shutdown in the meanwhile...
while (done.get() == false && !shutdownHook.vmShutdown()) {
try {
// refresh packages should not take a long time..
wait(1000);
} catch (InterruptedException e) {
/** No-op **/
}
}
} }
|
public class class_name {
@FFDCIgnore({ InterruptedException.class })
public synchronized void waitForComplete() {
// Don't bother waiting if the vm has been shutdown in the meanwhile...
while (done.get() == false && !shutdownHook.vmShutdown()) {
try {
// refresh packages should not take a long time..
wait(1000); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
/** No-op **/
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public double[] calculateDrift(ArrayList<T> tracks){
double[] result = new double[3];
double sumX =0;
double sumY = 0;
double sumZ = 0;
int N=0;
for(int i = 0; i < tracks.size(); i++){
T t = tracks.get(i);
TrajectoryValidIndexTimelagIterator it = new TrajectoryValidIndexTimelagIterator(t,1);
//for(int j = 1; j < t.size(); j++){
while(it.hasNext()) {
int j = it.next();
sumX += t.get(j+1).x - t.get(j).x;
sumY += t.get(j+1).y - t.get(j).y;
sumZ += t.get(j+1).z - t.get(j).z;
N++;
}
}
result[0] = sumX/N;
result[1] = sumY/N;
result[2] = sumZ/N;
return result;
} }
|
public class class_name {
public double[] calculateDrift(ArrayList<T> tracks){
double[] result = new double[3];
double sumX =0;
double sumY = 0;
double sumZ = 0;
int N=0;
for(int i = 0; i < tracks.size(); i++){
T t = tracks.get(i);
TrajectoryValidIndexTimelagIterator it = new TrajectoryValidIndexTimelagIterator(t,1);
//for(int j = 1; j < t.size(); j++){
while(it.hasNext()) {
int j = it.next();
sumX += t.get(j+1).x - t.get(j).x; // depends on control dependency: [while], data = [none]
sumY += t.get(j+1).y - t.get(j).y; // depends on control dependency: [while], data = [none]
sumZ += t.get(j+1).z - t.get(j).z; // depends on control dependency: [while], data = [none]
N++; // depends on control dependency: [while], data = [none]
}
}
result[0] = sumX/N;
result[1] = sumY/N;
result[2] = sumZ/N;
return result;
} }
|
public class class_name {
public synchronized int addElement(E theElement) {
if (theElement == null) {
return -1;
}
if (elementCount == currentCapacity) {
// try to expand the table to handle the new value, if that fails
// then it will throw an illegalstate exception
expandTable();
}
int theIndex = occupiedSlots.nextClearBit(0);
if (theIndex < 0 || theIndex > currentCapacity - 1) {
throw new IllegalStateException("No space available for element");
}
theElementArray[theIndex] = theElement;
elementCount++;
occupiedSlots.set(theIndex);
return theIndex;
} }
|
public class class_name {
public synchronized int addElement(E theElement) {
if (theElement == null) {
return -1; // depends on control dependency: [if], data = [none]
}
if (elementCount == currentCapacity) {
// try to expand the table to handle the new value, if that fails
// then it will throw an illegalstate exception
expandTable(); // depends on control dependency: [if], data = [none]
}
int theIndex = occupiedSlots.nextClearBit(0);
if (theIndex < 0 || theIndex > currentCapacity - 1) {
throw new IllegalStateException("No space available for element");
}
theElementArray[theIndex] = theElement;
elementCount++;
occupiedSlots.set(theIndex);
return theIndex;
} }
|
public class class_name {
private void cleanupMessage(boolean filterSourceOut, boolean downloadLogsSuccess, boolean processSourceSuccess, CloudTrailSource source) {
if (filterSourceOut) {
deleteMessageAfterProcessSource(ProgressState.deleteFilteredMessage, source);
} else if (processSourceSuccess || sqsManager.shouldDeleteMessageUponFailure(!downloadLogsSuccess)) {
deleteMessageAfterProcessSource(ProgressState.deleteMessage, source);
}
} }
|
public class class_name {
private void cleanupMessage(boolean filterSourceOut, boolean downloadLogsSuccess, boolean processSourceSuccess, CloudTrailSource source) {
if (filterSourceOut) {
deleteMessageAfterProcessSource(ProgressState.deleteFilteredMessage, source); // depends on control dependency: [if], data = [none]
} else if (processSourceSuccess || sqsManager.shouldDeleteMessageUponFailure(!downloadLogsSuccess)) {
deleteMessageAfterProcessSource(ProgressState.deleteMessage, source); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public EEnum getIfcThermalLoadTypeEnum() {
if (ifcThermalLoadTypeEnumEEnum == null) {
ifcThermalLoadTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(915);
}
return ifcThermalLoadTypeEnumEEnum;
} }
|
public class class_name {
public EEnum getIfcThermalLoadTypeEnum() {
if (ifcThermalLoadTypeEnumEEnum == null) {
ifcThermalLoadTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(915);
// depends on control dependency: [if], data = [none]
}
return ifcThermalLoadTypeEnumEEnum;
} }
|
public class class_name {
public N getPartitionSuperNode(N node) {
checkNotNull(colorToNodeMap, "No coloring founded. color() should be called first.");
Color color = graph.getNode(node).getAnnotation();
N headNode = colorToNodeMap[color.value];
if (headNode == null) {
colorToNodeMap[color.value] = node;
return node;
} else {
return headNode;
}
} }
|
public class class_name {
public N getPartitionSuperNode(N node) {
checkNotNull(colorToNodeMap, "No coloring founded. color() should be called first.");
Color color = graph.getNode(node).getAnnotation();
N headNode = colorToNodeMap[color.value];
if (headNode == null) {
colorToNodeMap[color.value] = node; // depends on control dependency: [if], data = [none]
return node; // depends on control dependency: [if], data = [none]
} else {
return headNode; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static <T> void onNextDropped(T t, Context context) {
Objects.requireNonNull(t, "onNext");
Objects.requireNonNull(context, "context");
Consumer<Object> hook = context.getOrDefault(Hooks.KEY_ON_NEXT_DROPPED, null);
if (hook == null) {
hook = Hooks.onNextDroppedHook;
}
if (hook != null) {
hook.accept(t);
}
else if (log.isDebugEnabled()) {
log.debug("onNextDropped: " + t);
}
} }
|
public class class_name {
public static <T> void onNextDropped(T t, Context context) {
Objects.requireNonNull(t, "onNext");
Objects.requireNonNull(context, "context");
Consumer<Object> hook = context.getOrDefault(Hooks.KEY_ON_NEXT_DROPPED, null);
if (hook == null) {
hook = Hooks.onNextDroppedHook; // depends on control dependency: [if], data = [none]
}
if (hook != null) {
hook.accept(t); // depends on control dependency: [if], data = [none]
}
else if (log.isDebugEnabled()) {
log.debug("onNextDropped: " + t); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void establishSSLContext(HttpClient client,
int port,
LibertyServer server,
String ksPath,
String ksPassword,
String tsPath,
String tsPassword,
String sslProtocol) {
String methodName = "establishSSLContext";
Log.info(logClass, methodName, "ksPath : " + ksPath + ", tsPath : " + tsPath);
FileInputStream ksStream = null;
FileInputStream tsStream = null;
try {
int sslPort;
if (server != null) {
sslPort = server.getHttpDefaultSecurePort();
} else {
sslPort = port;
}
try {
KeyManager keyManagers[] = null;
if (ksPath != null) {
KeyManagerFactory kmFactory =
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
File ksFile = new File(ksPath);
KeyStore keyStore = KeyStore.getInstance("JKS");
ksStream = new FileInputStream(ksFile);
keyStore.load(ksStream, ksPassword.toCharArray());
kmFactory.init(keyStore, ksPassword.toCharArray());
keyManagers = kmFactory.getKeyManagers();
Log.info(logClass, methodName, "KeyManager is configured properly.");
}
TrustManager[] trustManagers = null;
if (tsPath != null) {
TrustManagerFactory tmFactory =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
File tsFile = new File(tsPath);
KeyStore trustStore = KeyStore.getInstance("JKS");
tsStream = new FileInputStream(tsFile);
trustStore.load(tsStream, tsPassword.toCharArray());
tmFactory.init(trustStore);
trustManagers = tmFactory.getTrustManagers();
Log.info(logClass, methodName, "TrustManager is configured properly.");
}
if (trustManagers == null) {
trustManagers = new TrustManager[] { createTrustAllTrustManager() };
Log.info(logClass, methodName, "Default AllTrustManager is configured properly.");
}
if (sslProtocol == null)
sslProtocol = "TLSv1.2";
SSLContext ctx = SSLContext.getInstance(sslProtocol);
ctx.init(keyManagers, trustManagers, null);
SSLSocketFactory socketFactory = new SSLSocketFactory(ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
Scheme sch = new Scheme("https", sslPort, socketFactory);
client.getConnectionManager().getSchemeRegistry().register(sch);
} catch (Exception e) {
throw new RuntimeException("Unable to establish SSLSocketFactory", e);
}
} finally {
try {
if (ksStream != null) {
ksStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
try {
if (tsStream != null) {
tsStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
} }
|
public class class_name {
public static void establishSSLContext(HttpClient client,
int port,
LibertyServer server,
String ksPath,
String ksPassword,
String tsPath,
String tsPassword,
String sslProtocol) {
String methodName = "establishSSLContext";
Log.info(logClass, methodName, "ksPath : " + ksPath + ", tsPath : " + tsPath);
FileInputStream ksStream = null;
FileInputStream tsStream = null;
try {
int sslPort;
if (server != null) {
sslPort = server.getHttpDefaultSecurePort(); // depends on control dependency: [if], data = [none]
} else {
sslPort = port; // depends on control dependency: [if], data = [none]
}
try {
KeyManager keyManagers[] = null;
if (ksPath != null) {
KeyManagerFactory kmFactory =
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
File ksFile = new File(ksPath);
KeyStore keyStore = KeyStore.getInstance("JKS");
ksStream = new FileInputStream(ksFile); // depends on control dependency: [if], data = [none]
keyStore.load(ksStream, ksPassword.toCharArray()); // depends on control dependency: [if], data = [none]
kmFactory.init(keyStore, ksPassword.toCharArray()); // depends on control dependency: [if], data = [none]
keyManagers = kmFactory.getKeyManagers(); // depends on control dependency: [if], data = [none]
Log.info(logClass, methodName, "KeyManager is configured properly."); // depends on control dependency: [if], data = [none]
}
TrustManager[] trustManagers = null;
if (tsPath != null) {
TrustManagerFactory tmFactory =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
File tsFile = new File(tsPath);
KeyStore trustStore = KeyStore.getInstance("JKS");
tsStream = new FileInputStream(tsFile); // depends on control dependency: [if], data = [none]
trustStore.load(tsStream, tsPassword.toCharArray()); // depends on control dependency: [if], data = [none]
tmFactory.init(trustStore); // depends on control dependency: [if], data = [none]
trustManagers = tmFactory.getTrustManagers(); // depends on control dependency: [if], data = [none]
Log.info(logClass, methodName, "TrustManager is configured properly."); // depends on control dependency: [if], data = [none]
}
if (trustManagers == null) {
trustManagers = new TrustManager[] { createTrustAllTrustManager() }; // depends on control dependency: [if], data = [none]
Log.info(logClass, methodName, "Default AllTrustManager is configured properly."); // depends on control dependency: [if], data = [none]
}
if (sslProtocol == null)
sslProtocol = "TLSv1.2";
SSLContext ctx = SSLContext.getInstance(sslProtocol);
ctx.init(keyManagers, trustManagers, null); // depends on control dependency: [try], data = [none]
SSLSocketFactory socketFactory = new SSLSocketFactory(ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
Scheme sch = new Scheme("https", sslPort, socketFactory);
client.getConnectionManager().getSchemeRegistry().register(sch); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Unable to establish SSLSocketFactory", e);
} // depends on control dependency: [catch], data = [none]
} finally {
try {
if (ksStream != null) {
ksStream.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
try {
if (tsStream != null) {
tsStream.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static String getHttpStatusCodeText(int sc) {
HttpStatusCode sCode = HttpStatusCode.fromNumStatusCode(sc);
if (sCode == null) {
return sc + " <unknown status code>";
} else {
return sCode.toString();
}
} }
|
public class class_name {
public static String getHttpStatusCodeText(int sc) {
HttpStatusCode sCode = HttpStatusCode.fromNumStatusCode(sc);
if (sCode == null) {
return sc + " <unknown status code>"; // depends on control dependency: [if], data = [none]
} else {
return sCode.toString(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value)
{
if (facesContext == null)
{
throw new NullPointerException("facesContext");
}
if (uiComponent == null)
{
throw new NullPointerException("uiComponent");
}
if (value != null)
{
value = value.trim();
if (value.length() > 0)
{
try
{
return new BigInteger(value.trim());
}
catch (NumberFormatException e)
{
throw new ConverterException(_MessageUtils.getErrorMessage(facesContext,
BIGINTEGER_ID,
new Object[]{value,"2345",_MessageUtils.getLabel(facesContext, uiComponent)}), e);
}
}
}
return null;
} }
|
public class class_name {
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value)
{
if (facesContext == null)
{
throw new NullPointerException("facesContext");
}
if (uiComponent == null)
{
throw new NullPointerException("uiComponent");
}
if (value != null)
{
value = value.trim(); // depends on control dependency: [if], data = [none]
if (value.length() > 0)
{
try
{
return new BigInteger(value.trim()); // depends on control dependency: [try], data = [none]
}
catch (NumberFormatException e)
{
throw new ConverterException(_MessageUtils.getErrorMessage(facesContext,
BIGINTEGER_ID,
new Object[]{value,"2345",_MessageUtils.getLabel(facesContext, uiComponent)}), e);
} // depends on control dependency: [catch], data = [none]
}
}
return null;
} }
|
public class class_name {
@SubscribeEvent
public void postRender(RenderWorldLastEvent event)
{
// Check that the video producer and frame type match - eg if this is a colourmap frame, then
// only the colourmap videoproducer needs to do anything.
boolean colourmapFrame = TextureHelper.colourmapFrame;
boolean colourmapVideoProducer = this.videoProducer.getVideoType() == VideoType.COLOUR_MAP;
if (colourmapFrame != colourmapVideoProducer)
return;
EntityPlayerSP player = Minecraft.getMinecraft().player;
float x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks());
float y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks());
float z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks());
float yaw = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * event.getPartialTicks();
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.getPartialTicks();
long time_before_ns = System.nanoTime();
if (observer != null)
observer.frameProduced();
if (time_before_ns < retry_time_ns)
return;
boolean success = false;
long time_after_render_ns;
try
{
int size = this.videoProducer.getRequiredBufferSize();
if (AddressHelper.getMissionControlPort() == 0) {
success = true;
if (envServer != null) {
// Write the obs data into a newly allocated buffer:
byte[] data = new byte[size];
this.buffer.clear();
this.videoProducer.getFrame(this.missionInit, this.buffer);
this.buffer.get(data); // Avoiding copy not simple as data is kept & written to a stream later.
time_after_render_ns = System.nanoTime();
envServer.addFrame(data);
} else {
time_after_render_ns = System.nanoTime();
}
} else {
// Get buffer ready for writing to:
this.buffer.clear();
this.headerbuffer.clear();
// Write the pos data:
this.headerbuffer.putFloat(x);
this.headerbuffer.putFloat(y);
this.headerbuffer.putFloat(z);
this.headerbuffer.putFloat(yaw);
this.headerbuffer.putFloat(pitch);
// Write the frame data:
this.videoProducer.getFrame(this.missionInit, this.buffer);
// The buffer gets flipped by getFrame(), but we need to flip our header buffer ourselves:
this.headerbuffer.flip();
ByteBuffer[] buffers = {this.headerbuffer, this.buffer};
time_after_render_ns = System.nanoTime();
success = this.connection.sendTCPBytes(buffers, size + POS_HEADER_SIZE);
}
long time_after_ns = System.nanoTime();
float ms_send = (time_after_ns - time_after_render_ns) / 1000000.0f;
float ms_render = (time_after_render_ns - time_before_ns) / 1000000.0f;
if (success)
{
this.failedTCPSendCount = 0; // Reset count of failed sends.
this.timeOfLastFrame = System.currentTimeMillis();
if (this.timeOfFirstFrame == 0)
this.timeOfFirstFrame = this.timeOfLastFrame;
this.framesSent++;
// System.out.format("Total: %.2fms; collecting took %.2fms; sending %d bytes took %.2fms\n", ms_send + ms_render, ms_render, size, ms_send);
// System.out.println("Collect: " + ms_render + "; Send: " + ms_send);
}
}
catch (Exception e)
{
System.out.format(e.getMessage());
}
if (!success) {
System.out.format("Failed to send frame - will retry in %d seconds\n", RETRY_GAP_NS / 1000000000L);
retry_time_ns = time_before_ns + RETRY_GAP_NS;
this.failedTCPSendCount++;
}
} }
|
public class class_name {
@SubscribeEvent
public void postRender(RenderWorldLastEvent event)
{
// Check that the video producer and frame type match - eg if this is a colourmap frame, then
// only the colourmap videoproducer needs to do anything.
boolean colourmapFrame = TextureHelper.colourmapFrame;
boolean colourmapVideoProducer = this.videoProducer.getVideoType() == VideoType.COLOUR_MAP;
if (colourmapFrame != colourmapVideoProducer)
return;
EntityPlayerSP player = Minecraft.getMinecraft().player;
float x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks());
float y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks());
float z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks());
float yaw = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * event.getPartialTicks();
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.getPartialTicks();
long time_before_ns = System.nanoTime();
if (observer != null)
observer.frameProduced();
if (time_before_ns < retry_time_ns)
return;
boolean success = false;
long time_after_render_ns;
try
{
int size = this.videoProducer.getRequiredBufferSize();
if (AddressHelper.getMissionControlPort() == 0) {
success = true; // depends on control dependency: [if], data = [none]
if (envServer != null) {
// Write the obs data into a newly allocated buffer:
byte[] data = new byte[size];
this.buffer.clear(); // depends on control dependency: [if], data = [none]
this.videoProducer.getFrame(this.missionInit, this.buffer); // depends on control dependency: [if], data = [none]
this.buffer.get(data); // Avoiding copy not simple as data is kept & written to a stream later. // depends on control dependency: [if], data = [none]
time_after_render_ns = System.nanoTime(); // depends on control dependency: [if], data = [none]
envServer.addFrame(data); // depends on control dependency: [if], data = [none]
} else {
time_after_render_ns = System.nanoTime(); // depends on control dependency: [if], data = [none]
}
} else {
// Get buffer ready for writing to:
this.buffer.clear(); // depends on control dependency: [if], data = [none]
this.headerbuffer.clear(); // depends on control dependency: [if], data = [none]
// Write the pos data:
this.headerbuffer.putFloat(x); // depends on control dependency: [if], data = [none]
this.headerbuffer.putFloat(y); // depends on control dependency: [if], data = [none]
this.headerbuffer.putFloat(z); // depends on control dependency: [if], data = [none]
this.headerbuffer.putFloat(yaw); // depends on control dependency: [if], data = [none]
this.headerbuffer.putFloat(pitch); // depends on control dependency: [if], data = [none]
// Write the frame data:
this.videoProducer.getFrame(this.missionInit, this.buffer); // depends on control dependency: [if], data = [none]
// The buffer gets flipped by getFrame(), but we need to flip our header buffer ourselves:
this.headerbuffer.flip(); // depends on control dependency: [if], data = [none]
ByteBuffer[] buffers = {this.headerbuffer, this.buffer};
time_after_render_ns = System.nanoTime(); // depends on control dependency: [if], data = [none]
success = this.connection.sendTCPBytes(buffers, size + POS_HEADER_SIZE); // depends on control dependency: [if], data = [none]
}
long time_after_ns = System.nanoTime();
float ms_send = (time_after_ns - time_after_render_ns) / 1000000.0f;
float ms_render = (time_after_render_ns - time_before_ns) / 1000000.0f;
if (success)
{
this.failedTCPSendCount = 0; // Reset count of failed sends. // depends on control dependency: [if], data = [none]
this.timeOfLastFrame = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
if (this.timeOfFirstFrame == 0)
this.timeOfFirstFrame = this.timeOfLastFrame;
this.framesSent++; // depends on control dependency: [if], data = [none]
// System.out.format("Total: %.2fms; collecting took %.2fms; sending %d bytes took %.2fms\n", ms_send + ms_render, ms_render, size, ms_send);
// System.out.println("Collect: " + ms_render + "; Send: " + ms_send);
}
}
catch (Exception e)
{
System.out.format(e.getMessage());
} // depends on control dependency: [catch], data = [none]
if (!success) {
System.out.format("Failed to send frame - will retry in %d seconds\n", RETRY_GAP_NS / 1000000000L); // depends on control dependency: [if], data = [none]
retry_time_ns = time_before_ns + RETRY_GAP_NS; // depends on control dependency: [if], data = [none]
this.failedTCPSendCount++; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public EClass getIfcAnnotationTextOccurrence() {
if (ifcAnnotationTextOccurrenceEClass == null) {
ifcAnnotationTextOccurrenceEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(20);
}
return ifcAnnotationTextOccurrenceEClass;
} }
|
public class class_name {
public EClass getIfcAnnotationTextOccurrence() {
if (ifcAnnotationTextOccurrenceEClass == null) {
ifcAnnotationTextOccurrenceEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(20);
// depends on control dependency: [if], data = [none]
}
return ifcAnnotationTextOccurrenceEClass;
} }
|
public class class_name {
private static List<String> parseTokens(String exp) {
if (exp == null) {
return null;
}
List<String> tokens = new ArrayList<String>();
Character commentChar = null;
int start = 0;
for (int i = 0; i < exp.length(); i++) {
if (exp.charAt(i) == '"') {
if (commentChar == null) {
commentChar = '"';
} else if (commentChar == '"') {
commentChar = null;
tokens.add(exp.substring(start, i + 1).trim());
start = i + 1;
}
} else if (exp.charAt(i) == '\'') {
if (commentChar == null) {
commentChar = '\'';
} else if (commentChar == '\'') {
commentChar = null;
tokens.add(exp.substring(start, i + 1).trim());
start = i + 1;
}
} else if (exp.charAt(i) == '[') {
if (commentChar == null) {
if (start != i) {
tokens.add(exp.substring(start, i).trim());
}
tokens.add("[");
start = i + 1;
}
} else if (exp.charAt(i) == ']') {
if (commentChar == null) {
if (start != i) {
tokens.add(exp.substring(start, i).trim());
}
tokens.add("]");
start = i + 1;
}
} else if (exp.charAt(i) == '.') {
if (commentChar == null) {
if (start != i) {
tokens.add(exp.substring(start, i).trim());
}
start = i + 1;
}
} else if (i == exp.length() - 1) {
tokens.add(exp.substring(start, i + 1).trim());
}
}
return tokens;
} }
|
public class class_name {
private static List<String> parseTokens(String exp) {
if (exp == null) {
return null; // depends on control dependency: [if], data = [none]
}
List<String> tokens = new ArrayList<String>();
Character commentChar = null;
int start = 0;
for (int i = 0; i < exp.length(); i++) {
if (exp.charAt(i) == '"') {
if (commentChar == null) {
commentChar = '"'; // depends on control dependency: [if], data = [none]
} else if (commentChar == '"') {
commentChar = null; // depends on control dependency: [if], data = [none]
tokens.add(exp.substring(start, i + 1).trim()); // depends on control dependency: [if], data = [none]
start = i + 1; // depends on control dependency: [if], data = [none]
}
} else if (exp.charAt(i) == '\'') {
if (commentChar == null) {
commentChar = '\''; // depends on control dependency: [if], data = [none]
} else if (commentChar == '\'') {
commentChar = null; // depends on control dependency: [if], data = [none]
tokens.add(exp.substring(start, i + 1).trim()); // depends on control dependency: [if], data = [none]
start = i + 1; // depends on control dependency: [if], data = [none]
}
} else if (exp.charAt(i) == '[') {
if (commentChar == null) {
if (start != i) {
tokens.add(exp.substring(start, i).trim()); // depends on control dependency: [if], data = [(start]
}
tokens.add("["); // depends on control dependency: [if], data = [none]
start = i + 1; // depends on control dependency: [if], data = [none]
}
} else if (exp.charAt(i) == ']') {
if (commentChar == null) {
if (start != i) {
tokens.add(exp.substring(start, i).trim()); // depends on control dependency: [if], data = [(start]
}
tokens.add("]"); // depends on control dependency: [if], data = [none]
start = i + 1; // depends on control dependency: [if], data = [none]
}
} else if (exp.charAt(i) == '.') {
if (commentChar == null) {
if (start != i) {
tokens.add(exp.substring(start, i).trim()); // depends on control dependency: [if], data = [(start]
}
start = i + 1; // depends on control dependency: [if], data = [none]
}
} else if (i == exp.length() - 1) {
tokens.add(exp.substring(start, i + 1).trim()); // depends on control dependency: [if], data = [none]
}
}
return tokens;
} }
|
public class class_name {
@Override
public int compareTo(IPAddressString other) {
if(this == other) {
return 0;
}
boolean isValid = isValid();
boolean otherIsValid = other.isValid();
if(!isValid && !otherIsValid) {
return toString().compareTo(other.toString());
}
return addressProvider.providerCompare(other.addressProvider);
} }
|
public class class_name {
@Override
public int compareTo(IPAddressString other) {
if(this == other) {
return 0; // depends on control dependency: [if], data = [none]
}
boolean isValid = isValid();
boolean otherIsValid = other.isValid();
if(!isValid && !otherIsValid) {
return toString().compareTo(other.toString()); // depends on control dependency: [if], data = [none]
}
return addressProvider.providerCompare(other.addressProvider);
} }
|
public class class_name {
void showFilesConfiguration() {
// Message to communicate the resolved configuration:
String message;
if (filesUrl != null) {
String reload = filesReloadable ? "reloadable" : "non-reloadable";
message = "Files will be served from: " + filesUrl + " (" + reload + ")";
} else {
message = "No static files will be served.";
}
log.info("Files: {}", message);
} }
|
public class class_name {
void showFilesConfiguration() {
// Message to communicate the resolved configuration:
String message;
if (filesUrl != null) {
String reload = filesReloadable ? "reloadable" : "non-reloadable";
message = "Files will be served from: " + filesUrl + " (" + reload + ")"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
} else {
message = "No static files will be served."; // depends on control dependency: [if], data = [none]
}
log.info("Files: {}", message);
} }
|
public class class_name {
public ListEntitiesForPolicyResult withPolicyRoles(PolicyRole... policyRoles) {
if (this.policyRoles == null) {
setPolicyRoles(new com.amazonaws.internal.SdkInternalList<PolicyRole>(policyRoles.length));
}
for (PolicyRole ele : policyRoles) {
this.policyRoles.add(ele);
}
return this;
} }
|
public class class_name {
public ListEntitiesForPolicyResult withPolicyRoles(PolicyRole... policyRoles) {
if (this.policyRoles == null) {
setPolicyRoles(new com.amazonaws.internal.SdkInternalList<PolicyRole>(policyRoles.length)); // depends on control dependency: [if], data = [none]
}
for (PolicyRole ele : policyRoles) {
this.policyRoles.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static MethodInvoker getMethodInvokerByAnnotation(
final Class<? extends Annotation> annotationType, final Object target) {
Assert.notNull(target, "Target must not be null");
Assert.notNull(annotationType, "AnnotationType must not be null");
Assert.isTrue(ObjectUtils.containsElement(
annotationType.getAnnotation(Target.class).value(), ElementType.METHOD),
"Annotation [" + annotationType + "] is not a Method-level annotation.");
final Class<?> targetClass = (target instanceof Advised)
? ((Advised) target).getTargetSource().getTargetClass()
: target.getClass();
if (targetClass == null) {
// Proxy with no target cannot have annotations
return null;
}
final AtomicReference<Method> annotatedMethod = new AtomicReference<Method>();
ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() {
public void doWith(Method method)
throws IllegalArgumentException, IllegalAccessException {
Annotation annotation = AnnotationUtils.findAnnotation(method,
annotationType);
if (annotation != null) {
Assert.isNull(annotatedMethod.get(),
"found more than one method on target class ["
+ targetClass.getSimpleName()
+ "] with the annotation type ["
+ annotationType.getSimpleName() + "].");
annotatedMethod.set(method);
}
}
});
Method method = annotatedMethod.get();
if (method == null) {
return null;
}
else {
return new SimpleMethodInvoker(target, annotatedMethod.get());
}
} }
|
public class class_name {
public static MethodInvoker getMethodInvokerByAnnotation(
final Class<? extends Annotation> annotationType, final Object target) {
Assert.notNull(target, "Target must not be null");
Assert.notNull(annotationType, "AnnotationType must not be null");
Assert.isTrue(ObjectUtils.containsElement(
annotationType.getAnnotation(Target.class).value(), ElementType.METHOD),
"Annotation [" + annotationType + "] is not a Method-level annotation.");
final Class<?> targetClass = (target instanceof Advised)
? ((Advised) target).getTargetSource().getTargetClass()
: target.getClass();
if (targetClass == null) {
// Proxy with no target cannot have annotations
return null;
}
final AtomicReference<Method> annotatedMethod = new AtomicReference<Method>();
ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() {
public void doWith(Method method)
throws IllegalArgumentException, IllegalAccessException {
Annotation annotation = AnnotationUtils.findAnnotation(method,
annotationType);
if (annotation != null) {
Assert.isNull(annotatedMethod.get(),
"found more than one method on target class ["
+ targetClass.getSimpleName()
+ "] with the annotation type ["
+ annotationType.getSimpleName() + "].");
annotatedMethod.set(method);
}
}
});
Method method = annotatedMethod.get();
if (method == null) {
return null; // depends on control dependency: [if], data = [none]
}
else {
return new SimpleMethodInvoker(target, annotatedMethod.get()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void checkForTimeouts(long checkTime) {
TimeSlot nextSlot = this.firstSlot;
TimerWorkItem entry = null;
TimeSlot oldSlot = null;
while (nextSlot != null && checkTime >= nextSlot.timeoutTime) {
// Timeout all entries here
int endIndex = nextSlot.lastEntryIndex;
for (int i = 0; i <= endIndex; i++) {
// invoke callback if not already cancelled
entry = nextSlot.entries[i];
if (entry.state == TimerWorkItem.ENTRY_ACTIVE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found a timeout, calling timerTriggered");
}
entry.state = TimerWorkItem.ENTRY_CANCELLED;
entry.callback.timerTriggered(entry);
}
}
// since we timed out all slot entries, remove it
oldSlot = nextSlot;
removeSlot(oldSlot);
nextSlot = nextSlot.nextEntry;
}
} }
|
public class class_name {
public void checkForTimeouts(long checkTime) {
TimeSlot nextSlot = this.firstSlot;
TimerWorkItem entry = null;
TimeSlot oldSlot = null;
while (nextSlot != null && checkTime >= nextSlot.timeoutTime) {
// Timeout all entries here
int endIndex = nextSlot.lastEntryIndex;
for (int i = 0; i <= endIndex; i++) {
// invoke callback if not already cancelled
entry = nextSlot.entries[i]; // depends on control dependency: [for], data = [i]
if (entry.state == TimerWorkItem.ENTRY_ACTIVE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found a timeout, calling timerTriggered"); // depends on control dependency: [if], data = [none]
}
entry.state = TimerWorkItem.ENTRY_CANCELLED; // depends on control dependency: [if], data = [none]
entry.callback.timerTriggered(entry); // depends on control dependency: [if], data = [none]
}
}
// since we timed out all slot entries, remove it
oldSlot = nextSlot; // depends on control dependency: [while], data = [none]
removeSlot(oldSlot); // depends on control dependency: [while], data = [none]
nextSlot = nextSlot.nextEntry; // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == this)
{
Date dateTarget = this.getTargetDate();
JCalendarPopup popup = JCalendarPopup.createCalendarPopup(this.getDateParam(), dateTarget, this, languageString);
popup.addPropertyChangeListener(this);
}
} }
|
public class class_name {
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == this)
{
Date dateTarget = this.getTargetDate();
JCalendarPopup popup = JCalendarPopup.createCalendarPopup(this.getDateParam(), dateTarget, this, languageString);
popup.addPropertyChangeListener(this); // depends on control dependency: [if], data = [this)]
}
} }
|
public class class_name {
@Override
protected List findUsingLucene(EntityMetadata m, Client client)
{
QueryTranslator translator = new QueryTranslator();
translator.translate(getKunderaQuery(), m, true);
List<Map<String, Object>> columns = translator.getColumnsToOutput(m, getKunderaQuery(), true);
Object value = null;
for (Object obj : getKunderaQuery().getFilterClauseQueue())
{
if (obj instanceof FilterClause)
{
value = ((FilterClause) obj).getValue().get(0);
}
}
byte[] valueInBytes = HBaseUtils.getBytes(value,
((AbstractAttribute) m.getIdAttribute()).getBindableJavaType());
return ((HBaseClient) client).findData(m, valueInBytes, null, null, columns, null);
} }
|
public class class_name {
@Override
protected List findUsingLucene(EntityMetadata m, Client client)
{
QueryTranslator translator = new QueryTranslator();
translator.translate(getKunderaQuery(), m, true);
List<Map<String, Object>> columns = translator.getColumnsToOutput(m, getKunderaQuery(), true);
Object value = null;
for (Object obj : getKunderaQuery().getFilterClauseQueue())
{
if (obj instanceof FilterClause)
{
value = ((FilterClause) obj).getValue().get(0); // depends on control dependency: [if], data = [none]
}
}
byte[] valueInBytes = HBaseUtils.getBytes(value,
((AbstractAttribute) m.getIdAttribute()).getBindableJavaType());
return ((HBaseClient) client).findData(m, valueInBytes, null, null, columns, null);
} }
|
public class class_name {
public void marshall(Grant grant, ProtocolMarshaller protocolMarshaller) {
if (grant == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(grant.getGrantee(), GRANTEE_BINDING);
protocolMarshaller.marshall(grant.getPermission(), PERMISSION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Grant grant, ProtocolMarshaller protocolMarshaller) {
if (grant == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(grant.getGrantee(), GRANTEE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(grant.getPermission(), PERMISSION_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 String getFirstHeader(String name) {
List<String> headerValues = getHeader(name);
if (headerValues == null || headerValues.size() == 0) {
return null;
}
return headerValues.get(0);
} }
|
public class class_name {
public String getFirstHeader(String name) {
List<String> headerValues = getHeader(name);
if (headerValues == null || headerValues.size() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
return headerValues.get(0);
} }
|
public class class_name {
public static String threadIdToString(int threadId) {
StringBuffer buffer = new StringBuffer(8);
// pad the HexString ThreadId so that it is always 8 characters long.
for (int shift = 7; shift >= 0; shift--) {
buffer.append(hexChars[(threadId >> (shift << 2)) & 0xF]);
}
return buffer.toString();
} }
|
public class class_name {
public static String threadIdToString(int threadId) {
StringBuffer buffer = new StringBuffer(8);
// pad the HexString ThreadId so that it is always 8 characters long.
for (int shift = 7; shift >= 0; shift--) {
buffer.append(hexChars[(threadId >> (shift << 2)) & 0xF]); // depends on control dependency: [for], data = [shift]
}
return buffer.toString();
} }
|
public class class_name {
String regExpGroupName(String elementName) {
for (String regexp : sortedRegExpList) {
if (elementName.startsWith(regexp)) {
return regExpGroupMap.get(regexp);
}
}
return null;
} }
|
public class class_name {
String regExpGroupName(String elementName) {
for (String regexp : sortedRegExpList) {
if (elementName.startsWith(regexp)) {
return regExpGroupMap.get(regexp); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static String encode(final String aString, final boolean aIgnoreSlashFlag) {
final CharacterIterator iterator = new StringCharacterIterator(decode(aString));
final StringBuilder builder = new StringBuilder();
for (char c = iterator.first(); c != CharacterIterator.DONE; c = iterator.next()) {
switch (c) {
case '%':
builder.append(PERCENT);
break;
case '/':
if (aIgnoreSlashFlag) {
builder.append(c);
} else {
builder.append("%2F");
}
break;
case '?':
builder.append("%3F");
break;
case '#':
builder.append("%23");
break;
case '[':
builder.append("%5B");
break;
case ']':
builder.append("%5D");
break;
case '@':
builder.append("%40");
break;
default:
builder.append(c);
break;
}
}
// Must percent-encode any characters outside the US-ASCII set
return URI.create(builder.toString()).toASCIIString();
} }
|
public class class_name {
public static String encode(final String aString, final boolean aIgnoreSlashFlag) {
final CharacterIterator iterator = new StringCharacterIterator(decode(aString));
final StringBuilder builder = new StringBuilder();
for (char c = iterator.first(); c != CharacterIterator.DONE; c = iterator.next()) {
switch (c) {
case '%':
builder.append(PERCENT);
break;
case '/':
if (aIgnoreSlashFlag) {
builder.append(c); // depends on control dependency: [if], data = [none]
} else {
builder.append("%2F"); // depends on control dependency: [if], data = [none]
}
break;
case '?':
builder.append("%3F");
break;
case '#':
builder.append("%23");
break;
case '[':
builder.append("%5B");
break;
case ']':
builder.append("%5D");
break;
case '@':
builder.append("%40");
break;
default:
builder.append(c);
break;
}
}
// Must percent-encode any characters outside the US-ASCII set
return URI.create(builder.toString()).toASCIIString();
} }
|
public class class_name {
private Attribute readAttribute(
final Attribute[] attributePrototypes,
final String type,
final int offset,
final int length,
final char[] charBuffer,
final int codeAttributeOffset,
final Label[] labels) {
for (Attribute attributePrototype : attributePrototypes) {
if (attributePrototype.type.equals(type)) {
return attributePrototype.read(
this, offset, length, charBuffer, codeAttributeOffset, labels);
}
}
return new Attribute(type).read(this, offset, length, null, -1, null);
} }
|
public class class_name {
private Attribute readAttribute(
final Attribute[] attributePrototypes,
final String type,
final int offset,
final int length,
final char[] charBuffer,
final int codeAttributeOffset,
final Label[] labels) {
for (Attribute attributePrototype : attributePrototypes) {
if (attributePrototype.type.equals(type)) {
return attributePrototype.read(
this, offset, length, charBuffer, codeAttributeOffset, labels); // depends on control dependency: [if], data = [none]
}
}
return new Attribute(type).read(this, offset, length, null, -1, null);
} }
|
public class class_name {
protected void checkValid() throws SISessionUnavailableException {
if (!_parentConnection.isValid()) {
final SISessionUnavailableException exception = new SISessionUnavailableException(
NLS.getString("INVALID_SESSION_CWSIV0200"));
if (TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception);
}
throw exception;
}
} }
|
public class class_name {
protected void checkValid() throws SISessionUnavailableException {
if (!_parentConnection.isValid()) {
final SISessionUnavailableException exception = new SISessionUnavailableException(
NLS.getString("INVALID_SESSION_CWSIV0200"));
if (TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception); // depends on control dependency: [if], data = [none]
}
throw exception;
}
} }
|
public class class_name {
private void sortEvents(List<? extends WeekViewEvent> events) {
Collections.sort(events, new Comparator<WeekViewEvent>() {
@Override
public int compare(WeekViewEvent event1, WeekViewEvent event2) {
long start1 = event1.getStartTime().getTimeInMillis();
long start2 = event2.getStartTime().getTimeInMillis();
int comparator = start1 > start2 ? 1 : (start1 < start2 ? -1 : 0);
if (comparator == 0) {
long end1 = event1.getEndTime().getTimeInMillis();
long end2 = event2.getEndTime().getTimeInMillis();
comparator = end1 > end2 ? 1 : (end1 < end2 ? -1 : 0);
}
return comparator;
}
});
} }
|
public class class_name {
private void sortEvents(List<? extends WeekViewEvent> events) {
Collections.sort(events, new Comparator<WeekViewEvent>() {
@Override
public int compare(WeekViewEvent event1, WeekViewEvent event2) {
long start1 = event1.getStartTime().getTimeInMillis();
long start2 = event2.getStartTime().getTimeInMillis();
int comparator = start1 > start2 ? 1 : (start1 < start2 ? -1 : 0);
if (comparator == 0) {
long end1 = event1.getEndTime().getTimeInMillis();
long end2 = event2.getEndTime().getTimeInMillis();
comparator = end1 > end2 ? 1 : (end1 < end2 ? -1 : 0); // depends on control dependency: [if], data = [0)]
}
return comparator;
}
});
} }
|
public class class_name {
private void obtainRestoreDefaultsButtonText() {
CharSequence text;
try {
text = ThemeUtil.getText(getActivity(), R.attr.restoreDefaultsButtonText);
} catch (NotFoundException e) {
text = getText(R.string.restore_defaults_button_text);
}
setRestoreDefaultsButtonText(text);
} }
|
public class class_name {
private void obtainRestoreDefaultsButtonText() {
CharSequence text;
try {
text = ThemeUtil.getText(getActivity(), R.attr.restoreDefaultsButtonText); // depends on control dependency: [try], data = [none]
} catch (NotFoundException e) {
text = getText(R.string.restore_defaults_button_text);
} // depends on control dependency: [catch], data = [none]
setRestoreDefaultsButtonText(text);
} }
|
public class class_name {
public IWord findFirstWordByLabel(String label)
{
for (IWord word : this)
{
if (label.equals(word.getLabel()))
{
return word;
}
}
return null;
} }
|
public class class_name {
public IWord findFirstWordByLabel(String label)
{
for (IWord word : this)
{
if (label.equals(word.getLabel()))
{
return word; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
@Inject
void setExecutionService(@Named(TaskExecutors.IO) @Nullable ExecutorService executionService) {
if (executionService != null) {
this.executionService = executionService;
}
} }
|
public class class_name {
@Inject
void setExecutionService(@Named(TaskExecutors.IO) @Nullable ExecutorService executionService) {
if (executionService != null) {
this.executionService = executionService; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private int indexNodes(int startIndex) {
if (index() < 0) { // if this node has no index
if (tg != null) {
tg.addNodeToIndexMap(startIndex, this);
}
setIndex(startIndex++);
}
if (!isLeaf()) {
for (int i = 0; i < children.length; i++) {
startIndex = children[i].indexNodes(startIndex);
}
}
return startIndex;
} }
|
public class class_name {
private int indexNodes(int startIndex) {
if (index() < 0) { // if this node has no index
if (tg != null) {
tg.addNodeToIndexMap(startIndex, this);
// depends on control dependency: [if], data = [none]
}
setIndex(startIndex++);
// depends on control dependency: [if], data = [none]
}
if (!isLeaf()) {
for (int i = 0; i < children.length; i++) {
startIndex = children[i].indexNodes(startIndex);
// depends on control dependency: [for], data = [i]
}
}
return startIndex;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.