code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public boolean hasPermission(User user, E userGroup, Permission permission) {
// always grant READ access to groups in which the user itself is a member
if (user != null && permission.equals(Permission.READ)
&& userGroup.getMembers().contains(user)) {
LOG.trace("Granting READ access on group where the user is member.");
return true;
}
// call parent implementation
return super.hasPermission(user, userGroup, permission);
} } | public class class_name {
@Override
public boolean hasPermission(User user, E userGroup, Permission permission) {
// always grant READ access to groups in which the user itself is a member
if (user != null && permission.equals(Permission.READ)
&& userGroup.getMembers().contains(user)) {
LOG.trace("Granting READ access on group where the user is member."); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
// call parent implementation
return super.hasPermission(user, userGroup, permission);
} } |
public class class_name {
private static String getSkippedPackagesMessage(Set<String> skippedPackages, int skippedLines, int indentationLevel) {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < 2 + indentationLevel; i++) {
stringBuilder.append(INDENT);
}
stringBuilder.append(skippedLines).append(" line").append((skippedLines == 1 ? "" : "s")).append(" skipped for ")
.append(skippedPackages);
return stringBuilder.toString();
} } | public class class_name {
private static String getSkippedPackagesMessage(Set<String> skippedPackages, int skippedLines, int indentationLevel) {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < 2 + indentationLevel; i++) {
stringBuilder.append(INDENT); // depends on control dependency: [for], data = [none]
}
stringBuilder.append(skippedLines).append(" line").append((skippedLines == 1 ? "" : "s")).append(" skipped for ")
.append(skippedPackages);
return stringBuilder.toString();
} } |
public class class_name {
public void handle(Object job)
{
Socket socket = (Socket) job;
try
{
if (_tcpNoDelay) socket.setTcpNoDelay(true);
handleConnection(socket);
}
catch (Exception e)
{
log.debug("Connection problem", e);
}
finally
{
try
{
socket.close();
}
catch (Exception e)
{
log.debug("Connection problem", e);
}
}
} } | public class class_name {
public void handle(Object job)
{
Socket socket = (Socket) job;
try
{
if (_tcpNoDelay) socket.setTcpNoDelay(true);
handleConnection(socket); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
log.debug("Connection problem", e);
} // depends on control dependency: [catch], data = [none]
finally
{
try
{
socket.close(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
log.debug("Connection problem", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected void stopAllActiveJobs() {
for (Long jobExecutionId : executingJobs.keySet()) {
try {
logger.log(Level.INFO, "stopping.job.at.shutdown", jobExecutionId);
stopJob(jobExecutionId);
} catch (Exception e) {
// FFDC it. Could be the job just finished. In any event,
// continue on and stop the remaining jobs.
}
}
} } | public class class_name {
protected void stopAllActiveJobs() {
for (Long jobExecutionId : executingJobs.keySet()) {
try {
logger.log(Level.INFO, "stopping.job.at.shutdown", jobExecutionId); // depends on control dependency: [try], data = [none]
stopJob(jobExecutionId); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// FFDC it. Could be the job just finished. In any event,
// continue on and stop the remaining jobs.
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void getAndSetNodeDataSize(String nodePath)
{
try
{
long dataSize = getNodeDataSizeDirectly(nodePath);
quotaPersister.setNodeDataSizeIfQuotaExists(rName, wsName, nodePath, dataSize);
}
catch (QuotaManagerException e)
{
LOG.warn("Can't calculate node data size " + nodePath + " because: " + e.getCause().getMessage());
}
} } | public class class_name {
public void getAndSetNodeDataSize(String nodePath)
{
try
{
long dataSize = getNodeDataSizeDirectly(nodePath);
quotaPersister.setNodeDataSizeIfQuotaExists(rName, wsName, nodePath, dataSize); // depends on control dependency: [try], data = [none]
}
catch (QuotaManagerException e)
{
LOG.warn("Can't calculate node data size " + nodePath + " because: " + e.getCause().getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
String getHiddenInputHtmlForRequestParameters() {
StringBuilder html = new StringBuilder();
if (parameterMap != null) {
Set<Entry<String, String[]>> entries = parameterMap.entrySet();
for (Entry<String, String[]> entry : entries) {
html.append(getHiddenInputForRequestParam(entry));
}
}
return html.toString();
} } | public class class_name {
String getHiddenInputHtmlForRequestParameters() {
StringBuilder html = new StringBuilder();
if (parameterMap != null) {
Set<Entry<String, String[]>> entries = parameterMap.entrySet();
for (Entry<String, String[]> entry : entries) {
html.append(getHiddenInputForRequestParam(entry)); // depends on control dependency: [for], data = [entry]
}
}
return html.toString();
} } |
public class class_name {
protected ArrayList<String> _split_multi_line(String text, int max_len) {
// TODO Auto-generated method stub
ArrayList<String> output = new ArrayList<String>();
text = text.trim();
if(text.length() <= max_len) {
output.add(text);
return output;
}
ArrayList<String> words = new ArrayList<String>();
Collections.addAll(words, text.split("\\s+"));
while(!words.isEmpty()) {
text = words.remove(0);
while(!words.isEmpty() && (text.length() + 1 + words.get(0).length()) <= max_len) {
text += " " + words.remove(0);
text = text.trim();
}
output.add(text);
}
assert words.isEmpty();
return output;
} } | public class class_name {
protected ArrayList<String> _split_multi_line(String text, int max_len) {
// TODO Auto-generated method stub
ArrayList<String> output = new ArrayList<String>();
text = text.trim();
if(text.length() <= max_len) {
output.add(text); // depends on control dependency: [if], data = [none]
return output; // depends on control dependency: [if], data = [none]
}
ArrayList<String> words = new ArrayList<String>();
Collections.addAll(words, text.split("\\s+"));
while(!words.isEmpty()) {
text = words.remove(0); // depends on control dependency: [while], data = [none]
while(!words.isEmpty() && (text.length() + 1 + words.get(0).length()) <= max_len) {
text += " " + words.remove(0); // depends on control dependency: [while], data = [none]
text = text.trim(); // depends on control dependency: [while], data = [none]
}
output.add(text); // depends on control dependency: [while], data = [none]
}
assert words.isEmpty();
return output;
} } |
public class class_name {
public static String getEventsAsJsonTracySegment() {
// Assuming max 8 frames per segment. Typical Tracy JSON frame is ~250
// ( 250 * 8 = 2000). Rounding up to 2048
final int TRACY_SEGMENT_CHAR_SIZE = 2048;
String jsonArrayString = null;
int frameCounter = 0;
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx) && ctx.getPoppedList().size()>0) {
StringBuilder sb = new StringBuilder(TRACY_SEGMENT_CHAR_SIZE);
sb.append("{\"tracySegment\":[");
for (TracyEvent event : ctx.getPoppedList()) {
if (frameCounter > 0) {
sb.append(",");
}
sb.append(event.toJsonString());
frameCounter++;
}
sb.append("]}");
jsonArrayString = sb.toString();
}
return jsonArrayString;
} } | public class class_name {
public static String getEventsAsJsonTracySegment() {
// Assuming max 8 frames per segment. Typical Tracy JSON frame is ~250
// ( 250 * 8 = 2000). Rounding up to 2048
final int TRACY_SEGMENT_CHAR_SIZE = 2048;
String jsonArrayString = null;
int frameCounter = 0;
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx) && ctx.getPoppedList().size()>0) {
StringBuilder sb = new StringBuilder(TRACY_SEGMENT_CHAR_SIZE);
sb.append("{\"tracySegment\":["); // depends on control dependency: [if], data = [none]
for (TracyEvent event : ctx.getPoppedList()) {
if (frameCounter > 0) {
sb.append(","); // depends on control dependency: [if], data = [none]
}
sb.append(event.toJsonString()); // depends on control dependency: [for], data = [event]
frameCounter++; // depends on control dependency: [for], data = [none]
}
sb.append("]}"); // depends on control dependency: [if], data = [none]
jsonArrayString = sb.toString(); // depends on control dependency: [if], data = [none]
}
return jsonArrayString;
} } |
public class class_name {
public void texture(Shape shape, Image image, float scaleX, float scaleY,
boolean fit) {
predraw();
TextureImpl.bindNone();
currentColor.bind();
if (fit) {
ShapeRenderer.textureFit(shape, image, scaleX, scaleY);
} else {
ShapeRenderer.texture(shape, image, scaleX, scaleY);
}
postdraw();
} } | public class class_name {
public void texture(Shape shape, Image image, float scaleX, float scaleY,
boolean fit) {
predraw();
TextureImpl.bindNone();
currentColor.bind();
if (fit) {
ShapeRenderer.textureFit(shape, image, scaleX, scaleY);
// depends on control dependency: [if], data = [none]
} else {
ShapeRenderer.texture(shape, image, scaleX, scaleY);
// depends on control dependency: [if], data = [none]
}
postdraw();
} } |
public class class_name {
public Headers toHeaders() {
Headers headers = new Headers();
if (!getMatch().isEmpty()) {
headers = headers.add(new Header(HeaderConstants.IF_MATCH, buildTagHeaderValue(getMatch())));
}
if (!getNoneMatch().isEmpty()) {
headers = headers.add(new Header(HeaderConstants.IF_NONE_MATCH, buildTagHeaderValue(getNoneMatch())));
}
if (modifiedSince.isPresent()) {
headers = headers.set(HeaderUtils.toHttpDate(HeaderConstants.IF_MODIFIED_SINCE, modifiedSince.get()));
}
if (unModifiedSince.isPresent()) {
headers = headers.set(HeaderUtils.toHttpDate(HeaderConstants.IF_UNMODIFIED_SINCE, unModifiedSince.get()));
}
return headers;
} } | public class class_name {
public Headers toHeaders() {
Headers headers = new Headers();
if (!getMatch().isEmpty()) {
headers = headers.add(new Header(HeaderConstants.IF_MATCH, buildTagHeaderValue(getMatch()))); // depends on control dependency: [if], data = [none]
}
if (!getNoneMatch().isEmpty()) {
headers = headers.add(new Header(HeaderConstants.IF_NONE_MATCH, buildTagHeaderValue(getNoneMatch()))); // depends on control dependency: [if], data = [none]
}
if (modifiedSince.isPresent()) {
headers = headers.set(HeaderUtils.toHttpDate(HeaderConstants.IF_MODIFIED_SINCE, modifiedSince.get())); // depends on control dependency: [if], data = [none]
}
if (unModifiedSince.isPresent()) {
headers = headers.set(HeaderUtils.toHttpDate(HeaderConstants.IF_UNMODIFIED_SINCE, unModifiedSince.get())); // depends on control dependency: [if], data = [none]
}
return headers;
} } |
public class class_name {
private boolean creatingFunctionShortensGremlin(GroovyExpression headExpr) {
int tailLength = getTailLength();
int length = headExpr.toString().length() - tailLength;
int overhead = 0;
if (nextFunctionBodyStart instanceof AbstractFunctionExpression) {
overhead = functionDefLength;
} else {
overhead = INITIAL_FUNCTION_DEF_LENGTH;
}
overhead += FUNCTION_CALL_OVERHEAD * scaleFactor;
//length * scaleFactor = space taken by having the expression be inlined [scaleFactor] times
//overhead + length = space taken by the function definition and its calls
return length * scaleFactor > overhead + length;
} } | public class class_name {
private boolean creatingFunctionShortensGremlin(GroovyExpression headExpr) {
int tailLength = getTailLength();
int length = headExpr.toString().length() - tailLength;
int overhead = 0;
if (nextFunctionBodyStart instanceof AbstractFunctionExpression) {
overhead = functionDefLength; // depends on control dependency: [if], data = [none]
} else {
overhead = INITIAL_FUNCTION_DEF_LENGTH; // depends on control dependency: [if], data = [none]
}
overhead += FUNCTION_CALL_OVERHEAD * scaleFactor;
//length * scaleFactor = space taken by having the expression be inlined [scaleFactor] times
//overhead + length = space taken by the function definition and its calls
return length * scaleFactor > overhead + length;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static FieldSpec<SaveInstanceStateAnn>[] getSaveInstanceSpecs(Class<?> cls) {
FieldSpec<SaveInstanceStateAnn>[] specs = SAVE_INSTANCE_SPECS.get(cls);
if (specs == null) {
ArrayList<FieldSpec<SaveInstanceStateAnn>> list = new ArrayList<FieldSpec<SaveInstanceStateAnn>>();
for (Field field : getFieldHierarchy(cls)) {
SaveInstanceStateAnn ann = getSaveInstanceStateAnn(field);
if (ann != null) {
list.add(new FieldSpec<SaveInstanceStateAnn>(field, ann));
}
}
specs = list.toArray(new FieldSpec[list.size()]);
SAVE_INSTANCE_SPECS.put(cls, specs);
}
return specs;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static FieldSpec<SaveInstanceStateAnn>[] getSaveInstanceSpecs(Class<?> cls) {
FieldSpec<SaveInstanceStateAnn>[] specs = SAVE_INSTANCE_SPECS.get(cls);
if (specs == null) {
ArrayList<FieldSpec<SaveInstanceStateAnn>> list = new ArrayList<FieldSpec<SaveInstanceStateAnn>>();
for (Field field : getFieldHierarchy(cls)) {
SaveInstanceStateAnn ann = getSaveInstanceStateAnn(field);
if (ann != null) {
list.add(new FieldSpec<SaveInstanceStateAnn>(field, ann)); // depends on control dependency: [if], data = [none]
}
}
specs = list.toArray(new FieldSpec[list.size()]); // depends on control dependency: [if], data = [none]
SAVE_INSTANCE_SPECS.put(cls, specs); // depends on control dependency: [if], data = [none]
}
return specs;
} } |
public class class_name {
public DynaTreeNode getDomainTree(String domainName) {
DynaTreeNode domainNode = new DynaTreeNode()
.setTitle(domainName)
.setKey(domainName)
.setMode(MODE_DOMAIN);
try {
// List all objects in the domain
ObjectName name = new ObjectName(domainName + ":*");
Set<ObjectName> objs = mBeanServer.queryNames(name, null);
// Convert object naems to a tree
for (ObjectName objName : objs) {
MBeanInfo info = mBeanServer.getMBeanInfo(objName);
Matcher m = csvRE.matcher(objName.getKeyPropertyListString());
DynaTreeNode node = domainNode;
StringBuilder innerKey = new StringBuilder();
innerKey.append(domainName).append(":");
while (m.find()) {
String title = StringUtils.removeEnd(m.group(), ",");
String key = StringUtils.substringBefore(title, "=");
String value = StringUtils.substringAfter(title, "=");
value = StringUtils.removeStart(value, "\"");
value = StringUtils.removeEnd (value, "\"");
innerKey.append(title).append(",");
DynaTreeNode next = node.getChild(value);
if (next == null) {
next = new DynaTreeNode()
.setTitle(value)
.setMode(MODE_INNER)
.setKey(innerKey.toString() + "*")
.setNoLink(false);
node.putChild(next);
}
node = next;
}
node.setKey(objName.getCanonicalName())
.setMode(MODE_LEAF);
if ( info.getAttributes() != null
|| info.getOperations() != null
|| info.getNotifications() != null) {
node.setNoLink(false);
}
}
} catch (MalformedObjectNameException e) {
LOG.error("Exception in getDomainTree ", e);
} catch (IntrospectionException e) {
LOG.error("Exception in getDomainTree ", e);
} catch (ReflectionException e) {
LOG.error("Exception in getDomainTree ", e);
} catch (InstanceNotFoundException e) {
LOG.error("Exception in getDomainTree ", e);
} catch (RuntimeException e) {
LOG.error("Exception in getDomainTree ", e);
}
return domainNode;
} } | public class class_name {
public DynaTreeNode getDomainTree(String domainName) {
DynaTreeNode domainNode = new DynaTreeNode()
.setTitle(domainName)
.setKey(domainName)
.setMode(MODE_DOMAIN);
try {
// List all objects in the domain
ObjectName name = new ObjectName(domainName + ":*");
Set<ObjectName> objs = mBeanServer.queryNames(name, null);
// Convert object naems to a tree
for (ObjectName objName : objs) {
MBeanInfo info = mBeanServer.getMBeanInfo(objName);
Matcher m = csvRE.matcher(objName.getKeyPropertyListString());
DynaTreeNode node = domainNode;
StringBuilder innerKey = new StringBuilder();
innerKey.append(domainName).append(":"); // depends on control dependency: [for], data = [none]
while (m.find()) {
String title = StringUtils.removeEnd(m.group(), ",");
String key = StringUtils.substringBefore(title, "=");
String value = StringUtils.substringAfter(title, "=");
value = StringUtils.removeStart(value, "\""); // depends on control dependency: [while], data = [none]
value = StringUtils.removeEnd (value, "\""); // depends on control dependency: [while], data = [none]
innerKey.append(title).append(","); // depends on control dependency: [while], data = [none]
DynaTreeNode next = node.getChild(value);
if (next == null) {
next = new DynaTreeNode()
.setTitle(value)
.setMode(MODE_INNER)
.setKey(innerKey.toString() + "*")
.setNoLink(false); // depends on control dependency: [if], data = [none]
node.putChild(next); // depends on control dependency: [if], data = [(next]
}
node = next; // depends on control dependency: [while], data = [none]
}
node.setKey(objName.getCanonicalName())
.setMode(MODE_LEAF); // depends on control dependency: [for], data = [objName]
if ( info.getAttributes() != null
|| info.getOperations() != null
|| info.getNotifications() != null) {
node.setNoLink(false); // depends on control dependency: [if], data = [none]
}
}
} catch (MalformedObjectNameException e) {
LOG.error("Exception in getDomainTree ", e);
} catch (IntrospectionException e) { // depends on control dependency: [catch], data = [none]
LOG.error("Exception in getDomainTree ", e);
} catch (ReflectionException e) { // depends on control dependency: [catch], data = [none]
LOG.error("Exception in getDomainTree ", e);
} catch (InstanceNotFoundException e) { // depends on control dependency: [catch], data = [none]
LOG.error("Exception in getDomainTree ", e);
} catch (RuntimeException e) { // depends on control dependency: [catch], data = [none]
LOG.error("Exception in getDomainTree ", e);
} // depends on control dependency: [catch], data = [none]
return domainNode;
} } |
public class class_name {
public static String getMacAddr(Context context) {
String mac = "";
try {
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifi = wifiManager.getConnectionInfo();
mac = wifi.getMacAddress();
} catch (Exception e) {
mac = null;
Log.e(TAG, "", e);
}
if (StringUtils.isNullOrEmpty(mac))
mac = getLocalMacAddressFromBusybox();
if (StringUtils.isNullOrEmpty(mac))
mac = MAC_EMPTY;
return mac;
} } | public class class_name {
public static String getMacAddr(Context context) {
String mac = "";
try {
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifi = wifiManager.getConnectionInfo();
mac = wifi.getMacAddress(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
mac = null;
Log.e(TAG, "", e);
} // depends on control dependency: [catch], data = [none]
if (StringUtils.isNullOrEmpty(mac))
mac = getLocalMacAddressFromBusybox();
if (StringUtils.isNullOrEmpty(mac))
mac = MAC_EMPTY;
return mac;
} } |
public class class_name {
public boolean startSession() {
synchronized (sharedLock) {
SessionData session = loadSession();
if (isSessionActive(session)) {
sharedLock.notifyAll();
return false;
} else {
clearAll();
}
sharedLock.notifyAll();
}
return true;
} } | public class class_name {
public boolean startSession() {
synchronized (sharedLock) {
SessionData session = loadSession();
if (isSessionActive(session)) {
sharedLock.notifyAll(); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else {
clearAll(); // depends on control dependency: [if], data = [none]
}
sharedLock.notifyAll();
}
return true;
} } |
public class class_name {
public void build(String... inputFile) throws Exception {
System.out.println("read file ...");
for(String file:inputFile){
LinkedList<Integer> n1gramList = new LinkedList<Integer>();
for(int i=0;i<n;i++){
n1gramList.add(-1);
}
Scanner scanner = new Scanner(new FileInputStream(file), "utf-8");
while(scanner.hasNext()) {
String s = scanner.next();
int idx = wordDict.lookupIndex(s);
n1gramList.add(idx);
n1gramList.remove();
assert n1gramList.size()==n;
String[] grams = getNgram(n1gramList);
String n1gram = grams[0];
String ngram = grams[1];
int n1gramidx = n1gramDict.lookupIndex(n1gram);
if(n1gramidx==n1gramCount.size())
n1gramCount.add(1);
else if(n1gramidx>n1gramCount.size()){
throw new Exception();
}
else{
int count = n1gramCount.get(n1gramidx);
n1gramCount.set(n1gramidx, count+1);
}
int ngramidx = ngramDict.lookupIndex(ngram);
if(ngramidx==prob.size())
prob.add(1);
else if(ngramidx>prob.size()){
throw new Exception();
}
else{
float count = prob.get(ngramidx);
prob.set(ngramidx, count+1);
}
if(index.contains(ngramidx))
assert(index.get(ngramidx) == n1gramidx);
else
index.put(ngramidx, n1gramidx);
}
scanner.close();
}
ngramDict.setStopIncrement(true);
n1gramDict.setStopIncrement(true);
wordDict.setStopIncrement(true);
System.out.println("词表大小" + wordDict.size());
} } | public class class_name {
public void build(String... inputFile) throws Exception {
System.out.println("read file ...");
for(String file:inputFile){
LinkedList<Integer> n1gramList = new LinkedList<Integer>();
for(int i=0;i<n;i++){
n1gramList.add(-1); // depends on control dependency: [for], data = [none]
}
Scanner scanner = new Scanner(new FileInputStream(file), "utf-8");
while(scanner.hasNext()) {
String s = scanner.next();
int idx = wordDict.lookupIndex(s);
n1gramList.add(idx); // depends on control dependency: [while], data = [none]
n1gramList.remove(); // depends on control dependency: [while], data = [none]
assert n1gramList.size()==n;
String[] grams = getNgram(n1gramList);
String n1gram = grams[0];
String ngram = grams[1];
int n1gramidx = n1gramDict.lookupIndex(n1gram);
if(n1gramidx==n1gramCount.size())
n1gramCount.add(1);
else if(n1gramidx>n1gramCount.size()){
throw new Exception();
}
else{
int count = n1gramCount.get(n1gramidx);
n1gramCount.set(n1gramidx, count+1); // depends on control dependency: [if], data = [(n1gramidx]
}
int ngramidx = ngramDict.lookupIndex(ngram);
if(ngramidx==prob.size())
prob.add(1);
else if(ngramidx>prob.size()){
throw new Exception();
}
else{
float count = prob.get(ngramidx);
prob.set(ngramidx, count+1); // depends on control dependency: [if], data = [(ngramidx]
}
if(index.contains(ngramidx))
assert(index.get(ngramidx) == n1gramidx);
else
index.put(ngramidx, n1gramidx);
}
scanner.close();
}
ngramDict.setStopIncrement(true);
n1gramDict.setStopIncrement(true);
wordDict.setStopIncrement(true);
System.out.println("词表大小" + wordDict.size());
} } |
public class class_name {
public static boolean completeWakefulIntent(Intent intent) {
if (intent == null) {
return false;
}
final int id = intent.getIntExtra(EXTRA_WAKE_LOCK_ID, 0);
if (id == 0) {
return false;
}
synchronized (ACTIVE_WAKE_LOCKS) {
releaseWakeLock(ACTIVE_WAKE_LOCKS.get(id));
ACTIVE_WAKE_LOCKS.remove(id);
return true;
}
} } | public class class_name {
public static boolean completeWakefulIntent(Intent intent) {
if (intent == null) {
return false; // depends on control dependency: [if], data = [none]
}
final int id = intent.getIntExtra(EXTRA_WAKE_LOCK_ID, 0);
if (id == 0) {
return false; // depends on control dependency: [if], data = [none]
}
synchronized (ACTIVE_WAKE_LOCKS) {
releaseWakeLock(ACTIVE_WAKE_LOCKS.get(id));
ACTIVE_WAKE_LOCKS.remove(id);
return true;
}
} } |
public class class_name {
public static GeometryCollection extrudeLineStringAsGeometry(LineString lineString, double height){
Geometry[] geometries = new Geometry[3];
GeometryFactory factory = lineString.getFactory();
//Extract the walls
Coordinate[] coords = lineString.getCoordinates();
Polygon[] walls = new Polygon[coords.length - 1];
for (int i = 0; i < coords.length - 1; i++) {
walls[i] = extrudeEdge(coords[i], coords[i + 1], height, factory);
}
lineString.apply(new TranslateCoordinateSequenceFilter(0));
geometries[0]= lineString;
geometries[1]= factory.createMultiPolygon(walls);
geometries[2]= extractRoof(lineString, height);
return factory.createGeometryCollection(geometries);
} } | public class class_name {
public static GeometryCollection extrudeLineStringAsGeometry(LineString lineString, double height){
Geometry[] geometries = new Geometry[3];
GeometryFactory factory = lineString.getFactory();
//Extract the walls
Coordinate[] coords = lineString.getCoordinates();
Polygon[] walls = new Polygon[coords.length - 1];
for (int i = 0; i < coords.length - 1; i++) {
walls[i] = extrudeEdge(coords[i], coords[i + 1], height, factory); // depends on control dependency: [for], data = [i]
}
lineString.apply(new TranslateCoordinateSequenceFilter(0));
geometries[0]= lineString;
geometries[1]= factory.createMultiPolygon(walls);
geometries[2]= extractRoof(lineString, height);
return factory.createGeometryCollection(geometries);
} } |
public class class_name {
@DELETE
@Path("status")
public Response deleteStatusUpdate(
@HeaderParam(PeerEurekaNode.HEADER_REPLICATION) String isReplication,
@QueryParam("value") String newStatusValue,
@QueryParam("lastDirtyTimestamp") String lastDirtyTimestamp) {
try {
if (registry.getInstanceByAppAndId(app.getName(), id) == null) {
logger.warn("Instance not found: {}/{}", app.getName(), id);
return Response.status(Status.NOT_FOUND).build();
}
InstanceStatus newStatus = newStatusValue == null ? InstanceStatus.UNKNOWN : InstanceStatus.valueOf(newStatusValue);
boolean isSuccess = registry.deleteStatusOverride(app.getName(), id,
newStatus, lastDirtyTimestamp, "true".equals(isReplication));
if (isSuccess) {
logger.info("Status override removed: {} - {}", app.getName(), id);
return Response.ok().build();
} else {
logger.warn("Unable to remove status override: {} - {}", app.getName(), id);
return Response.serverError().build();
}
} catch (Throwable e) {
logger.error("Error removing instance's {} status override", id);
return Response.serverError().build();
}
} } | public class class_name {
@DELETE
@Path("status")
public Response deleteStatusUpdate(
@HeaderParam(PeerEurekaNode.HEADER_REPLICATION) String isReplication,
@QueryParam("value") String newStatusValue,
@QueryParam("lastDirtyTimestamp") String lastDirtyTimestamp) {
try {
if (registry.getInstanceByAppAndId(app.getName(), id) == null) {
logger.warn("Instance not found: {}/{}", app.getName(), id); // depends on control dependency: [if], data = [none]
return Response.status(Status.NOT_FOUND).build(); // depends on control dependency: [if], data = [none]
}
InstanceStatus newStatus = newStatusValue == null ? InstanceStatus.UNKNOWN : InstanceStatus.valueOf(newStatusValue);
boolean isSuccess = registry.deleteStatusOverride(app.getName(), id,
newStatus, lastDirtyTimestamp, "true".equals(isReplication));
if (isSuccess) {
logger.info("Status override removed: {} - {}", app.getName(), id); // depends on control dependency: [if], data = [none]
return Response.ok().build(); // depends on control dependency: [if], data = [none]
} else {
logger.warn("Unable to remove status override: {} - {}", app.getName(), id); // depends on control dependency: [if], data = [none]
return Response.serverError().build(); // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
logger.error("Error removing instance's {} status override", id);
return Response.serverError().build();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected String findLibrary(final String libname) {
if (!this.isInit()) {
if (CClassLoader.sl(CClassLoader.DEBUG)) {
CClassLoader
.log("Not initialized, forward to old loader "
+ libname + " in " + this.getPath(),
CClassLoader.DEBUG);
}
return super.findLibrary(libname);
}
final String system = CSystem.getName() + "/" + libname;
final CThreadContext context = CThreadContext.getInstance();
final String cpName = CClassLoader.CCLASSLOADER_NAMESPACE + system;
try {
List lPriorLoader = (List) context.get(cpName);
if (lPriorLoader == null) {
lPriorLoader = new Vector();
context.set(cpName, lPriorLoader);
}
if (lPriorLoader.contains(this.toString())) {
return null;
}
lPriorLoader.add(this.toString());
if (!this.booAlone) {
CClassLoader loader = null;
for (final Iterator it = CClassLoader.mandatoryLoadersMap
.entrySet().iterator(); it.hasNext();) {
final Entry entry = (Entry) it.next();
loader = (CClassLoader) entry.getValue();
if (loader.dllMap.containsKey(system)) {
if (loader != this) {
break;
}
loader = null;
break;
}
loader = null;
}
if (loader != null) {
final String c = loader.findLibrary(libname);
context.set(cpName, null);
return c;
}
}
String path = null;
final Object obj = this.dllMap.get(system);
if (obj instanceof URL) {
final URL urlToResource = (URL) obj;
final byte[] buffer = CClassLoader.loadByteArray(urlToResource);
final File nfile = File.createTempFile(libname
+ this.hashCode(), ".so");
final FileOutputStream fout = new FileOutputStream(nfile);
fout.write(buffer);
fout.close();
this.dllMap.put(system, nfile);
path = nfile.getAbsolutePath();
} else if (obj instanceof File) {
final File nfile = (File) obj;
path = nfile.getAbsolutePath();
}
if (path != null) {
context.set(cpName, null);
return path;
}
// then search in each children
final List tmpLoader = new ArrayList();
for (final Iterator it = this.childrenMap.entrySet().iterator(); it
.hasNext();) {
final Entry entry = (Entry) it.next();
final CClassLoader child = (CClassLoader) entry.getValue();
if (lPriorLoader.contains(child.toString())) {
continue;
}
tmpLoader.add(child);
}
for (final Iterator it = tmpLoader.iterator(); it.hasNext();) {
final Object element = it.next();
final CClassLoader child = (CClassLoader) element;
final String c = child.findLibrary(libname);
if (c != null) {
return c;
}
}
// then follow to parents
if ((this != CClassLoader.getRootLoader())
&& !this.booDoNotForwardToParent) {
if (lPriorLoader.contains(this.getParent().toString())) {
return null;
} else {
if (this.getParent() instanceof CClassLoader) {
final CClassLoader parent = (CClassLoader) this
.getParent();
return parent.findLibrary(libname);
} else {
return super.findLibrary(libname);
}
}
} else {
final String c = super.findLibrary(libname);
context.set(cpName, null);
return c;
}
} catch (final IOException e) {
return super.findLibrary(libname);
}
} } | public class class_name {
protected String findLibrary(final String libname) {
if (!this.isInit()) {
if (CClassLoader.sl(CClassLoader.DEBUG)) {
CClassLoader
.log("Not initialized, forward to old loader "
+ libname + " in " + this.getPath(),
CClassLoader.DEBUG); // depends on control dependency: [if], data = [none]
}
return super.findLibrary(libname); // depends on control dependency: [if], data = [none]
}
final String system = CSystem.getName() + "/" + libname;
final CThreadContext context = CThreadContext.getInstance();
final String cpName = CClassLoader.CCLASSLOADER_NAMESPACE + system;
try {
List lPriorLoader = (List) context.get(cpName);
if (lPriorLoader == null) {
lPriorLoader = new Vector(); // depends on control dependency: [if], data = [none]
context.set(cpName, lPriorLoader); // depends on control dependency: [if], data = [none]
}
if (lPriorLoader.contains(this.toString())) {
return null; // depends on control dependency: [if], data = [none]
}
lPriorLoader.add(this.toString()); // depends on control dependency: [try], data = [none]
if (!this.booAlone) {
CClassLoader loader = null;
for (final Iterator it = CClassLoader.mandatoryLoadersMap
.entrySet().iterator(); it.hasNext();) {
final Entry entry = (Entry) it.next();
loader = (CClassLoader) entry.getValue(); // depends on control dependency: [for], data = [none]
if (loader.dllMap.containsKey(system)) {
if (loader != this) {
break;
}
loader = null; // depends on control dependency: [if], data = [none]
break;
}
loader = null; // depends on control dependency: [for], data = [none]
}
if (loader != null) {
final String c = loader.findLibrary(libname);
context.set(cpName, null); // depends on control dependency: [if], data = [null)]
return c; // depends on control dependency: [if], data = [none]
}
}
String path = null;
final Object obj = this.dllMap.get(system);
if (obj instanceof URL) {
final URL urlToResource = (URL) obj;
final byte[] buffer = CClassLoader.loadByteArray(urlToResource);
final File nfile = File.createTempFile(libname
+ this.hashCode(), ".so");
final FileOutputStream fout = new FileOutputStream(nfile);
fout.write(buffer); // depends on control dependency: [if], data = [none]
fout.close(); // depends on control dependency: [if], data = [none]
this.dllMap.put(system, nfile); // depends on control dependency: [if], data = [none]
path = nfile.getAbsolutePath(); // depends on control dependency: [if], data = [none]
} else if (obj instanceof File) {
final File nfile = (File) obj;
path = nfile.getAbsolutePath(); // depends on control dependency: [if], data = [none]
}
if (path != null) {
context.set(cpName, null); // depends on control dependency: [if], data = [null)]
return path; // depends on control dependency: [if], data = [none]
}
// then search in each children
final List tmpLoader = new ArrayList();
for (final Iterator it = this.childrenMap.entrySet().iterator(); it
.hasNext();) {
final Entry entry = (Entry) it.next();
final CClassLoader child = (CClassLoader) entry.getValue();
if (lPriorLoader.contains(child.toString())) {
continue;
}
tmpLoader.add(child); // depends on control dependency: [for], data = [none]
}
for (final Iterator it = tmpLoader.iterator(); it.hasNext();) {
final Object element = it.next();
final CClassLoader child = (CClassLoader) element;
final String c = child.findLibrary(libname);
if (c != null) {
return c; // depends on control dependency: [if], data = [none]
}
}
// then follow to parents
if ((this != CClassLoader.getRootLoader())
&& !this.booDoNotForwardToParent) {
if (lPriorLoader.contains(this.getParent().toString())) {
return null; // depends on control dependency: [if], data = [none]
} else {
if (this.getParent() instanceof CClassLoader) {
final CClassLoader parent = (CClassLoader) this
.getParent();
return parent.findLibrary(libname); // depends on control dependency: [if], data = [none]
} else {
return super.findLibrary(libname); // depends on control dependency: [if], data = [none]
}
}
} else {
final String c = super.findLibrary(libname);
context.set(cpName, null); // depends on control dependency: [if], data = [none]
return c; // depends on control dependency: [if], data = [none]
}
} catch (final IOException e) {
return super.findLibrary(libname);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <V, E> Graph<V, E> loadGraph(String path, EdgeLineProcessor<E> lineProcessor,
VertexFactory<V> vertexFactory, int numVertices, boolean allowMultipleEdges) throws IOException {
Graph<V, E> graph = new Graph<>(numVertices, allowMultipleEdges, vertexFactory);
try (BufferedReader br = new BufferedReader(new FileReader(new File(path)))) {
String line;
while ((line = br.readLine()) != null) {
Edge<E> edge = lineProcessor.processLine(line);
if (edge != null) {
graph.addEdge(edge);
}
}
}
return graph;
} } | public class class_name {
public static <V, E> Graph<V, E> loadGraph(String path, EdgeLineProcessor<E> lineProcessor,
VertexFactory<V> vertexFactory, int numVertices, boolean allowMultipleEdges) throws IOException {
Graph<V, E> graph = new Graph<>(numVertices, allowMultipleEdges, vertexFactory);
try (BufferedReader br = new BufferedReader(new FileReader(new File(path)))) {
String line;
while ((line = br.readLine()) != null) {
Edge<E> edge = lineProcessor.processLine(line);
if (edge != null) {
graph.addEdge(edge); // depends on control dependency: [if], data = [(edge]
}
}
}
return graph;
} } |
public class class_name {
@Override
@FFDCIgnore(NumberFormatException.class)
public String getHostName(String hostAlias) {
int pos = hostAlias.lastIndexOf(':');
if (pos > -1 && pos < hostAlias.length()) {
String hostName = hostAlias.substring(0, pos);
if (hostName.equals("*")) {
try {
int port = Integer.valueOf(hostAlias.substring(pos + 1));
for (EndpointState state : myEndpoints.values()) {
if (state.httpPort == port || state.httpsPort == port) {
return state.hostName;
}
}
} catch (NumberFormatException nfe) {
}
}
return hostName;
}
return hostAlias;
} } | public class class_name {
@Override
@FFDCIgnore(NumberFormatException.class)
public String getHostName(String hostAlias) {
int pos = hostAlias.lastIndexOf(':');
if (pos > -1 && pos < hostAlias.length()) {
String hostName = hostAlias.substring(0, pos);
if (hostName.equals("*")) {
try {
int port = Integer.valueOf(hostAlias.substring(pos + 1));
for (EndpointState state : myEndpoints.values()) {
if (state.httpPort == port || state.httpsPort == port) {
return state.hostName; // depends on control dependency: [if], data = [none]
}
}
} catch (NumberFormatException nfe) {
} // depends on control dependency: [catch], data = [none]
}
return hostName; // depends on control dependency: [if], data = [none]
}
return hostAlias;
} } |
public class class_name {
public Emitter on(String event, Listener fn) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
if (callbacks == null) {
callbacks = new ConcurrentLinkedQueue<Listener>();
ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbacks);
if (_callbacks != null) {
callbacks = _callbacks;
}
}
callbacks.add(fn);
return this;
} } | public class class_name {
public Emitter on(String event, Listener fn) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
if (callbacks == null) {
callbacks = new ConcurrentLinkedQueue<Listener>(); // depends on control dependency: [if], data = [none]
ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbacks);
if (_callbacks != null) {
callbacks = _callbacks; // depends on control dependency: [if], data = [none]
}
}
callbacks.add(fn);
return this;
} } |
public class class_name {
public synchronized T getNonBlocking ()
{
if (_count == 0) {
return null;
}
// pull the object off, and clear our reference to it
T retval = _items[_start];
_items[_start] = null;
_start = (_start + 1) % _size;
_count--;
return retval;
} } | public class class_name {
public synchronized T getNonBlocking ()
{
if (_count == 0) {
return null; // depends on control dependency: [if], data = [none]
}
// pull the object off, and clear our reference to it
T retval = _items[_start];
_items[_start] = null;
_start = (_start + 1) % _size;
_count--;
return retval;
} } |
public class class_name {
private MBeanAttributeInfo[] getAttributeInfo() {
final List<MBeanAttributeInfo> infoList = new ArrayList<>();
if (type != null) {
final List<String> attributes = new ArrayList<>();
if (type.isInterface()) {
ReflectionUtils.doWithMethods(type, new ReflectionUtils.MethodCallback() {
@Override
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
String attributeName;
if (method.getName().startsWith("get")) {
attributeName = method.getName().substring(3);
} else if (method.getName().startsWith("is")) {
attributeName = method.getName().substring(2);
} else {
attributeName = method.getName();
}
if (!attributes.contains(attributeName)) {
infoList.add(new MBeanAttributeInfo(attributeName, method.getReturnType().getName(), ATTRIBUTE_DESCRIPTION, true, true, method.getName().startsWith("is")));
attributes.add(attributeName);
}
}
}, new ReflectionUtils.MethodFilter() {
@Override
public boolean matches(Method method) {
return method.getDeclaringClass().equals(type) && (method.getName().startsWith("get") || method.getName().startsWith("is"));
}
});
} else {
ReflectionUtils.doWithFields(type, new ReflectionUtils.FieldCallback() {
@Override
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
infoList.add(new MBeanAttributeInfo(field.getName(), field.getType().getName(), ATTRIBUTE_DESCRIPTION, true, true, field.getType().equals(Boolean.class)));
}
}, new ReflectionUtils.FieldFilter() {
@Override
public boolean matches(Field field) {
return !Modifier.isStatic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers());
}
});
}
} else {
int i = 1;
for (ManagedBeanInvocation.Attribute attribute : attributes) {
infoList.add(new MBeanAttributeInfo(attribute.getName(), attribute.getType(), ATTRIBUTE_DESCRIPTION, true, true, attribute.getType().equals(Boolean.class.getName())));
}
}
return infoList.toArray(new MBeanAttributeInfo[infoList.size()]);
} } | public class class_name {
private MBeanAttributeInfo[] getAttributeInfo() {
final List<MBeanAttributeInfo> infoList = new ArrayList<>();
if (type != null) {
final List<String> attributes = new ArrayList<>();
if (type.isInterface()) {
ReflectionUtils.doWithMethods(type, new ReflectionUtils.MethodCallback() {
@Override
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
String attributeName;
if (method.getName().startsWith("get")) {
attributeName = method.getName().substring(3);
} else if (method.getName().startsWith("is")) {
attributeName = method.getName().substring(2);
} else {
attributeName = method.getName();
}
if (!attributes.contains(attributeName)) {
infoList.add(new MBeanAttributeInfo(attributeName, method.getReturnType().getName(), ATTRIBUTE_DESCRIPTION, true, true, method.getName().startsWith("is")));
attributes.add(attributeName);
}
}
}, new ReflectionUtils.MethodFilter() {
@Override
public boolean matches(Method method) {
return method.getDeclaringClass().equals(type) && (method.getName().startsWith("get") || method.getName().startsWith("is"));
}
}); // depends on control dependency: [if], data = [none]
} else {
ReflectionUtils.doWithFields(type, new ReflectionUtils.FieldCallback() {
@Override
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
infoList.add(new MBeanAttributeInfo(field.getName(), field.getType().getName(), ATTRIBUTE_DESCRIPTION, true, true, field.getType().equals(Boolean.class)));
}
}, new ReflectionUtils.FieldFilter() {
@Override
public boolean matches(Field field) {
return !Modifier.isStatic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers());
}
}); // depends on control dependency: [if], data = [none]
}
} else {
int i = 1;
for (ManagedBeanInvocation.Attribute attribute : attributes) {
infoList.add(new MBeanAttributeInfo(attribute.getName(), attribute.getType(), ATTRIBUTE_DESCRIPTION, true, true, attribute.getType().equals(Boolean.class.getName()))); // depends on control dependency: [for], data = [attribute]
}
}
return infoList.toArray(new MBeanAttributeInfo[infoList.size()]);
} } |
public class class_name {
public static DateValue convertFromRawComponents(ICalDate date) {
DateTimeComponents raw = date.getRawComponents();
if (raw == null) {
raw = new DateTimeComponents(date);
}
return convert(raw);
} } | public class class_name {
public static DateValue convertFromRawComponents(ICalDate date) {
DateTimeComponents raw = date.getRawComponents();
if (raw == null) {
raw = new DateTimeComponents(date); // depends on control dependency: [if], data = [none]
}
return convert(raw);
} } |
public class class_name {
public static void rcvXARecover(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvXARecover",
new Object[]
{
request,
conversation,
""+requestNumber,
""+allocatedFromBufferPool,
""+partOfExchange
});
ConversationState convState = (ConversationState) conversation.getAttachment();
ServerLinkLevelState linkState = (ServerLinkLevelState) conversation.getLinkLevelAttachment();
try
{
int clientTransactionId = request.getInt();
int flags = request.getInt();
boolean requiresMSResource = false;
if (conversation.getHandshakeProperties().getFapLevel() >= JFapChannelConstants.FAP_VERSION_5)
{
requiresMSResource = request.get() == 0x01;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "XAResource Object ID", clientTransactionId);
SibTr.debug(tc, "Flags: ", flags);
}
// Get the transaction out of the table
SITransaction tran = linkState.getTransactionTable().get(clientTransactionId, true); // D297060
if (tran == IdToTransactionTable.INVALID_TRANSACTION)
{
// This is a odd (but not completely impossible situation to
// be in). The client has created an optimized XA transaction
// (i.e. one in which we get the XA resource and enlist it
// during the first transacted operation) yet the code that
// is responsible for doing this has failed to get an XA
// resource. The client has then called recover on the
// resource. This is a very strange useage pattern for the
// resource. Never the less - the only reasonable course
// of action is to signal a RM error.
throw new XAException(XAException.XAER_RMERR);
}
// Get the actual transaction ...
SIXAResource xaResource = getResourceFromTran(tran, convState, requiresMSResource);
// Now call the method on the XA resource
Xid[] xids = xaResource.recover(flags);
CommsByteBuffer reply = poolManager.allocate();
if (xids == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "recover() returned null");
reply.putShort(0);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Serializing " + xids.length + " Xids");
reply.putShort(xids.length);
// Now for each one, serialize it and add it to the buffer list to send back
for (int x = 0; x < xids.length; x++)
{
reply.putXid(xids[x]);
}
}
try
{
conversation.send(reply,
JFapChannelConstants.SEG_XARECOVER_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
}
catch (SIException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvXARecover",
CommsConstants.STATICCATXATRANSACTION_XARECOVER_01);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2027", e);
}
}
catch (XAException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvXARecover",
CommsConstants.STATICCATXATRANSACTION_XARECOVER_02);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "XAException - RC: " + e.errorCode, e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATXATRANSACTION_XARECOVER_02,
conversation, requestNumber);
}
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvXARecover");
} } | public class class_name {
public static void rcvXARecover(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvXARecover",
new Object[]
{
request,
conversation,
""+requestNumber,
""+allocatedFromBufferPool,
""+partOfExchange
});
ConversationState convState = (ConversationState) conversation.getAttachment();
ServerLinkLevelState linkState = (ServerLinkLevelState) conversation.getLinkLevelAttachment();
try
{
int clientTransactionId = request.getInt();
int flags = request.getInt();
boolean requiresMSResource = false;
if (conversation.getHandshakeProperties().getFapLevel() >= JFapChannelConstants.FAP_VERSION_5)
{
requiresMSResource = request.get() == 0x01; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "XAResource Object ID", clientTransactionId); // depends on control dependency: [if], data = [none]
SibTr.debug(tc, "Flags: ", flags); // depends on control dependency: [if], data = [none]
}
// Get the transaction out of the table
SITransaction tran = linkState.getTransactionTable().get(clientTransactionId, true); // D297060
if (tran == IdToTransactionTable.INVALID_TRANSACTION)
{
// This is a odd (but not completely impossible situation to
// be in). The client has created an optimized XA transaction
// (i.e. one in which we get the XA resource and enlist it
// during the first transacted operation) yet the code that
// is responsible for doing this has failed to get an XA
// resource. The client has then called recover on the
// resource. This is a very strange useage pattern for the
// resource. Never the less - the only reasonable course
// of action is to signal a RM error.
throw new XAException(XAException.XAER_RMERR);
}
// Get the actual transaction ...
SIXAResource xaResource = getResourceFromTran(tran, convState, requiresMSResource);
// Now call the method on the XA resource
Xid[] xids = xaResource.recover(flags);
CommsByteBuffer reply = poolManager.allocate();
if (xids == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "recover() returned null");
reply.putShort(0); // depends on control dependency: [if], data = [none]
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Serializing " + xids.length + " Xids");
reply.putShort(xids.length); // depends on control dependency: [if], data = [(xids]
// Now for each one, serialize it and add it to the buffer list to send back
for (int x = 0; x < xids.length; x++)
{
reply.putXid(xids[x]); // depends on control dependency: [for], data = [x]
}
}
try
{
conversation.send(reply,
JFapChannelConstants.SEG_XARECOVER_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null); // depends on control dependency: [try], data = [none]
}
catch (SIException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvXARecover",
CommsConstants.STATICCATXATRANSACTION_XARECOVER_01);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2027", e);
} // depends on control dependency: [catch], data = [none]
}
catch (XAException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvXARecover",
CommsConstants.STATICCATXATRANSACTION_XARECOVER_02);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "XAException - RC: " + e.errorCode, e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATXATRANSACTION_XARECOVER_02,
conversation, requestNumber);
} // depends on control dependency: [catch], data = [none]
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvXARecover");
} } |
public class class_name {
protected static Method findTargetMethod(final Method sourceMethod, Class<?> target) throws NoSuchElementException {
return Iterables.find(Arrays.asList(target.getMethods()), new Predicate<Method>() {
@Override
public boolean apply(Method element) {
if (!sourceMethod.getName().equals(element.getName())) {
return false;
}
if (sourceMethod.getParameterTypes().length != element.getParameterTypes().length) {
return false;
}
return true;
}
});
} } | public class class_name {
protected static Method findTargetMethod(final Method sourceMethod, Class<?> target) throws NoSuchElementException {
return Iterables.find(Arrays.asList(target.getMethods()), new Predicate<Method>() {
@Override
public boolean apply(Method element) {
if (!sourceMethod.getName().equals(element.getName())) {
return false;
}
if (sourceMethod.getParameterTypes().length != element.getParameterTypes().length) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
}
});
} } |
public class class_name {
public static Throwable unwrap(Throwable wrapped) {
Throwable unwrapped = wrapped;
while (true) {
if (unwrapped instanceof InvocationTargetException) {
unwrapped = ((InvocationTargetException) unwrapped).getTargetException();
} else if (unwrapped instanceof UndeclaredThrowableException) {
unwrapped = ((UndeclaredThrowableException) unwrapped).getUndeclaredThrowable();
} else {
return unwrapped;
}
}
} } | public class class_name {
public static Throwable unwrap(Throwable wrapped) {
Throwable unwrapped = wrapped;
while (true) {
if (unwrapped instanceof InvocationTargetException) {
unwrapped = ((InvocationTargetException) unwrapped).getTargetException(); // depends on control dependency: [if], data = [none]
} else if (unwrapped instanceof UndeclaredThrowableException) {
unwrapped = ((UndeclaredThrowableException) unwrapped).getUndeclaredThrowable(); // depends on control dependency: [if], data = [none]
} else {
return unwrapped; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static <T> List<T> getListOfType(Object instance, Class<T> elementType) {
if (instance == null || elementType == null || !isListOfType(instance, elementType)) {
return null;
}
try {
return (List<T>) instance;
} catch (ClassCastException e) {
return null;
}
} } | public class class_name {
public static <T> List<T> getListOfType(Object instance, Class<T> elementType) {
if (instance == null || elementType == null || !isListOfType(instance, elementType)) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return (List<T>) instance; // depends on control dependency: [try], data = [none]
} catch (ClassCastException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public synchronized List<alluxio.grpc.JobCommand> pollAllPendingCommands(long workerId) {
if (!mWorkerIdToPendingCommands.containsKey(workerId)) {
return Lists.newArrayList();
}
List<JobCommand> commands =
Lists.newArrayList(mWorkerIdToPendingCommands.get(workerId));
mWorkerIdToPendingCommands.get(workerId).clear();
return commands;
} } | public class class_name {
public synchronized List<alluxio.grpc.JobCommand> pollAllPendingCommands(long workerId) {
if (!mWorkerIdToPendingCommands.containsKey(workerId)) {
return Lists.newArrayList(); // depends on control dependency: [if], data = [none]
}
List<JobCommand> commands =
Lists.newArrayList(mWorkerIdToPendingCommands.get(workerId));
mWorkerIdToPendingCommands.get(workerId).clear();
return commands;
} } |
public class class_name {
@Override
public IConstructorLinkingCandidate getLinkingCandidate(/* @Nullable */ XConstructorCall constructorCall) {
if (!shared.allLinking.contains(constructorCall)) {
return null;
}
return (IConstructorLinkingCandidate) doGetCandidate(constructorCall);
} } | public class class_name {
@Override
public IConstructorLinkingCandidate getLinkingCandidate(/* @Nullable */ XConstructorCall constructorCall) {
if (!shared.allLinking.contains(constructorCall)) {
return null; // depends on control dependency: [if], data = [none]
}
return (IConstructorLinkingCandidate) doGetCandidate(constructorCall);
} } |
public class class_name {
protected void fireTrigger(final ReplicationTrigger trigger) {
Log.d(Log.TAG_SYNC, "%s [fireTrigger()] => " + trigger, this);
// All state machine triggers need to happen on the replicator thread
synchronized (executor) {
if (!executor.isShutdown()) {
executor.submit(new Runnable() {
@Override
public void run() {
try {
Log.d(Log.TAG_SYNC, "firing trigger: %s", trigger);
stateMachine.fire(trigger);
} catch (Exception e) {
Log.i(Log.TAG_SYNC, "Error in StateMachine.fire(trigger): %s", e.getMessage());
throw new RuntimeException(e);
}
}
});
}
}
} } | public class class_name {
protected void fireTrigger(final ReplicationTrigger trigger) {
Log.d(Log.TAG_SYNC, "%s [fireTrigger()] => " + trigger, this);
// All state machine triggers need to happen on the replicator thread
synchronized (executor) {
if (!executor.isShutdown()) {
executor.submit(new Runnable() {
@Override
public void run() {
try {
Log.d(Log.TAG_SYNC, "firing trigger: %s", trigger); // depends on control dependency: [try], data = [none]
stateMachine.fire(trigger); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
Log.i(Log.TAG_SYNC, "Error in StateMachine.fire(trigger): %s", e.getMessage());
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
}); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static String currentRequestContextPath() {
final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (null == requestAttributes) {
throw new IllegalStateException(
"Request attributes are not bound. "
+ "Not operating in context of a Spring-processed Request?");
}
if (requestAttributes instanceof ServletRequestAttributes) {
final ServletRequestAttributes servletRequestAttributes =
(ServletRequestAttributes) requestAttributes;
final HttpServletRequest request = servletRequestAttributes.getRequest();
return request.getContextPath();
} else if (requestAttributes instanceof PortletRequestAttributes) {
final PortletRequestAttributes portletRequestAttributes =
(PortletRequestAttributes) requestAttributes;
final PortletRequest request = portletRequestAttributes.getRequest();
return request.getContextPath();
} else {
throw new IllegalStateException(
"Request attributes are an unrecognized implementation.");
}
} } | public class class_name {
public static String currentRequestContextPath() {
final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (null == requestAttributes) {
throw new IllegalStateException(
"Request attributes are not bound. "
+ "Not operating in context of a Spring-processed Request?");
}
if (requestAttributes instanceof ServletRequestAttributes) {
final ServletRequestAttributes servletRequestAttributes =
(ServletRequestAttributes) requestAttributes;
final HttpServletRequest request = servletRequestAttributes.getRequest();
return request.getContextPath(); // depends on control dependency: [if], data = [none]
} else if (requestAttributes instanceof PortletRequestAttributes) {
final PortletRequestAttributes portletRequestAttributes =
(PortletRequestAttributes) requestAttributes;
final PortletRequest request = portletRequestAttributes.getRequest();
return request.getContextPath(); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException(
"Request attributes are an unrecognized implementation.");
}
} } |
public class class_name {
protected void splitPixels(int indexStart, int length) {
// too short to split
if( length < minimumSideLengthPixel)
return;
// end points of the line
int indexEnd = (indexStart+length)%N;
int splitOffset = selectSplitOffset(indexStart,length);
if( splitOffset >= 0 ) {
// System.out.println(" splitting ");
splitPixels(indexStart, splitOffset);
int indexSplit = (indexStart+splitOffset)%N;
splits.add(indexSplit);
splitPixels(indexSplit, circularDistance(indexSplit, indexEnd));
}
} } | public class class_name {
protected void splitPixels(int indexStart, int length) {
// too short to split
if( length < minimumSideLengthPixel)
return;
// end points of the line
int indexEnd = (indexStart+length)%N;
int splitOffset = selectSplitOffset(indexStart,length);
if( splitOffset >= 0 ) {
// System.out.println(" splitting ");
splitPixels(indexStart, splitOffset); // depends on control dependency: [if], data = [none]
int indexSplit = (indexStart+splitOffset)%N;
splits.add(indexSplit); // depends on control dependency: [if], data = [none]
splitPixels(indexSplit, circularDistance(indexSplit, indexEnd)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Beta
@GwtIncompatible // NavigableSet
public static <K extends Comparable<? super K>> NavigableSet<K> subSet(
NavigableSet<K> set, Range<K> range) {
if (set.comparator() != null
&& set.comparator() != Ordering.natural()
&& range.hasLowerBound()
&& range.hasUpperBound()) {
checkArgument(
set.comparator().compare(range.lowerEndpoint(), range.upperEndpoint()) <= 0,
"set is using a custom comparator which is inconsistent with the natural ordering.");
}
if (range.hasLowerBound() && range.hasUpperBound()) {
return set.subSet(
range.lowerEndpoint(),
range.lowerBoundType() == BoundType.CLOSED,
range.upperEndpoint(),
range.upperBoundType() == BoundType.CLOSED);
} else if (range.hasLowerBound()) {
return set.tailSet(range.lowerEndpoint(), range.lowerBoundType() == BoundType.CLOSED);
} else if (range.hasUpperBound()) {
return set.headSet(range.upperEndpoint(), range.upperBoundType() == BoundType.CLOSED);
}
return checkNotNull(set);
} } | public class class_name {
@Beta
@GwtIncompatible // NavigableSet
public static <K extends Comparable<? super K>> NavigableSet<K> subSet(
NavigableSet<K> set, Range<K> range) {
if (set.comparator() != null
&& set.comparator() != Ordering.natural()
&& range.hasLowerBound()
&& range.hasUpperBound()) {
checkArgument(
set.comparator().compare(range.lowerEndpoint(), range.upperEndpoint()) <= 0,
"set is using a custom comparator which is inconsistent with the natural ordering."); // depends on control dependency: [if], data = [none]
}
if (range.hasLowerBound() && range.hasUpperBound()) {
return set.subSet(
range.lowerEndpoint(),
range.lowerBoundType() == BoundType.CLOSED,
range.upperEndpoint(),
range.upperBoundType() == BoundType.CLOSED); // depends on control dependency: [if], data = [none]
} else if (range.hasLowerBound()) {
return set.tailSet(range.lowerEndpoint(), range.lowerBoundType() == BoundType.CLOSED); // depends on control dependency: [if], data = [none]
} else if (range.hasUpperBound()) {
return set.headSet(range.upperEndpoint(), range.upperBoundType() == BoundType.CLOSED); // depends on control dependency: [if], data = [none]
}
return checkNotNull(set);
} } |
public class class_name {
public void marshall(PutSecretValueRequest putSecretValueRequest, ProtocolMarshaller protocolMarshaller) {
if (putSecretValueRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putSecretValueRequest.getSecretId(), SECRETID_BINDING);
protocolMarshaller.marshall(putSecretValueRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);
protocolMarshaller.marshall(putSecretValueRequest.getSecretBinary(), SECRETBINARY_BINDING);
protocolMarshaller.marshall(putSecretValueRequest.getSecretString(), SECRETSTRING_BINDING);
protocolMarshaller.marshall(putSecretValueRequest.getVersionStages(), VERSIONSTAGES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PutSecretValueRequest putSecretValueRequest, ProtocolMarshaller protocolMarshaller) {
if (putSecretValueRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putSecretValueRequest.getSecretId(), SECRETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putSecretValueRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putSecretValueRequest.getSecretBinary(), SECRETBINARY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putSecretValueRequest.getSecretString(), SECRETSTRING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putSecretValueRequest.getVersionStages(), VERSIONSTAGES_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
public String getValueAsString() {
List<?> selected = getValue();
if (selected == null || selected.isEmpty()) {
return null;
}
StringBuffer stringValues = new StringBuffer();
for (int i = 0; i < selected.size(); i++) {
if (i > 0) {
stringValues.append(", ");
}
stringValues.append(optionToString(selected.get(i)));
}
return stringValues.toString();
} } | public class class_name {
@Override
public String getValueAsString() {
List<?> selected = getValue();
if (selected == null || selected.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuffer stringValues = new StringBuffer();
for (int i = 0; i < selected.size(); i++) {
if (i > 0) {
stringValues.append(", "); // depends on control dependency: [if], data = [none]
}
stringValues.append(optionToString(selected.get(i))); // depends on control dependency: [for], data = [i]
}
return stringValues.toString();
} } |
public class class_name {
public String translatePath(String path) {
String translated;
// special character: ~ maps to the user's home directory
if (path.startsWith("~" + File.separator)) {
translated = System.getProperty("user.home") + path.substring(1);
} else if (path.startsWith("~")) {
String userName = path.substring(1);
translated = new File(new File(System.getProperty("user.home")).getParent(),
userName).getAbsolutePath();
// Keep the path separator in translated or add one if no user home specified
translated = userName.isEmpty() || path.endsWith(File.separator) ? translated + File.separator : translated;
} else if (!new File(path).isAbsolute()) {
translated = ctx.getCurrentDir().getAbsolutePath() + File.separator + path;
} else {
translated = path;
}
return translated;
} } | public class class_name {
public String translatePath(String path) {
String translated;
// special character: ~ maps to the user's home directory
if (path.startsWith("~" + File.separator)) {
translated = System.getProperty("user.home") + path.substring(1); // depends on control dependency: [if], data = [none]
} else if (path.startsWith("~")) {
String userName = path.substring(1);
translated = new File(new File(System.getProperty("user.home")).getParent(),
userName).getAbsolutePath(); // depends on control dependency: [if], data = [none]
// Keep the path separator in translated or add one if no user home specified
translated = userName.isEmpty() || path.endsWith(File.separator) ? translated + File.separator : translated; // depends on control dependency: [if], data = [none]
} else if (!new File(path).isAbsolute()) {
translated = ctx.getCurrentDir().getAbsolutePath() + File.separator + path; // depends on control dependency: [if], data = [none]
} else {
translated = path; // depends on control dependency: [if], data = [none]
}
return translated;
} } |
public class class_name {
public List<MsRun.MsInstrument> getMsInstrument() {
if (msInstrument == null) {
msInstrument = new ArrayList<MsRun.MsInstrument>();
}
return this.msInstrument;
} } | public class class_name {
public List<MsRun.MsInstrument> getMsInstrument() {
if (msInstrument == null) {
msInstrument = new ArrayList<MsRun.MsInstrument>(); // depends on control dependency: [if], data = [none]
}
return this.msInstrument;
} } |
public class class_name {
protected boolean determineIfThrottled(ThrottleState state) {
final long prevUncommitted = lastUncommitted;
lastUncommitted = state.uncommittedJournalEntries;
final String transportName = this.getClass().getSimpleName();
log.debug("Checking if transport {} should be throttled {}", transportName, state);
if (state.uncommittedJournalEntries == 0) {
// journal is completely empty, let's read some stuff
log.debug("[{}] [unthrottled] journal empty", transportName);
return false;
}
if (state.uncommittedJournalEntries > 100_000) {
log.debug("[{}] [throttled] number of unread journal entries is larger than 100.000 entries: {}", transportName, state.uncommittedJournalEntries);
return true;
}
if (state.uncommittedJournalEntries - prevUncommitted > 20_000) {
// journal is growing, don't read more
log.debug("[{}] [throttled] number of unread journal entries is growing by more than 20.000 entries: {}", transportName, state.uncommittedJournalEntries - prevUncommitted);
return true;
}
if (state.processBufferCapacity == 0) {
log.debug("[{}] [throttled] no capacity in process buffer", transportName);
return true;
}
if (state.appendEventsPerSec == 0 && state.readEventsPerSec == 0 && state.processBufferCapacity > 0) {
// no one writes anything, it's ok to get more events
log.debug("[{}] [unthrottled] no incoming messages and nothing read from journal even if we could", transportName);
return false;
}
if ((state.journalSize / (double) state.journalSizeLimit) * 100.0 > 90) {
// more than 90% of the journal limit is in use, don't read more if possible to avoid throwing away data
log.debug("[{}] [throttled] journal more than 90% full", transportName);
return true;
}
if ((state.readEventsPerSec / (double) state.appendEventsPerSec) * 100.0 < 50) {
// read rate is less than 50% of what we write to the journal over the last second, let's try to back off
log.debug("[{}] [throttled] write rate is more than twice as high than read rate", transportName);
return true;
}
log.debug("[{}] [unthrottled] fall through", transportName);
return false;
} } | public class class_name {
protected boolean determineIfThrottled(ThrottleState state) {
final long prevUncommitted = lastUncommitted;
lastUncommitted = state.uncommittedJournalEntries;
final String transportName = this.getClass().getSimpleName();
log.debug("Checking if transport {} should be throttled {}", transportName, state);
if (state.uncommittedJournalEntries == 0) {
// journal is completely empty, let's read some stuff
log.debug("[{}] [unthrottled] journal empty", transportName); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (state.uncommittedJournalEntries > 100_000) {
log.debug("[{}] [throttled] number of unread journal entries is larger than 100.000 entries: {}", transportName, state.uncommittedJournalEntries); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
if (state.uncommittedJournalEntries - prevUncommitted > 20_000) {
// journal is growing, don't read more
log.debug("[{}] [throttled] number of unread journal entries is growing by more than 20.000 entries: {}", transportName, state.uncommittedJournalEntries - prevUncommitted);
return true;
}
if (state.processBufferCapacity == 0) {
log.debug("[{}] [throttled] no capacity in process buffer", transportName);
return true;
}
if (state.appendEventsPerSec == 0 && state.readEventsPerSec == 0 && state.processBufferCapacity > 0) {
// no one writes anything, it's ok to get more events
log.debug("[{}] [unthrottled] no incoming messages and nothing read from journal even if we could", transportName);
return false;
}
if ((state.journalSize / (double) state.journalSizeLimit) * 100.0 > 90) {
// more than 90% of the journal limit is in use, don't read more if possible to avoid throwing away data
log.debug("[{}] [throttled] journal more than 90% full", transportName);
return true;
}
if ((state.readEventsPerSec / (double) state.appendEventsPerSec) * 100.0 < 50) {
// read rate is less than 50% of what we write to the journal over the last second, let's try to back off
log.debug("[{}] [throttled] write rate is more than twice as high than read rate", transportName);
return true;
}
log.debug("[{}] [unthrottled] fall through", transportName);
return false;
} } |
public class class_name {
public void set(byte b, Collection c) {
if ((c != null) && (c.size() > 0)) {
StringBuilder sb = new StringBuilder();
Iterator it = c.iterator();
while (it.hasNext()) {
String s = (String) it.next();
sb.append(s);
if (it.hasNext())
sb.append(lineSeparator);
}
set(b, sb.toString());
} else
remove(b);
} } | public class class_name {
public void set(byte b, Collection c) {
if ((c != null) && (c.size() > 0)) {
StringBuilder sb = new StringBuilder();
Iterator it = c.iterator();
while (it.hasNext()) {
String s = (String) it.next();
sb.append(s);
// depends on control dependency: [while], data = [none]
if (it.hasNext())
sb.append(lineSeparator);
}
set(b, sb.toString());
// depends on control dependency: [if], data = [none]
} else
remove(b);
} } |
public class class_name {
public void marshall(WorkflowExecutionInfo workflowExecutionInfo, ProtocolMarshaller protocolMarshaller) {
if (workflowExecutionInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(workflowExecutionInfo.getExecution(), EXECUTION_BINDING);
protocolMarshaller.marshall(workflowExecutionInfo.getWorkflowType(), WORKFLOWTYPE_BINDING);
protocolMarshaller.marshall(workflowExecutionInfo.getStartTimestamp(), STARTTIMESTAMP_BINDING);
protocolMarshaller.marshall(workflowExecutionInfo.getCloseTimestamp(), CLOSETIMESTAMP_BINDING);
protocolMarshaller.marshall(workflowExecutionInfo.getExecutionStatus(), EXECUTIONSTATUS_BINDING);
protocolMarshaller.marshall(workflowExecutionInfo.getCloseStatus(), CLOSESTATUS_BINDING);
protocolMarshaller.marshall(workflowExecutionInfo.getParent(), PARENT_BINDING);
protocolMarshaller.marshall(workflowExecutionInfo.getTagList(), TAGLIST_BINDING);
protocolMarshaller.marshall(workflowExecutionInfo.getCancelRequested(), CANCELREQUESTED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(WorkflowExecutionInfo workflowExecutionInfo, ProtocolMarshaller protocolMarshaller) {
if (workflowExecutionInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(workflowExecutionInfo.getExecution(), EXECUTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(workflowExecutionInfo.getWorkflowType(), WORKFLOWTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(workflowExecutionInfo.getStartTimestamp(), STARTTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(workflowExecutionInfo.getCloseTimestamp(), CLOSETIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(workflowExecutionInfo.getExecutionStatus(), EXECUTIONSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(workflowExecutionInfo.getCloseStatus(), CLOSESTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(workflowExecutionInfo.getParent(), PARENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(workflowExecutionInfo.getTagList(), TAGLIST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(workflowExecutionInfo.getCancelRequested(), CANCELREQUESTED_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 long nClass() {
if( _nclass!=-1 ) return _nclass;
if(_isClassification==true){
long cnt=0;
cnt = _fr.vec(_response).domain().length;
/*for(int i=0;i<_cols.length;++i) {
if(_cols[i]._response==true) cnt = _cols[i]._v.domain().length;
}*/
return(_nclass=cnt);
}else{
return(_nclass=0);
}
} } | public class class_name {
public long nClass() {
if( _nclass!=-1 ) return _nclass;
if(_isClassification==true){
long cnt=0;
cnt = _fr.vec(_response).domain().length; // depends on control dependency: [if], data = [none]
/*for(int i=0;i<_cols.length;++i) {
if(_cols[i]._response==true) cnt = _cols[i]._v.domain().length;
}*/
return(_nclass=cnt); // depends on control dependency: [if], data = [none]
}else{
return(_nclass=0); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static int[] toIntArray(String pString, String pDelimiters, int pBase) {
if (isEmpty(pString)) {
return new int[0];
}
// Some room for improvement here...
String[] temp = toStringArray(pString, pDelimiters);
int[] array = new int[temp.length];
for (int i = 0; i < array.length; i++) {
array[i] = Integer.parseInt(temp[i], pBase);
}
return array;
} } | public class class_name {
public static int[] toIntArray(String pString, String pDelimiters, int pBase) {
if (isEmpty(pString)) {
return new int[0];
// depends on control dependency: [if], data = [none]
}
// Some room for improvement here...
String[] temp = toStringArray(pString, pDelimiters);
int[] array = new int[temp.length];
for (int i = 0; i < array.length; i++) {
array[i] = Integer.parseInt(temp[i], pBase);
// depends on control dependency: [for], data = [i]
}
return array;
} } |
public class class_name {
public void marshall(AudioNormalizationSettings audioNormalizationSettings, ProtocolMarshaller protocolMarshaller) {
if (audioNormalizationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(audioNormalizationSettings.getAlgorithm(), ALGORITHM_BINDING);
protocolMarshaller.marshall(audioNormalizationSettings.getAlgorithmControl(), ALGORITHMCONTROL_BINDING);
protocolMarshaller.marshall(audioNormalizationSettings.getTargetLkfs(), TARGETLKFS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AudioNormalizationSettings audioNormalizationSettings, ProtocolMarshaller protocolMarshaller) {
if (audioNormalizationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(audioNormalizationSettings.getAlgorithm(), ALGORITHM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(audioNormalizationSettings.getAlgorithmControl(), ALGORITHMCONTROL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(audioNormalizationSettings.getTargetLkfs(), TARGETLKFS_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 InstalledFeature addInstalledFeatureToCache(ExtensionId feature, String namespace,
DefaultInstalledExtension installedExtension, boolean forceCreate)
{
Map<String, InstalledFeature> installedExtensionsForFeature =
this.extensionNamespaceByFeature.get(feature.getId());
if (installedExtensionsForFeature == null) {
installedExtensionsForFeature = new HashMap<String, InstalledFeature>();
this.extensionNamespaceByFeature.put(feature.getId(), installedExtensionsForFeature);
}
InstalledFeature installedFeature = installedExtensionsForFeature.get(namespace);
if (forceCreate || installedFeature == null) {
// Find or create root feature
InstalledRootFeature rootInstalledFeature;
if (installedExtension.getId().getId().equals(feature.getId())) {
rootInstalledFeature = new InstalledRootFeature(namespace);
} else {
rootInstalledFeature = getInstalledFeatureFromCache(installedExtension.getId().getId(), namespace).root;
}
// Create new feature
installedFeature = new InstalledFeature(rootInstalledFeature, feature);
// Add new feature
installedExtensionsForFeature.put(namespace, installedFeature);
}
if (installedExtension.isValid(namespace)) {
installedFeature.root.extension = installedExtension;
} else {
installedFeature.root.invalidExtensions.add(installedExtension);
}
return installedFeature;
} } | public class class_name {
private InstalledFeature addInstalledFeatureToCache(ExtensionId feature, String namespace,
DefaultInstalledExtension installedExtension, boolean forceCreate)
{
Map<String, InstalledFeature> installedExtensionsForFeature =
this.extensionNamespaceByFeature.get(feature.getId());
if (installedExtensionsForFeature == null) {
installedExtensionsForFeature = new HashMap<String, InstalledFeature>(); // depends on control dependency: [if], data = [none]
this.extensionNamespaceByFeature.put(feature.getId(), installedExtensionsForFeature); // depends on control dependency: [if], data = [none]
}
InstalledFeature installedFeature = installedExtensionsForFeature.get(namespace);
if (forceCreate || installedFeature == null) {
// Find or create root feature
InstalledRootFeature rootInstalledFeature;
if (installedExtension.getId().getId().equals(feature.getId())) {
rootInstalledFeature = new InstalledRootFeature(namespace); // depends on control dependency: [if], data = [none]
} else {
rootInstalledFeature = getInstalledFeatureFromCache(installedExtension.getId().getId(), namespace).root; // depends on control dependency: [if], data = [none]
}
// Create new feature
installedFeature = new InstalledFeature(rootInstalledFeature, feature); // depends on control dependency: [if], data = [none]
// Add new feature
installedExtensionsForFeature.put(namespace, installedFeature); // depends on control dependency: [if], data = [none]
}
if (installedExtension.isValid(namespace)) {
installedFeature.root.extension = installedExtension; // depends on control dependency: [if], data = [none]
} else {
installedFeature.root.invalidExtensions.add(installedExtension); // depends on control dependency: [if], data = [none]
}
return installedFeature;
} } |
public class class_name {
public static final Renderer<Date> instance() { // NOPMD it's thread save!
if (DateRenderer.instanceRenderer == null) {
synchronized (DateRenderer.class) {
if (DateRenderer.instanceRenderer == null) {
DateRenderer.instanceRenderer = new DateRenderer("yyyy-MM-dd");
}
}
}
return DateRenderer.instanceRenderer;
} } | public class class_name {
public static final Renderer<Date> instance() { // NOPMD it's thread save!
if (DateRenderer.instanceRenderer == null) {
synchronized (DateRenderer.class) { // depends on control dependency: [if], data = [none]
if (DateRenderer.instanceRenderer == null) {
DateRenderer.instanceRenderer = new DateRenderer("yyyy-MM-dd"); // depends on control dependency: [if], data = [none]
}
}
}
return DateRenderer.instanceRenderer;
} } |
public class class_name {
public EClass getIfcDimensionPair() {
if (ifcDimensionPairEClass == null) {
ifcDimensionPairEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(152);
}
return ifcDimensionPairEClass;
} } | public class class_name {
public EClass getIfcDimensionPair() {
if (ifcDimensionPairEClass == null) {
ifcDimensionPairEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(152);
// depends on control dependency: [if], data = [none]
}
return ifcDimensionPairEClass;
} } |
public class class_name {
public void setEndpointConfigs(java.util.Collection<EndpointConfigSummary> endpointConfigs) {
if (endpointConfigs == null) {
this.endpointConfigs = null;
return;
}
this.endpointConfigs = new java.util.ArrayList<EndpointConfigSummary>(endpointConfigs);
} } | public class class_name {
public void setEndpointConfigs(java.util.Collection<EndpointConfigSummary> endpointConfigs) {
if (endpointConfigs == null) {
this.endpointConfigs = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.endpointConfigs = new java.util.ArrayList<EndpointConfigSummary>(endpointConfigs);
} } |
public class class_name {
public int compareTo(final ChronoIndexData info)
{
long value;
if (chronoSort) {
value = this.time - info.time;
}
else {
value = this.revisionCounter - info.revisionCounter;
}
if (value == 0) {
return 0;
}
else if (value > 0) {
return 1;
}
else {
return -1;
}
} } | public class class_name {
public int compareTo(final ChronoIndexData info)
{
long value;
if (chronoSort) {
value = this.time - info.time; // depends on control dependency: [if], data = [none]
}
else {
value = this.revisionCounter - info.revisionCounter; // depends on control dependency: [if], data = [none]
}
if (value == 0) {
return 0; // depends on control dependency: [if], data = [none]
}
else if (value > 0) {
return 1; // depends on control dependency: [if], data = [none]
}
else {
return -1; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Cell createCell(Date date) {
Cell cell = this.getNextCell(CellType.STRING);
if (date != null) {
cell.setCellValue(date);
}
cell.setCellStyle(this.style.getDateCs());
return cell;
} } | public class class_name {
public Cell createCell(Date date) {
Cell cell = this.getNextCell(CellType.STRING);
if (date != null) {
cell.setCellValue(date); // depends on control dependency: [if], data = [(date]
}
cell.setCellStyle(this.style.getDateCs());
return cell;
} } |
public class class_name {
public static String capitalize(String s) {
if (Character.isLowerCase(s.charAt(0))) {
return Character.toUpperCase(s.charAt(0)) + s.substring(1);
} else {
return s;
}
} } | public class class_name {
public static String capitalize(String s) {
if (Character.isLowerCase(s.charAt(0))) {
return Character.toUpperCase(s.charAt(0)) + s.substring(1); // depends on control dependency: [if], data = [none]
} else {
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void logHttpRequest(HttpServletRequest httpRequest, String requestName, long duration,
boolean systemError, int responseSize, String loggerName) {
final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(loggerName);
if (logger.isLoggable(Level.INFO)) {
logger.info(LOG.buildLogMessage(httpRequest, duration, systemError, responseSize));
}
} } | public class class_name {
@Override
public void logHttpRequest(HttpServletRequest httpRequest, String requestName, long duration,
boolean systemError, int responseSize, String loggerName) {
final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(loggerName);
if (logger.isLoggable(Level.INFO)) {
logger.info(LOG.buildLogMessage(httpRequest, duration, systemError, responseSize));
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Map<String, String> getLinks() {
if (links == null) {
return ImmutableMap.of();
}
return ImmutableMap.copyOf(links);
} } | public class class_name {
public Map<String, String> getLinks() {
if (links == null) {
return ImmutableMap.of(); // depends on control dependency: [if], data = [none]
}
return ImmutableMap.copyOf(links);
} } |
public class class_name {
public Vector nlist(String path)
throws ServerException, ClientException, IOException {
ByteArrayDataSink sink = new ByteArrayDataSink();
nlist(path, sink);
ByteArrayOutputStream received = sink.getData();
// transfer done. Data is in received stream.
// convert it to a vector.
BufferedReader reader =
new BufferedReader(new StringReader(received.toString()));
Vector fileList = new Vector();
FileInfo fileInfo = null;
String line = null;
while ((line = reader.readLine()) != null) {
if (logger.isDebugEnabled()) {
logger.debug("line ->" + line);
}
fileInfo = new FileInfo();
fileInfo.setName(line);
fileInfo.setFileType(FileInfo.UNKNOWN_TYPE);
fileList.addElement(fileInfo);
}
return fileList;
} } | public class class_name {
public Vector nlist(String path)
throws ServerException, ClientException, IOException {
ByteArrayDataSink sink = new ByteArrayDataSink();
nlist(path, sink);
ByteArrayOutputStream received = sink.getData();
// transfer done. Data is in received stream.
// convert it to a vector.
BufferedReader reader =
new BufferedReader(new StringReader(received.toString()));
Vector fileList = new Vector();
FileInfo fileInfo = null;
String line = null;
while ((line = reader.readLine()) != null) {
if (logger.isDebugEnabled()) {
logger.debug("line ->" + line); // depends on control dependency: [if], data = [none]
}
fileInfo = new FileInfo();
fileInfo.setName(line);
fileInfo.setFileType(FileInfo.UNKNOWN_TYPE);
fileList.addElement(fileInfo);
}
return fileList;
} } |
public class class_name {
public String displayBody() {
StringBuffer result = new StringBuffer(256);
// change to online project to allow static export
try {
getJsp().getRequestContext().setCurrentProject(m_onlineProject);
result.append(buildHtmlHelpStart("onlinehelp.css", true));
result.append("<body>\n");
result.append("<a name=\"top\"></a>\n");
result.append("<table class=\"helpcontent\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
result.append("<tr>\n");
result.append("\t<td class=\"helpnav\">\n");
result.append(
"\t\t<a class=\"navhelphead\" href=\"javascript:top.body.location.href=top.head.homeLink;\">");
result.append(key(Messages.GUI_HELP_NAVIGATION_HEAD_0));
result.append("</a>\n");
result.append(buildHtmlHelpNavigation());
result.append("</td>\n");
result.append("\t<td class=\"helpcontent\">\n");
result.append("\t\t<h1>");
result.append(
getJsp().property(
CmsPropertyDefinition.PROPERTY_TITLE,
getParamHelpresource(),
key(Messages.GUI_HELP_FRAMESET_TITLE_0)));
result.append("</h1>\n");
// print navigation if property template-elements is set to sitemap
result.append(getJsp().getContent(getParamHelpresource(), "body", getLocale()));
try {
// additionally allow appending content of dynamic pages whose path may be specified
// as value of property PROPERTY_TEMPLATE_ELEMENTS (currently sitemap.jsp and search.jsp are used)
CmsProperty elements = getCms().readPropertyObject(
getParamHelpresource(),
CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
false);
if (!elements.isNullProperty()) {
try {
// trigger an exception here as getContent won't throw anything!
getJsp().getCmsObject().readFile(elements.getValue());
// Ok, ressource exists: switsch from the online project to turn of static export links.
String elementName = elements.getValue();
// check, wether the "dynamic resource" wants to be exported or not:
boolean export = false;
CmsProperty exportProp = getCms().readPropertyObject(
elementName,
CmsPropertyDefinition.PROPERTY_EXPORT,
true);
if (!exportProp.isNullProperty()) {
export = Boolean.valueOf(exportProp.getValue(CmsStringUtil.FALSE)).booleanValue();
}
if (!export) {
// switch back from online project to avoid export:
getJsp().getRequestContext().setCurrentProject(m_offlineProject);
}
result.append(getJsp().getContent(elements.getValue()));
} catch (Throwable t) {
CmsVfsResourceNotFoundException e2 = new CmsVfsResourceNotFoundException(
Messages.get().container(
Messages.GUI_HELP_ERR_CONTENT_APPEND_2,
getParamHelpresource(),
elements.getValue(),
CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS),
t);
throw e2;
}
}
} catch (CmsException e1) {
if (LOG.isErrorEnabled()) {
LOG.error(e1);
}
result.append("<br>\n<div class=\"dialogerror\">");
// getLocale() does not work in this context!?!
result.append(e1.getMessageContainer().key(Locale.GERMAN));
result.append("</div>");
}
result.append("\t</td>\n");
result.append("</tr>\n");
result.append("</table>\n");
result.append(buildHtmlHelpEnd());
return result.toString();
} finally {
getJsp().getRequestContext().setCurrentProject(m_offlineProject);
}
} } | public class class_name {
public String displayBody() {
StringBuffer result = new StringBuffer(256);
// change to online project to allow static export
try {
getJsp().getRequestContext().setCurrentProject(m_onlineProject); // depends on control dependency: [try], data = [none]
result.append(buildHtmlHelpStart("onlinehelp.css", true)); // depends on control dependency: [try], data = [none]
result.append("<body>\n"); // depends on control dependency: [try], data = [none]
result.append("<a name=\"top\"></a>\n"); // depends on control dependency: [try], data = [none]
result.append("<table class=\"helpcontent\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"); // depends on control dependency: [try], data = [none]
result.append("<tr>\n"); // depends on control dependency: [try], data = [none]
result.append("\t<td class=\"helpnav\">\n"); // depends on control dependency: [try], data = [none]
result.append(
"\t\t<a class=\"navhelphead\" href=\"javascript:top.body.location.href=top.head.homeLink;\">");
result.append(key(Messages.GUI_HELP_NAVIGATION_HEAD_0));
result.append("</a>\n"); // depends on control dependency: [try], data = [none]
result.append(buildHtmlHelpNavigation()); // depends on control dependency: [try], data = [none]
result.append("</td>\n"); // depends on control dependency: [try], data = [none]
result.append("\t<td class=\"helpcontent\">\n"); // depends on control dependency: [try], data = [none]
result.append("\t\t<h1>"); // depends on control dependency: [try], data = [none]
result.append(
getJsp().property(
CmsPropertyDefinition.PROPERTY_TITLE,
getParamHelpresource(),
key(Messages.GUI_HELP_FRAMESET_TITLE_0))); // depends on control dependency: [try], data = [none]
result.append("</h1>\n"); // depends on control dependency: [try], data = [none]
// print navigation if property template-elements is set to sitemap
result.append(getJsp().getContent(getParamHelpresource(), "body", getLocale())); // depends on control dependency: [try], data = [none]
try {
// additionally allow appending content of dynamic pages whose path may be specified
// as value of property PROPERTY_TEMPLATE_ELEMENTS (currently sitemap.jsp and search.jsp are used)
CmsProperty elements = getCms().readPropertyObject(
getParamHelpresource(),
CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
false);
if (!elements.isNullProperty()) {
try {
// trigger an exception here as getContent won't throw anything!
getJsp().getCmsObject().readFile(elements.getValue()); // depends on control dependency: [try], data = [none]
// Ok, ressource exists: switsch from the online project to turn of static export links.
String elementName = elements.getValue();
// check, wether the "dynamic resource" wants to be exported or not:
boolean export = false;
CmsProperty exportProp = getCms().readPropertyObject(
elementName,
CmsPropertyDefinition.PROPERTY_EXPORT,
true);
if (!exportProp.isNullProperty()) {
export = Boolean.valueOf(exportProp.getValue(CmsStringUtil.FALSE)).booleanValue(); // depends on control dependency: [if], data = [none]
}
if (!export) {
// switch back from online project to avoid export:
getJsp().getRequestContext().setCurrentProject(m_offlineProject); // depends on control dependency: [if], data = [none]
}
result.append(getJsp().getContent(elements.getValue())); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
CmsVfsResourceNotFoundException e2 = new CmsVfsResourceNotFoundException(
Messages.get().container(
Messages.GUI_HELP_ERR_CONTENT_APPEND_2,
getParamHelpresource(),
elements.getValue(),
CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS),
t);
throw e2;
} // depends on control dependency: [catch], data = [none]
}
} catch (CmsException e1) {
if (LOG.isErrorEnabled()) {
LOG.error(e1); // depends on control dependency: [if], data = [none]
}
result.append("<br>\n<div class=\"dialogerror\">");
// getLocale() does not work in this context!?!
result.append(e1.getMessageContainer().key(Locale.GERMAN));
result.append("</div>");
} // depends on control dependency: [catch], data = [none]
result.append("\t</td>\n"); // depends on control dependency: [try], data = [none]
result.append("</tr>\n"); // depends on control dependency: [try], data = [none]
result.append("</table>\n"); // depends on control dependency: [try], data = [none]
result.append(buildHtmlHelpEnd()); // depends on control dependency: [try], data = [none]
return result.toString(); // depends on control dependency: [try], data = [none]
} finally {
getJsp().getRequestContext().setCurrentProject(m_offlineProject);
}
} } |
public class class_name {
final public void write(int ch)
{
try {
_out.print((char) ch);
} catch (IOException e) {
log.log(Level.FINE, e.toString(), e);
}
} } | public class class_name {
final public void write(int ch)
{
try {
_out.print((char) ch); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.log(Level.FINE, e.toString(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private synchronized Channel channel() throws IOException {
if (autoReconnect) {
try {
connect();
} catch (GeneralSecurityException e) {
throw new IOException(e);
}
}
return channel;
} } | public class class_name {
private synchronized Channel channel() throws IOException {
if (autoReconnect) {
try {
connect(); // depends on control dependency: [try], data = [none]
} catch (GeneralSecurityException e) {
throw new IOException(e);
} // depends on control dependency: [catch], data = [none]
}
return channel;
} } |
public class class_name {
private void processCalendarData(ProjectCalendar calendar, List<ResultSetRow> calendarData)
{
for (ResultSetRow row : calendarData)
{
processCalendarData(calendar, row);
}
} } | public class class_name {
private void processCalendarData(ProjectCalendar calendar, List<ResultSetRow> calendarData)
{
for (ResultSetRow row : calendarData)
{
processCalendarData(calendar, row); // depends on control dependency: [for], data = [row]
}
} } |
public class class_name {
public static List<byte[]> getTagsFromTSUID(final String tsuid) {
if (tsuid == null || tsuid.isEmpty()) {
throw new IllegalArgumentException("Missing TSUID");
}
if (tsuid.length() <= TSDB.metrics_width() * 2) {
throw new IllegalArgumentException(
"TSUID is too short, may be missing tags");
}
final List<byte[]> tags = new ArrayList<byte[]>();
final int pair_width = (TSDB.tagk_width() * 2) + (TSDB.tagv_width() * 2);
// start after the metric then iterate over each tagk/tagv pair
for (int i = TSDB.metrics_width() * 2; i < tsuid.length(); i+= pair_width) {
if (i + pair_width > tsuid.length()){
throw new IllegalArgumentException(
"The TSUID appears to be malformed, improper tag width");
}
String tag = tsuid.substring(i, i + (TSDB.tagk_width() * 2));
tags.add(UniqueId.stringToUid(tag));
tag = tsuid.substring(i + (TSDB.tagk_width() * 2), i + pair_width);
tags.add(UniqueId.stringToUid(tag));
}
return tags;
} } | public class class_name {
public static List<byte[]> getTagsFromTSUID(final String tsuid) {
if (tsuid == null || tsuid.isEmpty()) {
throw new IllegalArgumentException("Missing TSUID");
}
if (tsuid.length() <= TSDB.metrics_width() * 2) {
throw new IllegalArgumentException(
"TSUID is too short, may be missing tags");
}
final List<byte[]> tags = new ArrayList<byte[]>();
final int pair_width = (TSDB.tagk_width() * 2) + (TSDB.tagv_width() * 2);
// start after the metric then iterate over each tagk/tagv pair
for (int i = TSDB.metrics_width() * 2; i < tsuid.length(); i+= pair_width) {
if (i + pair_width > tsuid.length()){
throw new IllegalArgumentException(
"The TSUID appears to be malformed, improper tag width");
}
String tag = tsuid.substring(i, i + (TSDB.tagk_width() * 2));
tags.add(UniqueId.stringToUid(tag)); // depends on control dependency: [for], data = [none]
tag = tsuid.substring(i + (TSDB.tagk_width() * 2), i + pair_width); // depends on control dependency: [for], data = [i]
tags.add(UniqueId.stringToUid(tag)); // depends on control dependency: [for], data = [none]
}
return tags;
} } |
public class class_name {
public static Predicate<Matcher> preventLoops() {
return new Predicate<Matcher>() {
private final Set<Matcher> visited = new HashSet<Matcher>();
public boolean apply(Matcher node) {
node = unwrap(node);
if (visited.contains(node)) {
return false;
}
visited.add(node);
return true;
}
};
} } | public class class_name {
public static Predicate<Matcher> preventLoops() {
return new Predicate<Matcher>() {
private final Set<Matcher> visited = new HashSet<Matcher>();
public boolean apply(Matcher node) {
node = unwrap(node);
if (visited.contains(node)) {
return false; // depends on control dependency: [if], data = [none]
}
visited.add(node);
return true;
}
};
} } |
public class class_name {
public void processAllRecords(String strPackage)
{
Map<String,String> mapDatabaseList = new HashMap<String,String>();
FileHdr recFileHdr = (FileHdr)this.getMainRecord();
recFileHdr.setKeyArea(FileHdr.FILE_NAME_KEY);
recFileHdr.close();
try {
Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
while (recFileHdr.hasNext())
{
recFileHdr.next();
String strRecord = recFileHdr.getField(FileHdr.FILE_NAME).toString();
if ((strRecord == null) || (strRecord.length() == 0))
continue;
if (!recFileHdr.isPhysicalFile())
continue;
//xif (recFileHdr.getField(FileHdr.DATABASE_NAME).isNull())
//x continue;
if (DatabaseInfo.DATABASE_INFO_FILE.equalsIgnoreCase(recFileHdr.getField(FileHdr.DATABASE_NAME).toString()))
continue;
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY);
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strRecord);
if (recClassInfo.seek(null))
{
String strClassPackage = this.getFullPackageName(recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).toString(), recClassInfo.getField(ClassInfo.CLASS_PACKAGE).toString());
if (this.includeRecord(recFileHdr, recClassInfo, strPackage))
{
Record record = this.getThisRecord(strRecord, strClassPackage, null);
boolean success = this.processThisRecord(record);
if (success)
{
String databaseName = record.getTable().getDatabase().getDatabaseName(true);
if (databaseName.lastIndexOf('_') != -1) // always
databaseName = databaseName.substring(0, databaseName.lastIndexOf('_'));
mapDatabaseList.put(databaseName, strClassPackage);
}
}
}
}
// Now export any control records
recFileHdr.close();
while (recFileHdr.hasNext())
{
recFileHdr.next();
String strRecord = recFileHdr.getField(FileHdr.FILE_NAME).toString();
if ((strRecord == null) || (strRecord.length() == 0))
continue;
if (!recFileHdr.isPhysicalFile())
continue;
if (!recFileHdr.getField(FileHdr.DATABASE_NAME).isNull())
continue;
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY);
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strRecord);
if (recClassInfo.seek(null))
{
if (recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).toString().equalsIgnoreCase("QueryRecord"))
continue;
if (recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).toString().indexOf("Query") != -1)
continue;
String strClassPackage = this.getFullPackageName(recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).toString(), recClassInfo.getField(ClassInfo.CLASS_PACKAGE).toString());
if (strPackage != null)
if (strClassPackage != null)
if (!strClassPackage.matches(strPackage))
continue;
if (!DatabaseInfo.DATABASE_INFO_FILE.equalsIgnoreCase(strRecord))
continue; // Hack
if ("USER_DATA".equalsIgnoreCase(this.getProperty("type")))
continue; // User data doesn't have database info
String databaseName = this.getProperty("database");
strRecord = strClassPackage + "." + strRecord;
for (String strDBName : mapDatabaseList.keySet())
{
String strClassPkg = mapDatabaseList.get(strDBName);
if (strClassPkg != null)
{
Record record = this.getThisRecord(strRecord, strClassPkg, strDBName);
if (record != null)
{
if (databaseName != null)
if (!strDBName.startsWith(databaseName))
continue;
this.processThisRecord(record);
}
}
}
}
}
} catch (DBException ex) {
ex.printStackTrace();
}
return;
} } | public class class_name {
public void processAllRecords(String strPackage)
{
Map<String,String> mapDatabaseList = new HashMap<String,String>();
FileHdr recFileHdr = (FileHdr)this.getMainRecord();
recFileHdr.setKeyArea(FileHdr.FILE_NAME_KEY);
recFileHdr.close();
try {
Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
while (recFileHdr.hasNext())
{
recFileHdr.next(); // depends on control dependency: [while], data = [none]
String strRecord = recFileHdr.getField(FileHdr.FILE_NAME).toString();
if ((strRecord == null) || (strRecord.length() == 0))
continue;
if (!recFileHdr.isPhysicalFile())
continue;
//xif (recFileHdr.getField(FileHdr.DATABASE_NAME).isNull())
//x continue;
if (DatabaseInfo.DATABASE_INFO_FILE.equalsIgnoreCase(recFileHdr.getField(FileHdr.DATABASE_NAME).toString()))
continue;
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY); // depends on control dependency: [while], data = [none]
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strRecord); // depends on control dependency: [while], data = [none]
if (recClassInfo.seek(null))
{
String strClassPackage = this.getFullPackageName(recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).toString(), recClassInfo.getField(ClassInfo.CLASS_PACKAGE).toString());
if (this.includeRecord(recFileHdr, recClassInfo, strPackage))
{
Record record = this.getThisRecord(strRecord, strClassPackage, null);
boolean success = this.processThisRecord(record);
if (success)
{
String databaseName = record.getTable().getDatabase().getDatabaseName(true);
if (databaseName.lastIndexOf('_') != -1) // always
databaseName = databaseName.substring(0, databaseName.lastIndexOf('_'));
mapDatabaseList.put(databaseName, strClassPackage); // depends on control dependency: [if], data = [none]
}
}
}
}
// Now export any control records
recFileHdr.close(); // depends on control dependency: [try], data = [none]
while (recFileHdr.hasNext())
{
recFileHdr.next(); // depends on control dependency: [while], data = [none]
String strRecord = recFileHdr.getField(FileHdr.FILE_NAME).toString();
if ((strRecord == null) || (strRecord.length() == 0))
continue;
if (!recFileHdr.isPhysicalFile())
continue;
if (!recFileHdr.getField(FileHdr.DATABASE_NAME).isNull())
continue;
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY); // depends on control dependency: [while], data = [none]
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strRecord); // depends on control dependency: [while], data = [none]
if (recClassInfo.seek(null))
{
if (recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).toString().equalsIgnoreCase("QueryRecord"))
continue;
if (recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).toString().indexOf("Query") != -1)
continue;
String strClassPackage = this.getFullPackageName(recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).toString(), recClassInfo.getField(ClassInfo.CLASS_PACKAGE).toString());
if (strPackage != null)
if (strClassPackage != null)
if (!strClassPackage.matches(strPackage))
continue;
if (!DatabaseInfo.DATABASE_INFO_FILE.equalsIgnoreCase(strRecord))
continue; // Hack
if ("USER_DATA".equalsIgnoreCase(this.getProperty("type")))
continue; // User data doesn't have database info
String databaseName = this.getProperty("database");
strRecord = strClassPackage + "." + strRecord; // depends on control dependency: [if], data = [none]
for (String strDBName : mapDatabaseList.keySet())
{
String strClassPkg = mapDatabaseList.get(strDBName);
if (strClassPkg != null)
{
Record record = this.getThisRecord(strRecord, strClassPkg, strDBName);
if (record != null)
{
if (databaseName != null)
if (!strDBName.startsWith(databaseName))
continue;
this.processThisRecord(record); // depends on control dependency: [if], data = [(record]
}
}
}
}
}
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return;
} } |
public class class_name {
private ColumnFamily collectAllData(boolean copyOnHeap)
{
Tracing.trace("Acquiring sstable references");
ColumnFamilyStore.ViewFragment view = cfs.select(cfs.viewFilter(filter.key));
List<Iterator<? extends OnDiskAtom>> iterators = new ArrayList<>(Iterables.size(view.memtables) + view.sstables.size());
ColumnFamily returnCF = ArrayBackedSortedColumns.factory.create(cfs.metadata, filter.filter.isReversed());
DeletionInfo returnDeletionInfo = returnCF.deletionInfo();
try
{
Tracing.trace("Merging memtable tombstones");
for (Memtable memtable : view.memtables)
{
final ColumnFamily cf = memtable.getColumnFamily(filter.key);
if (cf != null)
{
filter.delete(returnDeletionInfo, cf);
Iterator<Cell> iter = filter.getIterator(cf);
if (copyOnHeap)
{
iter = Iterators.transform(iter, new Function<Cell, Cell>()
{
public Cell apply(Cell cell)
{
return cell.localCopy(cf.metadata, HeapAllocator.instance);
}
});
}
iterators.add(iter);
}
}
/*
* We can't eliminate full sstables based on the timestamp of what we've already read like
* in collectTimeOrderedData, but we still want to eliminate sstable whose maxTimestamp < mostRecentTombstone
* we've read. We still rely on the sstable ordering by maxTimestamp since if
* maxTimestamp_s1 > maxTimestamp_s0,
* we're guaranteed that s1 cannot have a row tombstone such that
* timestamp(tombstone) > maxTimestamp_s0
* since we necessarily have
* timestamp(tombstone) <= maxTimestamp_s1
* In other words, iterating in maxTimestamp order allow to do our mostRecentTombstone elimination
* in one pass, and minimize the number of sstables for which we read a rowTombstone.
*/
Collections.sort(view.sstables, SSTableReader.maxTimestampComparator);
List<SSTableReader> skippedSSTables = null;
long mostRecentRowTombstone = Long.MIN_VALUE;
long minTimestamp = Long.MAX_VALUE;
int nonIntersectingSSTables = 0;
for (SSTableReader sstable : view.sstables)
{
minTimestamp = Math.min(minTimestamp, sstable.getMinTimestamp());
// if we've already seen a row tombstone with a timestamp greater
// than the most recent update to this sstable, we can skip it
if (sstable.getMaxTimestamp() < mostRecentRowTombstone)
break;
if (!filter.shouldInclude(sstable))
{
nonIntersectingSSTables++;
// sstable contains no tombstone if maxLocalDeletionTime == Integer.MAX_VALUE, so we can safely skip those entirely
if (sstable.getSSTableMetadata().maxLocalDeletionTime != Integer.MAX_VALUE)
{
if (skippedSSTables == null)
skippedSSTables = new ArrayList<>();
skippedSSTables.add(sstable);
}
continue;
}
sstable.incrementReadCount();
OnDiskAtomIterator iter = filter.getSSTableColumnIterator(sstable);
iterators.add(iter);
if (iter.getColumnFamily() != null)
{
ColumnFamily cf = iter.getColumnFamily();
if (cf.isMarkedForDelete())
mostRecentRowTombstone = cf.deletionInfo().getTopLevelDeletion().markedForDeleteAt;
returnCF.delete(cf);
sstablesIterated++;
}
}
int includedDueToTombstones = 0;
// Check for row tombstone in the skipped sstables
if (skippedSSTables != null)
{
for (SSTableReader sstable : skippedSSTables)
{
if (sstable.getMaxTimestamp() <= minTimestamp)
continue;
sstable.incrementReadCount();
OnDiskAtomIterator iter = filter.getSSTableColumnIterator(sstable);
ColumnFamily cf = iter.getColumnFamily();
// we are only interested in row-level tombstones here, and only if markedForDeleteAt is larger than minTimestamp
if (cf != null && cf.deletionInfo().getTopLevelDeletion().markedForDeleteAt > minTimestamp)
{
includedDueToTombstones++;
iterators.add(iter);
returnCF.delete(cf.deletionInfo().getTopLevelDeletion());
sstablesIterated++;
}
else
{
FileUtils.closeQuietly(iter);
}
}
}
if (Tracing.isTracing())
Tracing.trace("Skipped {}/{} non-slice-intersecting sstables, included {} due to tombstones", new Object[] {nonIntersectingSSTables, view.sstables.size(), includedDueToTombstones});
// we need to distinguish between "there is no data at all for this row" (BF will let us rebuild that efficiently)
// and "there used to be data, but it's gone now" (we should cache the empty CF so we don't need to rebuild that slower)
if (iterators.isEmpty())
return null;
Tracing.trace("Merging data from memtables and {} sstables", sstablesIterated);
filter.collateOnDiskAtom(returnCF, iterators, gcBefore);
// Caller is responsible for final removeDeletedCF. This is important for cacheRow to work correctly:
return returnCF;
}
finally
{
for (Object iter : iterators)
if (iter instanceof Closeable)
FileUtils.closeQuietly((Closeable) iter);
}
} } | public class class_name {
private ColumnFamily collectAllData(boolean copyOnHeap)
{
Tracing.trace("Acquiring sstable references");
ColumnFamilyStore.ViewFragment view = cfs.select(cfs.viewFilter(filter.key));
List<Iterator<? extends OnDiskAtom>> iterators = new ArrayList<>(Iterables.size(view.memtables) + view.sstables.size());
ColumnFamily returnCF = ArrayBackedSortedColumns.factory.create(cfs.metadata, filter.filter.isReversed());
DeletionInfo returnDeletionInfo = returnCF.deletionInfo();
try
{
Tracing.trace("Merging memtable tombstones"); // depends on control dependency: [try], data = [none]
for (Memtable memtable : view.memtables)
{
final ColumnFamily cf = memtable.getColumnFamily(filter.key);
if (cf != null)
{
filter.delete(returnDeletionInfo, cf); // depends on control dependency: [if], data = [none]
Iterator<Cell> iter = filter.getIterator(cf);
if (copyOnHeap)
{
iter = Iterators.transform(iter, new Function<Cell, Cell>()
{
public Cell apply(Cell cell)
{
return cell.localCopy(cf.metadata, HeapAllocator.instance);
}
}); // depends on control dependency: [if], data = [none]
}
iterators.add(iter); // depends on control dependency: [if], data = [none]
}
}
/*
* We can't eliminate full sstables based on the timestamp of what we've already read like
* in collectTimeOrderedData, but we still want to eliminate sstable whose maxTimestamp < mostRecentTombstone
* we've read. We still rely on the sstable ordering by maxTimestamp since if
* maxTimestamp_s1 > maxTimestamp_s0,
* we're guaranteed that s1 cannot have a row tombstone such that
* timestamp(tombstone) > maxTimestamp_s0
* since we necessarily have
* timestamp(tombstone) <= maxTimestamp_s1
* In other words, iterating in maxTimestamp order allow to do our mostRecentTombstone elimination
* in one pass, and minimize the number of sstables for which we read a rowTombstone.
*/
Collections.sort(view.sstables, SSTableReader.maxTimestampComparator); // depends on control dependency: [try], data = [none]
List<SSTableReader> skippedSSTables = null;
long mostRecentRowTombstone = Long.MIN_VALUE;
long minTimestamp = Long.MAX_VALUE;
int nonIntersectingSSTables = 0;
for (SSTableReader sstable : view.sstables)
{
minTimestamp = Math.min(minTimestamp, sstable.getMinTimestamp()); // depends on control dependency: [for], data = [sstable]
// if we've already seen a row tombstone with a timestamp greater
// than the most recent update to this sstable, we can skip it
if (sstable.getMaxTimestamp() < mostRecentRowTombstone)
break;
if (!filter.shouldInclude(sstable))
{
nonIntersectingSSTables++; // depends on control dependency: [if], data = [none]
// sstable contains no tombstone if maxLocalDeletionTime == Integer.MAX_VALUE, so we can safely skip those entirely
if (sstable.getSSTableMetadata().maxLocalDeletionTime != Integer.MAX_VALUE)
{
if (skippedSSTables == null)
skippedSSTables = new ArrayList<>();
skippedSSTables.add(sstable); // depends on control dependency: [if], data = [none]
}
continue;
}
sstable.incrementReadCount(); // depends on control dependency: [for], data = [sstable]
OnDiskAtomIterator iter = filter.getSSTableColumnIterator(sstable);
iterators.add(iter); // depends on control dependency: [for], data = [none]
if (iter.getColumnFamily() != null)
{
ColumnFamily cf = iter.getColumnFamily();
if (cf.isMarkedForDelete())
mostRecentRowTombstone = cf.deletionInfo().getTopLevelDeletion().markedForDeleteAt;
returnCF.delete(cf); // depends on control dependency: [if], data = [none]
sstablesIterated++; // depends on control dependency: [if], data = [none]
}
}
int includedDueToTombstones = 0;
// Check for row tombstone in the skipped sstables
if (skippedSSTables != null)
{
for (SSTableReader sstable : skippedSSTables)
{
if (sstable.getMaxTimestamp() <= minTimestamp)
continue;
sstable.incrementReadCount(); // depends on control dependency: [for], data = [sstable]
OnDiskAtomIterator iter = filter.getSSTableColumnIterator(sstable);
ColumnFamily cf = iter.getColumnFamily();
// we are only interested in row-level tombstones here, and only if markedForDeleteAt is larger than minTimestamp
if (cf != null && cf.deletionInfo().getTopLevelDeletion().markedForDeleteAt > minTimestamp)
{
includedDueToTombstones++; // depends on control dependency: [if], data = [none]
iterators.add(iter); // depends on control dependency: [if], data = [none]
returnCF.delete(cf.deletionInfo().getTopLevelDeletion()); // depends on control dependency: [if], data = [(cf]
sstablesIterated++; // depends on control dependency: [if], data = [none]
}
else
{
FileUtils.closeQuietly(iter); // depends on control dependency: [if], data = [none]
}
}
}
if (Tracing.isTracing())
Tracing.trace("Skipped {}/{} non-slice-intersecting sstables, included {} due to tombstones", new Object[] {nonIntersectingSSTables, view.sstables.size(), includedDueToTombstones});
// we need to distinguish between "there is no data at all for this row" (BF will let us rebuild that efficiently)
// and "there used to be data, but it's gone now" (we should cache the empty CF so we don't need to rebuild that slower)
if (iterators.isEmpty())
return null;
Tracing.trace("Merging data from memtables and {} sstables", sstablesIterated); // depends on control dependency: [try], data = [none]
filter.collateOnDiskAtom(returnCF, iterators, gcBefore); // depends on control dependency: [try], data = [none]
// Caller is responsible for final removeDeletedCF. This is important for cacheRow to work correctly:
return returnCF; // depends on control dependency: [try], data = [none]
}
finally
{
for (Object iter : iterators)
if (iter instanceof Closeable)
FileUtils.closeQuietly((Closeable) iter);
}
} } |
public class class_name {
public GetFindingsStatisticsRequest withFindingStatisticTypes(String... findingStatisticTypes) {
if (this.findingStatisticTypes == null) {
setFindingStatisticTypes(new java.util.ArrayList<String>(findingStatisticTypes.length));
}
for (String ele : findingStatisticTypes) {
this.findingStatisticTypes.add(ele);
}
return this;
} } | public class class_name {
public GetFindingsStatisticsRequest withFindingStatisticTypes(String... findingStatisticTypes) {
if (this.findingStatisticTypes == null) {
setFindingStatisticTypes(new java.util.ArrayList<String>(findingStatisticTypes.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : findingStatisticTypes) {
this.findingStatisticTypes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public EClass getIfcLibraryReference() {
if (ifcLibraryReferenceEClass == null) {
ifcLibraryReferenceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(289);
}
return ifcLibraryReferenceEClass;
} } | public class class_name {
public EClass getIfcLibraryReference() {
if (ifcLibraryReferenceEClass == null) {
ifcLibraryReferenceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(289);
// depends on control dependency: [if], data = [none]
}
return ifcLibraryReferenceEClass;
} } |
public class class_name {
static public ProjectionImpl makeProjection(CoverageTransform gct, Formatter errInfo) {
// standard name
String transform_name = gct.findAttValueIgnoreCase(CF.GRID_MAPPING_NAME, null);
if (null == transform_name) {
errInfo.format("**Failed to find Coordinate Transform name from GridCoordTransform= %s%n", gct);
return null;
}
transform_name = transform_name.trim();
// do we have a transform registered for this ?
Class builderClass = null;
for (Transform transform : transformList) {
if (transform.transName.equals(transform_name)) {
builderClass = transform.transClass;
break;
}
}
if (null == builderClass) {
errInfo.format("**Failed to find CoordTransBuilder name= %s from GridCoordTransform= %s%n", transform_name, gct);
return null;
}
// get an instance of that class
HorizTransformBuilderIF builder;
try {
builder = (HorizTransformBuilderIF) builderClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
log.error("Cant create new instance "+builderClass.getName(), e);
return null;
}
if (null == builder) { // cant happen - because this was tested in registerTransform()
errInfo.format("**Failed to build CoordTransBuilder object from class= %s for GridCoordTransform= %s%n", builderClass.getName(), gct);
return null;
}
String units = gct.findAttValueIgnoreCase(CDM.UNITS, null);
builder.setErrorBuffer( errInfo);
ProjectionCT ct = builder.makeCoordinateTransform(gct, units);
assert ct != null;
return ct.getProjection();
} } | public class class_name {
static public ProjectionImpl makeProjection(CoverageTransform gct, Formatter errInfo) {
// standard name
String transform_name = gct.findAttValueIgnoreCase(CF.GRID_MAPPING_NAME, null);
if (null == transform_name) {
errInfo.format("**Failed to find Coordinate Transform name from GridCoordTransform= %s%n", gct);
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
}
transform_name = transform_name.trim();
// do we have a transform registered for this ?
Class builderClass = null;
for (Transform transform : transformList) {
if (transform.transName.equals(transform_name)) {
builderClass = transform.transClass;
// depends on control dependency: [if], data = [none]
break;
}
}
if (null == builderClass) {
errInfo.format("**Failed to find CoordTransBuilder name= %s from GridCoordTransform= %s%n", transform_name, gct);
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
}
// get an instance of that class
HorizTransformBuilderIF builder;
try {
builder = (HorizTransformBuilderIF) builderClass.newInstance();
// depends on control dependency: [try], data = [none]
} catch (InstantiationException | IllegalAccessException e) {
log.error("Cant create new instance "+builderClass.getName(), e);
return null;
}
// depends on control dependency: [catch], data = [none]
if (null == builder) { // cant happen - because this was tested in registerTransform()
errInfo.format("**Failed to build CoordTransBuilder object from class= %s for GridCoordTransform= %s%n", builderClass.getName(), gct);
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
}
String units = gct.findAttValueIgnoreCase(CDM.UNITS, null);
builder.setErrorBuffer( errInfo);
ProjectionCT ct = builder.makeCoordinateTransform(gct, units);
assert ct != null;
return ct.getProjection();
} } |
public class class_name {
public void updateModel(@NonNull Model model) {
if (zoo != null) {
for (val w: zoo)
w.updateModel(model);
} else {
// if zoo wasn't initalized yet - just replace model
this.model = model;
}
} } | public class class_name {
public void updateModel(@NonNull Model model) {
if (zoo != null) {
for (val w: zoo)
w.updateModel(model);
} else {
// if zoo wasn't initalized yet - just replace model
this.model = model; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean close(PageComponent pageComponent) {
if (!pageComponent.canClose()) {
return false;
}
if (!pageComponents.contains(pageComponent)) {
return false;
}
if (pageComponent == activeComponent) {
fireFocusLost(pageComponent);
activeComponent = null;
}
doRemovePageComponent(pageComponent);
pageComponents.remove(pageComponent);
pageComponent.removePropertyChangeListener(pageComponentUpdater);
if (pageComponent instanceof ApplicationListener && getApplicationEventMulticaster() != null) {
getApplicationEventMulticaster().removeApplicationListener((ApplicationListener) pageComponent);
}
pageComponent.dispose();
fireClosed(pageComponent);
if (activeComponent == null) {
setActiveComponent();
}
return true;
} } | public class class_name {
public boolean close(PageComponent pageComponent) {
if (!pageComponent.canClose()) {
return false; // depends on control dependency: [if], data = [none]
}
if (!pageComponents.contains(pageComponent)) {
return false; // depends on control dependency: [if], data = [none]
}
if (pageComponent == activeComponent) {
fireFocusLost(pageComponent); // depends on control dependency: [if], data = [(pageComponent]
activeComponent = null; // depends on control dependency: [if], data = [none]
}
doRemovePageComponent(pageComponent);
pageComponents.remove(pageComponent);
pageComponent.removePropertyChangeListener(pageComponentUpdater);
if (pageComponent instanceof ApplicationListener && getApplicationEventMulticaster() != null) {
getApplicationEventMulticaster().removeApplicationListener((ApplicationListener) pageComponent); // depends on control dependency: [if], data = [none]
}
pageComponent.dispose();
fireClosed(pageComponent);
if (activeComponent == null) {
setActiveComponent(); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
int parse(final IntBuffer buff, final int start) {
int pos = start;
// read for Dacl
byte[] bytes = NumberFacility.getBytes(buff.get(pos));
revision = AclRevision.parseValue(bytes[0]);
pos++;
bytes = NumberFacility.getBytes(buff.get(pos));
final int aceCount = NumberFacility.getInt(bytes[1], bytes[0]);
for (int i = 0; i < aceCount; i++) {
pos++;
final ACE ace = new ACE();
aces.add(ace);
pos = ace.parse(buff, pos);
}
return pos;
} } | public class class_name {
int parse(final IntBuffer buff, final int start) {
int pos = start;
// read for Dacl
byte[] bytes = NumberFacility.getBytes(buff.get(pos));
revision = AclRevision.parseValue(bytes[0]);
pos++;
bytes = NumberFacility.getBytes(buff.get(pos));
final int aceCount = NumberFacility.getInt(bytes[1], bytes[0]);
for (int i = 0; i < aceCount; i++) {
pos++; // depends on control dependency: [for], data = [none]
final ACE ace = new ACE();
aces.add(ace); // depends on control dependency: [for], data = [none]
pos = ace.parse(buff, pos); // depends on control dependency: [for], data = [none]
}
return pos;
} } |
public class class_name {
protected final void deleteMessage(SIBusMessage message,
SITransaction transaction) throws ResourceException {
final String methodName = "deleteMessage";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { message,
transaction });
}
deleteMessages (new SIMessageHandle [] { message.getMessageHandle () }, transaction);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} } | public class class_name {
protected final void deleteMessage(SIBusMessage message,
SITransaction transaction) throws ResourceException {
final String methodName = "deleteMessage";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { message,
transaction });
}
deleteMessages (new SIMessageHandle [] { message.getMessageHandle () }, transaction);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static boolean addListToJSON(StringBuilder sb, String name, Object[] list, boolean jsonEscapeValues, boolean isFirstField) {
if (name == null || list == null)
return false;
// add comma if isFirstField == false
if (!isFirstField)
sb.append(",");
sb.append("\"" + name + "\":[");
boolean firstParm = true;
for (Object element : list) {
if (firstParm)
sb.append("\"");
else
sb.append(",\"");
if (element != null) {
if (jsonEscapeValues)
sb.append(jsonEscape2(element.toString()));
else
sb.append(element.toString());
}
sb.append("\"");
firstParm = false;
}
sb.append("]");
return true;
} } | public class class_name {
static boolean addListToJSON(StringBuilder sb, String name, Object[] list, boolean jsonEscapeValues, boolean isFirstField) {
if (name == null || list == null)
return false;
// add comma if isFirstField == false
if (!isFirstField)
sb.append(",");
sb.append("\"" + name + "\":[");
boolean firstParm = true;
for (Object element : list) {
if (firstParm)
sb.append("\"");
else
sb.append(",\"");
if (element != null) {
if (jsonEscapeValues)
sb.append(jsonEscape2(element.toString()));
else
sb.append(element.toString());
}
sb.append("\""); // depends on control dependency: [for], data = [none]
firstParm = false; // depends on control dependency: [for], data = [none]
}
sb.append("]");
return true;
} } |
public class class_name {
public void close() {
LOG.info("Close netty connection to {}", name());
if (!beingClosed.compareAndSet(false, true)) {
LOG.info("Netty client has been closed.");
return;
}
if (!connectMyself) {
unregisterMetrics();
}
Channel channel = channelRef.get();
if (channel == null) {
LOG.info("Channel {} has been closed already", name());
return;
}
// wait for pendings to exit
final long timeoutMilliSeconds = 10 * 1000;
final long start = System.currentTimeMillis();
LOG.info("Waiting for pending batchs to be sent with " + name() + "..., timeout: {}ms, pendings: {}",
timeoutMilliSeconds, pendings.get());
while (pendings.get() != 0) {
try {
long delta = System.currentTimeMillis() - start;
if (delta > timeoutMilliSeconds) {
LOG.error("Timeout when sending pending batchs with {}..., there are still {} pending batchs not sent",
name(), pendings.get());
break;
}
Thread.sleep(1000); // sleep 1s
} catch (InterruptedException e) {
break;
}
}
close_n_release();
} } | public class class_name {
public void close() {
LOG.info("Close netty connection to {}", name());
if (!beingClosed.compareAndSet(false, true)) {
LOG.info("Netty client has been closed."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (!connectMyself) {
unregisterMetrics(); // depends on control dependency: [if], data = [none]
}
Channel channel = channelRef.get();
if (channel == null) {
LOG.info("Channel {} has been closed already", name()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// wait for pendings to exit
final long timeoutMilliSeconds = 10 * 1000;
final long start = System.currentTimeMillis();
LOG.info("Waiting for pending batchs to be sent with " + name() + "..., timeout: {}ms, pendings: {}",
timeoutMilliSeconds, pendings.get());
while (pendings.get() != 0) {
try {
long delta = System.currentTimeMillis() - start;
if (delta > timeoutMilliSeconds) {
LOG.error("Timeout when sending pending batchs with {}..., there are still {} pending batchs not sent",
name(), pendings.get()); // depends on control dependency: [if], data = [none]
break;
}
Thread.sleep(1000); // sleep 1s // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
break;
} // depends on control dependency: [catch], data = [none]
}
close_n_release();
} } |
public class class_name {
public ProviderInfo setDynamicAttr(String dynamicAttrKey, Object dynamicAttrValue) {
if (dynamicAttrValue == null) {
dynamicAttrs.remove(dynamicAttrKey);
} else {
dynamicAttrs.put(dynamicAttrKey, dynamicAttrValue);
}
return this;
} } | public class class_name {
public ProviderInfo setDynamicAttr(String dynamicAttrKey, Object dynamicAttrValue) {
if (dynamicAttrValue == null) {
dynamicAttrs.remove(dynamicAttrKey); // depends on control dependency: [if], data = [none]
} else {
dynamicAttrs.put(dynamicAttrKey, dynamicAttrValue); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
public InputStream getResourceAsStream(String path) {
URL url = getResource(path);
if (url != null) {
try { return url.openStream(); }
catch (IOException ioe) { return null; }
}
return null;
} } | public class class_name {
@Override
public InputStream getResourceAsStream(String path) {
URL url = getResource(path);
if (url != null) {
try { return url.openStream(); } // depends on control dependency: [try], data = [none]
catch (IOException ioe) { return null; } // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
public static Double[] asDoubleArray(List<Double> input) {
Double[] result = new Double[input.size()];
for (int i = 0; i < result.length; i++) {
result[i] = input.get(i);
}
return result;
} } | public class class_name {
public static Double[] asDoubleArray(List<Double> input) {
Double[] result = new Double[input.size()];
for (int i = 0; i < result.length; i++) {
result[i] = input.get(i); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public INDArray convert(String text) {
Tokenizer tokenizer = tokenizerFactory.create(text);
List<String> tokens = tokenizer.getTokens();
INDArray create = Nd4j.create(1,wordIndexMap.size());
Counter<String> tokenizedCounter = new Counter<>();
for(int i = 0; i < tokens.size(); i++) {
tokenizedCounter.incrementCount(tokens.get(i),1.0);
}
for(int i = 0; i < tokens.size(); i++) {
if(wordIndexMap.containsKey(tokens.get(i))) {
int idx = wordIndexMap.get(tokens.get(i));
int count = (int) tokenizedCounter.getCount(tokens.get(i));
double weight = tfidfWord(tokens.get(i),count,tokens.size());
create.putScalar(idx,weight);
}
}
return create;
} } | public class class_name {
public INDArray convert(String text) {
Tokenizer tokenizer = tokenizerFactory.create(text);
List<String> tokens = tokenizer.getTokens();
INDArray create = Nd4j.create(1,wordIndexMap.size());
Counter<String> tokenizedCounter = new Counter<>();
for(int i = 0; i < tokens.size(); i++) {
tokenizedCounter.incrementCount(tokens.get(i),1.0); // depends on control dependency: [for], data = [i]
}
for(int i = 0; i < tokens.size(); i++) {
if(wordIndexMap.containsKey(tokens.get(i))) {
int idx = wordIndexMap.get(tokens.get(i));
int count = (int) tokenizedCounter.getCount(tokens.get(i));
double weight = tfidfWord(tokens.get(i),count,tokens.size());
create.putScalar(idx,weight); // depends on control dependency: [if], data = [none]
}
}
return create;
} } |
public class class_name {
@Override
public String getSimpleMoveTypeDescription() {
Set<String> childMoveTypeDescriptionSet = new TreeSet<>();
for (Move<Solution_> move : moves) {
childMoveTypeDescriptionSet.add(move.getSimpleMoveTypeDescription());
}
StringBuilder moveTypeDescription = new StringBuilder(20 * (moves.length + 1));
moveTypeDescription.append(getClass().getSimpleName()).append("(");
String delimiter = "";
for (String childMoveTypeDescription : childMoveTypeDescriptionSet) {
moveTypeDescription.append(delimiter).append("* ").append(childMoveTypeDescription);
delimiter = ", ";
}
moveTypeDescription.append(")");
return moveTypeDescription.toString();
} } | public class class_name {
@Override
public String getSimpleMoveTypeDescription() {
Set<String> childMoveTypeDescriptionSet = new TreeSet<>();
for (Move<Solution_> move : moves) {
childMoveTypeDescriptionSet.add(move.getSimpleMoveTypeDescription()); // depends on control dependency: [for], data = [move]
}
StringBuilder moveTypeDescription = new StringBuilder(20 * (moves.length + 1));
moveTypeDescription.append(getClass().getSimpleName()).append("(");
String delimiter = "";
for (String childMoveTypeDescription : childMoveTypeDescriptionSet) {
moveTypeDescription.append(delimiter).append("* ").append(childMoveTypeDescription); // depends on control dependency: [for], data = [childMoveTypeDescription]
delimiter = ", "; // depends on control dependency: [for], data = [none]
}
moveTypeDescription.append(")");
return moveTypeDescription.toString();
} } |
public class class_name {
public void marshall(RegisterRdsDbInstanceRequest registerRdsDbInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (registerRdsDbInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(registerRdsDbInstanceRequest.getStackId(), STACKID_BINDING);
protocolMarshaller.marshall(registerRdsDbInstanceRequest.getRdsDbInstanceArn(), RDSDBINSTANCEARN_BINDING);
protocolMarshaller.marshall(registerRdsDbInstanceRequest.getDbUser(), DBUSER_BINDING);
protocolMarshaller.marshall(registerRdsDbInstanceRequest.getDbPassword(), DBPASSWORD_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RegisterRdsDbInstanceRequest registerRdsDbInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (registerRdsDbInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(registerRdsDbInstanceRequest.getStackId(), STACKID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(registerRdsDbInstanceRequest.getRdsDbInstanceArn(), RDSDBINSTANCEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(registerRdsDbInstanceRequest.getDbUser(), DBUSER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(registerRdsDbInstanceRequest.getDbPassword(), DBPASSWORD_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 marshall(DeleteUploadRequest deleteUploadRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteUploadRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteUploadRequest.getArn(), ARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteUploadRequest deleteUploadRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteUploadRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteUploadRequest.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static String mapSubformat(String formatString, Map<String, String> mapping, int beginIndex,
int currentIndex, String escapeStart, String escapeEnd, String targetEscapeStart, String targetEscapeEnd) {
String subformat = formatString.substring(beginIndex, currentIndex);
if (subformat.equals(escapeStart) || subformat.equals(escapeEnd)) {
return targetEscapeStart + "(error: cannot ecape escape characters)" + targetEscapeEnd;
}
if (mapping.containsKey(subformat)) {
String result = mapping.get(subformat);
if (result==null || result.length()==0) {
return targetEscapeStart + "(error: " + subformat + " cannot be converted)" + targetEscapeEnd;
}
return result;
}
return subformat;
} } | public class class_name {
private static String mapSubformat(String formatString, Map<String, String> mapping, int beginIndex,
int currentIndex, String escapeStart, String escapeEnd, String targetEscapeStart, String targetEscapeEnd) {
String subformat = formatString.substring(beginIndex, currentIndex);
if (subformat.equals(escapeStart) || subformat.equals(escapeEnd)) {
return targetEscapeStart + "(error: cannot ecape escape characters)" + targetEscapeEnd; // depends on control dependency: [if], data = [none]
}
if (mapping.containsKey(subformat)) {
String result = mapping.get(subformat);
if (result==null || result.length()==0) {
return targetEscapeStart + "(error: " + subformat + " cannot be converted)" + targetEscapeEnd; // depends on control dependency: [if], data = [none]
}
return result; // depends on control dependency: [if], data = [none]
}
return subformat;
} } |
public class class_name {
public static int[] sort(double[] arr) {
int[] order = new int[arr.length];
for (int i = 0; i < order.length; i++) {
order[i] = i;
}
sort(arr, order);
return order;
} } | public class class_name {
public static int[] sort(double[] arr) {
int[] order = new int[arr.length];
for (int i = 0; i < order.length; i++) {
order[i] = i; // depends on control dependency: [for], data = [i]
}
sort(arr, order);
return order;
} } |
public class class_name {
private static void loadAgent(Config config, Log log, String agentJar, Class<?> vmClass) {
try {
// addAttach(config,log);
// first obtain the PID of the currently-running process
// ### this relies on the undocumented convention of the
// RuntimeMXBean's
// ### name starting with the PID, but there appears to be no other
// ### way to obtain the current process' id, which we need for
// ### the attach process
RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
String pid = runtime.getName();
if (pid.indexOf("@") != -1) pid = pid.substring(0, pid.indexOf("@"));
log.info("Instrumentation", "pid:" + pid);
// JDK1.6: now attach to the current VM so we can deploy a new agent
// ### this is a Sun JVM specific feature; other JVMs may offer
// ### this feature, but in an implementation-dependent way
Object vm = vmClass.getMethod("attach", new Class<?>[] { String.class }).invoke(null, new Object[] { pid });
// now deploy the actual agent, which will wind up calling
// agentmain()
vmClass.getMethod("loadAgent", new Class[] { String.class }).invoke(vm, new Object[] { agentJar });
vmClass.getMethod("detach", new Class[] {}).invoke(vm, new Object[] {});
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
// Log the message from the exception. Don't log the entire
// stack as this is expected when running on a JDK that doesn't
// support the Attach API.
log.log(Log.LEVEL_INFO, "Instrumentation", t);
}
} } | public class class_name {
private static void loadAgent(Config config, Log log, String agentJar, Class<?> vmClass) {
try {
// addAttach(config,log);
// first obtain the PID of the currently-running process
// ### this relies on the undocumented convention of the
// RuntimeMXBean's
// ### name starting with the PID, but there appears to be no other
// ### way to obtain the current process' id, which we need for
// ### the attach process
RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
String pid = runtime.getName();
if (pid.indexOf("@") != -1) pid = pid.substring(0, pid.indexOf("@"));
log.info("Instrumentation", "pid:" + pid); // depends on control dependency: [try], data = [none]
// JDK1.6: now attach to the current VM so we can deploy a new agent
// ### this is a Sun JVM specific feature; other JVMs may offer
// ### this feature, but in an implementation-dependent way
Object vm = vmClass.getMethod("attach", new Class<?>[] { String.class }).invoke(null, new Object[] { pid });
// now deploy the actual agent, which will wind up calling
// agentmain()
vmClass.getMethod("loadAgent", new Class[] { String.class }).invoke(vm, new Object[] { agentJar }); // depends on control dependency: [try], data = [none]
vmClass.getMethod("detach", new Class[] {}).invoke(vm, new Object[] {}); // depends on control dependency: [try], data = [none]
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
// Log the message from the exception. Don't log the entire
// stack as this is expected when running on a JDK that doesn't
// support the Attach API.
log.log(Log.LEVEL_INFO, "Instrumentation", t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int[] calculateBlockGap(int[][][] optAln){
//Initialize the array to be returned
int [] blockGap = new int[optAln.length];
//Loop for every block and look in both chains for non-contiguous residues.
for (int i=0; i<optAln.length; i++){
int gaps = 0; //the number of gaps in that block
int last1 = 0; //the last residue position in chain 1
int last2 = 0; //the last residue position in chain 2
//Loop for every position in the block
for (int j=0; j<optAln[i][0].length; j++){
//If the first position is evaluated initialize the last positions
if (j==0){
last1 = optAln[i][0][j];
last2 = optAln[i][1][j];
}
else{
//If one of the positions or both are not contiguous increment the number of gaps
if (optAln[i][0][j] > last1+1 || optAln[i][1][j] > last2+1){
gaps++;
last1 = optAln[i][0][j];
last2 = optAln[i][1][j];
}
//Otherwise just set the last position to the current one
else{
last1 = optAln[i][0][j];
last2 = optAln[i][1][j];
}
}
}
blockGap[i] = gaps;
}
return blockGap;
} } | public class class_name {
public static int[] calculateBlockGap(int[][][] optAln){
//Initialize the array to be returned
int [] blockGap = new int[optAln.length];
//Loop for every block and look in both chains for non-contiguous residues.
for (int i=0; i<optAln.length; i++){
int gaps = 0; //the number of gaps in that block
int last1 = 0; //the last residue position in chain 1
int last2 = 0; //the last residue position in chain 2
//Loop for every position in the block
for (int j=0; j<optAln[i][0].length; j++){
//If the first position is evaluated initialize the last positions
if (j==0){
last1 = optAln[i][0][j]; // depends on control dependency: [if], data = [none]
last2 = optAln[i][1][j]; // depends on control dependency: [if], data = [none]
}
else{
//If one of the positions or both are not contiguous increment the number of gaps
if (optAln[i][0][j] > last1+1 || optAln[i][1][j] > last2+1){
gaps++; // depends on control dependency: [if], data = [none]
last1 = optAln[i][0][j]; // depends on control dependency: [if], data = [none]
last2 = optAln[i][1][j]; // depends on control dependency: [if], data = [none]
}
//Otherwise just set the last position to the current one
else{
last1 = optAln[i][0][j]; // depends on control dependency: [if], data = [none]
last2 = optAln[i][1][j]; // depends on control dependency: [if], data = [none]
}
}
}
blockGap[i] = gaps; // depends on control dependency: [for], data = [i]
}
return blockGap;
} } |
public class class_name {
public void removeNotificationHandler(String serviceName, NotificationHandler handler) {
ServiceInstanceUtils.validateServiceName(serviceName);
if (handler == null) {
throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR,
ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(),
"NotificationHandler");
}
List<InstanceChangeListener<ModelServiceInstance>> list = changeListenerMap.get(serviceName);
if (list != null) {
boolean found = false;
for (InstanceChangeListener<ModelServiceInstance> listener : list) {
if (listener instanceof NotificationHandlerAdapter
&& ((NotificationHandlerAdapter) listener).getAdapter() == handler) {
list.remove(listener);
found = true;
break;
}
}
if (!found) {
LOGGER.error(ErrorCode.NOTIFICATION_HANDLER_DOES_NOT_EXIST.getMessageTemplate());
}
} else {
LOGGER.error(String.format(ErrorCode.SERVICE_DOES_NOT_EXIST.getMessageTemplate(), serviceName));
}
} } | public class class_name {
public void removeNotificationHandler(String serviceName, NotificationHandler handler) {
ServiceInstanceUtils.validateServiceName(serviceName);
if (handler == null) {
throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR,
ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(),
"NotificationHandler");
}
List<InstanceChangeListener<ModelServiceInstance>> list = changeListenerMap.get(serviceName);
if (list != null) {
boolean found = false;
for (InstanceChangeListener<ModelServiceInstance> listener : list) {
if (listener instanceof NotificationHandlerAdapter
&& ((NotificationHandlerAdapter) listener).getAdapter() == handler) {
list.remove(listener); // depends on control dependency: [if], data = [none]
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!found) {
LOGGER.error(ErrorCode.NOTIFICATION_HANDLER_DOES_NOT_EXIST.getMessageTemplate()); // depends on control dependency: [if], data = [none]
}
} else {
LOGGER.error(String.format(ErrorCode.SERVICE_DOES_NOT_EXIST.getMessageTemplate(), serviceName)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public java.util.List<ClusterNode> getClusterNodes() {
if (clusterNodes == null) {
clusterNodes = new com.amazonaws.internal.SdkInternalList<ClusterNode>();
}
return clusterNodes;
} } | public class class_name {
public java.util.List<ClusterNode> getClusterNodes() {
if (clusterNodes == null) {
clusterNodes = new com.amazonaws.internal.SdkInternalList<ClusterNode>(); // depends on control dependency: [if], data = [none]
}
return clusterNodes;
} } |
public class class_name {
private boolean isThereReflexivePronoun(
final AnalyzedTokenReadings[] tokens, int i) {
Pattern pPronomBuscat = null;
// 1) es queixa, se li queixa, se li'n queixa
if (matchPostagRegexp(tokens[i], VERB_INDSUBJ)) {
pPronomBuscat = pronomPattern(tokens[i]);
if (pPronomBuscat != null) {
int j = 1;
boolean keepCounting = true;
while (i - j > 0 && j < 4 && keepCounting) {
if (matchPostagRegexp(tokens[i - j], pPronomBuscat)
&& matchRegexp(tokens[i -j].getToken(), REFLEXIU_ANTEPOSAT))
return true;
keepCounting = matchPostagRegexp(tokens[i - j],
PRONOM_FEBLE);
j++;
}
}
}
// 2) queixa't, queixeu-vos-hi
if (matchPostagRegexp(tokens[i], VERB_IMP)) {
pPronomBuscat = pronomPattern(tokens[i]);
if (pPronomBuscat != null) {
if (i+1<tokens.length
&& matchPostagRegexp(tokens[i + 1], pPronomBuscat)
&& matchRegexp(tokens[i + 1].getToken(), REFLEXIU_POSPOSAT))
return true;
}
}
// 3) s'ha queixat, se li ha queixat, se li n'ha queixat.
if (matchPostagRegexp(tokens[i], VERB_PARTICIPI)) {
if (tokens[i - 1].hasLemma("haver")) {
if (matchPostagRegexp(tokens[i - 1], VERB_INDSUBJ)) {
pPronomBuscat = pronomPattern(tokens[i - 1]);
if (pPronomBuscat != null) {
int j = 2;
boolean keepCounting = true;
while (i - j > 0 && j < 5 && keepCounting) {
if (matchPostagRegexp(tokens[i - j], pPronomBuscat)
&& matchRegexp(tokens[i - j].getToken(), REFLEXIU_ANTEPOSAT))
return true;
keepCounting = matchPostagRegexp(tokens[i - j], PRONOM_FEBLE);
j++;
}
}
}
// es podria haver endut
else if (matchPostagRegexp(tokens[i - 1], VERB_INF)
&& matchPostagRegexp(tokens[i - 2], VERB_INDSUBJ)) {
pPronomBuscat = pronomPattern(tokens[i - 2]);
if (pPronomBuscat != null) {
int j = 3;
boolean keepCounting = true;
while (i - j > 0 && j < 5 && keepCounting) {
if (matchPostagRegexp(tokens[i - j], pPronomBuscat)
&& matchRegexp(tokens[i - j].getToken(), REFLEXIU_ANTEPOSAT))
return true;
keepCounting = matchPostagRegexp(tokens[i - j], PRONOM_FEBLE);
j++;
}
}
}
}
// *havent queixat, *haver queixat
// else if (!(matchLemmaRegexp(tokens[i - 1], VERB_HAVER) && matchPostagRegexp(
// tokens[i - 1], VERB_INFGER)))
// return true;
}
// 4) em vaig queixar, se li va queixar, se li'n va queixar, vas
// queixar-te'n,
// em puc queixar, ens en podem queixar, podeu queixar-vos,
// es va queixant, va queixant-se, comences queixant-te
// 5) no t'has de queixar, no has de queixar-te, pareu de queixar-vos,
// comenceu a queixar-vos
// corre a queixar-se, corre a queixar-te, vés a queixar-te
// no hauria pogut burlar-me
// 6) no podeu deixar de queixar-vos, no us podeu deixar de queixar
// en teniu prou amb queixar-vos, comenceu lentament a queixar-vos
// 7) no es va poder emportar, va decidir suïcidar-se,
// 8) Queixar-se, queixant-vos, podent abstenir-se
if (matchPostagRegexp(tokens[i], VERB_INFGER)) {
int k = 1;
boolean keepCounting = true;
boolean foundVerb = false;
while (i - k > 0 && keepCounting && !foundVerb) {
foundVerb = matchPostagRegexp(tokens[i - k], VERB_INDSUBJIMP);
keepCounting = matchPostagRegexp(tokens[i - k],
PREP_VERB_PRONOM);
if (matchPostagRegexp(tokens[i-k],VERB_INDSUBJ)
&& matchPostagRegexp(tokens[i-k+1],VERB_INFGER))
keepCounting=false;
if (matchPostagRegexp(tokens[i - k], VERB_INFGER) //pertanyen a grups verbals diferents
&& matchPostagRegexp(tokens[i - k + 1], PRONOM_FEBLE)
&& !matchRegexp(tokens[i - k + 1].getToken(), PRONOMFEBLE_POSPOSAT)) {
keepCounting=false;
}
k++;
}
if (foundVerb) {
k--;
pPronomBuscat = pronomPattern(tokens[i - k]);
if (pPronomBuscat != null) {
if (i+1< tokens.length
&& matchPostagRegexp(tokens[i + 1], pPronomBuscat)
&& matchRegexp(tokens[i + 1].getToken(), REFLEXIU_POSPOSAT))
return true;
int j = 1;
keepCounting = true;
while (i - j > 0 && keepCounting) {
if (j==1 && matchPostagRegexp(tokens[i - j], pPronomBuscat))
return true;
if (j>1 && matchPostagRegexp(tokens[i - j], pPronomBuscat)
&& !(matchRegexp(tokens[i - j].getToken(), REFLEXIU_POSPOSAT) && j>k))
return true;
keepCounting = matchPostagRegexp(tokens[i - j], PREP_VERB_PRONOM)
&& !(j>k-1 && matchPostagRegexp(tokens[i - j], VERB_PARTICIPI))
&& !matchPostagRegexp(tokens[i - j], TRENCA_COMPTE2);
if (tokens[i-j].getToken().equalsIgnoreCase("per")
&& tokens[i-j+1].getToken().equalsIgnoreCase("a")) {
keepCounting=false;
}
if (matchPostagRegexp(tokens[i - j], VERB_INFGER) //pertanyen a grups verbals diferents
&& matchPostagRegexp(tokens[i - j + 1], PRONOM_FEBLE)
&& !matchRegexp(tokens[i - j + 1].getToken(), PRONOMFEBLE_POSPOSAT)) {
keepCounting=false;
}
j++;
}
}
} else {
if (i+1<tokens.length
&& matchPostagRegexp(tokens[i + 1], PRONOM_REFLEXIU)
&& matchRegexp(tokens[i + 1].getToken(), REFLEXIU_POSPOSAT))
return true;
int j = 1;
keepCounting = true;
while (i - j > 0 && keepCounting) {
if (matchPostagRegexp(tokens[i - j], PRONOM_REFLEXIU))
return true;
keepCounting = matchPostagRegexp(tokens[i - j],
PREP_VERB_PRONOM);
if (tokens[i-j].getToken().equalsIgnoreCase("per")
&& tokens[i-j+1].getToken().equalsIgnoreCase("a")) {
keepCounting=false;
}
if (matchPostagRegexp(tokens[i - j], VERB_INFGER) //pertanyen a grups verbals diferents
&& matchPostagRegexp(tokens[i - j + 1], PRONOM_FEBLE)
&& !matchRegexp(tokens[i - j + 1].getToken(), PRONOMFEBLE_POSPOSAT)) {
keepCounting=false;
}
j++;
}
}
}
return false;
} } | public class class_name {
private boolean isThereReflexivePronoun(
final AnalyzedTokenReadings[] tokens, int i) {
Pattern pPronomBuscat = null;
// 1) es queixa, se li queixa, se li'n queixa
if (matchPostagRegexp(tokens[i], VERB_INDSUBJ)) {
pPronomBuscat = pronomPattern(tokens[i]); // depends on control dependency: [if], data = [none]
if (pPronomBuscat != null) {
int j = 1;
boolean keepCounting = true;
while (i - j > 0 && j < 4 && keepCounting) {
if (matchPostagRegexp(tokens[i - j], pPronomBuscat)
&& matchRegexp(tokens[i -j].getToken(), REFLEXIU_ANTEPOSAT))
return true;
keepCounting = matchPostagRegexp(tokens[i - j],
PRONOM_FEBLE); // depends on control dependency: [while], data = [none]
j++; // depends on control dependency: [while], data = [none]
}
}
}
// 2) queixa't, queixeu-vos-hi
if (matchPostagRegexp(tokens[i], VERB_IMP)) {
pPronomBuscat = pronomPattern(tokens[i]); // depends on control dependency: [if], data = [none]
if (pPronomBuscat != null) {
if (i+1<tokens.length
&& matchPostagRegexp(tokens[i + 1], pPronomBuscat)
&& matchRegexp(tokens[i + 1].getToken(), REFLEXIU_POSPOSAT))
return true;
}
}
// 3) s'ha queixat, se li ha queixat, se li n'ha queixat.
if (matchPostagRegexp(tokens[i], VERB_PARTICIPI)) {
if (tokens[i - 1].hasLemma("haver")) {
if (matchPostagRegexp(tokens[i - 1], VERB_INDSUBJ)) {
pPronomBuscat = pronomPattern(tokens[i - 1]); // depends on control dependency: [if], data = [none]
if (pPronomBuscat != null) {
int j = 2;
boolean keepCounting = true;
while (i - j > 0 && j < 5 && keepCounting) {
if (matchPostagRegexp(tokens[i - j], pPronomBuscat)
&& matchRegexp(tokens[i - j].getToken(), REFLEXIU_ANTEPOSAT))
return true;
keepCounting = matchPostagRegexp(tokens[i - j], PRONOM_FEBLE); // depends on control dependency: [while], data = [none]
j++; // depends on control dependency: [while], data = [none]
}
}
}
// es podria haver endut
else if (matchPostagRegexp(tokens[i - 1], VERB_INF)
&& matchPostagRegexp(tokens[i - 2], VERB_INDSUBJ)) {
pPronomBuscat = pronomPattern(tokens[i - 2]); // depends on control dependency: [if], data = [none]
if (pPronomBuscat != null) {
int j = 3;
boolean keepCounting = true;
while (i - j > 0 && j < 5 && keepCounting) {
if (matchPostagRegexp(tokens[i - j], pPronomBuscat)
&& matchRegexp(tokens[i - j].getToken(), REFLEXIU_ANTEPOSAT))
return true;
keepCounting = matchPostagRegexp(tokens[i - j], PRONOM_FEBLE); // depends on control dependency: [while], data = [none]
j++; // depends on control dependency: [while], data = [none]
}
}
}
}
// *havent queixat, *haver queixat
// else if (!(matchLemmaRegexp(tokens[i - 1], VERB_HAVER) && matchPostagRegexp(
// tokens[i - 1], VERB_INFGER)))
// return true;
}
// 4) em vaig queixar, se li va queixar, se li'n va queixar, vas
// queixar-te'n,
// em puc queixar, ens en podem queixar, podeu queixar-vos,
// es va queixant, va queixant-se, comences queixant-te
// 5) no t'has de queixar, no has de queixar-te, pareu de queixar-vos,
// comenceu a queixar-vos
// corre a queixar-se, corre a queixar-te, vés a queixar-te
// no hauria pogut burlar-me
// 6) no podeu deixar de queixar-vos, no us podeu deixar de queixar
// en teniu prou amb queixar-vos, comenceu lentament a queixar-vos
// 7) no es va poder emportar, va decidir suïcidar-se,
// 8) Queixar-se, queixant-vos, podent abstenir-se
if (matchPostagRegexp(tokens[i], VERB_INFGER)) {
int k = 1;
boolean keepCounting = true;
boolean foundVerb = false;
while (i - k > 0 && keepCounting && !foundVerb) {
foundVerb = matchPostagRegexp(tokens[i - k], VERB_INDSUBJIMP); // depends on control dependency: [while], data = [none]
keepCounting = matchPostagRegexp(tokens[i - k],
PREP_VERB_PRONOM); // depends on control dependency: [while], data = [none]
if (matchPostagRegexp(tokens[i-k],VERB_INDSUBJ)
&& matchPostagRegexp(tokens[i-k+1],VERB_INFGER))
keepCounting=false;
if (matchPostagRegexp(tokens[i - k], VERB_INFGER) //pertanyen a grups verbals diferents
&& matchPostagRegexp(tokens[i - k + 1], PRONOM_FEBLE)
&& !matchRegexp(tokens[i - k + 1].getToken(), PRONOMFEBLE_POSPOSAT)) {
keepCounting=false; // depends on control dependency: [if], data = [none]
}
k++; // depends on control dependency: [while], data = [none]
}
if (foundVerb) {
k--; // depends on control dependency: [if], data = [none]
pPronomBuscat = pronomPattern(tokens[i - k]); // depends on control dependency: [if], data = [none]
if (pPronomBuscat != null) {
if (i+1< tokens.length
&& matchPostagRegexp(tokens[i + 1], pPronomBuscat)
&& matchRegexp(tokens[i + 1].getToken(), REFLEXIU_POSPOSAT))
return true;
int j = 1;
keepCounting = true; // depends on control dependency: [if], data = [none]
while (i - j > 0 && keepCounting) {
if (j==1 && matchPostagRegexp(tokens[i - j], pPronomBuscat))
return true;
if (j>1 && matchPostagRegexp(tokens[i - j], pPronomBuscat)
&& !(matchRegexp(tokens[i - j].getToken(), REFLEXIU_POSPOSAT) && j>k))
return true;
keepCounting = matchPostagRegexp(tokens[i - j], PREP_VERB_PRONOM)
&& !(j>k-1 && matchPostagRegexp(tokens[i - j], VERB_PARTICIPI))
&& !matchPostagRegexp(tokens[i - j], TRENCA_COMPTE2); // depends on control dependency: [while], data = [none]
if (tokens[i-j].getToken().equalsIgnoreCase("per")
&& tokens[i-j+1].getToken().equalsIgnoreCase("a")) {
keepCounting=false; // depends on control dependency: [if], data = [none]
}
if (matchPostagRegexp(tokens[i - j], VERB_INFGER) //pertanyen a grups verbals diferents
&& matchPostagRegexp(tokens[i - j + 1], PRONOM_FEBLE)
&& !matchRegexp(tokens[i - j + 1].getToken(), PRONOMFEBLE_POSPOSAT)) {
keepCounting=false; // depends on control dependency: [if], data = [none]
}
j++; // depends on control dependency: [while], data = [none]
}
}
} else {
if (i+1<tokens.length
&& matchPostagRegexp(tokens[i + 1], PRONOM_REFLEXIU)
&& matchRegexp(tokens[i + 1].getToken(), REFLEXIU_POSPOSAT))
return true;
int j = 1;
keepCounting = true; // depends on control dependency: [if], data = [none]
while (i - j > 0 && keepCounting) {
if (matchPostagRegexp(tokens[i - j], PRONOM_REFLEXIU))
return true;
keepCounting = matchPostagRegexp(tokens[i - j],
PREP_VERB_PRONOM); // depends on control dependency: [while], data = [none]
if (tokens[i-j].getToken().equalsIgnoreCase("per")
&& tokens[i-j+1].getToken().equalsIgnoreCase("a")) {
keepCounting=false; // depends on control dependency: [if], data = [none]
}
if (matchPostagRegexp(tokens[i - j], VERB_INFGER) //pertanyen a grups verbals diferents
&& matchPostagRegexp(tokens[i - j + 1], PRONOM_FEBLE)
&& !matchRegexp(tokens[i - j + 1].getToken(), PRONOMFEBLE_POSPOSAT)) {
keepCounting=false; // depends on control dependency: [if], data = [none]
}
j++; // depends on control dependency: [while], data = [none]
}
}
}
return false;
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Pure
public <T extends EventListener> T[] getListeners(Class<T> type) {
final Object[] l = this.listeners;
final int n = getListenerCount(l, type);
final T[] result = (T[]) Array.newInstance(type, n);
int j = 0;
for (int i = l.length - 2; i >= 0; i -= 2) {
if (l[i] == type) {
result[j++] = type.cast(l[i + 1]);
}
}
return result;
} } | public class class_name {
@SuppressWarnings("unchecked")
@Pure
public <T extends EventListener> T[] getListeners(Class<T> type) {
final Object[] l = this.listeners;
final int n = getListenerCount(l, type);
final T[] result = (T[]) Array.newInstance(type, n);
int j = 0;
for (int i = l.length - 2; i >= 0; i -= 2) {
if (l[i] == type) {
result[j++] = type.cast(l[i + 1]); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
@Override
public boolean hasContentsOfAllSources() {
if (sourcesContent == null) {
return false;
}
return this.sourcesContent.size() >= this._sources.size() && !this.sourcesContent.stream().anyMatch(sc -> sc == null);
} } | public class class_name {
@Override
public boolean hasContentsOfAllSources() {
if (sourcesContent == null) {
return false; // depends on control dependency: [if], data = [none]
}
return this.sourcesContent.size() >= this._sources.size() && !this.sourcesContent.stream().anyMatch(sc -> sc == null);
} } |
public class class_name {
@Override
public void removeByCommerceAccountUserId(long commerceAccountUserId) {
for (CommerceAccountUserRel commerceAccountUserRel : findByCommerceAccountUserId(
commerceAccountUserId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
null)) {
remove(commerceAccountUserRel);
}
} } | public class class_name {
@Override
public void removeByCommerceAccountUserId(long commerceAccountUserId) {
for (CommerceAccountUserRel commerceAccountUserRel : findByCommerceAccountUserId(
commerceAccountUserId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
null)) {
remove(commerceAccountUserRel); // depends on control dependency: [for], data = [commerceAccountUserRel]
}
} } |
public class class_name {
@Override
public double[] getVotesForInstance(Instance inst)
{
double[] votes = {0.5, 0.5};
if(!referenceWindow)
{
votes[1] = this.getAnomalyScore(inst) + 0.5 - this.anomalyThreshold;
votes[0] = 1.0 - votes[1];
}
return votes;
} } | public class class_name {
@Override
public double[] getVotesForInstance(Instance inst)
{
double[] votes = {0.5, 0.5};
if(!referenceWindow)
{
votes[1] = this.getAnomalyScore(inst) + 0.5 - this.anomalyThreshold; // depends on control dependency: [if], data = [none]
votes[0] = 1.0 - votes[1]; // depends on control dependency: [if], data = [none]
}
return votes;
} } |
public class class_name {
private void processExternalTasks(List<Task> externalTasks)
{
//
// Sort the list of tasks into ID order
//
Collections.sort(externalTasks);
//
// Find any external tasks which don't have a sub project
// object, and set this attribute using the most recent
// value.
//
SubProject currentSubProject = null;
for (Task currentTask : externalTasks)
{
SubProject sp = currentTask.getSubProject();
if (sp == null)
{
currentTask.setSubProject(currentSubProject);
//we need to set the external task project path now that we have
//the subproject for this task (was skipped while processing the task earlier)
if (currentSubProject != null)
{
currentTask.setExternalTaskProject(currentSubProject.getFullPath());
}
}
else
{
currentSubProject = sp;
}
if (currentSubProject != null)
{
//System.out.println ("Task: " +currentTask.getUniqueID() + " " + currentTask.getName() + " File=" + currentSubProject.getFullPath() + " ID=" + currentTask.getExternalTaskID());
currentTask.setProject(currentSubProject.getFullPath());
}
}
} } | public class class_name {
private void processExternalTasks(List<Task> externalTasks)
{
//
// Sort the list of tasks into ID order
//
Collections.sort(externalTasks);
//
// Find any external tasks which don't have a sub project
// object, and set this attribute using the most recent
// value.
//
SubProject currentSubProject = null;
for (Task currentTask : externalTasks)
{
SubProject sp = currentTask.getSubProject();
if (sp == null)
{
currentTask.setSubProject(currentSubProject); // depends on control dependency: [if], data = [none]
//we need to set the external task project path now that we have
//the subproject for this task (was skipped while processing the task earlier)
if (currentSubProject != null)
{
currentTask.setExternalTaskProject(currentSubProject.getFullPath()); // depends on control dependency: [if], data = [(currentSubProject]
}
}
else
{
currentSubProject = sp; // depends on control dependency: [if], data = [none]
}
if (currentSubProject != null)
{
//System.out.println ("Task: " +currentTask.getUniqueID() + " " + currentTask.getName() + " File=" + currentSubProject.getFullPath() + " ID=" + currentTask.getExternalTaskID());
currentTask.setProject(currentSubProject.getFullPath()); // depends on control dependency: [if], data = [(currentSubProject]
}
}
} } |
public class class_name {
public void init() {
/* If the parent and name are equal to null,
* use the classname to load listFromClassLoader.
* */
if ( name == null && parent == null ) {
this.setDetailMessage( "{" + this.getClass().getName() + DETAIL_KEY + "}" );
this.setSummaryMessage( "{" + this.getClass().getName() + SUMMARY_KEY + "}" );
/* If the parent is null and the name is not,
* use the name to load listFromClassLoader.
*/
} else if ( name != null && parent == null ) {
this.setDetailMessage( "{" + "message." + getName() + DETAIL_KEY + "}" );
this.setSummaryMessage( "{" + "message." + getName() + SUMMARY_KEY + "}" );
/* If the parent is present, initialize the message keys
* with the parent name.
*/
} else if ( parent != null ) {
this.setDetailMessage( "{" + "message." + parent + DETAIL_KEY + "}" );
this.setSummaryMessage( "{" + "message." + parent + SUMMARY_KEY + "}" );
}
} } | public class class_name {
public void init() {
/* If the parent and name are equal to null,
* use the classname to load listFromClassLoader.
* */
if ( name == null && parent == null ) {
this.setDetailMessage( "{" + this.getClass().getName() + DETAIL_KEY + "}" ); // depends on control dependency: [if], data = [none]
this.setSummaryMessage( "{" + this.getClass().getName() + SUMMARY_KEY + "}" ); // depends on control dependency: [if], data = [none]
/* If the parent is null and the name is not,
* use the name to load listFromClassLoader.
*/
} else if ( name != null && parent == null ) {
this.setDetailMessage( "{" + "message." + getName() + DETAIL_KEY + "}" ); // depends on control dependency: [if], data = [none]
this.setSummaryMessage( "{" + "message." + getName() + SUMMARY_KEY + "}" ); // depends on control dependency: [if], data = [none]
/* If the parent is present, initialize the message keys
* with the parent name.
*/
} else if ( parent != null ) {
this.setDetailMessage( "{" + "message." + parent + DETAIL_KEY + "}" ); // depends on control dependency: [if], data = [none]
this.setSummaryMessage( "{" + "message." + parent + SUMMARY_KEY + "}" ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void initRemoteCommands()
{
if (rpcService != null)
{
// register commands
suspend = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager-suspend-"
+ dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
suspendLocally();
return null;
}
});
resume = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager-resume-"
+ dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
resumeLocally();
return null;
}
});
requestForResponsibleForResuming = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager"
+ "-requestForResponsibilityForResuming-" + dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
return isResponsibleForResuming.get();
}
});
}
} } | public class class_name {
private void initRemoteCommands()
{
if (rpcService != null)
{
// register commands
suspend = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager-suspend-"
+ dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
suspendLocally();
return null;
}
}); // depends on control dependency: [if], data = [none]
resume = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager-resume-"
+ dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
resumeLocally();
return null;
}
}); // depends on control dependency: [if], data = [none]
requestForResponsibleForResuming = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager"
+ "-requestForResponsibilityForResuming-" + dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
{
return isResponsibleForResuming.get();
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setSecurityGroups(java.util.Collection<SecurityGroup> securityGroups) {
if (securityGroups == null) {
this.securityGroups = null;
return;
}
this.securityGroups = new java.util.ArrayList<SecurityGroup>(securityGroups);
} } | public class class_name {
public void setSecurityGroups(java.util.Collection<SecurityGroup> securityGroups) {
if (securityGroups == null) {
this.securityGroups = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.securityGroups = new java.util.ArrayList<SecurityGroup>(securityGroups);
} } |
public class class_name {
public static void histogram( GrayS8 input , int minValue , int histogram[] ) {
if( BoofConcurrency.USE_CONCURRENT ) {
ImplImageStatistics_MT.histogram(input,minValue,histogram);
} else {
ImplImageStatistics.histogram(input,minValue,histogram);
}
} } | public class class_name {
public static void histogram( GrayS8 input , int minValue , int histogram[] ) {
if( BoofConcurrency.USE_CONCURRENT ) {
ImplImageStatistics_MT.histogram(input,minValue,histogram); // depends on control dependency: [if], data = [none]
} else {
ImplImageStatistics.histogram(input,minValue,histogram); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String format(String value) {
StringBuilder s = new StringBuilder();
if (value != null && value.trim().length() > 0) {
boolean continuationLine = false;
s.append(getName()).append(":");
if (isFirstLineEmpty()) {
s.append("\n");
continuationLine = true;
}
try {
BufferedReader reader = new BufferedReader(new StringReader(value));
String line;
while ((line = reader.readLine()) != null) {
if (continuationLine && line.trim().length() == 0) {
// put a dot on the empty continuation lines
s.append(" .\n");
} else {
s.append(" ").append(line).append("\n");
}
continuationLine = true;
}
} catch (IOException e) {
e.printStackTrace();
}
}
return s.toString();
} } | public class class_name {
public String format(String value) {
StringBuilder s = new StringBuilder();
if (value != null && value.trim().length() > 0) {
boolean continuationLine = false;
s.append(getName()).append(":"); // depends on control dependency: [if], data = [none]
if (isFirstLineEmpty()) {
s.append("\n"); // depends on control dependency: [if], data = [none]
continuationLine = true; // depends on control dependency: [if], data = [none]
}
try {
BufferedReader reader = new BufferedReader(new StringReader(value));
String line;
while ((line = reader.readLine()) != null) {
if (continuationLine && line.trim().length() == 0) {
// put a dot on the empty continuation lines
s.append(" .\n"); // depends on control dependency: [if], data = [none]
} else {
s.append(" ").append(line).append("\n"); // depends on control dependency: [if], data = [none]
}
continuationLine = true; // depends on control dependency: [while], data = [none]
}
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return s.toString();
} } |
public class class_name {
private List<Object> adjustArgs(List<String> args, Method m) {
final List<Object> result = new ArrayList<Object>();
final Class<?>[] types = m.getParameterTypes();
if (m.isVarArgs()) {
types[types.length - 1] = types[types.length - 1].getComponentType();
if (!String.class.isAssignableFrom(types[types.length - 1])) {
throw new CliException("Only String varargs is supported.");
}
types[types.length - 1] = String.class;
}
List<Object> varargs = new ArrayList<>();
for (int i = 0; i < args.size(); i++) {
try {
if (m.isVarArgs() && i >= types.length - 1) {
varargs.add(c.convert(args.get(i), types[types.length - 1]));
} else {
result.add(c.convert(args.get(i), types[i]));
}
} catch (ConversionException e) {
throw CliException.WRONG_ARG_TYPE(getArguments().get(i).getName(),
types[i].getName(), args.get(i));
}
}
if (m.isVarArgs()) {
result.add(varargs.toArray(new String[0]));
}
return result;
} } | public class class_name {
private List<Object> adjustArgs(List<String> args, Method m) {
final List<Object> result = new ArrayList<Object>();
final Class<?>[] types = m.getParameterTypes();
if (m.isVarArgs()) {
types[types.length - 1] = types[types.length - 1].getComponentType(); // depends on control dependency: [if], data = [none]
if (!String.class.isAssignableFrom(types[types.length - 1])) {
throw new CliException("Only String varargs is supported.");
}
types[types.length - 1] = String.class; // depends on control dependency: [if], data = [none]
}
List<Object> varargs = new ArrayList<>();
for (int i = 0; i < args.size(); i++) {
try {
if (m.isVarArgs() && i >= types.length - 1) {
varargs.add(c.convert(args.get(i), types[types.length - 1])); // depends on control dependency: [if], data = [none]
} else {
result.add(c.convert(args.get(i), types[i])); // depends on control dependency: [if], data = [none]
}
} catch (ConversionException e) {
throw CliException.WRONG_ARG_TYPE(getArguments().get(i).getName(),
types[i].getName(), args.get(i));
} // depends on control dependency: [catch], data = [none]
}
if (m.isVarArgs()) {
result.add(varargs.toArray(new String[0])); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@SafeVarargs
public static int[] removeAll(final int[] a, final int... elements) {
if (N.isNullOrEmpty(a)) {
return N.EMPTY_INT_ARRAY;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final IntList list = IntList.of(a.clone());
list.removeAll(IntList.of(elements));
return list.trimToSize().array();
} } | public class class_name {
@SafeVarargs
public static int[] removeAll(final int[] a, final int... elements) {
if (N.isNullOrEmpty(a)) {
return N.EMPTY_INT_ARRAY;
// depends on control dependency: [if], data = [none]
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
// depends on control dependency: [if], data = [none]
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
// depends on control dependency: [if], data = [none]
}
final IntList list = IntList.of(a.clone());
list.removeAll(IntList.of(elements));
return list.trimToSize().array();
} } |
public class class_name {
public Observable<ServiceResponse<VaultAccessPolicyParametersInner>> updateAccessPolicyWithServiceResponseAsync(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyProperties properties) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (vaultName == null) {
throw new IllegalArgumentException("Parameter vaultName is required and cannot be null.");
}
if (operationKind == null) {
throw new IllegalArgumentException("Parameter operationKind is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (properties == null) {
throw new IllegalArgumentException("Parameter properties is required and cannot be null.");
}
Validator.validate(properties);
VaultAccessPolicyParametersInner parameters = new VaultAccessPolicyParametersInner();
parameters.withProperties(properties);
return service.updateAccessPolicy(resourceGroupName, vaultName, operationKind, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VaultAccessPolicyParametersInner>>>() {
@Override
public Observable<ServiceResponse<VaultAccessPolicyParametersInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<VaultAccessPolicyParametersInner> clientResponse = updateAccessPolicyDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<VaultAccessPolicyParametersInner>> updateAccessPolicyWithServiceResponseAsync(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyProperties properties) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (vaultName == null) {
throw new IllegalArgumentException("Parameter vaultName is required and cannot be null.");
}
if (operationKind == null) {
throw new IllegalArgumentException("Parameter operationKind is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (properties == null) {
throw new IllegalArgumentException("Parameter properties is required and cannot be null.");
}
Validator.validate(properties);
VaultAccessPolicyParametersInner parameters = new VaultAccessPolicyParametersInner();
parameters.withProperties(properties);
return service.updateAccessPolicy(resourceGroupName, vaultName, operationKind, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VaultAccessPolicyParametersInner>>>() {
@Override
public Observable<ServiceResponse<VaultAccessPolicyParametersInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<VaultAccessPolicyParametersInner> clientResponse = updateAccessPolicyDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.