code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public boolean hasExtPros() {
Field[] fields = getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
if (!(Modifier.isFinal(fields[i].getModifiers())
|| Modifier.isStatic(fields[i].getModifiers()))) { return true; }
}
return false;
} } | public class class_name {
public boolean hasExtPros() {
Field[] fields = getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
if (!(Modifier.isFinal(fields[i].getModifiers())
|| Modifier.isStatic(fields[i].getModifiers()))) { return true; } // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static String elasticSearchTimeFormatToISO8601(String time) {
try {
DateTime dt = DateTime.parse(time, ES_DATE_FORMAT_FORMATTER);
return getISO8601String(dt);
} catch (IllegalArgumentException e) {
return time;
}
} } | public class class_name {
public static String elasticSearchTimeFormatToISO8601(String time) {
try {
DateTime dt = DateTime.parse(time, ES_DATE_FORMAT_FORMATTER);
return getISO8601String(dt); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
return time;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public ListDeploymentInstancesRequest withInstanceTypeFilter(InstanceType... instanceTypeFilter) {
com.amazonaws.internal.SdkInternalList<String> instanceTypeFilterCopy = new com.amazonaws.internal.SdkInternalList<String>(instanceTypeFilter.length);
for (InstanceType value : instanceTypeFilter) {
instanceTypeFilterCopy.add(value.toString());
}
if (getInstanceTypeFilter() == null) {
setInstanceTypeFilter(instanceTypeFilterCopy);
} else {
getInstanceTypeFilter().addAll(instanceTypeFilterCopy);
}
return this;
} } | public class class_name {
public ListDeploymentInstancesRequest withInstanceTypeFilter(InstanceType... instanceTypeFilter) {
com.amazonaws.internal.SdkInternalList<String> instanceTypeFilterCopy = new com.amazonaws.internal.SdkInternalList<String>(instanceTypeFilter.length);
for (InstanceType value : instanceTypeFilter) {
instanceTypeFilterCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getInstanceTypeFilter() == null) {
setInstanceTypeFilter(instanceTypeFilterCopy); // depends on control dependency: [if], data = [none]
} else {
getInstanceTypeFilter().addAll(instanceTypeFilterCopy); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
public void init(ConfigurationValueProvider... configurationValueProviders) {
if (configurationValueProviders != null) {
for (ConfigurationProperty property : getContainer().properties.values()) {
property.init(configurationValueProviders);
}
}
} } | public class class_name {
@Override
public void init(ConfigurationValueProvider... configurationValueProviders) {
if (configurationValueProviders != null) {
for (ConfigurationProperty property : getContainer().properties.values()) {
property.init(configurationValueProviders); // depends on control dependency: [for], data = [property]
}
}
} } |
public class class_name {
public String css(String identifier)
{
try {
return new CSSIdentifierSerializer().serialize(identifier);
} catch (IllegalArgumentException e) {
LOGGER.warn("Failed to escape CSS identifier. {}", e.getMessage());
return null;
}
} } | public class class_name {
public String css(String identifier)
{
try {
return new CSSIdentifierSerializer().serialize(identifier); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
LOGGER.warn("Failed to escape CSS identifier. {}", e.getMessage());
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Enumeration getValues(String name)
{
FieldInfo info=getFieldInfo(name);
final Field field=getField(info,true);
if (field!=null)
{
return new Enumeration()
{
Field f=field;
public boolean hasMoreElements()
{
while (f!=null && f._version!=_version)
f=f._next;
return f!=null;
}
public Object nextElement()
throws NoSuchElementException
{
if (f==null)
throw new NoSuchElementException();
Field n=f;
do f=f._next; while (f!=null && f._version!=_version);
return n._value;
}
};
}
return null;
} } | public class class_name {
public Enumeration getValues(String name)
{
FieldInfo info=getFieldInfo(name);
final Field field=getField(info,true);
if (field!=null)
{
return new Enumeration()
{
Field f=field;
public boolean hasMoreElements()
{
while (f!=null && f._version!=_version)
f=f._next;
return f!=null;
}
public Object nextElement()
throws NoSuchElementException
{
if (f==null)
throw new NoSuchElementException();
Field n=f;
do f=f._next; while (f!=null && f._version!=_version);
return n._value;
}
}; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static String toUnionMemberName(ClassTemplateSpec spec) {
if (spec.getSchema() == null) { // custom type
return spec.getClassName() + "Member";
}
Type schemaType = spec.getSchema().getType();
if (schemaType == Type.INT) {
return "IntMember";
} else if (schemaType == Type.LONG) {
return "LongMember";
} else if (schemaType == Type.FLOAT) {
return "FloatMember";
} else if (schemaType == Type.DOUBLE) {
return "DoubleMember";
} else if (schemaType == Type.STRING) {
return "StringMember";
} else if (schemaType == Type.BOOLEAN) {
return "BooleanMember";
} else if (schemaType == Type.BYTES) {
return "BytesMember";
} else if (schemaType == Type.FIXED) {
return "FixedMember";
} else if (schemaType == Type.ENUM) {
return spec.getClassName() + "Member";
} else if (schemaType == Type.RECORD) {
return spec.getClassName() + "Member";
} else if (schemaType == Type.MAP) {
return "MapMember";
} else if (schemaType == Type.ARRAY) {
return "ArrayMember";
} else {
throw new IllegalArgumentException("unrecognized type: " + schemaType);
}
} } | public class class_name {
public static String toUnionMemberName(ClassTemplateSpec spec) {
if (spec.getSchema() == null) { // custom type
return spec.getClassName() + "Member"; // depends on control dependency: [if], data = [none]
}
Type schemaType = spec.getSchema().getType();
if (schemaType == Type.INT) {
return "IntMember"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.LONG) {
return "LongMember"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.FLOAT) {
return "FloatMember"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.DOUBLE) {
return "DoubleMember"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.STRING) {
return "StringMember"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.BOOLEAN) {
return "BooleanMember"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.BYTES) {
return "BytesMember"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.FIXED) {
return "FixedMember"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.ENUM) {
return spec.getClassName() + "Member"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.RECORD) {
return spec.getClassName() + "Member"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.MAP) {
return "MapMember"; // depends on control dependency: [if], data = [none]
} else if (schemaType == Type.ARRAY) {
return "ArrayMember"; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("unrecognized type: " + schemaType);
}
} } |
public class class_name {
public String[] getAllGlobusID(String userID) {
if (userID == null) {
throw new IllegalArgumentException(i18n.getMessage("userIdNull"));
}
if (this.map == null) {
return null;
}
Vector v = new Vector();
Iterator iter = this.map.entrySet().iterator();
Map.Entry mapEntry;
GridMapEntry entry;
while(iter.hasNext()) {
mapEntry = (Map.Entry)iter.next();
entry = (GridMapEntry)mapEntry.getValue();
if (entry.containsUserID(userID)) {
v.add(entry.getGlobusID());
}
}
// create array of strings and add values back in
if(v.size() == 0) {
return null;
}
String idS[] = new String[v.size()];
for(int ctr = 0; ctr < v.size(); ctr++) {
idS[ctr] = (String) v.elementAt(ctr);
}
return idS;
} } | public class class_name {
public String[] getAllGlobusID(String userID) {
if (userID == null) {
throw new IllegalArgumentException(i18n.getMessage("userIdNull"));
}
if (this.map == null) {
return null; // depends on control dependency: [if], data = [none]
}
Vector v = new Vector();
Iterator iter = this.map.entrySet().iterator();
Map.Entry mapEntry;
GridMapEntry entry;
while(iter.hasNext()) {
mapEntry = (Map.Entry)iter.next(); // depends on control dependency: [while], data = [none]
entry = (GridMapEntry)mapEntry.getValue(); // depends on control dependency: [while], data = [none]
if (entry.containsUserID(userID)) {
v.add(entry.getGlobusID()); // depends on control dependency: [if], data = [none]
}
}
// create array of strings and add values back in
if(v.size() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
String idS[] = new String[v.size()];
for(int ctr = 0; ctr < v.size(); ctr++) {
idS[ctr] = (String) v.elementAt(ctr); // depends on control dependency: [for], data = [ctr]
}
return idS;
} } |
public class class_name {
public static <T> Set<T> filter(final Set<? extends T> input,
final Condition<? super T> condition, final int size) {
return new Set<T>() {
@Override
public int size() {
return size;
}
@Override
public boolean isEmpty() {
return size == 0;
}
@Override
@SuppressWarnings("unchecked")
public boolean contains(Object o) {
if (!input.contains(o))
return false;
T elem = null;
try {
elem = (T) o;
} catch (ClassCastException cce) {
return false;
}
/*
* here's why the condition must be consistent with equals(): we
* check it on the passed element while we really need to check
* it on the element which is in the underlying set (and is
* equal to o according to equals()). However, as long as the
* condition is consistent, the result will be the same.
*/
return condition.holds(elem);
}
@Override
public Iterator<T> iterator() {
return filter(input, condition).iterator();
}
@Override
public Object[] toArray() {
Object[] result = new Object[size];
int i = 0;
for (Object o : filter(input, condition)) {
result[i++] = o;
}
return result;
}
@Override
public <S> S[] toArray(S[] a) {
throw new UnsupportedOperationException();
}
@Override
public boolean add(T e) {
throw new UnsupportedOperationException();
}
@Override
public boolean remove(Object o) {
throw new UnsupportedOperationException();
}
@Override
public boolean containsAll(Collection<?> c) {
for (Object o : c) {
if (contains(o))
return false;
}
return true;
}
@Override
public boolean addAll(Collection<? extends T> c) {
throw new UnsupportedOperationException();
}
@Override
public boolean retainAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
@Override
public boolean removeAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
@Override
public void clear() {
throw new UnsupportedOperationException();
}
};
} } | public class class_name {
public static <T> Set<T> filter(final Set<? extends T> input,
final Condition<? super T> condition, final int size) {
return new Set<T>() {
@Override
public int size() {
return size;
}
@Override
public boolean isEmpty() {
return size == 0;
}
@Override
@SuppressWarnings("unchecked")
public boolean contains(Object o) {
if (!input.contains(o))
return false;
T elem = null;
try {
elem = (T) o; // depends on control dependency: [try], data = [none]
} catch (ClassCastException cce) {
return false;
} // depends on control dependency: [catch], data = [none]
/*
* here's why the condition must be consistent with equals(): we
* check it on the passed element while we really need to check
* it on the element which is in the underlying set (and is
* equal to o according to equals()). However, as long as the
* condition is consistent, the result will be the same.
*/
return condition.holds(elem);
}
@Override
public Iterator<T> iterator() {
return filter(input, condition).iterator();
}
@Override
public Object[] toArray() {
Object[] result = new Object[size];
int i = 0;
for (Object o : filter(input, condition)) {
result[i++] = o; // depends on control dependency: [for], data = [o]
}
return result;
}
@Override
public <S> S[] toArray(S[] a) {
throw new UnsupportedOperationException();
}
@Override
public boolean add(T e) {
throw new UnsupportedOperationException();
}
@Override
public boolean remove(Object o) {
throw new UnsupportedOperationException();
}
@Override
public boolean containsAll(Collection<?> c) {
for (Object o : c) {
if (contains(o))
return false;
}
return true;
}
@Override
public boolean addAll(Collection<? extends T> c) {
throw new UnsupportedOperationException();
}
@Override
public boolean retainAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
@Override
public boolean removeAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
@Override
public void clear() {
throw new UnsupportedOperationException();
}
};
} } |
public class class_name {
public void printXMLElement(String name, Map<String, String> attributes)
{
Element element = new DefaultElement(name);
if (attributes != null && !attributes.isEmpty()) {
for (Map.Entry<String, String> entry : attributes.entrySet()) {
element.addAttribute(entry.getKey(), entry.getValue());
}
}
try {
this.xmlWriter.write(element);
} catch (IOException e) {
// TODO: add error log here
}
} } | public class class_name {
public void printXMLElement(String name, Map<String, String> attributes)
{
Element element = new DefaultElement(name);
if (attributes != null && !attributes.isEmpty()) {
for (Map.Entry<String, String> entry : attributes.entrySet()) {
element.addAttribute(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
}
try {
this.xmlWriter.write(element); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// TODO: add error log here
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void addToolbarButtons() {
Button add = CmsToolBar.createButton(
FontOpenCms.LOGIN,
CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_LOGINMESSAGE_TOOL_NAME_0));
add.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openEditLoginMessageDialog();
}
});
m_uiContext.addToolbarButton(add);
Button broadcastToAll = CmsToolBar.createButton(
FontOpenCms.BROADCAST,
CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_TO_ALL_0));
broadcastToAll.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
showSendBroadcastDialog(
null,
CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_TO_ALL_0),
m_table);
}
});
m_uiContext.addToolbarButton(broadcastToAll);
m_infoButton = getStatisticButton();
m_uiContext.addToolbarButton(m_infoButton);
Button button = CmsToolBar.createButton(
FontOpenCms.RESET,
CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_REFRESH_0));
button.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
try {
m_table.ini();
m_infoButton.replaceData(getInfoMap());
} catch (CmsException e) {
//
}
}
});
m_uiContext.addToolbarButton(button);
} } | public class class_name {
private void addToolbarButtons() {
Button add = CmsToolBar.createButton(
FontOpenCms.LOGIN,
CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_LOGINMESSAGE_TOOL_NAME_0));
add.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openEditLoginMessageDialog();
}
});
m_uiContext.addToolbarButton(add);
Button broadcastToAll = CmsToolBar.createButton(
FontOpenCms.BROADCAST,
CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_TO_ALL_0));
broadcastToAll.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
showSendBroadcastDialog(
null,
CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_TO_ALL_0),
m_table);
}
});
m_uiContext.addToolbarButton(broadcastToAll);
m_infoButton = getStatisticButton();
m_uiContext.addToolbarButton(m_infoButton);
Button button = CmsToolBar.createButton(
FontOpenCms.RESET,
CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_REFRESH_0));
button.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
try {
m_table.ini(); // depends on control dependency: [try], data = [none]
m_infoButton.replaceData(getInfoMap()); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
//
} // depends on control dependency: [catch], data = [none]
}
});
m_uiContext.addToolbarButton(button);
} } |
public class class_name {
protected Session login(String repositoryId) {
LOGGER.debug("--- login: " + repositoryId);
if (context == null) {
throw new CmisRuntimeException("No user context!");
}
Session session = sessions.get(repositoryId);
if (session == null) {
HttpServletRequest request = (HttpServletRequest) context.get(CallContext.HTTP_SERVLET_REQUEST);
if (request != null) {
//try via http authentication
try {
session = jcrRepository(repositoryId).login(new ServletCredentials(request), workspace(repositoryId));
sessions.put(repositoryId, session);
return session;
} catch (CmisPermissionDeniedException e) {
LOGGER.debug(e, "Cannot authenticate using http authentication");
}
}
//http authentication didn't work, try std authentication
String userName = context.getUsername();
String password = context.getPassword();
Credentials credentials = (userName == null)
? null : new SimpleCredentials(userName, password == null ? "".toCharArray() : password.toCharArray());
try {
session = jcrRepository(repositoryId).login(credentials, workspace(repositoryId));
sessions.put(repositoryId, session);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return session;
} } | public class class_name {
protected Session login(String repositoryId) {
LOGGER.debug("--- login: " + repositoryId);
if (context == null) {
throw new CmisRuntimeException("No user context!");
}
Session session = sessions.get(repositoryId);
if (session == null) {
HttpServletRequest request = (HttpServletRequest) context.get(CallContext.HTTP_SERVLET_REQUEST);
if (request != null) {
//try via http authentication
try {
session = jcrRepository(repositoryId).login(new ServletCredentials(request), workspace(repositoryId)); // depends on control dependency: [try], data = [none]
sessions.put(repositoryId, session); // depends on control dependency: [try], data = [none]
return session; // depends on control dependency: [try], data = [none]
} catch (CmisPermissionDeniedException e) {
LOGGER.debug(e, "Cannot authenticate using http authentication");
} // depends on control dependency: [catch], data = [none]
}
//http authentication didn't work, try std authentication
String userName = context.getUsername();
String password = context.getPassword();
Credentials credentials = (userName == null)
? null : new SimpleCredentials(userName, password == null ? "".toCharArray() : password.toCharArray());
try {
session = jcrRepository(repositoryId).login(credentials, workspace(repositoryId)); // depends on control dependency: [try], data = [none]
sessions.put(repositoryId, session); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
return session;
} } |
public class class_name {
public final String getCurrentDataContextName() {
if (currentDataContextName == null) {
StringBuilder sb = new StringBuilder();
List<String> list = this.getCurrentDataContextNameList();
for (int i = 0; i < list.size(); i++) {
if (i > 0) {
sb.append(":" + list.get(i));
} else {
sb.append(list.get(i));
}
}
this.setCurrentDataContextName(sb.toString());
}
return currentDataContextName;
} } | public class class_name {
public final String getCurrentDataContextName() {
if (currentDataContextName == null) {
StringBuilder sb = new StringBuilder();
List<String> list = this.getCurrentDataContextNameList();
for (int i = 0; i < list.size(); i++) {
if (i > 0) {
sb.append(":" + list.get(i));
// depends on control dependency: [if], data = [(i]
} else {
sb.append(list.get(i));
// depends on control dependency: [if], data = [(i]
}
}
this.setCurrentDataContextName(sb.toString());
// depends on control dependency: [if], data = [none]
}
return currentDataContextName;
} } |
public class class_name {
public void setSelection(int selectionDegrees, boolean isInnerCircle, boolean forceDrawDot) {
mSelectionDegrees = selectionDegrees;
mSelectionRadians = selectionDegrees * Math.PI / 180;
mForceDrawDot = forceDrawDot;
if (mHasInnerCircle) {
if (isInnerCircle) {
mNumbersRadiusMultiplier = mInnerNumbersRadiusMultiplier;
} else {
mNumbersRadiusMultiplier = mOuterNumbersRadiusMultiplier;
}
}
} } | public class class_name {
public void setSelection(int selectionDegrees, boolean isInnerCircle, boolean forceDrawDot) {
mSelectionDegrees = selectionDegrees;
mSelectionRadians = selectionDegrees * Math.PI / 180;
mForceDrawDot = forceDrawDot;
if (mHasInnerCircle) {
if (isInnerCircle) {
mNumbersRadiusMultiplier = mInnerNumbersRadiusMultiplier; // depends on control dependency: [if], data = [none]
} else {
mNumbersRadiusMultiplier = mOuterNumbersRadiusMultiplier; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public FileAppender flush() {
try(PrintWriter pw = writer.getPrintWriter(true)){
for (String str : list) {
pw.print(str);
if (isNewLineMode) {
pw.println();
}
}
}
list.clear();
return this;
} } | public class class_name {
public FileAppender flush() {
try(PrintWriter pw = writer.getPrintWriter(true)){
for (String str : list) {
pw.print(str);
// depends on control dependency: [for], data = [str]
if (isNewLineMode) {
pw.println();
// depends on control dependency: [if], data = [none]
}
}
}
list.clear();
return this;
} } |
public class class_name {
@NotNull
protected Map<String, Object> toTypeArguments(@NotNull Map<String, ClassElement> typeArguments) {
final LinkedHashMap<String, Object> map = new LinkedHashMap<>(typeArguments.size());
for (Map.Entry<String, ClassElement> entry : typeArguments.entrySet()) {
final ClassElement ce = entry.getValue();
final Map<String, ClassElement> subArgs = ce.getTypeArguments();
if (CollectionUtils.isNotEmpty(subArgs)) {
map.put(entry.getKey(), toTypeArguments(subArgs));
} else {
final Type typeReference = getTypeForElement(ce);
map.put(entry.getKey(), typeReference);
}
}
return map;
} } | public class class_name {
@NotNull
protected Map<String, Object> toTypeArguments(@NotNull Map<String, ClassElement> typeArguments) {
final LinkedHashMap<String, Object> map = new LinkedHashMap<>(typeArguments.size());
for (Map.Entry<String, ClassElement> entry : typeArguments.entrySet()) {
final ClassElement ce = entry.getValue();
final Map<String, ClassElement> subArgs = ce.getTypeArguments();
if (CollectionUtils.isNotEmpty(subArgs)) {
map.put(entry.getKey(), toTypeArguments(subArgs)); // depends on control dependency: [if], data = [none]
} else {
final Type typeReference = getTypeForElement(ce);
map.put(entry.getKey(), typeReference); // depends on control dependency: [if], data = [none]
}
}
return map;
} } |
public class class_name {
public boolean isDemo() {
if (!isSignedIn()) {
return false;
}
Settings settings = storageService.getSettings();
String baseUrl = settings.getBaseUrl();
return getUser().getName().equals("demo")
&& "http://demo.next-reports.com".equals(baseUrl);
} } | public class class_name {
public boolean isDemo() {
if (!isSignedIn()) {
return false; // depends on control dependency: [if], data = [none]
}
Settings settings = storageService.getSettings();
String baseUrl = settings.getBaseUrl();
return getUser().getName().equals("demo")
&& "http://demo.next-reports.com".equals(baseUrl);
} } |
public class class_name {
public void add(int line, List<AtomNode> atomSegment)
{
// 将原子部分存入m_segGraph
int offset = 0;
for (AtomNode atomNode : atomSegment)//Init the cost array
{
String sWord = atomNode.sWord;//init the word
Nature nature = Nature.n;
int id = -1;
switch (atomNode.nPOS)
{
case CharType.CT_CHINESE:
break;
case CharType.CT_NUM:
case CharType.CT_INDEX:
case CharType.CT_CNUM:
nature = Nature.m;
sWord = Predefine.TAG_NUMBER;
id = CoreDictionary.M_WORD_ID;
break;
case CharType.CT_DELIMITER:
case CharType.CT_OTHER:
nature = Nature.w;
break;
case CharType.CT_SINGLE://12021-2129-3121
nature = Nature.nx;
sWord = Predefine.TAG_CLUSTER;
id = CoreDictionary.X_WORD_ID;
break;
default:
break;
}
// 这些通用符的量级都在10万左右
add(line + offset, new Vertex(sWord, atomNode.sWord, new CoreDictionary.Attribute(nature, 10000), id));
offset += atomNode.sWord.length();
}
} } | public class class_name {
public void add(int line, List<AtomNode> atomSegment)
{
// 将原子部分存入m_segGraph
int offset = 0;
for (AtomNode atomNode : atomSegment)//Init the cost array
{
String sWord = atomNode.sWord;//init the word
Nature nature = Nature.n;
int id = -1;
switch (atomNode.nPOS)
{
case CharType.CT_CHINESE:
break;
case CharType.CT_NUM:
case CharType.CT_INDEX:
case CharType.CT_CNUM:
nature = Nature.m;
sWord = Predefine.TAG_NUMBER;
id = CoreDictionary.M_WORD_ID;
break;
case CharType.CT_DELIMITER:
case CharType.CT_OTHER:
nature = Nature.w;
break;
case CharType.CT_SINGLE://12021-2129-3121
nature = Nature.nx;
sWord = Predefine.TAG_CLUSTER;
id = CoreDictionary.X_WORD_ID;
break;
default:
break;
}
// 这些通用符的量级都在10万左右
add(line + offset, new Vertex(sWord, atomNode.sWord, new CoreDictionary.Attribute(nature, 10000), id)); // depends on control dependency: [for], data = [atomNode]
offset += atomNode.sWord.length(); // depends on control dependency: [for], data = [atomNode]
}
} } |
public class class_name {
public <T extends CompoundButton> boolean isButtonChecked(Class<T> expectedClass, String text)
{
T button = waiter.waitForText(expectedClass, text, 0, Timeout.getSmallTimeout(), true);
if(button != null && button.isChecked()){
return true;
}
return false;
} } | public class class_name {
public <T extends CompoundButton> boolean isButtonChecked(Class<T> expectedClass, String text)
{
T button = waiter.waitForText(expectedClass, text, 0, Timeout.getSmallTimeout(), true);
if(button != null && button.isChecked()){
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void marshall(GetImportJobsRequest getImportJobsRequest, ProtocolMarshaller protocolMarshaller) {
if (getImportJobsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getImportJobsRequest.getApplicationId(), APPLICATIONID_BINDING);
protocolMarshaller.marshall(getImportJobsRequest.getPageSize(), PAGESIZE_BINDING);
protocolMarshaller.marshall(getImportJobsRequest.getToken(), TOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetImportJobsRequest getImportJobsRequest, ProtocolMarshaller protocolMarshaller) {
if (getImportJobsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getImportJobsRequest.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getImportJobsRequest.getPageSize(), PAGESIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getImportJobsRequest.getToken(), TOKEN_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 Object get(int indexValue)
{
Object result = null;
TransactionLocalStorage txStorage = (TransactionLocalStorage) perTransactionStorage.get(MithraManagerProvider.getMithraManager().zGetCurrentTransactionWithNoCheck());
Index perThreadAdded = txStorage == null ? null : txStorage.added;
if (perThreadAdded != null)
{
result = perThreadAdded.get(indexValue);
}
if (result == null)
{
result = this.mainIndex.get(indexValue);
result = this.checkDeletedIndex(result, txStorage);
}
return result;
} } | public class class_name {
public Object get(int indexValue)
{
Object result = null;
TransactionLocalStorage txStorage = (TransactionLocalStorage) perTransactionStorage.get(MithraManagerProvider.getMithraManager().zGetCurrentTransactionWithNoCheck());
Index perThreadAdded = txStorage == null ? null : txStorage.added;
if (perThreadAdded != null)
{
result = perThreadAdded.get(indexValue);
// depends on control dependency: [if], data = [none]
}
if (result == null)
{
result = this.mainIndex.get(indexValue);
// depends on control dependency: [if], data = [none]
result = this.checkDeletedIndex(result, txStorage);
// depends on control dependency: [if], data = [(result]
}
return result;
} } |
public class class_name {
public void init()
{
this.leading = 0;
while (this.leading < this.value.length() && this.value.charAt(this.leading) == ' ')
{
this.leading++;
}
if (this.leading == this.value.length())
{
this.setEmpty();
}
else
{
this.isEmpty = false;
this.trailing = 0;
while (this.value.charAt(this.value.length() - this.trailing - 1) == ' ')
{
this.trailing++;
}
}
} } | public class class_name {
public void init()
{
this.leading = 0;
while (this.leading < this.value.length() && this.value.charAt(this.leading) == ' ')
{
this.leading++; // depends on control dependency: [while], data = [none]
}
if (this.leading == this.value.length())
{
this.setEmpty(); // depends on control dependency: [if], data = [none]
}
else
{
this.isEmpty = false; // depends on control dependency: [if], data = [none]
this.trailing = 0; // depends on control dependency: [if], data = [none]
while (this.value.charAt(this.value.length() - this.trailing - 1) == ' ')
{
this.trailing++; // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
private void fetchComponentCounters(String componentName, PerformanceCountersHolder componentCountersHolder) {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThreadsStatistic field, then result statistic from this field
//will be aggregated to componentCountersHolder
//To decrease inter thread communication delay we fetch snapshots first
//and only after that we aggregate data from immutable snapshots
final Collection<ORawPair<Thread, PerformanceSnapshot>> snapshots = new ArrayList<>(statistics.size());
final List<Thread> threadsToRemove = new ArrayList<>();
for (Map.Entry<Thread, OSessionStoragePerformanceStatistic> entry : statistics.entrySet()) {
final Thread thread = entry.getKey();
final OSessionStoragePerformanceStatistic statistic = entry.getValue();
snapshots.add(new ORawPair<>(thread, statistic.getSnapshot()));
}
for (ORawPair<Thread, PerformanceSnapshot> pair : snapshots) {
final Thread thread = pair.getFirst();
if (thread.isAlive()) {
final PerformanceSnapshot snapshot = pair.getSecond();
final PerformanceCountersHolder holder = snapshot.countersByComponent.get(componentName);
if (holder != null)
holder.pushData(componentCountersHolder);
} else {
threadsToRemove.add(thread);
}
}
if (!threadsToRemove.isEmpty()) {
updateDeadThreadsStatistic(threadsToRemove);
}
final ImmutableStatistic ds = deadThreadsStatistic;
if (ds != null) {
final PerformanceCountersHolder dch = ds.countersByComponents.get(componentName);
if (dch != null) {
dch.pushData(componentCountersHolder);
}
}
} } | public class class_name {
private void fetchComponentCounters(String componentName, PerformanceCountersHolder componentCountersHolder) {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThreadsStatistic field, then result statistic from this field
//will be aggregated to componentCountersHolder
//To decrease inter thread communication delay we fetch snapshots first
//and only after that we aggregate data from immutable snapshots
final Collection<ORawPair<Thread, PerformanceSnapshot>> snapshots = new ArrayList<>(statistics.size());
final List<Thread> threadsToRemove = new ArrayList<>();
for (Map.Entry<Thread, OSessionStoragePerformanceStatistic> entry : statistics.entrySet()) {
final Thread thread = entry.getKey();
final OSessionStoragePerformanceStatistic statistic = entry.getValue();
snapshots.add(new ORawPair<>(thread, statistic.getSnapshot())); // depends on control dependency: [for], data = [none]
}
for (ORawPair<Thread, PerformanceSnapshot> pair : snapshots) {
final Thread thread = pair.getFirst();
if (thread.isAlive()) {
final PerformanceSnapshot snapshot = pair.getSecond();
final PerformanceCountersHolder holder = snapshot.countersByComponent.get(componentName);
if (holder != null)
holder.pushData(componentCountersHolder);
} else {
threadsToRemove.add(thread); // depends on control dependency: [if], data = [none]
}
}
if (!threadsToRemove.isEmpty()) {
updateDeadThreadsStatistic(threadsToRemove); // depends on control dependency: [if], data = [none]
}
final ImmutableStatistic ds = deadThreadsStatistic;
if (ds != null) {
final PerformanceCountersHolder dch = ds.countersByComponents.get(componentName);
if (dch != null) {
dch.pushData(componentCountersHolder); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public <T extends RoxPayload> List<T> load(Class<T> clazz) throws IOException {
List<T> payloads = new ArrayList<>();
for (File f : getTmpDir(clazz).listFiles()) {
if (f.isFile()) {
InputStreamReader isr = new InputStreamReader(
new FileInputStream(f),
Charset.forName(Constants.ENCODING).newDecoder()
);
payloads.add(serializer.deserializePayload(isr, clazz));
}
}
return payloads;
} } | public class class_name {
public <T extends RoxPayload> List<T> load(Class<T> clazz) throws IOException {
List<T> payloads = new ArrayList<>();
for (File f : getTmpDir(clazz).listFiles()) {
if (f.isFile()) {
InputStreamReader isr = new InputStreamReader(
new FileInputStream(f),
Charset.forName(Constants.ENCODING).newDecoder()
);
payloads.add(serializer.deserializePayload(isr, clazz)); // depends on control dependency: [if], data = [none]
}
}
return payloads;
} } |
public class class_name {
private DateTime getCachedOnset(final Date date) {
int index = Arrays.binarySearch(onsetsMillisec, date.getTime());
if (index >= 0) {
return onsetsDates[index];
} else {
int insertionIndex = -index - 1;
return onsetsDates[insertionIndex - 1];
}
} } | public class class_name {
private DateTime getCachedOnset(final Date date) {
int index = Arrays.binarySearch(onsetsMillisec, date.getTime());
if (index >= 0) {
return onsetsDates[index]; // depends on control dependency: [if], data = [none]
} else {
int insertionIndex = -index - 1;
return onsetsDates[insertionIndex - 1]; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Boolean hasIndex() {
Boolean hasIndex = false;
if (this.indexedFastaSequenceFile != null) {
hasIndex = this.indexedFastaSequenceFile.isIndexed();
}
return hasIndex;
} } | public class class_name {
public Boolean hasIndex() {
Boolean hasIndex = false;
if (this.indexedFastaSequenceFile != null) {
hasIndex = this.indexedFastaSequenceFile.isIndexed(); // depends on control dependency: [if], data = [none]
}
return hasIndex;
} } |
public class class_name {
@Override
public int transferTo(int index, WritableByteChannel channel) {
rangeCheck(index);
try {
long address = getAddress(index);
int segPos = _addressFormat.getOffset(address);
int segInd = _addressFormat.getSegment(address);
// no data found
if(segPos < Segment.dataStartPosition) return -1;
// get data segment
Segment seg = _segmentManager.getSegment(segInd);
if(seg == null) return -1;
// read data length
int size = _addressFormat.getDataSize(address);
int len = (size == 0) ? seg.readInt(segPos) : size;
// transfer data to a writable channel
if (len > 0) {
seg.transferTo(segPos + 4, len, channel);
}
return len;
} catch(Exception e) {
return -1;
}
} } | public class class_name {
@Override
public int transferTo(int index, WritableByteChannel channel) {
rangeCheck(index);
try {
long address = getAddress(index);
int segPos = _addressFormat.getOffset(address);
int segInd = _addressFormat.getSegment(address);
// no data found
if(segPos < Segment.dataStartPosition) return -1;
// get data segment
Segment seg = _segmentManager.getSegment(segInd);
if(seg == null) return -1;
// read data length
int size = _addressFormat.getDataSize(address);
int len = (size == 0) ? seg.readInt(segPos) : size;
// transfer data to a writable channel
if (len > 0) {
seg.transferTo(segPos + 4, len, channel); // depends on control dependency: [if], data = [none]
}
return len; // depends on control dependency: [try], data = [none]
} catch(Exception e) {
return -1;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public <T> HttpClientRequest.Builder<T> perform(final String methodName, final URI uri, final HttpClientResponseHandler<T> httpHandler) {
final HttpClientMethod method;
try {
method = HttpClientMethod.valueOf(methodName.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Unknown HTTP method type " + methodName, e);
}
return new HttpClientRequest.Builder<T>(httpClientFactory, method, uri, httpHandler);
} } | public class class_name {
public <T> HttpClientRequest.Builder<T> perform(final String methodName, final URI uri, final HttpClientResponseHandler<T> httpHandler) {
final HttpClientMethod method;
try {
method = HttpClientMethod.valueOf(methodName.toUpperCase(Locale.ENGLISH)); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Unknown HTTP method type " + methodName, e);
} // depends on control dependency: [catch], data = [none]
return new HttpClientRequest.Builder<T>(httpClientFactory, method, uri, httpHandler);
} } |
public class class_name {
public static ZMatrixRMaj hermitianPosDef(int width, Random rand) {
// This is not formally proven to work. It just seems to work.
ZMatrixRMaj a = RandomMatrices_ZDRM.rectangle(width,1,rand);
ZMatrixRMaj b = new ZMatrixRMaj(1,width);
ZMatrixRMaj c = new ZMatrixRMaj(width,width);
CommonOps_ZDRM.transposeConjugate(a,b);
CommonOps_ZDRM.mult(a, b, c);
for( int i = 0; i < width; i++ ) {
c.data[2*(i*width+i)] += 1;
}
return c;
} } | public class class_name {
public static ZMatrixRMaj hermitianPosDef(int width, Random rand) {
// This is not formally proven to work. It just seems to work.
ZMatrixRMaj a = RandomMatrices_ZDRM.rectangle(width,1,rand);
ZMatrixRMaj b = new ZMatrixRMaj(1,width);
ZMatrixRMaj c = new ZMatrixRMaj(width,width);
CommonOps_ZDRM.transposeConjugate(a,b);
CommonOps_ZDRM.mult(a, b, c);
for( int i = 0; i < width; i++ ) {
c.data[2*(i*width+i)] += 1; // depends on control dependency: [for], data = [i]
}
return c;
} } |
public class class_name {
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
protected Map<String, Object> setAuthorization(ServiceReference<AuthorizationService> ref) {
if (hasPropertiesFromFile(ref)) {
String id = (String) ref.getProperty(KEY_ID);
if (id != null) {
authorization.putReference(id, ref);
} else {
Tr.error(tc, "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID", KEY_AUTHORIZATION);
}
} else {
authorization.putReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref);
}
// determine a new authorization service
authzService.set(null);
return getServiceProperties();
} } | public class class_name {
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
protected Map<String, Object> setAuthorization(ServiceReference<AuthorizationService> ref) {
if (hasPropertiesFromFile(ref)) {
String id = (String) ref.getProperty(KEY_ID);
if (id != null) {
authorization.putReference(id, ref); // depends on control dependency: [if], data = [(id]
} else {
Tr.error(tc, "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID", KEY_AUTHORIZATION); // depends on control dependency: [if], data = [none]
}
} else {
authorization.putReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref); // depends on control dependency: [if], data = [none]
}
// determine a new authorization service
authzService.set(null);
return getServiceProperties();
} } |
public class class_name {
public static boolean keyMatch(String key1, String key2) {
int i = key2.indexOf('*');
if (i == -1) {
return key1.equals(key2);
}
if (key1.length() > i) {
return key1.substring(0, i).equals(key2.substring(0, i));
}
return key1.equals(key2.substring(0, i));
} } | public class class_name {
public static boolean keyMatch(String key1, String key2) {
int i = key2.indexOf('*');
if (i == -1) {
return key1.equals(key2); // depends on control dependency: [if], data = [none]
}
if (key1.length() > i) {
return key1.substring(0, i).equals(key2.substring(0, i)); // depends on control dependency: [if], data = [i)]
}
return key1.equals(key2.substring(0, i));
} } |
public class class_name {
public List<DependencyInfo> parseFileReader(String filePath, Reader reader) {
depInfos = new ArrayList<>();
if (logger.isLoggable(Level.FINE)) {
logger.fine("Parsing Dep: " + filePath);
}
doParse(filePath, reader);
return depInfos;
} } | public class class_name {
public List<DependencyInfo> parseFileReader(String filePath, Reader reader) {
depInfos = new ArrayList<>();
if (logger.isLoggable(Level.FINE)) {
logger.fine("Parsing Dep: " + filePath); // depends on control dependency: [if], data = [none]
}
doParse(filePath, reader);
return depInfos;
} } |
public class class_name {
private static Set<EquivalentAddressGroup> stripAttrs(List<EquivalentAddressGroup> groupList) {
Set<EquivalentAddressGroup> addrs = new HashSet<>(groupList.size());
for (EquivalentAddressGroup group : groupList) {
addrs.add(new EquivalentAddressGroup(group.getAddresses()));
}
return addrs;
} } | public class class_name {
private static Set<EquivalentAddressGroup> stripAttrs(List<EquivalentAddressGroup> groupList) {
Set<EquivalentAddressGroup> addrs = new HashSet<>(groupList.size());
for (EquivalentAddressGroup group : groupList) {
addrs.add(new EquivalentAddressGroup(group.getAddresses())); // depends on control dependency: [for], data = [group]
}
return addrs;
} } |
public class class_name {
public INodeHardLinkFile getHardLinkedFile(int i) {
if (i < this.linkedFiles.size()) {
return this.linkedFiles.get(i);
}
return null;
} } | public class class_name {
public INodeHardLinkFile getHardLinkedFile(int i) {
if (i < this.linkedFiles.size()) {
return this.linkedFiles.get(i); // depends on control dependency: [if], data = [(i]
}
return null;
} } |
public class class_name {
public void setStructureId(String structureId) {
try {
m_resourceBuilder.setStructureId(new CmsUUID(structureId));
m_hasStructureId = true;
} catch (Throwable e) {
setThrowable(e);
}
} } | public class class_name {
public void setStructureId(String structureId) {
try {
m_resourceBuilder.setStructureId(new CmsUUID(structureId)); // depends on control dependency: [try], data = [none]
m_hasStructureId = true; // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
setThrowable(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void restart() {
if (frames.size() == 0) {
return;
}
stopped = false;
currentFrame = 0;
nextChange = (int) (((Frame) frames.get(0)).duration / speed);
firstUpdate = true;
lastUpdate = 0;
} } | public class class_name {
public void restart() {
if (frames.size() == 0) {
return;
// depends on control dependency: [if], data = [none]
}
stopped = false;
currentFrame = 0;
nextChange = (int) (((Frame) frames.get(0)).duration / speed);
firstUpdate = true;
lastUpdate = 0;
} } |
public class class_name {
public double factorOf(TimeUnit unit) {
if (unit == TimeUnit.NanoSeconds) {
return 1.0;
} else if (unit == TimeUnit.MicroSeconds) {
return 1.0e-3;
} else if (unit == TimeUnit.MilliSeconds) {
return 1.0e-6;
} else if (unit == TimeUnit.Seconds) {
return 1.0e-9;
} else if (unit == TimeUnit.Minutes) {
return 1.0e-9 / 60;
} else if (unit == TimeUnit.Hours) {
return 1.0e-9 / 3600;
}
return Double.NaN;
} } | public class class_name {
public double factorOf(TimeUnit unit) {
if (unit == TimeUnit.NanoSeconds) {
return 1.0; // depends on control dependency: [if], data = [none]
} else if (unit == TimeUnit.MicroSeconds) {
return 1.0e-3; // depends on control dependency: [if], data = [none]
} else if (unit == TimeUnit.MilliSeconds) {
return 1.0e-6; // depends on control dependency: [if], data = [none]
} else if (unit == TimeUnit.Seconds) {
return 1.0e-9; // depends on control dependency: [if], data = [none]
} else if (unit == TimeUnit.Minutes) {
return 1.0e-9 / 60; // depends on control dependency: [if], data = [none]
} else if (unit == TimeUnit.Hours) {
return 1.0e-9 / 3600; // depends on control dependency: [if], data = [none]
}
return Double.NaN;
} } |
public class class_name {
public static Document readXML(InputSource source) {
final DocumentBuilder builder = createDocumentBuilder();
try {
return builder.parse(source);
} catch (Exception e) {
throw new UtilException(e, "Parse XML from stream error!");
}
} } | public class class_name {
public static Document readXML(InputSource source) {
final DocumentBuilder builder = createDocumentBuilder();
try {
return builder.parse(source);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new UtilException(e, "Parse XML from stream error!");
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Client createInstance(Config srcConfig) {
Config config = srcConfig.withFallback(FALLBACK);
switch (schema) {
case HTTP:
return createHttpClient(config);
case D2:
String confPrefix = schema.name().toLowerCase();
if (config.hasPath(confPrefix)) {
Config d2Config = config.getConfig(confPrefix);
return createD2Client(d2Config);
} else {
throw new ConfigException.Missing(confPrefix);
}
default:
throw new RuntimeException("Schema not supported: " + schema.name());
}
} } | public class class_name {
public Client createInstance(Config srcConfig) {
Config config = srcConfig.withFallback(FALLBACK);
switch (schema) {
case HTTP:
return createHttpClient(config);
case D2:
String confPrefix = schema.name().toLowerCase();
if (config.hasPath(confPrefix)) {
Config d2Config = config.getConfig(confPrefix);
return createD2Client(d2Config); // depends on control dependency: [if], data = [none]
} else {
throw new ConfigException.Missing(confPrefix);
}
default:
throw new RuntimeException("Schema not supported: " + schema.name());
}
} } |
public class class_name {
protected Label newItemLinkLabel(final String id, final LinkItem model)
{
final Label itemLinkLabel = ComponentFactory.newLabel(id,
ResourceModelFactory.newResourceModel(model.getResourceModelKey(), this));
// add css class to current page.
if ((model.getPageClass() != null) && model.getPageClass().equals(getPage().getClass()))
{
itemLinkLabel.add(new AttributeAppender("class", " " + getCurrentPageCssClass()));
}
return itemLinkLabel;
} } | public class class_name {
protected Label newItemLinkLabel(final String id, final LinkItem model)
{
final Label itemLinkLabel = ComponentFactory.newLabel(id,
ResourceModelFactory.newResourceModel(model.getResourceModelKey(), this));
// add css class to current page.
if ((model.getPageClass() != null) && model.getPageClass().equals(getPage().getClass()))
{
itemLinkLabel.add(new AttributeAppender("class", " " + getCurrentPageCssClass())); // depends on control dependency: [if], data = [none]
}
return itemLinkLabel;
} } |
public class class_name {
public void marshall(Scte20PlusEmbeddedDestinationSettings scte20PlusEmbeddedDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (scte20PlusEmbeddedDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Scte20PlusEmbeddedDestinationSettings scte20PlusEmbeddedDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (scte20PlusEmbeddedDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} 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 marshall(BurninDestinationSettings burninDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (burninDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(burninDestinationSettings.getAlignment(), ALIGNMENT_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getBackgroundColor(), BACKGROUNDCOLOR_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getBackgroundOpacity(), BACKGROUNDOPACITY_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontColor(), FONTCOLOR_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontOpacity(), FONTOPACITY_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontResolution(), FONTRESOLUTION_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontScript(), FONTSCRIPT_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontSize(), FONTSIZE_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getOutlineColor(), OUTLINECOLOR_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getOutlineSize(), OUTLINESIZE_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getShadowColor(), SHADOWCOLOR_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getShadowOpacity(), SHADOWOPACITY_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getShadowXOffset(), SHADOWXOFFSET_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getShadowYOffset(), SHADOWYOFFSET_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getTeletextSpacing(), TELETEXTSPACING_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getXPosition(), XPOSITION_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getYPosition(), YPOSITION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BurninDestinationSettings burninDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (burninDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(burninDestinationSettings.getAlignment(), ALIGNMENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getBackgroundColor(), BACKGROUNDCOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getBackgroundOpacity(), BACKGROUNDOPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getFontColor(), FONTCOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getFontOpacity(), FONTOPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getFontResolution(), FONTRESOLUTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getFontScript(), FONTSCRIPT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getFontSize(), FONTSIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getOutlineColor(), OUTLINECOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getOutlineSize(), OUTLINESIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getShadowColor(), SHADOWCOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getShadowOpacity(), SHADOWOPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getShadowXOffset(), SHADOWXOFFSET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getShadowYOffset(), SHADOWYOFFSET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getTeletextSpacing(), TELETEXTSPACING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getXPosition(), XPOSITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burninDestinationSettings.getYPosition(), YPOSITION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String getPrefix()
{
final String prefix;
if (loader.isPresent())
{
prefix = loader.get().getPackage().getName().replace(Constant.DOT, File.separator);
}
else
{
prefix = resourcesDir;
}
return prefix;
} } | public class class_name {
private String getPrefix()
{
final String prefix;
if (loader.isPresent())
{
prefix = loader.get().getPackage().getName().replace(Constant.DOT, File.separator);
// depends on control dependency: [if], data = [none]
}
else
{
prefix = resourcesDir;
// depends on control dependency: [if], data = [none]
}
return prefix;
} } |
public class class_name {
@Override
public void start() {
initLogger();
final String resourceName = StringUtil.replaceChar(JoyPaths.class.getName(), '.', '/') + ".class";
URL url = ClassLoaderUtil.getResourceUrl(resourceName);
if (url == null) {
throw new JoyException("Failed to resolve app dir, missing: " + resourceName);
}
final String protocol = url.getProtocol();
if (!protocol.equals("file")) {
try {
url = new URL(url.getFile());
} catch (MalformedURLException ignore) {
}
}
appDir = url.getFile();
final int ndx = appDir.indexOf("WEB-INF");
appDir = (ndx > 0) ? appDir.substring(0, ndx) : SystemUtil.info().getWorkingDir();
System.setProperty(APP_DIR, appDir);
log.info("Application folder: " + appDir);
} } | public class class_name {
@Override
public void start() {
initLogger();
final String resourceName = StringUtil.replaceChar(JoyPaths.class.getName(), '.', '/') + ".class";
URL url = ClassLoaderUtil.getResourceUrl(resourceName);
if (url == null) {
throw new JoyException("Failed to resolve app dir, missing: " + resourceName);
}
final String protocol = url.getProtocol();
if (!protocol.equals("file")) {
try {
url = new URL(url.getFile()); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException ignore) {
} // depends on control dependency: [catch], data = [none]
}
appDir = url.getFile();
final int ndx = appDir.indexOf("WEB-INF");
appDir = (ndx > 0) ? appDir.substring(0, ndx) : SystemUtil.info().getWorkingDir();
System.setProperty(APP_DIR, appDir);
log.info("Application folder: " + appDir);
} } |
public class class_name {
public boolean setMainKey(boolean bDisplayOption, Boolean boolSetModified, boolean bSetIfModified)
{
super.setMainKey(bDisplayOption, boolSetModified, bSetIfModified);
boolean bNonNulls = false; // Default to yes, all keys are null.
if (m_fldMainFile != null)
if ((m_bSetFilterIfNull) || (!m_fldMainFile.isNull()))
{
if ((bSetIfModified) || (!m_fldThisFile.isModified()) || (m_fldThisFile.isNull()))
m_fldThisFile.moveFieldToThis(m_fldMainFile, bDisplayOption, DBConstants.READ_MOVE);
if (boolSetModified != null)
m_fldThisFile.setModified(boolSetModified.booleanValue());
if (!m_fldThisFile.isNull())
bNonNulls = true; // Non null.
}
if (m_fldMainFile2 != null)
if ((m_bSetFilterIfNull) || (!m_fldMainFile2.isNull()))
{
if ((bSetIfModified) || (!m_fldThisFile2.isModified()) || (m_fldThisFile2.isNull()))
m_fldThisFile2.moveFieldToThis(m_fldMainFile2, bDisplayOption, DBConstants.READ_MOVE);
if (boolSetModified != null)
m_fldThisFile2.setModified(boolSetModified.booleanValue());
if (!m_fldThisFile2.isNull())
bNonNulls = true; // Non null.
}
if (m_fldMainFile3 != null)
if ((m_bSetFilterIfNull) || (!m_fldMainFile3.isNull()))
{
if ((bSetIfModified) || (!m_fldThisFile3.isModified()) || (m_fldThisFile3.isNull()))
m_fldThisFile3.moveFieldToThis(m_fldMainFile3, bDisplayOption, DBConstants.READ_MOVE);
if (boolSetModified != null)
m_fldThisFile3.setModified(boolSetModified.booleanValue());
if (!m_fldThisFile3.isNull())
bNonNulls = true; // Non null.
}
if (m_recordMain != null)
{
ReferenceField fieldThisRecord = this.getOwner().getReferenceField(m_recordMain);
if (m_bRefreshLastIfNotCurrent)
if (m_recordMain.getEditMode() == DBConstants.EDIT_NONE)
{ // If there is not a current record refresh the last record.
try {
Object bookmark = m_recordMain.getLastModified(DBConstants.DATA_SOURCE_HANDLE);
if (bookmark != null)
m_recordMain.setHandle(bookmark, DBConstants.DATA_SOURCE_HANDLE);
} catch (DBException ex) {
ex.printStackTrace();
}
}
if ((m_bSetFilterIfNull) || (!m_recordMain.getCounterField().isNull()))
{
if ((bSetIfModified) || (!fieldThisRecord.isModified()) || (fieldThisRecord.isNull()))
fieldThisRecord.setReference(m_recordMain, bDisplayOption, DBConstants.READ_MOVE); // Set the booking number in pax file
if (boolSetModified != null)
fieldThisRecord.setModified(boolSetModified.booleanValue());
}
if (!fieldThisRecord.isNull())
bNonNulls = true; // Non null.
}
return bNonNulls;
} } | public class class_name {
public boolean setMainKey(boolean bDisplayOption, Boolean boolSetModified, boolean bSetIfModified)
{
super.setMainKey(bDisplayOption, boolSetModified, bSetIfModified);
boolean bNonNulls = false; // Default to yes, all keys are null.
if (m_fldMainFile != null)
if ((m_bSetFilterIfNull) || (!m_fldMainFile.isNull()))
{
if ((bSetIfModified) || (!m_fldThisFile.isModified()) || (m_fldThisFile.isNull()))
m_fldThisFile.moveFieldToThis(m_fldMainFile, bDisplayOption, DBConstants.READ_MOVE);
if (boolSetModified != null)
m_fldThisFile.setModified(boolSetModified.booleanValue());
if (!m_fldThisFile.isNull())
bNonNulls = true; // Non null.
}
if (m_fldMainFile2 != null)
if ((m_bSetFilterIfNull) || (!m_fldMainFile2.isNull()))
{
if ((bSetIfModified) || (!m_fldThisFile2.isModified()) || (m_fldThisFile2.isNull()))
m_fldThisFile2.moveFieldToThis(m_fldMainFile2, bDisplayOption, DBConstants.READ_MOVE);
if (boolSetModified != null)
m_fldThisFile2.setModified(boolSetModified.booleanValue());
if (!m_fldThisFile2.isNull())
bNonNulls = true; // Non null.
}
if (m_fldMainFile3 != null)
if ((m_bSetFilterIfNull) || (!m_fldMainFile3.isNull()))
{
if ((bSetIfModified) || (!m_fldThisFile3.isModified()) || (m_fldThisFile3.isNull()))
m_fldThisFile3.moveFieldToThis(m_fldMainFile3, bDisplayOption, DBConstants.READ_MOVE);
if (boolSetModified != null)
m_fldThisFile3.setModified(boolSetModified.booleanValue());
if (!m_fldThisFile3.isNull())
bNonNulls = true; // Non null.
}
if (m_recordMain != null)
{
ReferenceField fieldThisRecord = this.getOwner().getReferenceField(m_recordMain);
if (m_bRefreshLastIfNotCurrent)
if (m_recordMain.getEditMode() == DBConstants.EDIT_NONE)
{ // If there is not a current record refresh the last record.
try {
Object bookmark = m_recordMain.getLastModified(DBConstants.DATA_SOURCE_HANDLE);
if (bookmark != null)
m_recordMain.setHandle(bookmark, DBConstants.DATA_SOURCE_HANDLE);
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
if ((m_bSetFilterIfNull) || (!m_recordMain.getCounterField().isNull()))
{
if ((bSetIfModified) || (!fieldThisRecord.isModified()) || (fieldThisRecord.isNull()))
fieldThisRecord.setReference(m_recordMain, bDisplayOption, DBConstants.READ_MOVE); // Set the booking number in pax file
if (boolSetModified != null)
fieldThisRecord.setModified(boolSetModified.booleanValue());
}
if (!fieldThisRecord.isNull())
bNonNulls = true; // Non null.
}
return bNonNulls;
} } |
public class class_name {
public void marshall(UserMetadata userMetadata, ProtocolMarshaller protocolMarshaller) {
if (userMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userMetadata.getId(), ID_BINDING);
protocolMarshaller.marshall(userMetadata.getUsername(), USERNAME_BINDING);
protocolMarshaller.marshall(userMetadata.getGivenName(), GIVENNAME_BINDING);
protocolMarshaller.marshall(userMetadata.getSurname(), SURNAME_BINDING);
protocolMarshaller.marshall(userMetadata.getEmailAddress(), EMAILADDRESS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UserMetadata userMetadata, ProtocolMarshaller protocolMarshaller) {
if (userMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userMetadata.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userMetadata.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userMetadata.getGivenName(), GIVENNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userMetadata.getSurname(), SURNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userMetadata.getEmailAddress(), EMAILADDRESS_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 Chat chatWith(EntityBareJid jid) {
Chat chat = chats.get(jid);
if (chat == null) {
synchronized (chats) {
// Double-checked locking.
chat = chats.get(jid);
if (chat != null) {
return chat;
}
chat = new Chat(connection(), jid);
chats.put(jid, chat);
}
}
return chat;
} } | public class class_name {
public Chat chatWith(EntityBareJid jid) {
Chat chat = chats.get(jid);
if (chat == null) {
synchronized (chats) { // depends on control dependency: [if], data = [(chat]
// Double-checked locking.
chat = chats.get(jid);
if (chat != null) {
return chat; // depends on control dependency: [if], data = [none]
}
chat = new Chat(connection(), jid);
chats.put(jid, chat);
}
}
return chat;
} } |
public class class_name {
@Override
public INodeDesc getNodeDesc() {
if (null==nodedesc) {
nodedesc = NodeEntryImpl.create(getFrameworkNodeHostname(), getFrameworkNodeName());
}
return nodedesc;
} } | public class class_name {
@Override
public INodeDesc getNodeDesc() {
if (null==nodedesc) {
nodedesc = NodeEntryImpl.create(getFrameworkNodeHostname(), getFrameworkNodeName()); // depends on control dependency: [if], data = [none]
}
return nodedesc;
} } |
public class class_name {
public void setWebApplicationConfigurationClassNames (String[] configurationClassNames)
{
if (configurationClassNames != null)
{
_webAppConfigurationClassNames = new String[configurationClassNames.length];
System.arraycopy(configurationClassNames, 0, _webAppConfigurationClassNames, 0, configurationClassNames.length);
}
} } | public class class_name {
public void setWebApplicationConfigurationClassNames (String[] configurationClassNames)
{
if (configurationClassNames != null)
{
_webAppConfigurationClassNames = new String[configurationClassNames.length]; // depends on control dependency: [if], data = [none]
System.arraycopy(configurationClassNames, 0, _webAppConfigurationClassNames, 0, configurationClassNames.length); // depends on control dependency: [if], data = [(configurationClassNames]
}
} } |
public class class_name {
@Override
public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) {
if (input == null || labels == null)
throw new IllegalStateException("Cannot calculate score without input and labels " + layerId());
INDArray preOut = preOutput2d(false, workspaceMgr);
ILossFunction lossFunction = layerConf().getLossFn();
INDArray scoreArray =
lossFunction.computeScoreArray(getLabels2d(workspaceMgr, ArrayType.FF_WORKING_MEM),
preOut, layerConf().getActivationFn(), maskArray);
if (fullNetRegTerm != 0.0) {
scoreArray.addi(fullNetRegTerm);
}
return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, scoreArray);
} } | public class class_name {
@Override
public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) {
if (input == null || labels == null)
throw new IllegalStateException("Cannot calculate score without input and labels " + layerId());
INDArray preOut = preOutput2d(false, workspaceMgr);
ILossFunction lossFunction = layerConf().getLossFn();
INDArray scoreArray =
lossFunction.computeScoreArray(getLabels2d(workspaceMgr, ArrayType.FF_WORKING_MEM),
preOut, layerConf().getActivationFn(), maskArray);
if (fullNetRegTerm != 0.0) {
scoreArray.addi(fullNetRegTerm); // depends on control dependency: [if], data = [(fullNetRegTerm]
}
return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, scoreArray);
} } |
public class class_name {
private static void setupStormCode(Map conf, String topologyId, String topologyRoot, Set<String> activeKeys)
throws Exception {
Map<String, String> blobKeysToLocation = getBlobKeysToLocation(topologyRoot, topologyId);
for (Map.Entry<String, String> entry : blobKeysToLocation.entrySet()) {
String key = entry.getKey();
String location = entry.getValue();
if (!activeKeys.contains(key)) {
blobStore.createBlob(key, new FileInputStream(location), new SettableBlobMeta());
if (isLocalBlobStore) {
int versionInfo = BlobStoreUtils.getVersionForKey(key, nimbusInfo, conf);
clusterState.setup_blobstore(key, nimbusInfo, versionInfo);
}
}
}
System.out.println("Successfully create blobstore for topology " + topologyId);
} } | public class class_name {
private static void setupStormCode(Map conf, String topologyId, String topologyRoot, Set<String> activeKeys)
throws Exception {
Map<String, String> blobKeysToLocation = getBlobKeysToLocation(topologyRoot, topologyId);
for (Map.Entry<String, String> entry : blobKeysToLocation.entrySet()) {
String key = entry.getKey();
String location = entry.getValue();
if (!activeKeys.contains(key)) {
blobStore.createBlob(key, new FileInputStream(location), new SettableBlobMeta());
if (isLocalBlobStore) {
int versionInfo = BlobStoreUtils.getVersionForKey(key, nimbusInfo, conf);
clusterState.setup_blobstore(key, nimbusInfo, versionInfo); // depends on control dependency: [if], data = [none]
}
}
}
System.out.println("Successfully create blobstore for topology " + topologyId);
} } |
public class class_name {
private void getRead() {
// Execute on background thread as we don't know how large this is
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
int size = mPrefs.getInt("READ_ARRAY_SIZE", 0);
boolean value;
if(size < 1)
return null;
for(int i = 0, key; i < size; i++) {
key = mPrefs.getInt("READ_ARRAY_KEY_" + i, 0);
value = mPrefs.getBoolean("READ_ARRAY_VALUE_" + i, false);
readList.put(key, value);
}
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} } | public class class_name {
private void getRead() {
// Execute on background thread as we don't know how large this is
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
int size = mPrefs.getInt("READ_ARRAY_SIZE", 0);
boolean value;
if(size < 1)
return null;
for(int i = 0, key; i < size; i++) {
key = mPrefs.getInt("READ_ARRAY_KEY_" + i, 0); // depends on control dependency: [for], data = [i]
value = mPrefs.getBoolean("READ_ARRAY_VALUE_" + i, false); // depends on control dependency: [for], data = [i]
readList.put(key, value); // depends on control dependency: [for], data = [none]
}
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} } |
public class class_name {
public void getSet(int which , FastQueue<Point2D_I32> list ) {
list.reset();
BlockIndexLength set = sets.get(which);
for (int i = 0; i < set.length; i++) {
int index = set.start + i*2;
int blockIndex = set.block + index/blockLength;
index %= blockLength;
int block[] = blocks.get( blockIndex );
list.grow().set( block[index] , block[index+1] );
}
} } | public class class_name {
public void getSet(int which , FastQueue<Point2D_I32> list ) {
list.reset();
BlockIndexLength set = sets.get(which);
for (int i = 0; i < set.length; i++) {
int index = set.start + i*2;
int blockIndex = set.block + index/blockLength;
index %= blockLength; // depends on control dependency: [for], data = [none]
int block[] = blocks.get( blockIndex );
list.grow().set( block[index] , block[index+1] ); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
protected void replaceDataVars(StructureMembers sm) {
for (StructureMembers.Member m : sm.getMembers()) {
VariableSimpleIF org = this.cols.get(m.getName());
int rank = org.getRank();
List<Dimension> orgDims = org.getDimensions();
// only keep the last n
int n = m.getShape().length;
List<Dimension> dims = orgDims.subList(rank-n, rank);
VariableSimpleImpl result = new VariableSimpleImpl(org.getShortName(), org.getDescription(), org.getUnitsString(), org.getDataType(), dims);
for (Attribute att : org.getAttributes()) result.add(att);
this.cols.put(m.getName(), result);
}
} } | public class class_name {
protected void replaceDataVars(StructureMembers sm) {
for (StructureMembers.Member m : sm.getMembers()) {
VariableSimpleIF org = this.cols.get(m.getName());
int rank = org.getRank();
List<Dimension> orgDims = org.getDimensions();
// only keep the last n
int n = m.getShape().length;
List<Dimension> dims = orgDims.subList(rank-n, rank);
VariableSimpleImpl result = new VariableSimpleImpl(org.getShortName(), org.getDescription(), org.getUnitsString(), org.getDataType(), dims);
for (Attribute att : org.getAttributes()) result.add(att);
this.cols.put(m.getName(), result);
// depends on control dependency: [for], data = [m]
}
} } |
public class class_name {
public void addWindow(View view, String name) {
mWindowsLock.writeLock().lock();
try {
mWindows.put(view.getRootView(), name);
} finally {
mWindowsLock.writeLock().unlock();
}
fireWindowsChangedEvent();
} } | public class class_name {
public void addWindow(View view, String name) {
mWindowsLock.writeLock().lock();
try {
mWindows.put(view.getRootView(), name); // depends on control dependency: [try], data = [none]
} finally {
mWindowsLock.writeLock().unlock();
}
fireWindowsChangedEvent();
} } |
public class class_name {
private void adaptDividerColor() {
adaptDividerColor(topDivider);
adaptDividerColor(bottomDivider);
if (dividers != null) {
for (Divider divider : dividers.values()) {
adaptDividerColor(divider);
}
}
} } | public class class_name {
private void adaptDividerColor() {
adaptDividerColor(topDivider);
adaptDividerColor(bottomDivider);
if (dividers != null) {
for (Divider divider : dividers.values()) {
adaptDividerColor(divider); // depends on control dependency: [for], data = [divider]
}
}
} } |
public class class_name {
private Optional<String> getContentLocation(String urlStr, SerializationFormat format, ArrayList<String> redirects){
if(urlStr == null || urlStr.isEmpty() || redirects.contains(urlStr.trim()))
return Optional.empty();
redirects.add(urlStr.trim());
try {
URL url = new URL(urlStr);
// get the response
HttpResponse conn = TrustingUrlConnection.executeHeadRequest(url.toURI(), format);
// extract ContentType
Header cth = conn.getFirstHeader("Content-Type");
// only use the most prevalent
String ct = cth != null ? cth.getValue().split("([,;])")[0] : null;
// translate ContentType into MimeType
Set<SerializationFormat> ctf = findFormatByMimeType(ct);
StatusLine status = conn.getStatusLine();
//fill in all intermediate redirects
Stream.of(conn.getHeaders(TrustingUrlConnection.HEADERKEY)).forEach(x -> redirects.add(x.getValue().trim()));
String lastRedirect = redirects.get(redirects.size()-1);
// deal with errors
if(status.getStatusCode() >= 400){
String resp = status.getReasonPhrase();
if(redirects.size() <= 1)
log.error("Error while retrieving " + urlStr + " :" + status.getStatusCode() + " " + resp);
return Optional.empty();
}
// if we have a ContentType
if(ct != null){
// if the ContentType == HTML
if(ct.contains("html")) {
return tryToFindHtmlAlternative(format, redirects, url, conn, lastRedirect);
}
// if the ContentType is a well known RDF serialization
else if(! ctf.isEmpty()){
Optional<String> zw = getContentVersions(lastRedirect, ctf, redirects);
if (zw.isPresent())
return zw;
}
}
//default if nothing was found we return the origin and hope for the best :)
return Optional.of(lastRedirect);
} catch (IOException | URISyntaxException e) {
log.debug("Error while retrieving " + urlStr, e);
return Optional.empty();
}
} } | public class class_name {
private Optional<String> getContentLocation(String urlStr, SerializationFormat format, ArrayList<String> redirects){
if(urlStr == null || urlStr.isEmpty() || redirects.contains(urlStr.trim()))
return Optional.empty();
redirects.add(urlStr.trim());
try {
URL url = new URL(urlStr);
// get the response
HttpResponse conn = TrustingUrlConnection.executeHeadRequest(url.toURI(), format);
// extract ContentType
Header cth = conn.getFirstHeader("Content-Type");
// only use the most prevalent
String ct = cth != null ? cth.getValue().split("([,;])")[0] : null;
// translate ContentType into MimeType
Set<SerializationFormat> ctf = findFormatByMimeType(ct);
StatusLine status = conn.getStatusLine();
//fill in all intermediate redirects
Stream.of(conn.getHeaders(TrustingUrlConnection.HEADERKEY)).forEach(x -> redirects.add(x.getValue().trim())); // depends on control dependency: [try], data = [none]
String lastRedirect = redirects.get(redirects.size()-1);
// deal with errors
if(status.getStatusCode() >= 400){
String resp = status.getReasonPhrase();
if(redirects.size() <= 1)
log.error("Error while retrieving " + urlStr + " :" + status.getStatusCode() + " " + resp);
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
// if we have a ContentType
if(ct != null){
// if the ContentType == HTML
if(ct.contains("html")) {
return tryToFindHtmlAlternative(format, redirects, url, conn, lastRedirect); // depends on control dependency: [if], data = [none]
}
// if the ContentType is a well known RDF serialization
else if(! ctf.isEmpty()){
Optional<String> zw = getContentVersions(lastRedirect, ctf, redirects);
if (zw.isPresent())
return zw;
}
}
//default if nothing was found we return the origin and hope for the best :)
return Optional.of(lastRedirect); // depends on control dependency: [try], data = [none]
} catch (IOException | URISyntaxException e) {
log.debug("Error while retrieving " + urlStr, e);
return Optional.empty();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public RoleSet getRolesForAccessId(String appName, String accessId) {
if (!populated) {
return null;
}
if (getApplicationName().equals(appName)) {
return rolesForAccessId(accessId);
} else {
return null;
}
} } | public class class_name {
@Override
public RoleSet getRolesForAccessId(String appName, String accessId) {
if (!populated) {
return null; // depends on control dependency: [if], data = [none]
}
if (getApplicationName().equals(appName)) {
return rolesForAccessId(accessId); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean runInThread(Runnable runnable) {
if (runnable == null) {
return false;
}
if (m_isShutdown) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_THREAD_POOL_UNAVAILABLE_0));
return false;
}
boolean hasNextRunnable;
synchronized (m_nextRunnableLock) {
// must synchronize here to avoid potential double checked locking
hasNextRunnable = (m_nextRunnable != null);
}
if (hasNextRunnable || (m_currentThreadCount == 0)) {
// try to grow the thread pool since other runnables are already waiting
growThreadPool();
}
synchronized (m_nextRunnableLock) {
// wait until a worker thread has taken the previous Runnable
// or until the thread pool is asked to shutdown
while ((m_nextRunnable != null) && !m_isShutdown) {
try {
m_nextRunnableLock.wait(1000);
} catch (InterruptedException e) {
// can be ignores
}
}
// during normal operation, not shutdown, set the nextRunnable
// and notify the worker threads waiting (getNextRunnable())
if (!m_isShutdown) {
m_nextRunnable = runnable;
m_nextRunnableLock.notifyAll();
}
}
// if the thread pool is going down, execute the Runnable
// within a new additional worker thread (no thread from the pool)
// note: the synchronized section should be as short (time) as
// possible as starting a new thread is not a quick action
if (m_isShutdown) {
CmsSchedulerThread thread = new CmsSchedulerThread(
this,
m_threadGroup,
m_threadNamePrefix + "(final)",
m_threadPriority,
false,
runnable);
thread.start();
}
return true;
} } | public class class_name {
public boolean runInThread(Runnable runnable) {
if (runnable == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (m_isShutdown) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_THREAD_POOL_UNAVAILABLE_0)); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
boolean hasNextRunnable;
synchronized (m_nextRunnableLock) {
// must synchronize here to avoid potential double checked locking
hasNextRunnable = (m_nextRunnable != null);
}
if (hasNextRunnable || (m_currentThreadCount == 0)) {
// try to grow the thread pool since other runnables are already waiting
growThreadPool(); // depends on control dependency: [if], data = [none]
}
synchronized (m_nextRunnableLock) {
// wait until a worker thread has taken the previous Runnable
// or until the thread pool is asked to shutdown
while ((m_nextRunnable != null) && !m_isShutdown) {
try {
m_nextRunnableLock.wait(1000); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
// can be ignores
} // depends on control dependency: [catch], data = [none]
}
// during normal operation, not shutdown, set the nextRunnable
// and notify the worker threads waiting (getNextRunnable())
if (!m_isShutdown) {
m_nextRunnable = runnable; // depends on control dependency: [if], data = [none]
m_nextRunnableLock.notifyAll(); // depends on control dependency: [if], data = [none]
}
}
// if the thread pool is going down, execute the Runnable
// within a new additional worker thread (no thread from the pool)
// note: the synchronized section should be as short (time) as
// possible as starting a new thread is not a quick action
if (m_isShutdown) {
CmsSchedulerThread thread = new CmsSchedulerThread(
this,
m_threadGroup,
m_threadNamePrefix + "(final)",
m_threadPriority,
false,
runnable);
thread.start(); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public static void ensureServiceAccessIsAllowed(final String service, final RegisteredService registeredService) {
if (registeredService == null) {
val msg = String.format("Unauthorized Service Access. Service [%s] is not found in service registry.", service);
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
val msg = String.format("Unauthorized Service Access. Service [%s] is not enabled in service registry.", service);
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!ensureServiceIsNotExpired(registeredService)) {
val msg = String.format("Expired Service Access. Service [%s] has been expired", service);
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_EXPIRED_SERVICE, msg);
}
} } | public class class_name {
public static void ensureServiceAccessIsAllowed(final String service, final RegisteredService registeredService) {
if (registeredService == null) {
val msg = String.format("Unauthorized Service Access. Service [%s] is not found in service registry.", service);
LOGGER.warn(msg); // depends on control dependency: [if], data = [none]
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
val msg = String.format("Unauthorized Service Access. Service [%s] is not enabled in service registry.", service);
LOGGER.warn(msg); // depends on control dependency: [if], data = [none]
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!ensureServiceIsNotExpired(registeredService)) {
val msg = String.format("Expired Service Access. Service [%s] has been expired", service);
LOGGER.warn(msg); // depends on control dependency: [if], data = [none]
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_EXPIRED_SERVICE, msg);
}
} } |
public class class_name {
public final void characters(char chars[], int start, int length)
throws org.xml.sax.SAXException
{
if (m_elemContext.m_isRaw)
{
try
{
// Clean up some pending issues.
if (m_elemContext.m_startTagOpen)
{
closeStartTag();
m_elemContext.m_startTagOpen = false;
}
m_ispreserve = true;
writeNormalizedChars(chars, start, length, false, m_lineSepUse);
// time to generate characters event
if (m_tracer != null)
super.fireCharEvent(chars, start, length);
return;
}
catch (IOException ioe)
{
throw new org.xml.sax.SAXException(
Utils.messages.createMessage(MsgKey.ER_OIERROR,null),ioe);
}
}
else
{
super.characters(chars, start, length);
}
} } | public class class_name {
public final void characters(char chars[], int start, int length)
throws org.xml.sax.SAXException
{
if (m_elemContext.m_isRaw)
{
try
{
// Clean up some pending issues.
if (m_elemContext.m_startTagOpen)
{
closeStartTag(); // depends on control dependency: [if], data = [none]
m_elemContext.m_startTagOpen = false; // depends on control dependency: [if], data = [none]
}
m_ispreserve = true; // depends on control dependency: [try], data = [none]
writeNormalizedChars(chars, start, length, false, m_lineSepUse); // depends on control dependency: [try], data = [none]
// time to generate characters event
if (m_tracer != null)
super.fireCharEvent(chars, start, length);
return; // depends on control dependency: [try], data = [none]
}
catch (IOException ioe)
{
throw new org.xml.sax.SAXException(
Utils.messages.createMessage(MsgKey.ER_OIERROR,null),ioe);
} // depends on control dependency: [catch], data = [none]
}
else
{
super.characters(chars, start, length);
}
} } |
public class class_name {
public FormDataParser createParser(final HttpServerExchange exchange) {
FormDataParser existing = exchange.getAttachment(ATTACHMENT_KEY);
if(existing != null) {
return existing;
}
for (int i = 0; i < parserDefinitions.length; ++i) {
FormDataParser parser = parserDefinitions[i].create(exchange);
if (parser != null) {
exchange.putAttachment(ATTACHMENT_KEY, parser);
return parser;
}
}
return null;
} } | public class class_name {
public FormDataParser createParser(final HttpServerExchange exchange) {
FormDataParser existing = exchange.getAttachment(ATTACHMENT_KEY);
if(existing != null) {
return existing; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < parserDefinitions.length; ++i) {
FormDataParser parser = parserDefinitions[i].create(exchange);
if (parser != null) {
exchange.putAttachment(ATTACHMENT_KEY, parser); // depends on control dependency: [if], data = [none]
return parser; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private static void enlargeTables(float[][] data, int[][] rowIndex, int cols, int currentRow, int currentCol) {
while (data[currentRow].length < currentCol + cols) {
if(data[currentRow].length == SPARSE_MATRIX_DIM) {
currentCol = 0;
cols -= (data[currentRow].length - currentCol);
currentRow++;
data[currentRow] = malloc4f(ALLOCATED_ARRAY_LEN);
rowIndex[currentRow] = malloc4(ALLOCATED_ARRAY_LEN);
} else {
int newLen = (int) Math.min((long) data[currentRow].length << 1L, (long) SPARSE_MATRIX_DIM);
data[currentRow] = Arrays.copyOf(data[currentRow], newLen);
rowIndex[currentRow] = Arrays.copyOf(rowIndex[currentRow], newLen);
}
}
} } | public class class_name {
private static void enlargeTables(float[][] data, int[][] rowIndex, int cols, int currentRow, int currentCol) {
while (data[currentRow].length < currentCol + cols) {
if(data[currentRow].length == SPARSE_MATRIX_DIM) {
currentCol = 0; // depends on control dependency: [if], data = [none]
cols -= (data[currentRow].length - currentCol); // depends on control dependency: [if], data = [(data[currentRow].length]
currentRow++; // depends on control dependency: [if], data = [none]
data[currentRow] = malloc4f(ALLOCATED_ARRAY_LEN); // depends on control dependency: [if], data = [none]
rowIndex[currentRow] = malloc4(ALLOCATED_ARRAY_LEN); // depends on control dependency: [if], data = [none]
} else {
int newLen = (int) Math.min((long) data[currentRow].length << 1L, (long) SPARSE_MATRIX_DIM);
data[currentRow] = Arrays.copyOf(data[currentRow], newLen); // depends on control dependency: [if], data = [none]
rowIndex[currentRow] = Arrays.copyOf(rowIndex[currentRow], newLen); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public final static void classAvailable(Class<?> clazz) {
Object target = classAvailableTarget;
Method method = classAvailableMethod;
if (target == null || method == null) {
return;
}
try {
method.invoke(target, clazz);
} catch (Throwable t) {
t.printStackTrace();
}
} } | public class class_name {
public final static void classAvailable(Class<?> clazz) {
Object target = classAvailableTarget;
Method method = classAvailableMethod;
if (target == null || method == null) {
return; // depends on control dependency: [if], data = [none]
}
try {
method.invoke(target, clazz); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
t.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void deleteRTreeSpatialIndex(GeoPackageCore geoPackage,
String table) {
RTreeIndexCoreExtension rTreeIndexExtension = getRTreeIndexExtension(geoPackage);
if (rTreeIndexExtension.has(table)) {
rTreeIndexExtension.delete(table);
}
} } | public class class_name {
public static void deleteRTreeSpatialIndex(GeoPackageCore geoPackage,
String table) {
RTreeIndexCoreExtension rTreeIndexExtension = getRTreeIndexExtension(geoPackage);
if (rTreeIndexExtension.has(table)) {
rTreeIndexExtension.delete(table); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Geometry simplify(Geometry geom, double resolution, double factor){
Geometry simplifiedGeometry = null;
if( geom instanceof GeometryCollection ){
GeometryCollection collection = (GeometryCollection)geom;
boolean isSimplified = false;
//List<Geometry> newComponents = new Vector<Geometry>();
// Extract basic geometries
List<Geometry> basicGeometries = new Vector<Geometry>();
collection.accumulateBasicGeometries(basicGeometries);
List<Point> accumulatedPoints = new Vector<Point>();
List<LineString> accumulatedLineStrings = new Vector<LineString>();
List<Polygon> accumulatedPolygons = new Vector<Polygon>();
for(Geometry component : basicGeometries){
if( component instanceof Point ){
Point p = (Point)component;
accumulatedPoints.add(p);
} else if( component instanceof LineString ){
LineString ls = (LineString)component;
accumulatedLineStrings.add(ls);
} else if( component instanceof Polygon ){
Polygon poly = (Polygon)component;
accumulatedPolygons.add(poly);
}
}
List<Geometry> newComponents = new Vector<Geometry>();
// Deal with polygons in one simplification
if( accumulatedPolygons.size() > 0 ){
MultiPolygon polygons = new MultiPolygon(accumulatedPolygons);
Geometry effectiveComponent = simplify(polygons, resolution, factor);
if( null != effectiveComponent ){
isSimplified = true;
newComponents.add(effectiveComponent);
} else {
newComponents.add(polygons);
}
}
// Deal with linestrings in one simplification
if( accumulatedLineStrings.size() > 0 ){
MultiLineString linestrings = new MultiLineString(accumulatedLineStrings);
Geometry effectiveComponent = simplify(linestrings, resolution, factor);
if( null != effectiveComponent ){
isSimplified = true;
newComponents.add(effectiveComponent);
} else {
newComponents.add(linestrings);
}
}
// Deal with points in one simplification
if( accumulatedPoints.size() > 0 ){
MultiPoint points = new MultiPoint(accumulatedPoints);
Geometry effectiveComponent = simplify(points, resolution, factor);
if( null != effectiveComponent ){
isSimplified = true;
newComponents.add(effectiveComponent);
} else {
newComponents.add(points);
}
}
if( isSimplified ){
simplifiedGeometry = new GeometryCollection(newComponents);
}
} else if( geom instanceof Point ) {
// Point point = (Point)geom;
//
// double x = Math.round(point.getX() * factor) / factor;
// double y = Math.round(point.getY() * factor) / factor;
// if( x != point.getX()
// || y != point.getY() ){
// simplifiedGeometry = new Point(x,y);
// }
} else if( geom instanceof LineString ) {
// The simplification of a LineString might result into a LineString
// or into a point
LineString lineString = (LineString)geom;
boolean isGeneralized = false;
List<Point> accumulatedPoints = new Vector<Point>();
Point lastPoint = null;
// Keep track of bounds
BoundingBox bbox = new BoundingBox();
for(Point point : lineString.getPoints()){
// Keep track of bounds
bbox.extendToInclude(point);
Geometry simplifiedPointObj = simplify(point, resolution, factor);
Point simplifiedPoint = null;
if( null != simplifiedPointObj ){
isGeneralized = true;
simplifiedPoint = (Point)simplifiedPointObj;
} else {
simplifiedPoint = point;
}
if( null == lastPoint ){
lastPoint = simplifiedPoint;
accumulatedPoints.add(simplifiedPoint);
} else {
if( areLocationsColliding(simplifiedPoint, lastPoint, resolution) ){
isGeneralized = true;
} else {
lastPoint = simplifiedPoint;
accumulatedPoints.add(simplifiedPoint);
}
}
}
if( isGeneralized ){
// A change occurred
if( accumulatedPoints.size() < 2 ){
// Create a point that represents the centre of the line string
simplifiedGeometry = bbox.getCentroid();
} else {
simplifiedGeometry = new LineString(accumulatedPoints);
};
};
} else if( geom instanceof Polygon ) {
// Might return a polygon or a point
Polygon polygon = (Polygon)geom;
boolean newPolygonNeeded = false;
List<LineString> newRings = new Vector<LineString>();
// First linear ring is the outer limit of polygon
List<LineString> rings = polygon.getLinearRings();
LineString firstRing = rings.get(0);
Geometry simplifiedFirstRing = simplify(firstRing, resolution, factor);
if( null != simplifiedFirstRing ){
if( simplifiedFirstRing instanceof Point ){
// The outer ring was turned into a point. The whole
// polygon is now a point. Do not process the other rings.
// Abort and return the point.
return simplifiedFirstRing;
} else {
newPolygonNeeded = true;
LineString simplifiedLineString = (LineString)simplifiedFirstRing;
newRings.add(simplifiedLineString);
}
} else {
newRings.add(firstRing);
}
// The following rings are subtractions from the outer ring
for(int i=1,e=rings.size(); i<e; ++i){
LineString innerRing = rings.get(i);
Geometry simplifiedInnerRing = simplify(innerRing,resolution,factor);
if( null != simplifiedInnerRing ){
newPolygonNeeded = true;
if( simplifiedInnerRing instanceof Point ){
// Drop inner ring
} else {
LineString simplifiedLineString = (LineString)simplifiedInnerRing;
newRings.add(simplifiedLineString);
}
} else {
newRings.add(innerRing);
}
}
if( newPolygonNeeded ){
simplifiedGeometry = new Polygon(newRings);
}
} else if( geom instanceof MultiPoint ) {
// A MultiPoint can be simplified into a MultiPoint or
// a simple Point
MultiPoint multiPoint = (MultiPoint)geom;
boolean isGeneralized = false;
List<Point> accumulatedPoints = new Vector<Point>();
Point lastPoint = null;
for(Point point : multiPoint.getPoints()){
Point effectivePoint = point;
Geometry simplifiedPoint = simplify(point,resolution,factor);
if( null != simplifiedPoint ){
isGeneralized = true;
effectivePoint = (Point)simplifiedPoint;
}
if( null == lastPoint ) {
lastPoint = effectivePoint;
accumulatedPoints.add(effectivePoint);
} else {
if( areLocationsColliding(effectivePoint, accumulatedPoints, resolution) ){
// If this points is colliding with other points, do not
// add to resulting collection
isGeneralized = true;
} else {
lastPoint = effectivePoint;
accumulatedPoints.add(effectivePoint);
}
}
}
if( isGeneralized ){
if( accumulatedPoints.size() < 2 ){
simplifiedGeometry = accumulatedPoints.get(0);
} else {
simplifiedGeometry = new MultiPoint(accumulatedPoints);
}
}
} else if( geom instanceof MultiLineString ) {
// A MultiLineString can be simplified into a MultiLineString, a LineString,
// a MultiPoint or a Point
MultiLineString multiLineString = (MultiLineString)geom;
List<LineString> effectiveLineStrings = makeLineStrings(
multiLineString.getLineStrings(),
null,
resolution
);
boolean isGeneralized = false;
List<LineString> accumulatedLineStrings = new Vector<LineString>();
List<Point> accumulatedPoints = new Vector<Point>();
for(LineString lineString : effectiveLineStrings){
Geometry simplifiedLineString = simplify(lineString, resolution, factor);
if( null != simplifiedLineString ){
isGeneralized = true;
if( simplifiedLineString instanceof Point ){
Point simplifiedPoint = (Point)simplifiedLineString;
if( false == areLocationsColliding(simplifiedPoint, accumulatedPoints, resolution) ){
accumulatedPoints.add(simplifiedPoint);
}
} else {
LineString simplifiedLS = (LineString)simplifiedLineString;
accumulatedLineStrings.add(simplifiedLS);
}
} else {
accumulatedLineStrings.add(lineString);
}
}
if( isGeneralized ){
if( accumulatedLineStrings.size() > 1 ){
simplifiedGeometry = new MultiLineString(accumulatedLineStrings);
} else if( accumulatedLineStrings.size() == 1 ){
simplifiedGeometry = accumulatedLineStrings.get(0);
} else if( accumulatedPoints.size() > 1 ){
simplifiedGeometry = new MultiPoint(accumulatedPoints);
} else if( accumulatedPoints.size() == 1 ){
simplifiedGeometry = accumulatedPoints.get(0);
}
}
} else if( geom instanceof MultiPolygon ) {
// A MultiPolygon can be simplified into a MultiPolygon, a Polygon,
// a MultiPoint or a Point
MultiPolygon multiPolygon = (MultiPolygon)geom;
boolean isGeneralized = false;
List<Polygon> accumulatedPolygons = new Vector<Polygon>();
List<Point> accumulatedPoints = new Vector<Point>();
for(Polygon polygon : multiPolygon.getPolygons()){
Geometry simplifiedPolygon = simplify(polygon, resolution, factor);
if( null != simplifiedPolygon ){
isGeneralized = true;
if( simplifiedPolygon instanceof Point ){
Point simplifiedPoint = (Point)simplifiedPolygon;
if( false == areLocationsColliding(simplifiedPoint, accumulatedPoints, resolution) ){
accumulatedPoints.add(simplifiedPoint);
}
} else {
Polygon simplifiedPoly = (Polygon)simplifiedPolygon;
accumulatedPolygons.add(simplifiedPoly);
}
} else {
accumulatedPolygons.add(polygon);
}
}
if( isGeneralized ){
if( accumulatedPolygons.size() > 1 ){
simplifiedGeometry = new MultiPolygon(accumulatedPolygons);
} else if( accumulatedPolygons.size() == 1 ){
simplifiedGeometry = accumulatedPolygons.get(0);
} else if( accumulatedPoints.size() > 1 ){
simplifiedGeometry = new MultiPoint(accumulatedPoints);
} else if( accumulatedPoints.size() == 1 ){
simplifiedGeometry = accumulatedPoints.get(0);
}
}
}
return simplifiedGeometry;
} } | public class class_name {
private Geometry simplify(Geometry geom, double resolution, double factor){
Geometry simplifiedGeometry = null;
if( geom instanceof GeometryCollection ){
GeometryCollection collection = (GeometryCollection)geom;
boolean isSimplified = false;
//List<Geometry> newComponents = new Vector<Geometry>();
// Extract basic geometries
List<Geometry> basicGeometries = new Vector<Geometry>();
collection.accumulateBasicGeometries(basicGeometries); // depends on control dependency: [if], data = [none]
List<Point> accumulatedPoints = new Vector<Point>();
List<LineString> accumulatedLineStrings = new Vector<LineString>();
List<Polygon> accumulatedPolygons = new Vector<Polygon>();
for(Geometry component : basicGeometries){
if( component instanceof Point ){
Point p = (Point)component;
accumulatedPoints.add(p); // depends on control dependency: [if], data = [none]
} else if( component instanceof LineString ){
LineString ls = (LineString)component;
accumulatedLineStrings.add(ls); // depends on control dependency: [if], data = [none]
} else if( component instanceof Polygon ){
Polygon poly = (Polygon)component;
accumulatedPolygons.add(poly); // depends on control dependency: [if], data = [none]
}
}
List<Geometry> newComponents = new Vector<Geometry>();
// Deal with polygons in one simplification
if( accumulatedPolygons.size() > 0 ){
MultiPolygon polygons = new MultiPolygon(accumulatedPolygons);
Geometry effectiveComponent = simplify(polygons, resolution, factor);
if( null != effectiveComponent ){
isSimplified = true; // depends on control dependency: [if], data = [none]
newComponents.add(effectiveComponent); // depends on control dependency: [if], data = [none]
} else {
newComponents.add(polygons); // depends on control dependency: [if], data = [none]
}
}
// Deal with linestrings in one simplification
if( accumulatedLineStrings.size() > 0 ){
MultiLineString linestrings = new MultiLineString(accumulatedLineStrings);
Geometry effectiveComponent = simplify(linestrings, resolution, factor);
if( null != effectiveComponent ){
isSimplified = true; // depends on control dependency: [if], data = [none]
newComponents.add(effectiveComponent); // depends on control dependency: [if], data = [none]
} else {
newComponents.add(linestrings); // depends on control dependency: [if], data = [none]
}
}
// Deal with points in one simplification
if( accumulatedPoints.size() > 0 ){
MultiPoint points = new MultiPoint(accumulatedPoints);
Geometry effectiveComponent = simplify(points, resolution, factor);
if( null != effectiveComponent ){
isSimplified = true; // depends on control dependency: [if], data = [none]
newComponents.add(effectiveComponent); // depends on control dependency: [if], data = [none]
} else {
newComponents.add(points); // depends on control dependency: [if], data = [none]
}
}
if( isSimplified ){
simplifiedGeometry = new GeometryCollection(newComponents); // depends on control dependency: [if], data = [none]
}
} else if( geom instanceof Point ) {
// Point point = (Point)geom;
//
// double x = Math.round(point.getX() * factor) / factor;
// double y = Math.round(point.getY() * factor) / factor;
// if( x != point.getX()
// || y != point.getY() ){
// simplifiedGeometry = new Point(x,y);
// }
} else if( geom instanceof LineString ) {
// The simplification of a LineString might result into a LineString
// or into a point
LineString lineString = (LineString)geom;
boolean isGeneralized = false;
List<Point> accumulatedPoints = new Vector<Point>();
Point lastPoint = null;
// Keep track of bounds
BoundingBox bbox = new BoundingBox();
for(Point point : lineString.getPoints()){
// Keep track of bounds
bbox.extendToInclude(point); // depends on control dependency: [for], data = [point]
Geometry simplifiedPointObj = simplify(point, resolution, factor);
Point simplifiedPoint = null;
if( null != simplifiedPointObj ){
isGeneralized = true; // depends on control dependency: [if], data = [none]
simplifiedPoint = (Point)simplifiedPointObj; // depends on control dependency: [if], data = [none]
} else {
simplifiedPoint = point; // depends on control dependency: [if], data = [none]
}
if( null == lastPoint ){
lastPoint = simplifiedPoint; // depends on control dependency: [if], data = [none]
accumulatedPoints.add(simplifiedPoint); // depends on control dependency: [if], data = [none]
} else {
if( areLocationsColliding(simplifiedPoint, lastPoint, resolution) ){
isGeneralized = true; // depends on control dependency: [if], data = [none]
} else {
lastPoint = simplifiedPoint; // depends on control dependency: [if], data = [none]
accumulatedPoints.add(simplifiedPoint); // depends on control dependency: [if], data = [none]
}
}
}
if( isGeneralized ){
// A change occurred
if( accumulatedPoints.size() < 2 ){
// Create a point that represents the centre of the line string
simplifiedGeometry = bbox.getCentroid(); // depends on control dependency: [if], data = [none]
} else {
simplifiedGeometry = new LineString(accumulatedPoints); // depends on control dependency: [if], data = [none]
};
};
} else if( geom instanceof Polygon ) {
// Might return a polygon or a point
Polygon polygon = (Polygon)geom;
boolean newPolygonNeeded = false;
List<LineString> newRings = new Vector<LineString>();
// First linear ring is the outer limit of polygon
List<LineString> rings = polygon.getLinearRings();
LineString firstRing = rings.get(0);
Geometry simplifiedFirstRing = simplify(firstRing, resolution, factor);
if( null != simplifiedFirstRing ){
if( simplifiedFirstRing instanceof Point ){
// The outer ring was turned into a point. The whole
// polygon is now a point. Do not process the other rings.
// Abort and return the point.
return simplifiedFirstRing; // depends on control dependency: [if], data = [none]
} else {
newPolygonNeeded = true; // depends on control dependency: [if], data = [none]
LineString simplifiedLineString = (LineString)simplifiedFirstRing;
newRings.add(simplifiedLineString); // depends on control dependency: [if], data = [none]
}
} else {
newRings.add(firstRing); // depends on control dependency: [if], data = [none]
}
// The following rings are subtractions from the outer ring
for(int i=1,e=rings.size(); i<e; ++i){
LineString innerRing = rings.get(i);
Geometry simplifiedInnerRing = simplify(innerRing,resolution,factor);
if( null != simplifiedInnerRing ){
newPolygonNeeded = true; // depends on control dependency: [if], data = [none]
if( simplifiedInnerRing instanceof Point ){
// Drop inner ring
} else {
LineString simplifiedLineString = (LineString)simplifiedInnerRing;
newRings.add(simplifiedLineString); // depends on control dependency: [if], data = [none]
}
} else {
newRings.add(innerRing); // depends on control dependency: [if], data = [none]
}
}
if( newPolygonNeeded ){
simplifiedGeometry = new Polygon(newRings); // depends on control dependency: [if], data = [none]
}
} else if( geom instanceof MultiPoint ) {
// A MultiPoint can be simplified into a MultiPoint or
// a simple Point
MultiPoint multiPoint = (MultiPoint)geom;
boolean isGeneralized = false;
List<Point> accumulatedPoints = new Vector<Point>();
Point lastPoint = null;
for(Point point : multiPoint.getPoints()){
Point effectivePoint = point;
Geometry simplifiedPoint = simplify(point,resolution,factor);
if( null != simplifiedPoint ){
isGeneralized = true; // depends on control dependency: [if], data = [none]
effectivePoint = (Point)simplifiedPoint; // depends on control dependency: [if], data = [none]
}
if( null == lastPoint ) {
lastPoint = effectivePoint; // depends on control dependency: [if], data = [none]
accumulatedPoints.add(effectivePoint); // depends on control dependency: [if], data = [none]
} else {
if( areLocationsColliding(effectivePoint, accumulatedPoints, resolution) ){
// If this points is colliding with other points, do not
// add to resulting collection
isGeneralized = true; // depends on control dependency: [if], data = [none]
} else {
lastPoint = effectivePoint; // depends on control dependency: [if], data = [none]
accumulatedPoints.add(effectivePoint); // depends on control dependency: [if], data = [none]
}
}
}
if( isGeneralized ){
if( accumulatedPoints.size() < 2 ){
simplifiedGeometry = accumulatedPoints.get(0); // depends on control dependency: [if], data = [none]
} else {
simplifiedGeometry = new MultiPoint(accumulatedPoints); // depends on control dependency: [if], data = [none]
}
}
} else if( geom instanceof MultiLineString ) {
// A MultiLineString can be simplified into a MultiLineString, a LineString,
// a MultiPoint or a Point
MultiLineString multiLineString = (MultiLineString)geom;
List<LineString> effectiveLineStrings = makeLineStrings(
multiLineString.getLineStrings(),
null,
resolution
);
boolean isGeneralized = false;
List<LineString> accumulatedLineStrings = new Vector<LineString>();
List<Point> accumulatedPoints = new Vector<Point>();
for(LineString lineString : effectiveLineStrings){
Geometry simplifiedLineString = simplify(lineString, resolution, factor);
if( null != simplifiedLineString ){
isGeneralized = true; // depends on control dependency: [if], data = [none]
if( simplifiedLineString instanceof Point ){
Point simplifiedPoint = (Point)simplifiedLineString;
if( false == areLocationsColliding(simplifiedPoint, accumulatedPoints, resolution) ){
accumulatedPoints.add(simplifiedPoint); // depends on control dependency: [if], data = [none]
}
} else {
LineString simplifiedLS = (LineString)simplifiedLineString;
accumulatedLineStrings.add(simplifiedLS); // depends on control dependency: [if], data = [none]
}
} else {
accumulatedLineStrings.add(lineString); // depends on control dependency: [if], data = [none]
}
}
if( isGeneralized ){
if( accumulatedLineStrings.size() > 1 ){
simplifiedGeometry = new MultiLineString(accumulatedLineStrings); // depends on control dependency: [if], data = [none]
} else if( accumulatedLineStrings.size() == 1 ){
simplifiedGeometry = accumulatedLineStrings.get(0); // depends on control dependency: [if], data = [none]
} else if( accumulatedPoints.size() > 1 ){
simplifiedGeometry = new MultiPoint(accumulatedPoints); // depends on control dependency: [if], data = [none]
} else if( accumulatedPoints.size() == 1 ){
simplifiedGeometry = accumulatedPoints.get(0); // depends on control dependency: [if], data = [none]
}
}
} else if( geom instanceof MultiPolygon ) {
// A MultiPolygon can be simplified into a MultiPolygon, a Polygon,
// a MultiPoint or a Point
MultiPolygon multiPolygon = (MultiPolygon)geom;
boolean isGeneralized = false;
List<Polygon> accumulatedPolygons = new Vector<Polygon>();
List<Point> accumulatedPoints = new Vector<Point>();
for(Polygon polygon : multiPolygon.getPolygons()){
Geometry simplifiedPolygon = simplify(polygon, resolution, factor);
if( null != simplifiedPolygon ){
isGeneralized = true; // depends on control dependency: [if], data = [none]
if( simplifiedPolygon instanceof Point ){
Point simplifiedPoint = (Point)simplifiedPolygon;
if( false == areLocationsColliding(simplifiedPoint, accumulatedPoints, resolution) ){
accumulatedPoints.add(simplifiedPoint); // depends on control dependency: [if], data = [none]
}
} else {
Polygon simplifiedPoly = (Polygon)simplifiedPolygon;
accumulatedPolygons.add(simplifiedPoly); // depends on control dependency: [if], data = [none]
}
} else {
accumulatedPolygons.add(polygon); // depends on control dependency: [if], data = [none]
}
}
if( isGeneralized ){
if( accumulatedPolygons.size() > 1 ){
simplifiedGeometry = new MultiPolygon(accumulatedPolygons); // depends on control dependency: [if], data = [none]
} else if( accumulatedPolygons.size() == 1 ){
simplifiedGeometry = accumulatedPolygons.get(0); // depends on control dependency: [if], data = [none]
} else if( accumulatedPoints.size() > 1 ){
simplifiedGeometry = new MultiPoint(accumulatedPoints); // depends on control dependency: [if], data = [none]
} else if( accumulatedPoints.size() == 1 ){
simplifiedGeometry = accumulatedPoints.get(0); // depends on control dependency: [if], data = [none]
}
}
}
return simplifiedGeometry;
} } |
public class class_name {
void setEndPoints() {
float angleNum = 360f / (rayNum - 1);
for (int i = 0; i < rayNum; i++) {
final float angle = angleNum * i;
sin[i] = MathUtils.sinDeg(angle);
cos[i] = MathUtils.cosDeg(angle);
endX[i] = distance * cos[i];
endY[i] = distance * sin[i];
}
} } | public class class_name {
void setEndPoints() {
float angleNum = 360f / (rayNum - 1);
for (int i = 0; i < rayNum; i++) {
final float angle = angleNum * i;
sin[i] = MathUtils.sinDeg(angle);
// depends on control dependency: [for], data = [i]
cos[i] = MathUtils.cosDeg(angle);
// depends on control dependency: [for], data = [i]
endX[i] = distance * cos[i];
// depends on control dependency: [for], data = [i]
endY[i] = distance * sin[i];
// depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
@Override
public int getPort() {
if (this.port == null) {
return -1;
}
try {
return this.port.parseToInt();
} catch (final NumberFormatException e) {
// all of this should already have
// been checked so should be impossible
throw new RuntimeException(
"The port could not be parsed as an integer. This should not be possible. The port was "
+ this.port);
} catch (final IOException e) {
throw new RuntimeException("IOException while extracting out the port. This should not be possible.");
}
} } | public class class_name {
@Override
public int getPort() {
if (this.port == null) {
return -1; // depends on control dependency: [if], data = [none]
}
try {
return this.port.parseToInt(); // depends on control dependency: [try], data = [none]
} catch (final NumberFormatException e) {
// all of this should already have
// been checked so should be impossible
throw new RuntimeException(
"The port could not be parsed as an integer. This should not be possible. The port was "
+ this.port);
} catch (final IOException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException("IOException while extracting out the port. This should not be possible.");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean sendMsg(Message msg) {
SendResult sendResult = null;
try {
sendResult = producer.send(msg);
} catch (Exception e) {
logger.error("send msg error", e);
}
return sendResult != null && sendResult.getSendStatus() == SendStatus.SEND_OK;
} } | public class class_name {
public boolean sendMsg(Message msg) {
SendResult sendResult = null;
try {
sendResult = producer.send(msg); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("send msg error", e);
} // depends on control dependency: [catch], data = [none]
return sendResult != null && sendResult.getSendStatus() == SendStatus.SEND_OK;
} } |
public class class_name {
public void marshall(DeleteTopicRuleRequest deleteTopicRuleRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteTopicRuleRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteTopicRuleRequest.getRuleName(), RULENAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteTopicRuleRequest deleteTopicRuleRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteTopicRuleRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteTopicRuleRequest.getRuleName(), RULENAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
title.setVisible(clock.isTitleVisible());
title.setManaged(clock.isTitleVisible());
text.setVisible(clock.isTextVisible());
text.setManaged(clock.isTextVisible());
dateText.setVisible(clock.isDateVisible());
dateText.setManaged(clock.isDateVisible());
dateNumber.setVisible(clock.isDateVisible());
dateNumber.setManaged(clock.isDateVisible());
second.setVisible(clock.isSecondsVisible());
second.setManaged(clock.isSecondsVisible());
} else if ("SECTION".equals(EVENT_TYPE)) {
sections = clock.getSections();
highlightSections = clock.isHighlightSections();
sectionsVisible = clock.getSectionsVisible();
areas = clock.getAreas();
highlightAreas = clock.isHighlightAreas();
areasVisible = clock.getAreasVisible();
redraw();
}
} } | public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
title.setVisible(clock.isTitleVisible()); // depends on control dependency: [if], data = [none]
title.setManaged(clock.isTitleVisible()); // depends on control dependency: [if], data = [none]
text.setVisible(clock.isTextVisible()); // depends on control dependency: [if], data = [none]
text.setManaged(clock.isTextVisible()); // depends on control dependency: [if], data = [none]
dateText.setVisible(clock.isDateVisible()); // depends on control dependency: [if], data = [none]
dateText.setManaged(clock.isDateVisible()); // depends on control dependency: [if], data = [none]
dateNumber.setVisible(clock.isDateVisible()); // depends on control dependency: [if], data = [none]
dateNumber.setManaged(clock.isDateVisible()); // depends on control dependency: [if], data = [none]
second.setVisible(clock.isSecondsVisible()); // depends on control dependency: [if], data = [none]
second.setManaged(clock.isSecondsVisible()); // depends on control dependency: [if], data = [none]
} else if ("SECTION".equals(EVENT_TYPE)) {
sections = clock.getSections(); // depends on control dependency: [if], data = [none]
highlightSections = clock.isHighlightSections(); // depends on control dependency: [if], data = [none]
sectionsVisible = clock.getSectionsVisible(); // depends on control dependency: [if], data = [none]
areas = clock.getAreas(); // depends on control dependency: [if], data = [none]
highlightAreas = clock.isHighlightAreas(); // depends on control dependency: [if], data = [none]
areasVisible = clock.getAreasVisible(); // depends on control dependency: [if], data = [none]
redraw(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ResponseLaunchTemplateData withTagSpecifications(LaunchTemplateTagSpecification... tagSpecifications) {
if (this.tagSpecifications == null) {
setTagSpecifications(new com.amazonaws.internal.SdkInternalList<LaunchTemplateTagSpecification>(tagSpecifications.length));
}
for (LaunchTemplateTagSpecification ele : tagSpecifications) {
this.tagSpecifications.add(ele);
}
return this;
} } | public class class_name {
public ResponseLaunchTemplateData withTagSpecifications(LaunchTemplateTagSpecification... tagSpecifications) {
if (this.tagSpecifications == null) {
setTagSpecifications(new com.amazonaws.internal.SdkInternalList<LaunchTemplateTagSpecification>(tagSpecifications.length)); // depends on control dependency: [if], data = [none]
}
for (LaunchTemplateTagSpecification ele : tagSpecifications) {
this.tagSpecifications.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public boolean waitForIncomingEmail(long timeout, int emailCount) {
final CountDownLatch waitObject = managers.getSmtpManager().createAndAddNewWaitObject(emailCount);
final long endTime = System.currentTimeMillis() + timeout;
while (waitObject.getCount() > 0) {
final long waitTime = endTime - System.currentTimeMillis();
if (waitTime < 0L) {
return waitObject.getCount() == 0;
}
try {
waitObject.await(waitTime, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// Continue loop, in case of premature interruption
}
}
return waitObject.getCount() == 0;
} } | public class class_name {
@Override
public boolean waitForIncomingEmail(long timeout, int emailCount) {
final CountDownLatch waitObject = managers.getSmtpManager().createAndAddNewWaitObject(emailCount);
final long endTime = System.currentTimeMillis() + timeout;
while (waitObject.getCount() > 0) {
final long waitTime = endTime - System.currentTimeMillis();
if (waitTime < 0L) {
return waitObject.getCount() == 0;
// depends on control dependency: [if], data = [none]
}
try {
waitObject.await(waitTime, TimeUnit.MILLISECONDS);
// depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
// Continue loop, in case of premature interruption
}
// depends on control dependency: [catch], data = [none]
}
return waitObject.getCount() == 0;
} } |
public class class_name {
public String getHtmlCode()
{
StringBuffer _buffer = new StringBuffer();
Object[] _paramsStart =
{
getHtmlCodeForIdAttribute(), getHtmlCodeForNameAttribute()
};
_buffer.append(FORMAT__START.format(_paramsStart));
for (RadioButton _radio : getOptions())
{
Object[] _paramsItem =
{
_radio.getHtmlCode()
};
_buffer.append(FORMAT__ITEM.format(_paramsItem));
}
Object[] _paramsEnd = {};
_buffer.append(FORMAT__END.format(_paramsEnd));
return _buffer.toString();
} } | public class class_name {
public String getHtmlCode()
{
StringBuffer _buffer = new StringBuffer();
Object[] _paramsStart =
{
getHtmlCodeForIdAttribute(), getHtmlCodeForNameAttribute()
};
_buffer.append(FORMAT__START.format(_paramsStart));
for (RadioButton _radio : getOptions())
{
Object[] _paramsItem =
{
_radio.getHtmlCode()
};
_buffer.append(FORMAT__ITEM.format(_paramsItem));
// depends on control dependency: [for], data = [none]
}
Object[] _paramsEnd = {};
_buffer.append(FORMAT__END.format(_paramsEnd));
return _buffer.toString();
} } |
public class class_name {
protected boolean internalEquals(ValueData another)
{
if (another instanceof BooleanValueData)
{
return ((BooleanValueData)another).value == value;
}
return false;
} } | public class class_name {
protected boolean internalEquals(ValueData another)
{
if (another instanceof BooleanValueData)
{
return ((BooleanValueData)another).value == value; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
protected void initLegalTypes() {
Map<Integer, Map<ResourceType, Integer>> cpuToResourcePartitioning =
conf.getCpuToResourcePartitioning();
for (Map.Entry<Integer, Map<ResourceType, Integer>> entry :
cpuToResourcePartitioning.entrySet()) {
for (ResourceType type : entry.getValue().keySet()) {
legalTypeSet.add(type);
}
}
legalTypeSet = Collections.unmodifiableSet(legalTypeSet);
} } | public class class_name {
protected void initLegalTypes() {
Map<Integer, Map<ResourceType, Integer>> cpuToResourcePartitioning =
conf.getCpuToResourcePartitioning();
for (Map.Entry<Integer, Map<ResourceType, Integer>> entry :
cpuToResourcePartitioning.entrySet()) {
for (ResourceType type : entry.getValue().keySet()) {
legalTypeSet.add(type); // depends on control dependency: [for], data = [type]
}
}
legalTypeSet = Collections.unmodifiableSet(legalTypeSet);
} } |
public class class_name {
public EClass getIfcRelFillsElement() {
if (ifcRelFillsElementEClass == null) {
ifcRelFillsElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(473);
}
return ifcRelFillsElementEClass;
} } | public class class_name {
public EClass getIfcRelFillsElement() {
if (ifcRelFillsElementEClass == null) {
ifcRelFillsElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(473);
// depends on control dependency: [if], data = [none]
}
return ifcRelFillsElementEClass;
} } |
public class class_name {
public void printFunction(DifferentialFunction differentialFunction) {
if (!logExecution)
return;
if (differentialFunction instanceof SDVariable)
return;
StringBuilder argShapes = new StringBuilder();
for (val arg : differentialFunction.args()) {
argShapes.append(" Variable " + arg.getVarName() +
" Shape for " + Arrays.toString(arg.getShape()));
}
for (val func : differentialFunction.outputVariables()) {
argShapes.append(" Output variable " + func.getVarName() + " is " +
Arrays.toString(func.getShape()));
}
StringBuilder realShapes = new StringBuilder();
for (val arg : differentialFunction.args()) {
realShapes.append(" Input shape for " + arg.getVarName() + " is " + Arrays.
toString(getShapeForVarName(arg.getVarName())));
}
for (val arg : differentialFunction.outputVariables()) {
realShapes.append(" Output shape for " + arg.getVarName() + " is " + Arrays.
toString(getShapeForVarName(arg.getVarName())));
}
// log.info(realShapes.toString());
} } | public class class_name {
public void printFunction(DifferentialFunction differentialFunction) {
if (!logExecution)
return;
if (differentialFunction instanceof SDVariable)
return;
StringBuilder argShapes = new StringBuilder();
for (val arg : differentialFunction.args()) {
argShapes.append(" Variable " + arg.getVarName() +
" Shape for " + Arrays.toString(arg.getShape())); // depends on control dependency: [for], data = [arg]
}
for (val func : differentialFunction.outputVariables()) {
argShapes.append(" Output variable " + func.getVarName() + " is " +
Arrays.toString(func.getShape())); // depends on control dependency: [for], data = [none]
}
StringBuilder realShapes = new StringBuilder();
for (val arg : differentialFunction.args()) {
realShapes.append(" Input shape for " + arg.getVarName() + " is " + Arrays.
toString(getShapeForVarName(arg.getVarName())));
}
for (val arg : differentialFunction.outputVariables()) {
realShapes.append(" Output shape for " + arg.getVarName() + " is " + Arrays.
toString(getShapeForVarName(arg.getVarName())));
}
// log.info(realShapes.toString());
} } |
public class class_name {
public static double inverseCumulativeNormalDistribution_Wichura(double p) {
double zero = 0.e+00, one = 1.e+00, half = 0.5e+00;
double split1 = 0.425e+00, split2 = 5.e+00;
double const1 = 0.180625e+00, const2 = 1.6e+00;
// coefficients for p close to 0.5
double a0 = 3.3871328727963666080e+00;
double a1 = 1.3314166789178437745e+02;
double a2 = 1.9715909503065514427e+03;
double a3 = 1.3731693765509461125e+04;
double a4 = 4.5921953931549871457e+04;
double a5 = 6.7265770927008700853e+04;
double a6 = 3.3430575583588128105e+04;
double a7 = 2.5090809287301226727e+03;
double b1 = 4.2313330701600911252e+01;
double b2 = 6.8718700749205790830e+02;
double b3 = 5.3941960214247511077e+03;
double b4 = 2.1213794301586595867e+04;
double b5 = 3.9307895800092710610e+04;
double b6 = 2.8729085735721942674e+04;
double b7 = 5.2264952788528545610e+03;
// hash sum ab 55.8831928806149014439
// coefficients for p not close to 0, 0.5 or 1.
double c0 = 1.42343711074968357734e+00;
double c1 = 4.63033784615654529590e+00;
double c2 = 5.76949722146069140550e+00;
double c3 = 3.64784832476320460504e+00;
double c4 = 1.27045825245236838258e+00;
double c5 = 2.41780725177450611770e-01;
double c6 = 2.27238449892691845833e-02;
double c7 = 7.74545014278341407640e-04;
double d1 = 2.05319162663775882187e+00;
double d2 = 1.67638483018380384940e+00;
double d3 = 6.89767334985100004550e-01;
double d4 = 1.48103976427480074590e-01;
double d5 = 1.51986665636164571966e-02;
double d6 = 5.47593808499534494600e-04;
double d7 = 1.05075007164441684324e-09;
// hash sum cd 49.33206503301610289036
// coefficients for p near 0 or 1.
double e0 = 6.65790464350110377720e+00;
double e1 = 5.46378491116411436990e+00;
double e2 = 1.78482653991729133580e+00;
double e3 = 2.96560571828504891230e-01;
double e4 = 2.65321895265761230930e-02;
double e5 = 1.24266094738807843860e-03;
double e6 = 2.71155556874348757815e-05;
double e7 = 2.01033439929228813265e-07;
double f1 = 5.99832206555887937690e-01;
double f2 = 1.36929880922735805310e-01;
double f3 = 1.48753612908506148525e-02;
double f4 = 7.86869131145613259100e-04;
double f5 = 1.84631831751005468180e-05;
double f6 = 1.42151175831644588870e-07;
double f7 = 2.04426310338993978564e-15;
// hash sum ef 47.52583 31754 92896 71629
double q = p - half;
double r, ppnd16;
if (Math.abs(q) <= split1) {
r = const1 - q * q;
return q
* (((((((a7 * r + a6) * r + a5) * r + a4) * r + a3) * r + a2) * r + a1) * r + a0)
/ (((((((b7 * r + b6) * r + b5) * r + b4) * r + b3) * r + b2) * r + b1) * r + one);
} else {
if (q < zero) {
r = p;
} else {
r = one - p;
}
if (r <= zero) {
return zero;
}
r = Math.sqrt(-Math.log(r));
if (r <= split2) {
r -= const2;
ppnd16 =
(((((((c7 * r + c6) * r + c5) * r + c4) * r + c3) * r + c2) * r + c1) * r + c0)
/ (((((((d7 * r + d6) * r + d5) * r + d4) * r + d3) * r + d2) * r + d1) * r + one);
} else {
r -= split2;
ppnd16 =
(((((((e7 * r + e6) * r + e5) * r + e4) * r + e3) * r + e2) * r + e1) * r + e0)
/ (((((((f7 * r + f6) * r + f5) * r + f4) * r + f3) * r + f2) * r + f1) * r + one);
}
if (q < zero) {
ppnd16 = -ppnd16;
}
return ppnd16;
}
} } | public class class_name {
public static double inverseCumulativeNormalDistribution_Wichura(double p) {
double zero = 0.e+00, one = 1.e+00, half = 0.5e+00;
double split1 = 0.425e+00, split2 = 5.e+00;
double const1 = 0.180625e+00, const2 = 1.6e+00;
// coefficients for p close to 0.5
double a0 = 3.3871328727963666080e+00;
double a1 = 1.3314166789178437745e+02;
double a2 = 1.9715909503065514427e+03;
double a3 = 1.3731693765509461125e+04;
double a4 = 4.5921953931549871457e+04;
double a5 = 6.7265770927008700853e+04;
double a6 = 3.3430575583588128105e+04;
double a7 = 2.5090809287301226727e+03;
double b1 = 4.2313330701600911252e+01;
double b2 = 6.8718700749205790830e+02;
double b3 = 5.3941960214247511077e+03;
double b4 = 2.1213794301586595867e+04;
double b5 = 3.9307895800092710610e+04;
double b6 = 2.8729085735721942674e+04;
double b7 = 5.2264952788528545610e+03;
// hash sum ab 55.8831928806149014439
// coefficients for p not close to 0, 0.5 or 1.
double c0 = 1.42343711074968357734e+00;
double c1 = 4.63033784615654529590e+00;
double c2 = 5.76949722146069140550e+00;
double c3 = 3.64784832476320460504e+00;
double c4 = 1.27045825245236838258e+00;
double c5 = 2.41780725177450611770e-01;
double c6 = 2.27238449892691845833e-02;
double c7 = 7.74545014278341407640e-04;
double d1 = 2.05319162663775882187e+00;
double d2 = 1.67638483018380384940e+00;
double d3 = 6.89767334985100004550e-01;
double d4 = 1.48103976427480074590e-01;
double d5 = 1.51986665636164571966e-02;
double d6 = 5.47593808499534494600e-04;
double d7 = 1.05075007164441684324e-09;
// hash sum cd 49.33206503301610289036
// coefficients for p near 0 or 1.
double e0 = 6.65790464350110377720e+00;
double e1 = 5.46378491116411436990e+00;
double e2 = 1.78482653991729133580e+00;
double e3 = 2.96560571828504891230e-01;
double e4 = 2.65321895265761230930e-02;
double e5 = 1.24266094738807843860e-03;
double e6 = 2.71155556874348757815e-05;
double e7 = 2.01033439929228813265e-07;
double f1 = 5.99832206555887937690e-01;
double f2 = 1.36929880922735805310e-01;
double f3 = 1.48753612908506148525e-02;
double f4 = 7.86869131145613259100e-04;
double f5 = 1.84631831751005468180e-05;
double f6 = 1.42151175831644588870e-07;
double f7 = 2.04426310338993978564e-15;
// hash sum ef 47.52583 31754 92896 71629
double q = p - half;
double r, ppnd16;
if (Math.abs(q) <= split1) {
r = const1 - q * q; // depends on control dependency: [if], data = [none]
return q
* (((((((a7 * r + a6) * r + a5) * r + a4) * r + a3) * r + a2) * r + a1) * r + a0)
/ (((((((b7 * r + b6) * r + b5) * r + b4) * r + b3) * r + b2) * r + b1) * r + one); // depends on control dependency: [if], data = [none]
} else {
if (q < zero) {
r = p; // depends on control dependency: [if], data = [none]
} else {
r = one - p; // depends on control dependency: [if], data = [none]
}
if (r <= zero) {
return zero; // depends on control dependency: [if], data = [none]
}
r = Math.sqrt(-Math.log(r)); // depends on control dependency: [if], data = [none]
if (r <= split2) {
r -= const2; // depends on control dependency: [if], data = [none]
ppnd16 =
(((((((c7 * r + c6) * r + c5) * r + c4) * r + c3) * r + c2) * r + c1) * r + c0)
/ (((((((d7 * r + d6) * r + d5) * r + d4) * r + d3) * r + d2) * r + d1) * r + one); // depends on control dependency: [if], data = [none]
} else {
r -= split2; // depends on control dependency: [if], data = [none]
ppnd16 =
(((((((e7 * r + e6) * r + e5) * r + e4) * r + e3) * r + e2) * r + e1) * r + e0)
/ (((((((f7 * r + f6) * r + f5) * r + f4) * r + f3) * r + f2) * r + f1) * r + one); // depends on control dependency: [if], data = [none]
}
if (q < zero) {
ppnd16 = -ppnd16; // depends on control dependency: [if], data = [none]
}
return ppnd16; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
protected boolean isContentType(String schemaId, String schemaVersion, String systemId, String publicId) {
if (this.schema == null) {
return false;
}
if (this.regEx != null) {
final Matcher matcher = this.regEx.matcher(schemaId);
return matcher != null && matcher.find();
}
return this.schema.equalsIgnoreCase(schemaId);
} } | public class class_name {
@Override
protected boolean isContentType(String schemaId, String schemaVersion, String systemId, String publicId) {
if (this.schema == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (this.regEx != null) {
final Matcher matcher = this.regEx.matcher(schemaId);
return matcher != null && matcher.find(); // depends on control dependency: [if], data = [none]
}
return this.schema.equalsIgnoreCase(schemaId);
} } |
public class class_name {
public void marshall(CreateGameSessionQueueRequest createGameSessionQueueRequest, ProtocolMarshaller protocolMarshaller) {
if (createGameSessionQueueRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createGameSessionQueueRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createGameSessionQueueRequest.getTimeoutInSeconds(), TIMEOUTINSECONDS_BINDING);
protocolMarshaller.marshall(createGameSessionQueueRequest.getPlayerLatencyPolicies(), PLAYERLATENCYPOLICIES_BINDING);
protocolMarshaller.marshall(createGameSessionQueueRequest.getDestinations(), DESTINATIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateGameSessionQueueRequest createGameSessionQueueRequest, ProtocolMarshaller protocolMarshaller) {
if (createGameSessionQueueRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createGameSessionQueueRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createGameSessionQueueRequest.getTimeoutInSeconds(), TIMEOUTINSECONDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createGameSessionQueueRequest.getPlayerLatencyPolicies(), PLAYERLATENCYPOLICIES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createGameSessionQueueRequest.getDestinations(), DESTINATIONS_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 start()
{
// responsible for:
// 1. reading parameters (such as repoWorkspaceName, repoPath) from
// registryService (if present) or init params
// 2. initializing artifact service Registry Entry if registryService is
// present
// if Entry is not initialized yet (first launch)
// 3. initializing maven root if not initialized
if (LOG.isDebugEnabled())
{
LOG.debug("Starting ArtifactManagingService ...");
}
sessionProvider = SessionProvider.createSystemProvider();
try
{
InputStream xml = getClass().getResourceAsStream(NT_FILE);
ManageableRepository rep = repositoryService.getCurrentRepository();
rep.getNodeTypeManager().registerNodeTypes(xml, ExtendedNodeTypeManager.IGNORE_IF_EXISTS,
NodeTypeDataManager.TEXT_XML);
readParamsFromRegistryService(sessionProvider);
prepareRootNode(sessionProvider, rootNodePath);
}
catch (PathNotFoundException e)
{
try
{
readParamsFromFile();
writeParamsToRegistryService(sessionProvider);
prepareRootNode(sessionProvider, rootNodePath);
}
catch (RepositoryException exc)
{
LOG.error("Cannot write init configuration to RegistryService", exc);
}
catch (IOException exc)
{
LOG.error("Cannot write init configuration to RegistryService", exc);
}
catch (SAXException exc)
{
LOG.error("Cannot write init configuration to RegistryService", exc);
}
catch (ParserConfigurationException exc)
{
LOG.error("Cannot write init configuration to RegistryService", exc);
}
}
catch (RepositoryException e)
{
LOG.error("Error while register nodetypes/checking existance", e);
}
finally
{
sessionProvider.close();
}
} } | public class class_name {
public void start()
{
// responsible for:
// 1. reading parameters (such as repoWorkspaceName, repoPath) from
// registryService (if present) or init params
// 2. initializing artifact service Registry Entry if registryService is
// present
// if Entry is not initialized yet (first launch)
// 3. initializing maven root if not initialized
if (LOG.isDebugEnabled())
{
LOG.debug("Starting ArtifactManagingService ..."); // depends on control dependency: [if], data = [none]
}
sessionProvider = SessionProvider.createSystemProvider();
try
{
InputStream xml = getClass().getResourceAsStream(NT_FILE);
ManageableRepository rep = repositoryService.getCurrentRepository();
rep.getNodeTypeManager().registerNodeTypes(xml, ExtendedNodeTypeManager.IGNORE_IF_EXISTS,
NodeTypeDataManager.TEXT_XML); // depends on control dependency: [try], data = [none]
readParamsFromRegistryService(sessionProvider); // depends on control dependency: [try], data = [none]
prepareRootNode(sessionProvider, rootNodePath); // depends on control dependency: [try], data = [none]
}
catch (PathNotFoundException e)
{
try
{
readParamsFromFile(); // depends on control dependency: [try], data = [none]
writeParamsToRegistryService(sessionProvider); // depends on control dependency: [try], data = [none]
prepareRootNode(sessionProvider, rootNodePath); // depends on control dependency: [try], data = [none]
}
catch (RepositoryException exc)
{
LOG.error("Cannot write init configuration to RegistryService", exc);
} // depends on control dependency: [catch], data = [none]
catch (IOException exc)
{
LOG.error("Cannot write init configuration to RegistryService", exc);
} // depends on control dependency: [catch], data = [none]
catch (SAXException exc)
{
LOG.error("Cannot write init configuration to RegistryService", exc);
} // depends on control dependency: [catch], data = [none]
catch (ParserConfigurationException exc)
{
LOG.error("Cannot write init configuration to RegistryService", exc);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
catch (RepositoryException e)
{
LOG.error("Error while register nodetypes/checking existance", e);
} // depends on control dependency: [catch], data = [none]
finally
{
sessionProvider.close();
}
} } |
public class class_name {
@Override
public CPOptionCategory fetchByPrimaryKey(Serializable primaryKey) {
Serializable serializable = entityCache.getResult(CPOptionCategoryModelImpl.ENTITY_CACHE_ENABLED,
CPOptionCategoryImpl.class, primaryKey);
if (serializable == nullModel) {
return null;
}
CPOptionCategory cpOptionCategory = (CPOptionCategory)serializable;
if (cpOptionCategory == null) {
Session session = null;
try {
session = openSession();
cpOptionCategory = (CPOptionCategory)session.get(CPOptionCategoryImpl.class,
primaryKey);
if (cpOptionCategory != null) {
cacheResult(cpOptionCategory);
}
else {
entityCache.putResult(CPOptionCategoryModelImpl.ENTITY_CACHE_ENABLED,
CPOptionCategoryImpl.class, primaryKey, nullModel);
}
}
catch (Exception e) {
entityCache.removeResult(CPOptionCategoryModelImpl.ENTITY_CACHE_ENABLED,
CPOptionCategoryImpl.class, primaryKey);
throw processException(e);
}
finally {
closeSession(session);
}
}
return cpOptionCategory;
} } | public class class_name {
@Override
public CPOptionCategory fetchByPrimaryKey(Serializable primaryKey) {
Serializable serializable = entityCache.getResult(CPOptionCategoryModelImpl.ENTITY_CACHE_ENABLED,
CPOptionCategoryImpl.class, primaryKey);
if (serializable == nullModel) {
return null; // depends on control dependency: [if], data = [none]
}
CPOptionCategory cpOptionCategory = (CPOptionCategory)serializable;
if (cpOptionCategory == null) {
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
cpOptionCategory = (CPOptionCategory)session.get(CPOptionCategoryImpl.class,
primaryKey); // depends on control dependency: [try], data = [none]
if (cpOptionCategory != null) {
cacheResult(cpOptionCategory); // depends on control dependency: [if], data = [(cpOptionCategory]
}
else {
entityCache.putResult(CPOptionCategoryModelImpl.ENTITY_CACHE_ENABLED,
CPOptionCategoryImpl.class, primaryKey, nullModel); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
entityCache.removeResult(CPOptionCategoryModelImpl.ENTITY_CACHE_ENABLED,
CPOptionCategoryImpl.class, primaryKey);
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
}
return cpOptionCategory;
} } |
public class class_name {
public Tag getTagEntity(String objectIRI, String label, Relation relation, String codeSystemIRI) {
Tag tag =
dataService
.query(TAG, Tag.class)
.eq(OBJECT_IRI, objectIRI)
.and()
.eq(RELATION_IRI, relation.getIRI())
.and()
.eq(CODE_SYSTEM, codeSystemIRI)
.findOne();
if (tag == null) {
tag = tagFactory.create();
tag.setId(idGenerator.generateId());
tag.setObjectIri(objectIRI);
tag.setLabel(label);
tag.setRelationIri(relation.getIRI());
tag.setRelationLabel(relation.getLabel());
tag.setCodeSystem(codeSystemIRI);
dataService.add(TAG, tag);
}
return tag;
} } | public class class_name {
public Tag getTagEntity(String objectIRI, String label, Relation relation, String codeSystemIRI) {
Tag tag =
dataService
.query(TAG, Tag.class)
.eq(OBJECT_IRI, objectIRI)
.and()
.eq(RELATION_IRI, relation.getIRI())
.and()
.eq(CODE_SYSTEM, codeSystemIRI)
.findOne();
if (tag == null) {
tag = tagFactory.create(); // depends on control dependency: [if], data = [none]
tag.setId(idGenerator.generateId()); // depends on control dependency: [if], data = [none]
tag.setObjectIri(objectIRI); // depends on control dependency: [if], data = [none]
tag.setLabel(label); // depends on control dependency: [if], data = [none]
tag.setRelationIri(relation.getIRI()); // depends on control dependency: [if], data = [none]
tag.setRelationLabel(relation.getLabel()); // depends on control dependency: [if], data = [none]
tag.setCodeSystem(codeSystemIRI); // depends on control dependency: [if], data = [none]
dataService.add(TAG, tag); // depends on control dependency: [if], data = [none]
}
return tag;
} } |
public class class_name {
private void serverHello(ServerHello mesg) throws IOException {
serverKeyExchangeReceived = false;
if (debug != null && Debug.isOn("handshake")) {
mesg.print(System.out);
}
// check if the server selected protocol version is OK for us
ProtocolVersion mesgVersion = mesg.protocolVersion;
if (!isNegotiable(mesgVersion)) {
throw new SSLHandshakeException(
"Server chose " + mesgVersion +
", but that protocol version is not enabled or not supported " +
"by the client.");
}
handshakeHash.protocolDetermined(mesgVersion);
// Set protocolVersion and propagate to SSLSocket and the
// Handshake streams
setVersion(mesgVersion);
// check the "renegotiation_info" extension
RenegotiationInfoExtension serverHelloRI = (RenegotiationInfoExtension)
mesg.extensions.get(ExtensionType.EXT_RENEGOTIATION_INFO);
if (serverHelloRI != null) {
if (isInitialHandshake) {
// verify the length of the "renegotiated_connection" field
if (!serverHelloRI.isEmpty()) {
// abort the handshake with a fatal handshake_failure alert
fatalSE(Alerts.alert_handshake_failure,
"The renegotiation_info field is not empty");
}
secureRenegotiation = true;
} else {
// For a legacy renegotiation, the client MUST verify that
// it does not contain the "renegotiation_info" extension.
if (!secureRenegotiation) {
fatalSE(Alerts.alert_handshake_failure,
"Unexpected renegotiation indication extension");
}
// verify the client_verify_data and server_verify_data values
byte[] verifyData =
new byte[clientVerifyData.length + serverVerifyData.length];
System.arraycopy(clientVerifyData, 0, verifyData,
0, clientVerifyData.length);
System.arraycopy(serverVerifyData, 0, verifyData,
clientVerifyData.length, serverVerifyData.length);
if (!Arrays.equals(verifyData,
serverHelloRI.getRenegotiatedConnection())) {
fatalSE(Alerts.alert_handshake_failure,
"Incorrect verify data in ServerHello " +
"renegotiation_info message");
}
}
} else {
// no renegotiation indication extension
if (isInitialHandshake) {
if (!allowLegacyHelloMessages) {
// abort the handshake with a fatal handshake_failure alert
fatalSE(Alerts.alert_handshake_failure,
"Failed to negotiate the use of secure renegotiation");
}
secureRenegotiation = false;
if (debug != null && Debug.isOn("handshake")) {
System.out.println("Warning: No renegotiation " +
"indication extension in ServerHello");
}
} else {
// For a secure renegotiation, the client must abort the
// handshake if no "renegotiation_info" extension is present.
if (secureRenegotiation) {
fatalSE(Alerts.alert_handshake_failure,
"No renegotiation indication extension");
}
// we have already allowed unsafe renegotation before request
// the renegotiation.
}
}
//
// Save server nonce, we always use it to compute connection
// keys and it's also used to create the master secret if we're
// creating a new session (i.e. in the full handshake).
//
svr_random = mesg.svr_random;
if (isNegotiable(mesg.cipherSuite) == false) {
fatalSE(Alerts.alert_illegal_parameter,
"Server selected improper ciphersuite " + mesg.cipherSuite);
}
setCipherSuite(mesg.cipherSuite);
if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
handshakeHash.setFinishedAlg(cipherSuite.prfAlg.getPRFHashAlg());
}
if (mesg.compression_method != 0) {
fatalSE(Alerts.alert_illegal_parameter,
"compression type not supported, "
+ mesg.compression_method);
// NOTREACHED
}
// so far so good, let's look at the session
if (session != null) {
// we tried to resume, let's see what the server decided
if (session.getSessionId().equals(mesg.sessionId)) {
// server resumed the session, let's make sure everything
// checks out
// Verify that the session ciphers are unchanged.
CipherSuite sessionSuite = session.getSuite();
if (cipherSuite != sessionSuite) {
throw new SSLProtocolException
("Server returned wrong cipher suite for session");
}
// verify protocol version match
ProtocolVersion sessionVersion = session.getProtocolVersion();
if (protocolVersion != sessionVersion) {
throw new SSLProtocolException
("Server resumed session with wrong protocol version");
}
// validate subject identity
if (sessionSuite.keyExchange == K_KRB5 ||
sessionSuite.keyExchange == K_KRB5_EXPORT) {
Principal localPrincipal = session.getLocalPrincipal();
Subject subject = null;
try {
subject = AccessController.doPrivileged(
new PrivilegedExceptionAction<Subject>() {
public Subject run() throws Exception {
return Krb5Helper.getClientSubject(getAccSE());
}});
} catch (PrivilegedActionException e) {
subject = null;
if (debug != null && Debug.isOn("session")) {
System.out.println("Attempt to obtain" +
" subject failed!");
}
}
if (subject != null) {
// Eliminate dependency on KerberosPrincipal
Set<Principal> principals =
subject.getPrincipals(Principal.class);
if (!principals.contains(localPrincipal)) {
throw new SSLProtocolException("Server resumed" +
" session with wrong subject identity");
} else {
if (debug != null && Debug.isOn("session"))
System.out.println("Subject identity is same");
}
} else {
if (debug != null && Debug.isOn("session"))
System.out.println("Kerberos credentials are not" +
" present in the current Subject; check if " +
" javax.security.auth.useSubjectAsCreds" +
" system property has been set to false");
throw new SSLProtocolException
("Server resumed session with no subject");
}
}
// looks fine; resume it, and update the state machine.
resumingSession = true;
state = HandshakeMessage.ht_finished - 1;
calculateConnectionKeys(session.getMasterSecret());
if (debug != null && Debug.isOn("session")) {
System.out.println("%% Server resumed " + session);
}
} else {
// we wanted to resume, but the server refused
session = null;
if (!enableNewSession) {
throw new SSLException("New session creation is disabled");
}
}
}
if (resumingSession && session != null) {
if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
handshakeHash.setCertificateVerifyAlg(null);
}
setHandshakeSessionSE(session);
// Reserve the handshake state if this is a session-resumption
// abbreviated initial handshake.
if (isInitialHandshake) {
session.setAsSessionResumption(true);
// NPN_CHANGES_BEGIN
npnReceived(mesg);
// NPN_CHANGES_END
}
return;
}
// check extensions
for (HelloExtension ext : mesg.extensions.list()) {
ExtensionType type = ext.type;
if ((type != ExtensionType.EXT_ELLIPTIC_CURVES)
&& (type != ExtensionType.EXT_EC_POINT_FORMATS)
&& (type != ExtensionType.EXT_SERVER_NAME)
// NPN_CHANGES_BEGIN
&& (type != ExtensionType.EXT_NEXT_PROTOCOL_NEGOTIATION)
// NPN_CHANGES_END
&& (type != ExtensionType.EXT_RENEGOTIATION_INFO)) {
fatalSE(Alerts.alert_unsupported_extension,
"Server sent an unsupported extension: " + type);
}
}
// Create a new session, we need to do the full handshake
session = new SSLSessionImpl(protocolVersion, cipherSuite,
getLocalSupportedSignAlgs(),
mesg.sessionId, getHostSE(), getPortSE());
setHandshakeSessionSE(session);
if (debug != null && Debug.isOn("handshake")) {
System.out.println("** " + cipherSuite);
}
// NPN_CHANGES_BEGIN
if (isInitialHandshake)
npnReceived(mesg);
// NPN_CHANGES_END
} } | public class class_name {
private void serverHello(ServerHello mesg) throws IOException {
serverKeyExchangeReceived = false;
if (debug != null && Debug.isOn("handshake")) {
mesg.print(System.out);
}
// check if the server selected protocol version is OK for us
ProtocolVersion mesgVersion = mesg.protocolVersion;
if (!isNegotiable(mesgVersion)) {
throw new SSLHandshakeException(
"Server chose " + mesgVersion +
", but that protocol version is not enabled or not supported " +
"by the client.");
}
handshakeHash.protocolDetermined(mesgVersion);
// Set protocolVersion and propagate to SSLSocket and the
// Handshake streams
setVersion(mesgVersion);
// check the "renegotiation_info" extension
RenegotiationInfoExtension serverHelloRI = (RenegotiationInfoExtension)
mesg.extensions.get(ExtensionType.EXT_RENEGOTIATION_INFO);
if (serverHelloRI != null) {
if (isInitialHandshake) {
// verify the length of the "renegotiated_connection" field
if (!serverHelloRI.isEmpty()) {
// abort the handshake with a fatal handshake_failure alert
fatalSE(Alerts.alert_handshake_failure,
"The renegotiation_info field is not empty"); // depends on control dependency: [if], data = [none]
}
secureRenegotiation = true;
} else {
// For a legacy renegotiation, the client MUST verify that
// it does not contain the "renegotiation_info" extension.
if (!secureRenegotiation) {
fatalSE(Alerts.alert_handshake_failure,
"Unexpected renegotiation indication extension"); // depends on control dependency: [if], data = [none]
}
// verify the client_verify_data and server_verify_data values
byte[] verifyData =
new byte[clientVerifyData.length + serverVerifyData.length];
System.arraycopy(clientVerifyData, 0, verifyData,
0, clientVerifyData.length);
System.arraycopy(serverVerifyData, 0, verifyData,
clientVerifyData.length, serverVerifyData.length);
if (!Arrays.equals(verifyData,
serverHelloRI.getRenegotiatedConnection())) {
fatalSE(Alerts.alert_handshake_failure,
"Incorrect verify data in ServerHello " +
"renegotiation_info message"); // depends on control dependency: [if], data = [none]
}
}
} else {
// no renegotiation indication extension
if (isInitialHandshake) {
if (!allowLegacyHelloMessages) {
// abort the handshake with a fatal handshake_failure alert
fatalSE(Alerts.alert_handshake_failure,
"Failed to negotiate the use of secure renegotiation");
}
secureRenegotiation = false;
if (debug != null && Debug.isOn("handshake")) {
System.out.println("Warning: No renegotiation " +
"indication extension in ServerHello");
}
} else {
// For a secure renegotiation, the client must abort the
// handshake if no "renegotiation_info" extension is present.
if (secureRenegotiation) {
fatalSE(Alerts.alert_handshake_failure,
"No renegotiation indication extension");
}
// we have already allowed unsafe renegotation before request
// the renegotiation.
}
}
//
// Save server nonce, we always use it to compute connection
// keys and it's also used to create the master secret if we're
// creating a new session (i.e. in the full handshake).
//
svr_random = mesg.svr_random;
if (isNegotiable(mesg.cipherSuite) == false) {
fatalSE(Alerts.alert_illegal_parameter,
"Server selected improper ciphersuite " + mesg.cipherSuite);
}
setCipherSuite(mesg.cipherSuite);
if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
handshakeHash.setFinishedAlg(cipherSuite.prfAlg.getPRFHashAlg());
}
if (mesg.compression_method != 0) {
fatalSE(Alerts.alert_illegal_parameter,
"compression type not supported, "
+ mesg.compression_method);
// NOTREACHED
}
// so far so good, let's look at the session
if (session != null) {
// we tried to resume, let's see what the server decided
if (session.getSessionId().equals(mesg.sessionId)) {
// server resumed the session, let's make sure everything
// checks out
// Verify that the session ciphers are unchanged.
CipherSuite sessionSuite = session.getSuite();
if (cipherSuite != sessionSuite) {
throw new SSLProtocolException
("Server returned wrong cipher suite for session");
}
// verify protocol version match
ProtocolVersion sessionVersion = session.getProtocolVersion();
if (protocolVersion != sessionVersion) {
throw new SSLProtocolException
("Server resumed session with wrong protocol version");
}
// validate subject identity
if (sessionSuite.keyExchange == K_KRB5 ||
sessionSuite.keyExchange == K_KRB5_EXPORT) {
Principal localPrincipal = session.getLocalPrincipal();
Subject subject = null;
try {
subject = AccessController.doPrivileged(
new PrivilegedExceptionAction<Subject>() {
public Subject run() throws Exception {
return Krb5Helper.getClientSubject(getAccSE());
}});
} catch (PrivilegedActionException e) {
subject = null;
if (debug != null && Debug.isOn("session")) {
System.out.println("Attempt to obtain" +
" subject failed!");
}
}
if (subject != null) {
// Eliminate dependency on KerberosPrincipal
Set<Principal> principals =
subject.getPrincipals(Principal.class);
if (!principals.contains(localPrincipal)) {
throw new SSLProtocolException("Server resumed" +
" session with wrong subject identity");
} else {
if (debug != null && Debug.isOn("session"))
System.out.println("Subject identity is same");
}
} else {
if (debug != null && Debug.isOn("session"))
System.out.println("Kerberos credentials are not" +
" present in the current Subject; check if " +
" javax.security.auth.useSubjectAsCreds" +
" system property has been set to false");
throw new SSLProtocolException
("Server resumed session with no subject");
}
}
// looks fine; resume it, and update the state machine.
resumingSession = true;
state = HandshakeMessage.ht_finished - 1;
calculateConnectionKeys(session.getMasterSecret());
if (debug != null && Debug.isOn("session")) {
System.out.println("%% Server resumed " + session);
}
} else {
// we wanted to resume, but the server refused
session = null;
if (!enableNewSession) {
throw new SSLException("New session creation is disabled");
}
}
}
if (resumingSession && session != null) {
if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
handshakeHash.setCertificateVerifyAlg(null);
}
setHandshakeSessionSE(session);
// Reserve the handshake state if this is a session-resumption
// abbreviated initial handshake.
if (isInitialHandshake) {
session.setAsSessionResumption(true);
// NPN_CHANGES_BEGIN
npnReceived(mesg);
// NPN_CHANGES_END
}
return;
}
// check extensions
for (HelloExtension ext : mesg.extensions.list()) {
ExtensionType type = ext.type;
if ((type != ExtensionType.EXT_ELLIPTIC_CURVES)
&& (type != ExtensionType.EXT_EC_POINT_FORMATS)
&& (type != ExtensionType.EXT_SERVER_NAME)
// NPN_CHANGES_BEGIN
&& (type != ExtensionType.EXT_NEXT_PROTOCOL_NEGOTIATION)
// NPN_CHANGES_END
&& (type != ExtensionType.EXT_RENEGOTIATION_INFO)) {
fatalSE(Alerts.alert_unsupported_extension,
"Server sent an unsupported extension: " + type);
}
}
// Create a new session, we need to do the full handshake
session = new SSLSessionImpl(protocolVersion, cipherSuite,
getLocalSupportedSignAlgs(),
mesg.sessionId, getHostSE(), getPortSE());
setHandshakeSessionSE(session);
if (debug != null && Debug.isOn("handshake")) {
System.out.println("** " + cipherSuite);
}
// NPN_CHANGES_BEGIN
if (isInitialHandshake)
npnReceived(mesg);
// NPN_CHANGES_END
} } |
public class class_name {
public static IntSet and (IntSet... sets)
{
checkNotNull(sets);
IntSet result = create();
int len = sets.length;
if (len > 0) {
OUTER:
for (Interator it = sets[0].interator(); it.hasNext(); ) {
int val = it.nextInt();
for (int ii = 1; ii < len; ii++) {
if (!sets[ii].contains(val)) {
continue OUTER;
}
}
result.add(val);
}
}
return result;
} } | public class class_name {
public static IntSet and (IntSet... sets)
{
checkNotNull(sets);
IntSet result = create();
int len = sets.length;
if (len > 0) {
OUTER:
for (Interator it = sets[0].interator(); it.hasNext(); ) {
int val = it.nextInt();
for (int ii = 1; ii < len; ii++) {
if (!sets[ii].contains(val)) {
continue OUTER;
}
}
result.add(val); // depends on control dependency: [for], data = [none]
}
}
return result;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public <T,I> Collection<T> startWorking(Collection<Callable<I>> callables)
{
List<Future<I>> list = new ArrayList<Future<I>>();
for (Callable<I> callable : callables)
{
list.add(executor.submit(callable));
}
ArrayList<T> resultList = new ArrayList<T>(callables.size());
// Now retrieve the result
I output;
for (Future<I> future : list)
{
try
{
output = future.get();
if(output != null)
resultList.add((T)output);
}
catch (InterruptedException e)
{
throw new SystemException(e);
}
catch (ExecutionException e)
{
Throwable cause = e.getCause();
if(cause == null)
cause = e;
if(cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new SystemException(cause);
}
}
return resultList;
} } | public class class_name {
@SuppressWarnings("unchecked")
public <T,I> Collection<T> startWorking(Collection<Callable<I>> callables)
{
List<Future<I>> list = new ArrayList<Future<I>>();
for (Callable<I> callable : callables)
{
list.add(executor.submit(callable));
// depends on control dependency: [for], data = [callable]
}
ArrayList<T> resultList = new ArrayList<T>(callables.size());
// Now retrieve the result
I output;
for (Future<I> future : list)
{
try
{
output = future.get();
// depends on control dependency: [try], data = [none]
if(output != null)
resultList.add((T)output);
}
catch (InterruptedException e)
{
throw new SystemException(e);
}
// depends on control dependency: [catch], data = [none]
catch (ExecutionException e)
{
Throwable cause = e.getCause();
if(cause == null)
cause = e;
if(cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new SystemException(cause);
}
// depends on control dependency: [catch], data = [none]
}
return resultList;
} } |
public class class_name {
static byte[][] getPathComponents(String[] strings) {
if (strings.length == 0) {
return new byte[][]{null};
}
byte[][] bytes = new byte[strings.length][];
for (int i = 0; i < strings.length; i++)
bytes[i] = DFSUtil.string2Bytes(strings[i]);
return bytes;
} } | public class class_name {
static byte[][] getPathComponents(String[] strings) {
if (strings.length == 0) {
return new byte[][]{null}; // depends on control dependency: [if], data = [none]
}
byte[][] bytes = new byte[strings.length][];
for (int i = 0; i < strings.length; i++)
bytes[i] = DFSUtil.string2Bytes(strings[i]);
return bytes;
} } |
public class class_name {
public static Double convertDouble(Object input) {
Double result = null;
if (input instanceof Double) {
result = (Double)input;
} else if (input instanceof Number) {
result = Double.valueOf(((Number)input).doubleValue());
} else if (input instanceof A_CmsJspValueWrapper) {
result = ((A_CmsJspValueWrapper)input).getToDouble();
} else {
if (input != null) {
String str = String.valueOf(input);
// support both "10,0" and "10.0" comma style
str = str.replace(',', '.');
try {
result = Double.valueOf(str);
} catch (NumberFormatException e) {
LOG.info(e.getLocalizedMessage());
}
}
}
return result;
} } | public class class_name {
public static Double convertDouble(Object input) {
Double result = null;
if (input instanceof Double) {
result = (Double)input; // depends on control dependency: [if], data = [none]
} else if (input instanceof Number) {
result = Double.valueOf(((Number)input).doubleValue()); // depends on control dependency: [if], data = [none]
} else if (input instanceof A_CmsJspValueWrapper) {
result = ((A_CmsJspValueWrapper)input).getToDouble(); // depends on control dependency: [if], data = [none]
} else {
if (input != null) {
String str = String.valueOf(input);
// support both "10,0" and "10.0" comma style
str = str.replace(',', '.'); // depends on control dependency: [if], data = [none]
try {
result = Double.valueOf(str); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
LOG.info(e.getLocalizedMessage());
} // depends on control dependency: [catch], data = [none]
}
}
return result;
} } |
public class class_name {
public void addOption(Setter setter, Option o) {
checkNonNull(setter, "Setter");
checkNonNull(o, "Option");
checkOptionNotInMap(o.name());
for (String alias : o.aliases()) {
checkOptionNotInMap(alias);
}
options.add(createOptionHandler(new NamedOptionDef(o), setter));
} } | public class class_name {
public void addOption(Setter setter, Option o) {
checkNonNull(setter, "Setter");
checkNonNull(o, "Option");
checkOptionNotInMap(o.name());
for (String alias : o.aliases()) {
checkOptionNotInMap(alias); // depends on control dependency: [for], data = [alias]
}
options.add(createOptionHandler(new NamedOptionDef(o), setter));
} } |
public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper) {
TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0);
TypeInformation<NV> valueType;
if (mapper instanceof ResultTypeQueryable) {
valueType = ((ResultTypeQueryable) mapper).getProducedType();
} else {
valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, vertices.getType(), null);
}
TypeInformation<Vertex<K, NV>> returnType = (TypeInformation<Vertex<K, NV>>) new TupleTypeInfo(
Vertex.class, keyType, valueType);
return mapVertices(mapper, returnType);
} } | public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper) {
TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0);
TypeInformation<NV> valueType;
if (mapper instanceof ResultTypeQueryable) {
valueType = ((ResultTypeQueryable) mapper).getProducedType(); // depends on control dependency: [if], data = [none]
} else {
valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, vertices.getType(), null); // depends on control dependency: [if], data = [none]
}
TypeInformation<Vertex<K, NV>> returnType = (TypeInformation<Vertex<K, NV>>) new TupleTypeInfo(
Vertex.class, keyType, valueType);
return mapVertices(mapper, returnType);
} } |
public class class_name {
@Override
public String shutdown() {
client.shutdown();
String status;
try {
status = client.getStatusCodeReply();
} catch (JedisException ex) {
status = null;
}
return status;
} } | public class class_name {
@Override
public String shutdown() {
client.shutdown();
String status;
try {
status = client.getStatusCodeReply(); // depends on control dependency: [try], data = [none]
} catch (JedisException ex) {
status = null;
} // depends on control dependency: [catch], data = [none]
return status;
} } |
public class class_name {
@Override
public boolean containsKey(Object key) {
if (fast) {
return (map.containsKey(key));
} else {
synchronized (map) {
return (map.containsKey(key));
}
}
} } | public class class_name {
@Override
public boolean containsKey(Object key) {
if (fast) {
return (map.containsKey(key));
// depends on control dependency: [if], data = [none]
} else {
synchronized (map) {
// depends on control dependency: [if], data = [none]
return (map.containsKey(key));
}
}
} } |
public class class_name {
public boolean matches(HostName host) {
if(this == host) {
return true;
}
if(isValid()) {
if(host.isValid()) {
if(isAddressString()) {
return host.isAddressString()
&& asAddressString().equals(host.asAddressString())
&& Objects.equals(getPort(), host.getPort())
&& Objects.equals(getService(), host.getService());
}
if(host.isAddressString()) {
return false;
}
String thisHost = parsedHost.getHost();
String otherHost = host.parsedHost.getHost();
if(!thisHost.equals(otherHost)) {
return false;
}
return Objects.equals(parsedHost.getEquivalentPrefixLength(), host.parsedHost.getEquivalentPrefixLength()) &&
Objects.equals(parsedHost.getMask(), host.parsedHost.getMask()) &&
Objects.equals(parsedHost.getPort(), host.parsedHost.getPort()) &&
Objects.equals(parsedHost.getService(), host.parsedHost.getService());
}
return false;
}
return !host.isValid() && toString().equals(host.toString());
} } | public class class_name {
public boolean matches(HostName host) {
if(this == host) {
return true; // depends on control dependency: [if], data = [none]
}
if(isValid()) {
if(host.isValid()) {
if(isAddressString()) {
return host.isAddressString()
&& asAddressString().equals(host.asAddressString())
&& Objects.equals(getPort(), host.getPort())
&& Objects.equals(getService(), host.getService()); // depends on control dependency: [if], data = [none]
}
if(host.isAddressString()) {
return false; // depends on control dependency: [if], data = [none]
}
String thisHost = parsedHost.getHost();
String otherHost = host.parsedHost.getHost();
if(!thisHost.equals(otherHost)) {
return false; // depends on control dependency: [if], data = [none]
}
return Objects.equals(parsedHost.getEquivalentPrefixLength(), host.parsedHost.getEquivalentPrefixLength()) &&
Objects.equals(parsedHost.getMask(), host.parsedHost.getMask()) &&
Objects.equals(parsedHost.getPort(), host.parsedHost.getPort()) &&
Objects.equals(parsedHost.getService(), host.parsedHost.getService()); // depends on control dependency: [if], data = [none]
}
return false; // depends on control dependency: [if], data = [none]
}
return !host.isValid() && toString().equals(host.toString());
} } |
public class class_name {
public void setAll(double value) {
VectorIterator it = iterator();
while (it.hasNext()) {
it.next();
it.set(value);
}
} } | public class class_name {
public void setAll(double value) {
VectorIterator it = iterator();
while (it.hasNext()) {
it.next(); // depends on control dependency: [while], data = [none]
it.set(value); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public ResultSet executeQuery(){
Long start = null;
if (logger.isTraceEnabled()) {
start = System.currentTimeMillis();
}
try {
return this.statement.executeQuery();
} catch (SQLException ex) {
throw new ApplicationException(Code.BACKEND_ERROR, ex);
} finally {
if (null != start && logger.isTraceEnabled()) {
long end = System.currentTimeMillis();
logger.trace("[{}ms] {}", (end - start), rawQuery);
}
}
} } | public class class_name {
public ResultSet executeQuery(){
Long start = null;
if (logger.isTraceEnabled()) {
start = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
}
try {
return this.statement.executeQuery(); // depends on control dependency: [try], data = [none]
} catch (SQLException ex) {
throw new ApplicationException(Code.BACKEND_ERROR, ex);
} finally { // depends on control dependency: [catch], data = [none]
if (null != start && logger.isTraceEnabled()) {
long end = System.currentTimeMillis();
logger.trace("[{}ms] {}", (end - start), rawQuery); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void handleAttemptSuccess(List<MutateRowsResponse> responses) {
List<FailedMutation> allFailures = Lists.newArrayList(permanentFailures);
MutateRowsRequest lastRequest = currentRequest;
Builder builder = lastRequest.toBuilder().clearEntries();
List<Integer> newOriginalIndexes = Lists.newArrayList();
for (MutateRowsResponse response : responses) {
for (Entry entry : response.getEntriesList()) {
if (entry.getStatus().getCode() == Code.OK_VALUE) {
continue;
}
int origIndex = getOriginalIndex((int) entry.getIndex());
FailedMutation failedMutation =
FailedMutation.create(origIndex, createEntryError(entry.getStatus()));
allFailures.add(failedMutation);
if (!failedMutation.getError().isRetryable()) {
permanentFailures.add(failedMutation);
} else {
// Schedule the mutation entry for the next RPC by adding it to the request builder and
// recording it's original index
newOriginalIndexes.add(origIndex);
builder.addEntries(lastRequest.getEntries((int) entry.getIndex()));
}
}
}
currentRequest = builder.build();
originalIndexes = newOriginalIndexes;
if (!allFailures.isEmpty()) {
boolean isRetryable = builder.getEntriesCount() > 0;
throw new MutateRowsException(null, allFailures, isRetryable);
}
} } | public class class_name {
private void handleAttemptSuccess(List<MutateRowsResponse> responses) {
List<FailedMutation> allFailures = Lists.newArrayList(permanentFailures);
MutateRowsRequest lastRequest = currentRequest;
Builder builder = lastRequest.toBuilder().clearEntries();
List<Integer> newOriginalIndexes = Lists.newArrayList();
for (MutateRowsResponse response : responses) {
for (Entry entry : response.getEntriesList()) {
if (entry.getStatus().getCode() == Code.OK_VALUE) {
continue;
}
int origIndex = getOriginalIndex((int) entry.getIndex());
FailedMutation failedMutation =
FailedMutation.create(origIndex, createEntryError(entry.getStatus()));
allFailures.add(failedMutation); // depends on control dependency: [for], data = [none]
if (!failedMutation.getError().isRetryable()) {
permanentFailures.add(failedMutation); // depends on control dependency: [if], data = [none]
} else {
// Schedule the mutation entry for the next RPC by adding it to the request builder and
// recording it's original index
newOriginalIndexes.add(origIndex); // depends on control dependency: [if], data = [none]
builder.addEntries(lastRequest.getEntries((int) entry.getIndex())); // depends on control dependency: [if], data = [none]
}
}
}
currentRequest = builder.build();
originalIndexes = newOriginalIndexes;
if (!allFailures.isEmpty()) {
boolean isRetryable = builder.getEntriesCount() > 0;
throw new MutateRowsException(null, allFailures, isRetryable);
}
} } |
public class class_name {
public static void fixCommonConfigurationProblems() {
long diskCacheSize = OGlobalConfiguration.DISK_CACHE_SIZE.getValueAsLong();
final int max32BitCacheSize = 512;
if (getJavaBitWidth() == 32 && diskCacheSize > max32BitCacheSize) {
OLogManager.instance()
.infoNoDb(OGlobalConfiguration.class, "32 bit JVM is detected. Lowering disk cache size from %,dMB to %,dMB.",
diskCacheSize, max32BitCacheSize);
OGlobalConfiguration.DISK_CACHE_SIZE.setValue(max32BitCacheSize);
}
} } | public class class_name {
public static void fixCommonConfigurationProblems() {
long diskCacheSize = OGlobalConfiguration.DISK_CACHE_SIZE.getValueAsLong();
final int max32BitCacheSize = 512;
if (getJavaBitWidth() == 32 && diskCacheSize > max32BitCacheSize) {
OLogManager.instance()
.infoNoDb(OGlobalConfiguration.class, "32 bit JVM is detected. Lowering disk cache size from %,dMB to %,dMB.",
diskCacheSize, max32BitCacheSize); // depends on control dependency: [if], data = [none]
OGlobalConfiguration.DISK_CACHE_SIZE.setValue(max32BitCacheSize); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static ProtocolServer create(String protocol, Context context, ClassLoader classLoader, String netimpl) {
if (netimpl != null) netimpl = netimpl.trim();
if ("TCP".equalsIgnoreCase(protocol)) {
if (netimpl == null || netimpl.isEmpty()) {
return new TcpAioProtocolServer(context);
} else if ("aio".equalsIgnoreCase(netimpl)) {
return new TcpAioProtocolServer(context);
} else if ("nio".equalsIgnoreCase(netimpl)) {
return null;// return new TcpNioProtocolServer(context);
}
} else if ("UDP".equalsIgnoreCase(protocol)) {
if (netimpl == null || netimpl.isEmpty()) {
return null;// return new UdpBioProtocolServer(context);
} else if ("bio".equalsIgnoreCase(netimpl)) {
return null;// return new UdpBioProtocolServer(context);
}
} else if (netimpl == null || netimpl.isEmpty()) {
throw new RuntimeException("ProtocolServer not support protocol " + protocol);
}
try {
if (classLoader == null) classLoader = Thread.currentThread().getContextClassLoader();
Class clazz = classLoader.loadClass(netimpl);
return (ProtocolServer) clazz.getDeclaredConstructor(Context.class).newInstance(context);
} catch (Exception e) {
throw new RuntimeException("ProtocolServer(netimple=" + netimpl + ") newinstance error", e);
}
} } | public class class_name {
public static ProtocolServer create(String protocol, Context context, ClassLoader classLoader, String netimpl) {
if (netimpl != null) netimpl = netimpl.trim();
if ("TCP".equalsIgnoreCase(protocol)) {
if (netimpl == null || netimpl.isEmpty()) {
return new TcpAioProtocolServer(context);
// depends on control dependency: [if], data = [none]
} else if ("aio".equalsIgnoreCase(netimpl)) {
return new TcpAioProtocolServer(context);
// depends on control dependency: [if], data = [none]
} else if ("nio".equalsIgnoreCase(netimpl)) {
return null;// return new TcpNioProtocolServer(context);
// depends on control dependency: [if], data = [none]
}
} else if ("UDP".equalsIgnoreCase(protocol)) {
if (netimpl == null || netimpl.isEmpty()) {
return null;// return new UdpBioProtocolServer(context);
// depends on control dependency: [if], data = [none]
} else if ("bio".equalsIgnoreCase(netimpl)) {
return null;// return new UdpBioProtocolServer(context);
// depends on control dependency: [if], data = [none]
}
} else if (netimpl == null || netimpl.isEmpty()) {
throw new RuntimeException("ProtocolServer not support protocol " + protocol);
}
try {
if (classLoader == null) classLoader = Thread.currentThread().getContextClassLoader();
Class clazz = classLoader.loadClass(netimpl);
return (ProtocolServer) clazz.getDeclaredConstructor(Context.class).newInstance(context);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("ProtocolServer(netimple=" + netimpl + ") newinstance error", e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void removeColumnsAfter(JComponent columnContent) {
boolean remove = false;
for (Iterator<JComponent> it = componentNodeMap.keySet().iterator(); it.hasNext();) {
JComponent comp = it.next();
Node curNode = componentNodeMap.get(comp);
if (comp.equals(columnContent)) {
remove = true;
}
else if (remove) {
it.remove();
node.removeChild(curNode);
}
}
columns.rebuild();
columns.validate();
} } | public class class_name {
public void removeColumnsAfter(JComponent columnContent) {
boolean remove = false;
for (Iterator<JComponent> it = componentNodeMap.keySet().iterator(); it.hasNext();) {
JComponent comp = it.next();
Node curNode = componentNodeMap.get(comp);
if (comp.equals(columnContent)) {
remove = true; // depends on control dependency: [if], data = [none]
}
else if (remove) {
it.remove(); // depends on control dependency: [if], data = [none]
node.removeChild(curNode); // depends on control dependency: [if], data = [none]
}
}
columns.rebuild();
columns.validate();
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.