code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Override public Server choose(Object key) { int count = 0; Server server = roundRobinRule.choose(key); while (count++ <= 10) { if (server != null && predicate.apply(new PredicateKey(server))) { return server; } server = roundRobinRule.choose(key); } return super.choose(key); } }
public class class_name { @Override public Server choose(Object key) { int count = 0; Server server = roundRobinRule.choose(key); while (count++ <= 10) { if (server != null && predicate.apply(new PredicateKey(server))) { return server; // depends on control dependency: [if], data = [none] } server = roundRobinRule.choose(key); // depends on control dependency: [while], data = [none] } return super.choose(key); } }
public class class_name { public void setBindings(Bindings bindings, int scope) { if (scope == ScriptContext.GLOBAL_SCOPE) { context.setBindings(bindings, ScriptContext.GLOBAL_SCOPE); ; } else if (scope == ScriptContext.ENGINE_SCOPE) { context.setBindings(bindings, ScriptContext.ENGINE_SCOPE); ; } else { throw new IllegalArgumentException("Invalid scope value."); } } }
public class class_name { public void setBindings(Bindings bindings, int scope) { if (scope == ScriptContext.GLOBAL_SCOPE) { context.setBindings(bindings, ScriptContext.GLOBAL_SCOPE); // depends on control dependency: [if], data = [ScriptContext.GLOBAL_SCOPE)] ; } else if (scope == ScriptContext.ENGINE_SCOPE) { context.setBindings(bindings, ScriptContext.ENGINE_SCOPE); // depends on control dependency: [if], data = [ScriptContext.ENGINE_SCOPE)] ; } else { throw new IllegalArgumentException("Invalid scope value."); } } }
public class class_name { @SuppressWarnings("unchecked") public static Collection<Polygon> doVectorize( GridCoverage2D src, Map<String, Object> args ) { if (args == null) { args = new HashMap<String, Object>(); } ParameterBlockJAI pb = new ParameterBlockJAI("Vectorize"); pb.setSource("source0", src.getRenderedImage()); // Set any parameters that were passed in for( Entry<String, Object> e : args.entrySet() ) { pb.setParameter(e.getKey(), e.getValue()); } // Get the desintation image: this is the unmodified source image data // plus a property for the generated vectors RenderedOp dest = JAI.create("Vectorize", pb); // Get the vectors Collection<Polygon> polygons = (Collection<Polygon>) dest.getProperty(VectorizeDescriptor.VECTOR_PROPERTY_NAME); RegionMap regionParams = CoverageUtilities.getRegionParamsFromGridCoverage(src); double xRes = regionParams.getXres(); double yRes = regionParams.getYres(); final AffineTransform mt2D = (AffineTransform) src.getGridGeometry().getGridToCRS2D(PixelOrientation.CENTER); final AffineTransformation jtsTransformation = new AffineTransformation(mt2D.getScaleX(), mt2D.getShearX(), mt2D.getTranslateX() - xRes / 2.0, mt2D.getShearY(), mt2D.getScaleY(), mt2D.getTranslateY() + yRes / 2.0); for( Polygon polygon : polygons ) { polygon.apply(jtsTransformation); } return polygons; } }
public class class_name { @SuppressWarnings("unchecked") public static Collection<Polygon> doVectorize( GridCoverage2D src, Map<String, Object> args ) { if (args == null) { args = new HashMap<String, Object>(); // depends on control dependency: [if], data = [none] } ParameterBlockJAI pb = new ParameterBlockJAI("Vectorize"); pb.setSource("source0", src.getRenderedImage()); // Set any parameters that were passed in for( Entry<String, Object> e : args.entrySet() ) { pb.setParameter(e.getKey(), e.getValue()); // depends on control dependency: [for], data = [e] } // Get the desintation image: this is the unmodified source image data // plus a property for the generated vectors RenderedOp dest = JAI.create("Vectorize", pb); // Get the vectors Collection<Polygon> polygons = (Collection<Polygon>) dest.getProperty(VectorizeDescriptor.VECTOR_PROPERTY_NAME); RegionMap regionParams = CoverageUtilities.getRegionParamsFromGridCoverage(src); double xRes = regionParams.getXres(); double yRes = regionParams.getYres(); final AffineTransform mt2D = (AffineTransform) src.getGridGeometry().getGridToCRS2D(PixelOrientation.CENTER); final AffineTransformation jtsTransformation = new AffineTransformation(mt2D.getScaleX(), mt2D.getShearX(), mt2D.getTranslateX() - xRes / 2.0, mt2D.getShearY(), mt2D.getScaleY(), mt2D.getTranslateY() + yRes / 2.0); for( Polygon polygon : polygons ) { polygon.apply(jtsTransformation); // depends on control dependency: [for], data = [polygon] } return polygons; } }
public class class_name { public static void asJson(Writer writer, WxOutMsg msg) { NutMap map = new NutMap(); map.put("touser", msg.getToUserName()); map.put("msgtype", msg.getMsgType()); switch (WxMsgType.valueOf(msg.getMsgType())) { case text: map.put("text", new NutMap().setv("content", msg.getContent())); break; case image: map.put("image", new NutMap().setv("media_id", msg.getImage().getMediaId())); break; case voice: map.put("voice", new NutMap().setv("media_id", msg.getVoice().getMediaId())); break; case video: NutMap _video = new NutMap(); _video.setv("media_id", msg.getVideo().getMediaId()); if (msg.getVideo().getTitle() != null) _video.put("title", (msg.getVideo().getTitle())); if (msg.getVideo().getDescription() != null) _video.put("description", (msg.getVideo().getDescription())); map.put("video", _video); break; case music: NutMap _music = new NutMap(); WxMusic music = msg.getMusic(); if (music.getTitle() != null) _music.put("title", (music.getTitle())); if (music.getDescription() != null) _music.put("description", (music.getDescription())); if (music.getMusicUrl() != null) _music.put("musicurl", (music.getMusicUrl())); if (music.getHQMusicUrl() != null) _music.put("hqmusicurl", (music.getHQMusicUrl())); _music.put("thumb_media_id", (music.getThumbMediaId())); break; case news: NutMap _news = new NutMap(); List<NutMap> list = new ArrayList<NutMap>(); for (WxArticle article : msg.getArticles()) { NutMap item = new NutMap(); if (article.getTitle() != null) item.put("title", (article.getTitle())); if (article.getDescription() != null) item.put("description", (article.getDescription())); if (article.getPicUrl() != null) item.put("picurl", (article.getPicUrl())); if (article.getUrl() != null) item.put("url", (article.getUrl())); list.add(item); } _news.put("articles", list); map.put("news", _news); break; case mpnews: map.put("mpnews", new NutMap().setv("media_id", msg.getMedia_id())); break; case wxcard: map.put("wxcard", new NutMap().setv("card_id", msg.getCard().getId()) .setv("card_ext", msg.getCard().getExt())); break; default: break; } Json.toJson(writer, map); } }
public class class_name { public static void asJson(Writer writer, WxOutMsg msg) { NutMap map = new NutMap(); map.put("touser", msg.getToUserName()); map.put("msgtype", msg.getMsgType()); switch (WxMsgType.valueOf(msg.getMsgType())) { case text: map.put("text", new NutMap().setv("content", msg.getContent())); break; case image: map.put("image", new NutMap().setv("media_id", msg.getImage().getMediaId())); break; case voice: map.put("voice", new NutMap().setv("media_id", msg.getVoice().getMediaId())); break; case video: NutMap _video = new NutMap(); _video.setv("media_id", msg.getVideo().getMediaId()); if (msg.getVideo().getTitle() != null) _video.put("title", (msg.getVideo().getTitle())); if (msg.getVideo().getDescription() != null) _video.put("description", (msg.getVideo().getDescription())); map.put("video", _video); break; case music: NutMap _music = new NutMap(); WxMusic music = msg.getMusic(); if (music.getTitle() != null) _music.put("title", (music.getTitle())); if (music.getDescription() != null) _music.put("description", (music.getDescription())); if (music.getMusicUrl() != null) _music.put("musicurl", (music.getMusicUrl())); if (music.getHQMusicUrl() != null) _music.put("hqmusicurl", (music.getHQMusicUrl())); _music.put("thumb_media_id", (music.getThumbMediaId())); break; case news: NutMap _news = new NutMap(); List<NutMap> list = new ArrayList<NutMap>(); for (WxArticle article : msg.getArticles()) { NutMap item = new NutMap(); if (article.getTitle() != null) item.put("title", (article.getTitle())); if (article.getDescription() != null) item.put("description", (article.getDescription())); if (article.getPicUrl() != null) item.put("picurl", (article.getPicUrl())); if (article.getUrl() != null) item.put("url", (article.getUrl())); list.add(item); // depends on control dependency: [for], data = [none] } _news.put("articles", list); map.put("news", _news); break; case mpnews: map.put("mpnews", new NutMap().setv("media_id", msg.getMedia_id())); break; case wxcard: map.put("wxcard", new NutMap().setv("card_id", msg.getCard().getId()) .setv("card_ext", msg.getCard().getExt())); break; default: break; } Json.toJson(writer, map); } }
public class class_name { public final void voidInterfaceMethodDeclaratorRest() throws RecognitionException { int voidInterfaceMethodDeclaratorRest_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 35) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:439:5: ( formalParameters ( 'throws' qualifiedNameList )? ';' ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:439:7: formalParameters ( 'throws' qualifiedNameList )? ';' { pushFollow(FOLLOW_formalParameters_in_voidInterfaceMethodDeclaratorRest1232); formalParameters(); state._fsp--; if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:439:24: ( 'throws' qualifiedNameList )? int alt51=2; int LA51_0 = input.LA(1); if ( (LA51_0==113) ) { alt51=1; } switch (alt51) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:439:25: 'throws' qualifiedNameList { match(input,113,FOLLOW_113_in_voidInterfaceMethodDeclaratorRest1235); if (state.failed) return; pushFollow(FOLLOW_qualifiedNameList_in_voidInterfaceMethodDeclaratorRest1237); qualifiedNameList(); state._fsp--; if (state.failed) return; } break; } match(input,52,FOLLOW_52_in_voidInterfaceMethodDeclaratorRest1241); if (state.failed) return; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 35, voidInterfaceMethodDeclaratorRest_StartIndex); } } } }
public class class_name { public final void voidInterfaceMethodDeclaratorRest() throws RecognitionException { int voidInterfaceMethodDeclaratorRest_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 35) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:439:5: ( formalParameters ( 'throws' qualifiedNameList )? ';' ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:439:7: formalParameters ( 'throws' qualifiedNameList )? ';' { pushFollow(FOLLOW_formalParameters_in_voidInterfaceMethodDeclaratorRest1232); formalParameters(); state._fsp--; if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:439:24: ( 'throws' qualifiedNameList )? int alt51=2; int LA51_0 = input.LA(1); if ( (LA51_0==113) ) { alt51=1; // depends on control dependency: [if], data = [none] } switch (alt51) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:439:25: 'throws' qualifiedNameList { match(input,113,FOLLOW_113_in_voidInterfaceMethodDeclaratorRest1235); if (state.failed) return; pushFollow(FOLLOW_qualifiedNameList_in_voidInterfaceMethodDeclaratorRest1237); qualifiedNameList(); state._fsp--; if (state.failed) return; } break; } match(input,52,FOLLOW_52_in_voidInterfaceMethodDeclaratorRest1241); if (state.failed) return; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 35, voidInterfaceMethodDeclaratorRest_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { private void readRoleDefinitions(Project gpProject) { m_roleDefinitions.put("Default:1", "project manager"); for (Roles roles : gpProject.getRoles()) { if ("Default".equals(roles.getRolesetName())) { continue; } for (Role role : roles.getRole()) { m_roleDefinitions.put(role.getId(), role.getName()); } } } }
public class class_name { private void readRoleDefinitions(Project gpProject) { m_roleDefinitions.put("Default:1", "project manager"); for (Roles roles : gpProject.getRoles()) { if ("Default".equals(roles.getRolesetName())) { continue; } for (Role role : roles.getRole()) { m_roleDefinitions.put(role.getId(), role.getName()); // depends on control dependency: [for], data = [role] } } } }
public class class_name { public void removeService(ServiceReference reference, Object service) { if (serviceRegistration != null) { serviceRegistration.unregister(); serviceRegistration = null; } String alias = this.getAlias(); ((HttpService) service).unregister(alias); if (servlet instanceof WebappServlet) ((WebappServlet)servlet).free(); servlet = null; } }
public class class_name { public void removeService(ServiceReference reference, Object service) { if (serviceRegistration != null) { serviceRegistration.unregister(); // depends on control dependency: [if], data = [none] serviceRegistration = null; // depends on control dependency: [if], data = [none] } String alias = this.getAlias(); ((HttpService) service).unregister(alias); if (servlet instanceof WebappServlet) ((WebappServlet)servlet).free(); servlet = null; } }
public class class_name { public boolean startsWith(final String str) { if (str == null) { return false; } final int len = str.length(); if (len == 0) { return true; } if (len > size) { return false; } for (int i = 0; i < len; i++) { if (buffer[i] != str.charAt(i)) { return false; } } return true; } }
public class class_name { public boolean startsWith(final String str) { if (str == null) { return false; // depends on control dependency: [if], data = [none] } final int len = str.length(); if (len == 0) { return true; // depends on control dependency: [if], data = [none] } if (len > size) { return false; // depends on control dependency: [if], data = [none] } for (int i = 0; i < len; i++) { if (buffer[i] != str.charAt(i)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private static final String escape(String str) { if (str == null) { return null; } StringBuilder sb = new StringBuilder(str.length() * 2); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); switch (c) { case TOKEN_DELIM: case USER_DATA_DELIM: case USER_ATTRIB_DELIM: sb.append('\\'); break; default: break; } sb.append(c); } return sb.toString(); } }
public class class_name { private static final String escape(String str) { if (str == null) { return null; // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(str.length() * 2); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); switch (c) { case TOKEN_DELIM: case USER_DATA_DELIM: case USER_ATTRIB_DELIM: sb.append('\\'); break; default: break; } sb.append(c); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { public void closeConnection(String clusterName) { synchronized (connections) { if (connections.containsKey(clusterName)) { connections.get(clusterName).close(); connections.remove(clusterName); } } logger.info("Disconnected from [" + clusterName + "]"); } }
public class class_name { public void closeConnection(String clusterName) { synchronized (connections) { if (connections.containsKey(clusterName)) { connections.get(clusterName).close(); // depends on control dependency: [if], data = [none] connections.remove(clusterName); // depends on control dependency: [if], data = [none] } } logger.info("Disconnected from [" + clusterName + "]"); } }
public class class_name { public int compare(Version other) { int maxParts = Math.max(this.versions.length, other.versions.length); for(int i = 0; i < maxParts; i++) { int eq = this.getVersionPosition(i) - other.getVersionPosition(i); if(eq != 0) { if(eq > 0) { return 1; } else { return -1; } } } return 0; } }
public class class_name { public int compare(Version other) { int maxParts = Math.max(this.versions.length, other.versions.length); for(int i = 0; i < maxParts; i++) { int eq = this.getVersionPosition(i) - other.getVersionPosition(i); if(eq != 0) { if(eq > 0) { return 1; // depends on control dependency: [if], data = [none] } else { return -1; // depends on control dependency: [if], data = [none] } } } return 0; } }
public class class_name { public Set<Integer> getAdjacentFactors(int factorNum) { Set<Integer> adjacentFactors = Sets.newHashSet(); for (Integer variableNum : factorVariableMap.get(factorNum)) { adjacentFactors.addAll(variableFactorMap.get(variableNum)); } return adjacentFactors; } }
public class class_name { public Set<Integer> getAdjacentFactors(int factorNum) { Set<Integer> adjacentFactors = Sets.newHashSet(); for (Integer variableNum : factorVariableMap.get(factorNum)) { adjacentFactors.addAll(variableFactorMap.get(variableNum)); // depends on control dependency: [for], data = [variableNum] } return adjacentFactors; } }
public class class_name { private void addMemberProperties( AnnotationTypeDeclaration node, List<AnnotationTypeMemberDeclaration> members, Map<ExecutableElement, VariableElement> fieldElements) { if (members.isEmpty()) { return; } StringBuilder propertyDecls = new StringBuilder(); StringBuilder propertyImpls = new StringBuilder(); for (AnnotationTypeMemberDeclaration member : members) { ExecutableElement memberElement = member.getExecutableElement(); String propName = NameTable.getAnnotationPropertyName(memberElement); String memberTypeStr = nameTable.getObjCType(memberElement.getReturnType()); String fieldName = nameTable.getVariableShortName(fieldElements.get(memberElement)); propertyDecls.append(UnicodeUtils.format("@property (readonly) %s%s%s;\n", memberTypeStr, memberTypeStr.endsWith("*") ? "" : " ", propName)); if (NameTable.needsObjcMethodFamilyNoneAttribute(propName)) { propertyDecls.append(UnicodeUtils.format( "- (%s)%s OBJC_METHOD_FAMILY_NONE;\n", memberTypeStr, propName)); } propertyImpls.append(UnicodeUtils.format("@synthesize %s = %s;\n", propName, fieldName)); } node.addBodyDeclaration(NativeDeclaration.newInnerDeclaration( propertyDecls.toString(), propertyImpls.toString())); } }
public class class_name { private void addMemberProperties( AnnotationTypeDeclaration node, List<AnnotationTypeMemberDeclaration> members, Map<ExecutableElement, VariableElement> fieldElements) { if (members.isEmpty()) { return; // depends on control dependency: [if], data = [none] } StringBuilder propertyDecls = new StringBuilder(); StringBuilder propertyImpls = new StringBuilder(); for (AnnotationTypeMemberDeclaration member : members) { ExecutableElement memberElement = member.getExecutableElement(); String propName = NameTable.getAnnotationPropertyName(memberElement); String memberTypeStr = nameTable.getObjCType(memberElement.getReturnType()); String fieldName = nameTable.getVariableShortName(fieldElements.get(memberElement)); propertyDecls.append(UnicodeUtils.format("@property (readonly) %s%s%s;\n", memberTypeStr, memberTypeStr.endsWith("*") ? "" : " ", propName)); // depends on control dependency: [for], data = [none] if (NameTable.needsObjcMethodFamilyNoneAttribute(propName)) { propertyDecls.append(UnicodeUtils.format( "- (%s)%s OBJC_METHOD_FAMILY_NONE;\n", memberTypeStr, propName)); // depends on control dependency: [if], data = [none] } propertyImpls.append(UnicodeUtils.format("@synthesize %s = %s;\n", propName, fieldName)); // depends on control dependency: [for], data = [none] } node.addBodyDeclaration(NativeDeclaration.newInnerDeclaration( propertyDecls.toString(), propertyImpls.toString())); } }
public class class_name { @Override public String getId() { // As determining the name involves a fair bit of tree traversal, it is cached in the scratch map. // Try to retrieve the cached name first. Map scratchMap = getScratchMap(); if (scratchMap != null) { String name = (String) scratchMap.get("name"); if (name != null) { return name; } } // Get ID name String idName = getIdName(); String name; // No ID name, so generate an ID if (idName == null) { name = generateId(); } else { // Has ID name, so derive the full context name name = deriveId(idName); } if (scratchMap != null) { scratchMap.put("name", name); } // Log warning if an Active Naming Context has no id name if (this instanceof NamingContextable && ((NamingContextable) this).isNamingContext() && idName == null) { LOG.warn( "NamingContext [ID:" + name + "] does not have an id name set. Will be ignored."); } return name; } }
public class class_name { @Override public String getId() { // As determining the name involves a fair bit of tree traversal, it is cached in the scratch map. // Try to retrieve the cached name first. Map scratchMap = getScratchMap(); if (scratchMap != null) { String name = (String) scratchMap.get("name"); if (name != null) { return name; // depends on control dependency: [if], data = [none] } } // Get ID name String idName = getIdName(); String name; // No ID name, so generate an ID if (idName == null) { name = generateId(); // depends on control dependency: [if], data = [none] } else { // Has ID name, so derive the full context name name = deriveId(idName); // depends on control dependency: [if], data = [(idName] } if (scratchMap != null) { scratchMap.put("name", name); // depends on control dependency: [if], data = [none] } // Log warning if an Active Naming Context has no id name if (this instanceof NamingContextable && ((NamingContextable) this).isNamingContext() && idName == null) { LOG.warn( "NamingContext [ID:" + name + "] does not have an id name set. Will be ignored."); } return name; // depends on control dependency: [if], data = [none] } }
public class class_name { public void setEntitySafe(Entity entity) { if(StringUtils.isEmpty(entity.getName())) { setEntityKey(entity.getKey()); } else { setEntity(entity); } } }
public class class_name { public void setEntitySafe(Entity entity) { if(StringUtils.isEmpty(entity.getName())) { setEntityKey(entity.getKey()); // depends on control dependency: [if], data = [none] } else { setEntity(entity); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Snak copy(Snak snak) { if (snak instanceof ValueSnak) { return copy((ValueSnak) snak); } else if (snak instanceof NoValueSnak) { return copy((NoValueSnak) snak); } else if (snak instanceof SomeValueSnak) { return copy((SomeValueSnak) snak); } else { throw new IllegalArgumentException( "I don't know how to copy snaks of type " + snak.getClass()); } } }
public class class_name { private Snak copy(Snak snak) { if (snak instanceof ValueSnak) { return copy((ValueSnak) snak); // depends on control dependency: [if], data = [none] } else if (snak instanceof NoValueSnak) { return copy((NoValueSnak) snak); // depends on control dependency: [if], data = [none] } else if (snak instanceof SomeValueSnak) { return copy((SomeValueSnak) snak); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException( "I don't know how to copy snaks of type " + snak.getClass()); } } }
public class class_name { public <T> void add(T obj, Binding<T> binding, LifecycleMethods methods) throws Exception { State managerState = state.get(); if (managerState != State.CLOSED) { startInstance(obj, binding, methods); if ( managerState == State.STARTED ) { initializeObjectPostStart(obj); } } else { throw new IllegalStateException("LifecycleManager is closed"); } } }
public class class_name { public <T> void add(T obj, Binding<T> binding, LifecycleMethods methods) throws Exception { State managerState = state.get(); if (managerState != State.CLOSED) { startInstance(obj, binding, methods); if ( managerState == State.STARTED ) { initializeObjectPostStart(obj); // depends on control dependency: [if], data = [none] } } else { throw new IllegalStateException("LifecycleManager is closed"); } } }
public class class_name { public <K, V> void build(CommandArgs<K, V> args) { // PAUSE <queue-name> [option option ... option] if (bcast != null) { args.add(CommandKeyword.BCAST.getBytes()); } if (state != null) { args.add(CommandKeyword.STATE.getBytes()); } if (option != null) { args.add(option); } } }
public class class_name { public <K, V> void build(CommandArgs<K, V> args) { // PAUSE <queue-name> [option option ... option] if (bcast != null) { args.add(CommandKeyword.BCAST.getBytes()); // depends on control dependency: [if], data = [none] } if (state != null) { args.add(CommandKeyword.STATE.getBytes()); // depends on control dependency: [if], data = [none] } if (option != null) { args.add(option); // depends on control dependency: [if], data = [(option] } } }
public class class_name { @Override public String getName() { for (final IAdditionalDescriptors additionalDescriptors : delegateDescriptors) { final String name = additionalDescriptors.getName(); if (name != null) { return name; } } return null; } }
public class class_name { @Override public String getName() { for (final IAdditionalDescriptors additionalDescriptors : delegateDescriptors) { final String name = additionalDescriptors.getName(); if (name != null) { return name; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public COPACNeighborPredicate.Instance instantiate(Database database, Relation<V> relation) { DistanceQuery<V> dq = database.getDistanceQuery(relation, EuclideanDistanceFunction.STATIC); KNNQuery<V> knnq = database.getKNNQuery(dq, settings.k); WritableDataStore<COPACModel> storage = DataStoreUtil.makeStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, COPACModel.class); Duration time = LOG.newDuration(this.getClass().getName() + ".preprocessing-time").begin(); FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress(this.getClass().getName(), relation.size(), LOG) : null; for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { DoubleDBIDList ref = knnq.getKNNForDBID(iditer, settings.k); storage.put(iditer, computeLocalModel(iditer, ref, relation)); LOG.incrementProcessed(progress); } LOG.ensureCompleted(progress); LOG.statistics(time.end()); return new Instance(relation.getDBIDs(), storage); } }
public class class_name { public COPACNeighborPredicate.Instance instantiate(Database database, Relation<V> relation) { DistanceQuery<V> dq = database.getDistanceQuery(relation, EuclideanDistanceFunction.STATIC); KNNQuery<V> knnq = database.getKNNQuery(dq, settings.k); WritableDataStore<COPACModel> storage = DataStoreUtil.makeStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, COPACModel.class); Duration time = LOG.newDuration(this.getClass().getName() + ".preprocessing-time").begin(); FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress(this.getClass().getName(), relation.size(), LOG) : null; for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { DoubleDBIDList ref = knnq.getKNNForDBID(iditer, settings.k); storage.put(iditer, computeLocalModel(iditer, ref, relation)); // depends on control dependency: [for], data = [iditer] LOG.incrementProcessed(progress); // depends on control dependency: [for], data = [none] } LOG.ensureCompleted(progress); LOG.statistics(time.end()); return new Instance(relation.getDBIDs(), storage); } }
public class class_name { public static Map<String, Object> getExternalProperties(String pu, Map<String, Object> externalProperties, String... persistenceUnits) { Map<String, Object> puProperty; if (persistenceUnits != null && persistenceUnits.length > 1 && externalProperties != null) { puProperty = (Map<String, Object>) externalProperties.get(pu); // if property found then return it, if it is null by pass it, else // throw invalidConfiguration. if (puProperty != null) { return fetchPropertyMap(puProperty); } return null; } return externalProperties; } }
public class class_name { public static Map<String, Object> getExternalProperties(String pu, Map<String, Object> externalProperties, String... persistenceUnits) { Map<String, Object> puProperty; if (persistenceUnits != null && persistenceUnits.length > 1 && externalProperties != null) { puProperty = (Map<String, Object>) externalProperties.get(pu); // depends on control dependency: [if], data = [none] // if property found then return it, if it is null by pass it, else // throw invalidConfiguration. if (puProperty != null) { return fetchPropertyMap(puProperty); // depends on control dependency: [if], data = [(puProperty] } return null; // depends on control dependency: [if], data = [none] } return externalProperties; } }
public class class_name { public void setBoolean(Enum<?> key, boolean value) { if (key == null) { return; } setBoolean(key.name(), value); } }
public class class_name { public void setBoolean(Enum<?> key, boolean value) { if (key == null) { return; // depends on control dependency: [if], data = [none] } setBoolean(key.name(), value); } }
public class class_name { public boolean deactivate() throws Exception { if (activated) { if (connectionFactories != null) { for (ConnectionFactory cf : connectionFactories) { cf.deactivate(); } } if (adminObjects != null) { for (AdminObject ao : adminObjects) { ao.deactivate(); } } if (resourceAdapter != null) { resourceAdapter.deactivate(); } activated = false; return true; } return false; } }
public class class_name { public boolean deactivate() throws Exception { if (activated) { if (connectionFactories != null) { for (ConnectionFactory cf : connectionFactories) { cf.deactivate(); // depends on control dependency: [for], data = [cf] } } if (adminObjects != null) { for (AdminObject ao : adminObjects) { ao.deactivate(); // depends on control dependency: [for], data = [ao] } } if (resourceAdapter != null) { resourceAdapter.deactivate(); // depends on control dependency: [if], data = [none] } activated = false; return true; } return false; } }
public class class_name { public ListRecordsResult withRecords(Record... records) { if (this.records == null) { setRecords(new com.amazonaws.internal.SdkInternalList<Record>(records.length)); } for (Record ele : records) { this.records.add(ele); } return this; } }
public class class_name { public ListRecordsResult withRecords(Record... records) { if (this.records == null) { setRecords(new com.amazonaws.internal.SdkInternalList<Record>(records.length)); // depends on control dependency: [if], data = [none] } for (Record ele : records) { this.records.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public String asXML(ResourceBundle rb) { StringBuilder sb = new StringBuilder(); if (failures != null) { // PRE-XML int i = 0; for (Failure failure : failures) { Failure f = failure; sb = sb.append(f.asXML(rb)); if (i < failures.size() - 1) sb = sb.append(NEW_LINE); i++; } // POST-XML } return sb.toString(); } }
public class class_name { public String asXML(ResourceBundle rb) { StringBuilder sb = new StringBuilder(); if (failures != null) { // PRE-XML int i = 0; for (Failure failure : failures) { Failure f = failure; sb = sb.append(f.asXML(rb)); // depends on control dependency: [for], data = [none] if (i < failures.size() - 1) sb = sb.append(NEW_LINE); i++; // depends on control dependency: [for], data = [none] } // POST-XML } return sb.toString(); } }
public class class_name { public static boolean isMultipart(HttpServletRequest request) { if (false == isPostMethod(request)) { return false; } String contentType = request.getContentType(); if (StrUtil.isBlank(contentType)) { return false; } if (contentType.toLowerCase().startsWith("multipart/")) { return true; } return false; } }
public class class_name { public static boolean isMultipart(HttpServletRequest request) { if (false == isPostMethod(request)) { return false; // depends on control dependency: [if], data = [none] } String contentType = request.getContentType(); if (StrUtil.isBlank(contentType)) { return false; // depends on control dependency: [if], data = [none] } if (contentType.toLowerCase().startsWith("multipart/")) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static <Type extends Annotation> Type getAnnotation(final Method method, final Class<Type> annotationType) { if (isAnnotationPresent(method, annotationType)) { return method.getDeclaredAnnotation(annotationType).getAnnotation(annotationType); } return null; } }
public class class_name { public static <Type extends Annotation> Type getAnnotation(final Method method, final Class<Type> annotationType) { if (isAnnotationPresent(method, annotationType)) { return method.getDeclaredAnnotation(annotationType).getAnnotation(annotationType); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public Description matchMethod(MethodTree tree, VisitorState state) { MethodSymbol methodSym = ASTHelpers.getSymbol(tree); // precondition (1) if (!methodSym.getModifiers().contains(Modifier.PRIVATE)) { return Description.NO_MATCH; } ImmutableList<Tree> params = tree.getParameters().stream() .filter(param -> hasFunctionAsArg(param, state)) .filter( param -> isFunctionArgSubtypeOf( param, 0, state.getTypeFromString(JAVA_LANG_NUMBER), state) || isFunctionArgSubtypeOf( param, 1, state.getTypeFromString(JAVA_LANG_NUMBER), state)) .collect(toImmutableList()); // preconditions (2) and (3) if (params.isEmpty() || !methodCallsMeetConditions(methodSym, state)) { return Description.NO_MATCH; } SuggestedFix.Builder fixBuilder = SuggestedFix.builder(); for (Tree param : params) { getMappingForFunctionFromTree(param) .ifPresent( mappedFunction -> { fixBuilder.addImport(getImportName(mappedFunction)); fixBuilder.replace( param, getFunctionName(mappedFunction) + " " + ASTHelpers.getSymbol(param).name); refactorInternalApplyMethods(tree, fixBuilder, param, mappedFunction); }); } return describeMatch(tree, fixBuilder.build()); } }
public class class_name { @Override public Description matchMethod(MethodTree tree, VisitorState state) { MethodSymbol methodSym = ASTHelpers.getSymbol(tree); // precondition (1) if (!methodSym.getModifiers().contains(Modifier.PRIVATE)) { return Description.NO_MATCH; // depends on control dependency: [if], data = [none] } ImmutableList<Tree> params = tree.getParameters().stream() .filter(param -> hasFunctionAsArg(param, state)) .filter( param -> isFunctionArgSubtypeOf( param, 0, state.getTypeFromString(JAVA_LANG_NUMBER), state) || isFunctionArgSubtypeOf( param, 1, state.getTypeFromString(JAVA_LANG_NUMBER), state)) .collect(toImmutableList()); // preconditions (2) and (3) if (params.isEmpty() || !methodCallsMeetConditions(methodSym, state)) { return Description.NO_MATCH; // depends on control dependency: [if], data = [none] } SuggestedFix.Builder fixBuilder = SuggestedFix.builder(); for (Tree param : params) { getMappingForFunctionFromTree(param) .ifPresent( mappedFunction -> { fixBuilder.addImport(getImportName(mappedFunction)); // depends on control dependency: [for], data = [param] fixBuilder.replace( param, getFunctionName(mappedFunction) + " " + ASTHelpers.getSymbol(param).name); // depends on control dependency: [for], data = [none] refactorInternalApplyMethods(tree, fixBuilder, param, mappedFunction); // depends on control dependency: [for], data = [param] }); } return describeMatch(tree, fixBuilder.build()); } }
public class class_name { public boolean intersects(MappeableContainer x) { if (x instanceof MappeableArrayContainer) { return intersects((MappeableArrayContainer) x); } else if (x instanceof MappeableBitmapContainer) { return intersects((MappeableBitmapContainer) x); } return intersects((MappeableRunContainer) x); } }
public class class_name { public boolean intersects(MappeableContainer x) { if (x instanceof MappeableArrayContainer) { return intersects((MappeableArrayContainer) x); // depends on control dependency: [if], data = [none] } else if (x instanceof MappeableBitmapContainer) { return intersects((MappeableBitmapContainer) x); // depends on control dependency: [if], data = [none] } return intersects((MappeableRunContainer) x); } }
public class class_name { public void removeListener(ILabelProviderListener listener) { if (fListeners != null) { fListeners.remove(listener); if (fListeners.isEmpty() && fProblemChangedListener != null) { VdmUIPlugin.getDefault() .getProblemMarkerManager() .removeListener(fProblemChangedListener); fProblemChangedListener = null; } } } }
public class class_name { public void removeListener(ILabelProviderListener listener) { if (fListeners != null) { fListeners.remove(listener); // depends on control dependency: [if], data = [none] if (fListeners.isEmpty() && fProblemChangedListener != null) { VdmUIPlugin.getDefault() .getProblemMarkerManager() .removeListener(fProblemChangedListener); // depends on control dependency: [if], data = [none] fProblemChangedListener = null; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public double[][] getS() { double[][] S = new double[n][n]; for(int i = 0; i < n; i++) { S[i][i] = this.s[i]; } return S; } }
public class class_name { public double[][] getS() { double[][] S = new double[n][n]; for(int i = 0; i < n; i++) { S[i][i] = this.s[i]; // depends on control dependency: [for], data = [i] } return S; } }
public class class_name { public static String decodeString(String s) { try { return new String(CODEC.decode(s), "UTF-8"); } catch (UnsupportedEncodingException e) { // shouldn't happen return null; } } }
public class class_name { public static String decodeString(String s) { try { return new String(CODEC.decode(s), "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { // shouldn't happen return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void processEvent(QueryBatch batch) { try { batch.getClient().newDocumentManager().delete( batch.getItems() ); } catch (Throwable t) { for ( BatchFailureListener<Batch<String>> listener : failureListeners ) { try { listener.processFailure(batch, t); } catch (Throwable t2) { logger.error("Exception thrown by an onBatchFailure listener", t2); } } for ( BatchFailureListener<QueryBatch> queryBatchFailureListener : queryBatchFailureListeners ) { try { queryBatchFailureListener.processFailure(batch, t); } catch (Throwable t2) { logger.error("Exception thrown by an onFailure listener", t2); } } } } }
public class class_name { @Override public void processEvent(QueryBatch batch) { try { batch.getClient().newDocumentManager().delete( batch.getItems() ); // depends on control dependency: [try], data = [none] } catch (Throwable t) { for ( BatchFailureListener<Batch<String>> listener : failureListeners ) { try { listener.processFailure(batch, t); // depends on control dependency: [try], data = [none] } catch (Throwable t2) { logger.error("Exception thrown by an onBatchFailure listener", t2); } // depends on control dependency: [catch], data = [none] } for ( BatchFailureListener<QueryBatch> queryBatchFailureListener : queryBatchFailureListeners ) { try { queryBatchFailureListener.processFailure(batch, t); // depends on control dependency: [try], data = [none] } catch (Throwable t2) { logger.error("Exception thrown by an onFailure listener", t2); } // depends on control dependency: [catch], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void seekToRecord(int n) { if (!canSeek()) { throw new DbfException("Seeking is not supported."); } if (n < 0 || n >= header.getNumberOfRecords()) { throw new DbfException(String.format("Record index out of range [0, %d]: %d", header.getNumberOfRecords(), n)); } long position = header.getHeaderLength() + n * header.getRecordLength(); try { ((RandomAccessFile) dataInput).seek(position); } catch (IOException e) { throw new DbfException( String.format("Failed to seek to record %d of %d", n, header.getNumberOfRecords()), e); } } }
public class class_name { public void seekToRecord(int n) { if (!canSeek()) { throw new DbfException("Seeking is not supported."); } if (n < 0 || n >= header.getNumberOfRecords()) { throw new DbfException(String.format("Record index out of range [0, %d]: %d", header.getNumberOfRecords(), n)); } long position = header.getHeaderLength() + n * header.getRecordLength(); try { ((RandomAccessFile) dataInput).seek(position); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new DbfException( String.format("Failed to seek to record %d of %d", n, header.getNumberOfRecords()), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public boolean isAssignableBy(ResolvedType other) { if (other instanceof NullType) { return !this.isPrimitive(); } // everything is assignable to Object except void if (!other.isVoid() && this.getQualifiedName().equals(Object.class.getCanonicalName())) { return true; } // consider boxing if (other.isPrimitive()) { if (this.getQualifiedName().equals(Object.class.getCanonicalName())) { return true; } else { // Check if 'other' can be boxed to match this type if (isCorrespondingBoxingType(other.describe())) return true; // Resolve the boxed type and check if it can be assigned via widening reference conversion SymbolReference<ResolvedReferenceTypeDeclaration> type = typeSolver.tryToSolveType(other.asPrimitive().getBoxTypeQName()); return type.getCorrespondingDeclaration().canBeAssignedTo(super.typeDeclaration); } } if (other instanceof LambdaArgumentTypePlaceholder) { return this.getTypeDeclaration().hasAnnotation(FunctionalInterface.class.getCanonicalName()); } else if (other instanceof ReferenceTypeImpl) { ReferenceTypeImpl otherRef = (ReferenceTypeImpl) other; if (compareConsideringTypeParameters(otherRef)) { return true; } for (ResolvedReferenceType otherAncestor : otherRef.getAllAncestors()) { if (compareConsideringTypeParameters(otherAncestor)) { return true; } } return false; } else if (other.isTypeVariable()) { for (ResolvedTypeParameterDeclaration.Bound bound : other.asTypeVariable().asTypeParameter().getBounds()) { if (bound.isExtends()) { if (this.isAssignableBy(bound.getType())) { return true; } } } return false; } else if (other.isConstraint()){ return isAssignableBy(other.asConstraintType().getBound()); } else if (other.isWildcard()) { if (this.getQualifiedName().equals(Object.class.getCanonicalName())) { return true; } else if (other.asWildcard().isExtends()) { return isAssignableBy(other.asWildcard().getBoundedType()); } else { return false; } } else { return false; } } }
public class class_name { @Override public boolean isAssignableBy(ResolvedType other) { if (other instanceof NullType) { return !this.isPrimitive(); // depends on control dependency: [if], data = [none] } // everything is assignable to Object except void if (!other.isVoid() && this.getQualifiedName().equals(Object.class.getCanonicalName())) { return true; // depends on control dependency: [if], data = [none] } // consider boxing if (other.isPrimitive()) { if (this.getQualifiedName().equals(Object.class.getCanonicalName())) { return true; // depends on control dependency: [if], data = [none] } else { // Check if 'other' can be boxed to match this type if (isCorrespondingBoxingType(other.describe())) return true; // Resolve the boxed type and check if it can be assigned via widening reference conversion SymbolReference<ResolvedReferenceTypeDeclaration> type = typeSolver.tryToSolveType(other.asPrimitive().getBoxTypeQName()); return type.getCorrespondingDeclaration().canBeAssignedTo(super.typeDeclaration); // depends on control dependency: [if], data = [none] } } if (other instanceof LambdaArgumentTypePlaceholder) { return this.getTypeDeclaration().hasAnnotation(FunctionalInterface.class.getCanonicalName()); // depends on control dependency: [if], data = [none] } else if (other instanceof ReferenceTypeImpl) { ReferenceTypeImpl otherRef = (ReferenceTypeImpl) other; if (compareConsideringTypeParameters(otherRef)) { return true; // depends on control dependency: [if], data = [none] } for (ResolvedReferenceType otherAncestor : otherRef.getAllAncestors()) { if (compareConsideringTypeParameters(otherAncestor)) { return true; // depends on control dependency: [if], data = [none] } } return false; // depends on control dependency: [if], data = [none] } else if (other.isTypeVariable()) { for (ResolvedTypeParameterDeclaration.Bound bound : other.asTypeVariable().asTypeParameter().getBounds()) { if (bound.isExtends()) { if (this.isAssignableBy(bound.getType())) { return true; // depends on control dependency: [if], data = [none] } } } return false; // depends on control dependency: [if], data = [none] } else if (other.isConstraint()){ return isAssignableBy(other.asConstraintType().getBound()); // depends on control dependency: [if], data = [none] } else if (other.isWildcard()) { if (this.getQualifiedName().equals(Object.class.getCanonicalName())) { return true; // depends on control dependency: [if], data = [none] } else if (other.asWildcard().isExtends()) { return isAssignableBy(other.asWildcard().getBoundedType()); // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public AnnotationParameterValueList getAnnotationDefaultParameterValues() { if (!scanResult.scanSpec.enableAnnotationInfo) { throw new IllegalArgumentException("Please call ClassGraph#enableAnnotationInfo() before #scan()"); } if (!isAnnotation) { throw new IllegalArgumentException("Class is not an annotation: " + getName()); } if (annotationDefaultParamValues == null) { return AnnotationParameterValueList.EMPTY_LIST; } if (!annotationDefaultParamValuesHasBeenConvertedToPrimitive) { annotationDefaultParamValues.convertWrapperArraysToPrimitiveArrays(this); annotationDefaultParamValuesHasBeenConvertedToPrimitive = true; } return annotationDefaultParamValues; } }
public class class_name { public AnnotationParameterValueList getAnnotationDefaultParameterValues() { if (!scanResult.scanSpec.enableAnnotationInfo) { throw new IllegalArgumentException("Please call ClassGraph#enableAnnotationInfo() before #scan()"); } if (!isAnnotation) { throw new IllegalArgumentException("Class is not an annotation: " + getName()); } if (annotationDefaultParamValues == null) { return AnnotationParameterValueList.EMPTY_LIST; // depends on control dependency: [if], data = [none] } if (!annotationDefaultParamValuesHasBeenConvertedToPrimitive) { annotationDefaultParamValues.convertWrapperArraysToPrimitiveArrays(this); // depends on control dependency: [if], data = [none] annotationDefaultParamValuesHasBeenConvertedToPrimitive = true; // depends on control dependency: [if], data = [none] } return annotationDefaultParamValues; } }
public class class_name { public static X509Certificate getMiddleCert() { if (null == middleCert) { String path = SDKConfig.getConfig().getMiddleCertPath(); if (!isEmpty(path)) { initMiddleCert(); } else { LogUtil.writeErrorLog(SDKConfig.SDK_MIDDLECERT_PATH + " not set in " + SDKConfig.FILE_NAME); return null; } } return middleCert; } }
public class class_name { public static X509Certificate getMiddleCert() { if (null == middleCert) { String path = SDKConfig.getConfig().getMiddleCertPath(); if (!isEmpty(path)) { initMiddleCert(); // depends on control dependency: [if], data = [none] } else { LogUtil.writeErrorLog(SDKConfig.SDK_MIDDLECERT_PATH + " not set in " + SDKConfig.FILE_NAME); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } return middleCert; } }
public class class_name { public static String format(String name, char separator, String prefix, boolean includePrefix, boolean includeLeadingSeparator) { String leadingSeparators = includeLeadingSeparator ? getLeadingSeparators(name, '_') : null; if (leadingSeparators != null) { name = name.substring(leadingSeparators.length()); } List<String> parsedName = new ArrayList<String>(); if (prefix != null && name.startsWith(prefix) && name.length() > prefix.length() && Character.isUpperCase(name.charAt(prefix.length()))) { name = name.substring(prefix.length()); if (includePrefix) { parsedName = parseName(prefix, '_'); } } if (name.length() != 0) parsedName.addAll(parseName(name, '_')); StringBuilder result = new StringBuilder(); for (Iterator<String> nameIter = parsedName.iterator(); nameIter.hasNext();) { String nameComponent = nameIter.next(); result.append(nameComponent); if (nameIter.hasNext() && nameComponent.length() > 1) { result.append(separator); } } if (result.length() == 0 && prefix != null) { result.append(prefix); } return leadingSeparators != null ? "_" + result.toString() : result.toString(); } }
public class class_name { public static String format(String name, char separator, String prefix, boolean includePrefix, boolean includeLeadingSeparator) { String leadingSeparators = includeLeadingSeparator ? getLeadingSeparators(name, '_') : null; if (leadingSeparators != null) { name = name.substring(leadingSeparators.length()); // depends on control dependency: [if], data = [(leadingSeparators] } List<String> parsedName = new ArrayList<String>(); if (prefix != null && name.startsWith(prefix) && name.length() > prefix.length() && Character.isUpperCase(name.charAt(prefix.length()))) { name = name.substring(prefix.length()); // depends on control dependency: [if], data = [(prefix] if (includePrefix) { parsedName = parseName(prefix, '_'); // depends on control dependency: [if], data = [none] } } if (name.length() != 0) parsedName.addAll(parseName(name, '_')); StringBuilder result = new StringBuilder(); for (Iterator<String> nameIter = parsedName.iterator(); nameIter.hasNext();) { String nameComponent = nameIter.next(); result.append(nameComponent); // depends on control dependency: [for], data = [none] if (nameIter.hasNext() && nameComponent.length() > 1) { result.append(separator); // depends on control dependency: [if], data = [none] } } if (result.length() == 0 && prefix != null) { result.append(prefix); // depends on control dependency: [if], data = [none] } return leadingSeparators != null ? "_" + result.toString() : result.toString(); } }
public class class_name { private byte[] recvFromNodeCheckBigMsg(final NodeStruct node, final ReefNetworkGroupCommProtos.GroupCommMessage.Type msgType) { LOG.entering("OperatorTopologyStructImpl", "recvFromNodeCheckBigMsg", new Object[]{node, msgType}); byte[] retVal = receiveFromNode(node, false); if (retVal != null && retVal.length == 0) { LOG.finest(getQualifiedName() + " Got msg that node " + node.getId() + " has large data and is ready to send it. Sending ACK to receive data."); sendToNode(Utils.EMPTY_BYTE_ARR, msgType, node); retVal = receiveFromNode(node, true); if (retVal != null) { LOG.finest(getQualifiedName() + " Received large msg from node " + node.getId() + ". Will process it after ACKing."); sendToNode(Utils.EMPTY_BYTE_ARR, msgType, node); } else { LOG.warning(getQualifiedName() + "Expected large msg from node " + node.getId() + " but received nothing."); } } LOG.exiting("OperatorTopologyStructImpl", "recvFromNodeCheckBigMsg"); return retVal; } }
public class class_name { private byte[] recvFromNodeCheckBigMsg(final NodeStruct node, final ReefNetworkGroupCommProtos.GroupCommMessage.Type msgType) { LOG.entering("OperatorTopologyStructImpl", "recvFromNodeCheckBigMsg", new Object[]{node, msgType}); byte[] retVal = receiveFromNode(node, false); if (retVal != null && retVal.length == 0) { LOG.finest(getQualifiedName() + " Got msg that node " + node.getId() + " has large data and is ready to send it. Sending ACK to receive data."); // depends on control dependency: [if], data = [none] sendToNode(Utils.EMPTY_BYTE_ARR, msgType, node); // depends on control dependency: [if], data = [none] retVal = receiveFromNode(node, true); // depends on control dependency: [if], data = [none] if (retVal != null) { LOG.finest(getQualifiedName() + " Received large msg from node " + node.getId() + ". Will process it after ACKing."); // depends on control dependency: [if], data = [none] sendToNode(Utils.EMPTY_BYTE_ARR, msgType, node); // depends on control dependency: [if], data = [none] } else { LOG.warning(getQualifiedName() + "Expected large msg from node " + node.getId() + " but received nothing."); // depends on control dependency: [if], data = [none] } } LOG.exiting("OperatorTopologyStructImpl", "recvFromNodeCheckBigMsg"); return retVal; } }
public class class_name { public List<WindowFuture<K,R,P>> cancelAllExpired() { if (this.futures.size() <= 0) { return null; } List<WindowFuture<K,R,P>> expired = new ArrayList<WindowFuture<K,R,P>>(); long now = System.currentTimeMillis(); this.lock.lock(); try { // check every request this window contains and see if it's expired for (DefaultWindowFuture<K,R,P> future : this.futures.values()) { if (future.hasExpireTimestamp() && now >= future.getExpireTimestamp()) { expired.add(future); future.cancelHelper(now); } } if (expired.size() > 0) { // take all expired requests and remove them from the pendingRequests for (WindowFuture<K,R,P> future : expired) { this.futures.remove(future.getKey()); } // signal that a future is completed this.completedCondition.signalAll(); } } finally { this.lock.unlock(); } return expired; } }
public class class_name { public List<WindowFuture<K,R,P>> cancelAllExpired() { if (this.futures.size() <= 0) { return null; // depends on control dependency: [if], data = [none] } List<WindowFuture<K,R,P>> expired = new ArrayList<WindowFuture<K,R,P>>(); long now = System.currentTimeMillis(); this.lock.lock(); try { // check every request this window contains and see if it's expired for (DefaultWindowFuture<K,R,P> future : this.futures.values()) { if (future.hasExpireTimestamp() && now >= future.getExpireTimestamp()) { expired.add(future); // depends on control dependency: [if], data = [none] future.cancelHelper(now); // depends on control dependency: [if], data = [none] } } if (expired.size() > 0) { // take all expired requests and remove them from the pendingRequests for (WindowFuture<K,R,P> future : expired) { this.futures.remove(future.getKey()); // depends on control dependency: [for], data = [future] } // signal that a future is completed this.completedCondition.signalAll(); // depends on control dependency: [if], data = [none] } } finally { this.lock.unlock(); } return expired; } }
public class class_name { @Override public CommercePriceList fetchByG_NotS_Last(long groupId, int status, OrderByComparator<CommercePriceList> orderByComparator) { int count = countByG_NotS(groupId, status); if (count == 0) { return null; } List<CommercePriceList> list = findByG_NotS(groupId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } }
public class class_name { @Override public CommercePriceList fetchByG_NotS_Last(long groupId, int status, OrderByComparator<CommercePriceList> orderByComparator) { int count = countByG_NotS(groupId, status); if (count == 0) { return null; // depends on control dependency: [if], data = [none] } List<CommercePriceList> list = findByG_NotS(groupId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static <E extends Comparable<E>> int sortedIndex(final List<E> list, final E value) { int index = 0; for (E elem : list) { if (elem.compareTo(value) >= 0) { return index; } index += 1; } return -1; } }
public class class_name { public static <E extends Comparable<E>> int sortedIndex(final List<E> list, final E value) { int index = 0; for (E elem : list) { if (elem.compareTo(value) >= 0) { return index; // depends on control dependency: [if], data = [none] } index += 1; // depends on control dependency: [for], data = [none] } return -1; } }
public class class_name { public String determineDatabaseName() { if (this.generateUniqueName) { if (this.uniqueName == null) { this.uniqueName = UUID.randomUUID().toString(); } return this.uniqueName; } if (StringUtils.hasLength(this.name)) { return this.name; } if (this.embeddedDatabaseConnection != EmbeddedDatabaseConnection.NONE) { return "testdb"; } return null; } }
public class class_name { public String determineDatabaseName() { if (this.generateUniqueName) { if (this.uniqueName == null) { this.uniqueName = UUID.randomUUID().toString(); // depends on control dependency: [if], data = [none] } return this.uniqueName; // depends on control dependency: [if], data = [none] } if (StringUtils.hasLength(this.name)) { return this.name; // depends on control dependency: [if], data = [none] } if (this.embeddedDatabaseConnection != EmbeddedDatabaseConnection.NONE) { return "testdb"; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public synchronized WsByteBuffer[] getBuffersForTransmission() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getBufferForTransmission"); // Ensure the buffer has been prepared checkNotValid(); WsByteBuffer[] bufferArray = new WsByteBuffer[dataList.size()]; for (int x = 0; x < dataList.size(); x++) { bufferArray[x] = dataList.get(x); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getBufferForTransmission", dataList); return bufferArray; } }
public class class_name { public synchronized WsByteBuffer[] getBuffersForTransmission() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getBufferForTransmission"); // Ensure the buffer has been prepared checkNotValid(); WsByteBuffer[] bufferArray = new WsByteBuffer[dataList.size()]; for (int x = 0; x < dataList.size(); x++) { bufferArray[x] = dataList.get(x); // depends on control dependency: [for], data = [x] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getBufferForTransmission", dataList); return bufferArray; } }
public class class_name { public TransitGatewayRoute withTransitGatewayAttachments(TransitGatewayRouteAttachment... transitGatewayAttachments) { if (this.transitGatewayAttachments == null) { setTransitGatewayAttachments(new com.amazonaws.internal.SdkInternalList<TransitGatewayRouteAttachment>(transitGatewayAttachments.length)); } for (TransitGatewayRouteAttachment ele : transitGatewayAttachments) { this.transitGatewayAttachments.add(ele); } return this; } }
public class class_name { public TransitGatewayRoute withTransitGatewayAttachments(TransitGatewayRouteAttachment... transitGatewayAttachments) { if (this.transitGatewayAttachments == null) { setTransitGatewayAttachments(new com.amazonaws.internal.SdkInternalList<TransitGatewayRouteAttachment>(transitGatewayAttachments.length)); // depends on control dependency: [if], data = [none] } for (TransitGatewayRouteAttachment ele : transitGatewayAttachments) { this.transitGatewayAttachments.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private Collection<WordSimilarity> parse(File word353file) { Collection<WordSimilarity> pairs = new LinkedList<WordSimilarity>(); try { BufferedReader br = new BufferedReader(new FileReader(word353file)); // skip the first line br.readLine(); for (String line = null; (line = br.readLine()) != null; ) { // skip comments and blank lines if (line.startsWith("#") || line.length() == 0) { continue; } String[] wordsAndNum = line.split("\\s+"); if (wordsAndNum.length != 3) { throw new Error("Unexpected line formatting: " + line); } pairs.add(new SimpleWordSimilarity( wordsAndNum[0], wordsAndNum[1], Double.parseDouble(wordsAndNum[2]))); } } catch (IOException ioe) { // rethrow as an IOE is fatal evaluation throw new IOError(ioe); } return pairs; } }
public class class_name { private Collection<WordSimilarity> parse(File word353file) { Collection<WordSimilarity> pairs = new LinkedList<WordSimilarity>(); try { BufferedReader br = new BufferedReader(new FileReader(word353file)); // skip the first line br.readLine(); // depends on control dependency: [try], data = [none] for (String line = null; (line = br.readLine()) != null; ) { // skip comments and blank lines if (line.startsWith("#") || line.length() == 0) { continue; } String[] wordsAndNum = line.split("\\s+"); if (wordsAndNum.length != 3) { throw new Error("Unexpected line formatting: " + line); } pairs.add(new SimpleWordSimilarity( wordsAndNum[0], wordsAndNum[1], Double.parseDouble(wordsAndNum[2]))); // depends on control dependency: [for], data = [none] } } catch (IOException ioe) { // rethrow as an IOE is fatal evaluation throw new IOError(ioe); } // depends on control dependency: [catch], data = [none] return pairs; } }
public class class_name { public HomeInternal getHome(J2EEName name) //197121 { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "getHome : " + name); HomeInternal result = null; // Name is the HomeOfHomes special name when referencing an // EJBHome; return the HomeOfHomes if (name.equals(homeOfHomesJ2EEName)) { result = this; } // Name is the EJBFactory special name when referencing the // HomeOfHomes for EJB-Link or Auto-Link; return the // EJBFactoryHome. d440604 else if (name.equals(ivEJBFactoryHome.ivJ2eeName)) { result = ivEJBFactoryHome; } // Otherwise, the J2EEName is for a reference to an EJB // instance; return the EJBHome. else { HomeRecord hr = homesByName.get(name); // d366845.3 if (hr != null) { result = hr.homeInternal; if (result == null) { if (hr.bmd.ivDeferEJBInitialization) { result = hr.getHomeAndInitialize(); // d648522 } else { // Request for a non-deferred bean that hasn't quite finished // initializing; return null since bean doesn't exist just yet. // Caller will throw appropriate exception. PM98090 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Non-deferred EJB not yet available : " + name); } } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "getHome : " + result); return result; } }
public class class_name { public HomeInternal getHome(J2EEName name) //197121 { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "getHome : " + name); HomeInternal result = null; // Name is the HomeOfHomes special name when referencing an // EJBHome; return the HomeOfHomes if (name.equals(homeOfHomesJ2EEName)) { result = this; // depends on control dependency: [if], data = [none] } // Name is the EJBFactory special name when referencing the // HomeOfHomes for EJB-Link or Auto-Link; return the // EJBFactoryHome. d440604 else if (name.equals(ivEJBFactoryHome.ivJ2eeName)) { result = ivEJBFactoryHome; // depends on control dependency: [if], data = [none] } // Otherwise, the J2EEName is for a reference to an EJB // instance; return the EJBHome. else { HomeRecord hr = homesByName.get(name); // d366845.3 if (hr != null) { result = hr.homeInternal; // depends on control dependency: [if], data = [none] if (result == null) { if (hr.bmd.ivDeferEJBInitialization) { result = hr.getHomeAndInitialize(); // d648522 // depends on control dependency: [if], data = [none] } else { // Request for a non-deferred bean that hasn't quite finished // initializing; return null since bean doesn't exist just yet. // Caller will throw appropriate exception. PM98090 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Non-deferred EJB not yet available : " + name); } } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "getHome : " + result); return result; } }
public class class_name { @GET @Path("stack") @Produces(MediaType.TEXT_PLAIN) public String getThreadDump() { if (LOG.isDebugEnabled()) { LOG.debug("==> AdminResource.getThreadDump()"); } ThreadGroup topThreadGroup = Thread.currentThread().getThreadGroup(); while (topThreadGroup.getParent() != null) { topThreadGroup = topThreadGroup.getParent(); } Thread[] threads = new Thread[topThreadGroup.activeCount()]; int nr = topThreadGroup.enumerate(threads); StringBuilder builder = new StringBuilder(); for (int i = 0; i < nr; i++) { builder.append(threads[i].getName()).append("\nState: "). append(threads[i].getState()).append("\n"); String stackTrace = StringUtils.join(threads[i].getStackTrace(), "\n"); builder.append(stackTrace); } if (LOG.isDebugEnabled()) { LOG.debug("<== AdminResource.getThreadDump()"); } return builder.toString(); } }
public class class_name { @GET @Path("stack") @Produces(MediaType.TEXT_PLAIN) public String getThreadDump() { if (LOG.isDebugEnabled()) { LOG.debug("==> AdminResource.getThreadDump()"); // depends on control dependency: [if], data = [none] } ThreadGroup topThreadGroup = Thread.currentThread().getThreadGroup(); while (topThreadGroup.getParent() != null) { topThreadGroup = topThreadGroup.getParent(); // depends on control dependency: [while], data = [none] } Thread[] threads = new Thread[topThreadGroup.activeCount()]; int nr = topThreadGroup.enumerate(threads); StringBuilder builder = new StringBuilder(); for (int i = 0; i < nr; i++) { builder.append(threads[i].getName()).append("\nState: "). append(threads[i].getState()).append("\n"); // depends on control dependency: [for], data = [i] String stackTrace = StringUtils.join(threads[i].getStackTrace(), "\n"); builder.append(stackTrace); // depends on control dependency: [for], data = [none] } if (LOG.isDebugEnabled()) { LOG.debug("<== AdminResource.getThreadDump()"); // depends on control dependency: [if], data = [none] } return builder.toString(); } }
public class class_name { public static void main(String[] args) { Twitter twitter = new TwitterFactory().getInstance(); System.out.println("Saving public timeline."); try { new File("statuses").mkdir(); List<Status> statuses = twitter.getHomeTimeline(); for (Status status : statuses) { String rawJSON = TwitterObjectFactory.getRawJSON(status); String fileName = "statuses/" + status.getId() + ".json"; storeJSON(rawJSON, fileName); System.out.println(fileName + " - " + status.getText()); } System.out.print("\ndone."); System.exit(0); } catch (IOException ioe) { ioe.printStackTrace(); System.out.println("Failed to store tweets: " + ioe.getMessage()); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get timeline: " + te.getMessage()); System.exit(-1); } } }
public class class_name { public static void main(String[] args) { Twitter twitter = new TwitterFactory().getInstance(); System.out.println("Saving public timeline."); try { new File("statuses").mkdir(); // depends on control dependency: [try], data = [none] List<Status> statuses = twitter.getHomeTimeline(); for (Status status : statuses) { String rawJSON = TwitterObjectFactory.getRawJSON(status); String fileName = "statuses/" + status.getId() + ".json"; storeJSON(rawJSON, fileName); // depends on control dependency: [for], data = [none] System.out.println(fileName + " - " + status.getText()); // depends on control dependency: [for], data = [status] } System.out.print("\ndone."); // depends on control dependency: [try], data = [none] System.exit(0); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { ioe.printStackTrace(); System.out.println("Failed to store tweets: " + ioe.getMessage()); } catch (TwitterException te) { // depends on control dependency: [catch], data = [none] te.printStackTrace(); System.out.println("Failed to get timeline: " + te.getMessage()); System.exit(-1); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static GrammaticalRelation getPrep(String prepositionString) { GrammaticalRelation result = preps.get(prepositionString); if (result == null) { synchronized(preps) { result = preps.get(prepositionString); if (result == null) { result = new GrammaticalRelation(Language.English, "prep", "prep_collapsed", null, PREPOSITIONAL_MODIFIER, prepositionString); preps.put(prepositionString, result); threadSafeAddRelation(result); } } } return result; } }
public class class_name { public static GrammaticalRelation getPrep(String prepositionString) { GrammaticalRelation result = preps.get(prepositionString); if (result == null) { synchronized(preps) { // depends on control dependency: [if], data = [none] result = preps.get(prepositionString); if (result == null) { result = new GrammaticalRelation(Language.English, "prep", "prep_collapsed", null, PREPOSITIONAL_MODIFIER, prepositionString); // depends on control dependency: [if], data = [none] preps.put(prepositionString, result); // depends on control dependency: [if], data = [none] threadSafeAddRelation(result); // depends on control dependency: [if], data = [(result] } } } return result; } }
public class class_name { public static Entity getEntity(EntityWidget widget, StorageService storageService) { Entity entity = widget.getEntity(); if (entity == null) { String entityId = widget.getInternalSettings().get(EntityWidget.ENTITY_ID); try { entity = storageService.getEntityById(entityId); } catch (NotFoundException e) { e.printStackTrace(); } widget.setEntity(entity); } return entity; } }
public class class_name { public static Entity getEntity(EntityWidget widget, StorageService storageService) { Entity entity = widget.getEntity(); if (entity == null) { String entityId = widget.getInternalSettings().get(EntityWidget.ENTITY_ID); try { entity = storageService.getEntityById(entityId); // depends on control dependency: [try], data = [none] } catch (NotFoundException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] widget.setEntity(entity); // depends on control dependency: [if], data = [(entity] } return entity; } }
public class class_name { private void writeColumn(String columnName, Object value) throws XMLStreamException { xmlStreamWriter.writeStartElement("column"); xmlStreamWriter.writeAttribute("name", columnName); String stringValue = null; if (value instanceof CompositeObject) { CompositeObject descriptor = (CompositeObject) value; LanguageElement elementValue = LanguageHelper.getLanguageElement(descriptor); if (elementValue != null) { xmlStreamWriter.writeStartElement("element"); xmlStreamWriter.writeAttribute("language", elementValue.getLanguage()); xmlStreamWriter.writeCharacters(elementValue.name()); xmlStreamWriter.writeEndElement(); // element SourceProvider sourceProvider = elementValue.getSourceProvider(); stringValue = sourceProvider.getName(descriptor); String sourceFile = sourceProvider.getSourceFile(descriptor); Integer lineNumber = sourceProvider.getLineNumber(descriptor); if (sourceFile != null) { xmlStreamWriter.writeStartElement("source"); xmlStreamWriter.writeAttribute("name", sourceFile); if (lineNumber != null) { xmlStreamWriter.writeAttribute("line", lineNumber.toString()); } xmlStreamWriter.writeEndElement(); // sourceFile } } } else if (value != null) { stringValue = ReportHelper.getLabel(value); } xmlStreamWriter.writeStartElement("value"); xmlStreamWriter.writeCharacters(stringValue); xmlStreamWriter.writeEndElement(); // value xmlStreamWriter.writeEndElement(); // column } }
public class class_name { private void writeColumn(String columnName, Object value) throws XMLStreamException { xmlStreamWriter.writeStartElement("column"); xmlStreamWriter.writeAttribute("name", columnName); String stringValue = null; if (value instanceof CompositeObject) { CompositeObject descriptor = (CompositeObject) value; LanguageElement elementValue = LanguageHelper.getLanguageElement(descriptor); if (elementValue != null) { xmlStreamWriter.writeStartElement("element"); // depends on control dependency: [if], data = [none] xmlStreamWriter.writeAttribute("language", elementValue.getLanguage()); // depends on control dependency: [if], data = [none] xmlStreamWriter.writeCharacters(elementValue.name()); // depends on control dependency: [if], data = [(elementValue] xmlStreamWriter.writeEndElement(); // element // depends on control dependency: [if], data = [none] SourceProvider sourceProvider = elementValue.getSourceProvider(); stringValue = sourceProvider.getName(descriptor); // depends on control dependency: [if], data = [none] String sourceFile = sourceProvider.getSourceFile(descriptor); Integer lineNumber = sourceProvider.getLineNumber(descriptor); if (sourceFile != null) { xmlStreamWriter.writeStartElement("source"); // depends on control dependency: [if], data = [none] xmlStreamWriter.writeAttribute("name", sourceFile); // depends on control dependency: [if], data = [none] if (lineNumber != null) { xmlStreamWriter.writeAttribute("line", lineNumber.toString()); // depends on control dependency: [if], data = [none] } xmlStreamWriter.writeEndElement(); // sourceFile // depends on control dependency: [if], data = [none] } } } else if (value != null) { stringValue = ReportHelper.getLabel(value); } xmlStreamWriter.writeStartElement("value"); xmlStreamWriter.writeCharacters(stringValue); xmlStreamWriter.writeEndElement(); // value xmlStreamWriter.writeEndElement(); // column } }
public class class_name { private boolean shouldEmitDeprecationWarning(NodeTraversal t, Node n) { // In the global scope, there are only two kinds of accesses that should // be flagged for warnings: // 1) Calls of deprecated functions and methods. // 2) Instantiations of deprecated classes. // For now, we just let everything else by. if (t.inGlobalScope()) { if (!NodeUtil.isInvocationTarget(n) && !n.isNew()) { return false; } } return !canAccessDeprecatedTypes(t); } }
public class class_name { private boolean shouldEmitDeprecationWarning(NodeTraversal t, Node n) { // In the global scope, there are only two kinds of accesses that should // be flagged for warnings: // 1) Calls of deprecated functions and methods. // 2) Instantiations of deprecated classes. // For now, we just let everything else by. if (t.inGlobalScope()) { if (!NodeUtil.isInvocationTarget(n) && !n.isNew()) { return false; // depends on control dependency: [if], data = [none] } } return !canAccessDeprecatedTypes(t); } }
public class class_name { private Object jsToJava(Object jsObj) { if (jsObj instanceof Wrapper) { Wrapper njb = (Wrapper) jsObj; /* importClass feature of ImporterTopLevel puts * NativeJavaClass in global scope. If we unwrap * it, importClass won't work. */ if (njb instanceof NativeJavaClass) { return njb; } /* script may use Java primitive wrapper type objects * (such as java.lang.Integer, java.lang.Boolean etc) * explicitly. If we unwrap, then these script objects * will become script primitive types. For example, * * var x = new java.lang.Double(3.0); print(typeof x); * * will print 'number'. We don't want that to happen. */ Object obj = njb.unwrap(); if (obj instanceof Number || obj instanceof String || obj instanceof Boolean || obj instanceof Character) { // special type wrapped -- we just leave it as is. return njb; } else { // return unwrapped object for any other object. return obj; } } else { // not-a-Java-wrapper return jsObj; } } }
public class class_name { private Object jsToJava(Object jsObj) { if (jsObj instanceof Wrapper) { Wrapper njb = (Wrapper) jsObj; /* importClass feature of ImporterTopLevel puts * NativeJavaClass in global scope. If we unwrap * it, importClass won't work. */ if (njb instanceof NativeJavaClass) { return njb; // depends on control dependency: [if], data = [none] } /* script may use Java primitive wrapper type objects * (such as java.lang.Integer, java.lang.Boolean etc) * explicitly. If we unwrap, then these script objects * will become script primitive types. For example, * * var x = new java.lang.Double(3.0); print(typeof x); * * will print 'number'. We don't want that to happen. */ Object obj = njb.unwrap(); if (obj instanceof Number || obj instanceof String || obj instanceof Boolean || obj instanceof Character) { // special type wrapped -- we just leave it as is. return njb; // depends on control dependency: [if], data = [none] } else { // return unwrapped object for any other object. return obj; // depends on control dependency: [if], data = [none] } } else { // not-a-Java-wrapper return jsObj; // depends on control dependency: [if], data = [none] } } }
public class class_name { public ExcelExporter setColumnsHeader(List<String> columnsHeader) { noOfCols = columnsHeader.size(); sheet.createFreezePane(0, 1); SXSSFRow headerRow = sheet.createRow(0); for (int i = 0; i < columnsHeader.size(); i++) { String cellHeader = columnsHeader.get(i); writeCell(headerRow, i, cellHeader, headerStyle); } return this; } }
public class class_name { public ExcelExporter setColumnsHeader(List<String> columnsHeader) { noOfCols = columnsHeader.size(); sheet.createFreezePane(0, 1); SXSSFRow headerRow = sheet.createRow(0); for (int i = 0; i < columnsHeader.size(); i++) { String cellHeader = columnsHeader.get(i); writeCell(headerRow, i, cellHeader, headerStyle); // depends on control dependency: [for], data = [i] } return this; } }
public class class_name { @Override public ControlHandler getControlHandler( ProtocolType type, SIBUuid8 sourceMEUuid, ControlMessage msg) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "getControlHandler", new Object[] { type, sourceMEUuid, msg }); ControlHandler msgHandler = null; if (type == ProtocolType.UNICASTINPUT) { // do nothing, check the tSIB code, } else if (type == ProtocolType.UNICASTOUTPUT) { // do nothing, check the tSIB code, } else if (type == ProtocolType.PUBSUBINPUT) { msgHandler = (ControlHandler) inputHandler; } else if (type == ProtocolType.PUBSUBOUTPUT) { msgHandler = _pubSubRealization.getControlHandler(sourceMEUuid); } else if (type == ProtocolType.ANYCASTINPUT) { // For durable, AIHs are referenced by pseudo destination ID so check for that first SIBUuid12 destID = msg.getGuaranteedTargetDestinationDefinitionUUID(); SIBUuid12 gatheringTargetDestUuid = msg.getGuaranteedGatheringTargetUUID(); if (isPubSub()) { msgHandler = _protoRealization. getRemoteSupport(). getAnycastInputHandlerByPseudoDestId(destID); } // Otherwise, use the uuid of the sourceCellule ME to find the AIH to handle the message. We assume that this // uuid corresponds to that used to choose the AIH initially, and that was used by the AIH as the // uuid of the DME to which it sent the request for the message. /** * 466323 * We now no longer create the AnycastInputHandler (+ its persistent resources) when * a message arrives and we cant find an existing one. * * If the RME AIH resources do not exist, this means we *must* have previously completed * a successful flush. This means that the DME has sent us a flush. If they have done * this then they must be cleaned up their end. * * We therefore do not create new resources when the AIH cannot be found. Instead we * generate warnings at the RemoteMessageReceiver level to indicate cleanup is required * on the DME. We should only be able to get into this situation if the msgStore for the * RME has been deleted (either db tables removed or ME was restarted based on a backup db). */ if (msgHandler == null) msgHandler = getAnycastInputHandler(sourceMEUuid, gatheringTargetDestUuid, false); } else if (type == ProtocolType.ANYCASTOUTPUT) { // For durable, AOHs are referenced by pseudo destination ID so check for that first SIBUuid12 destID = msg.getGuaranteedTargetDestinationDefinitionUUID(); msgHandler = _protoRealization. getRemoteSupport(). getAnycastOutputHandlerByPseudoDestId(destID); // Otherwise, assume this is a queueing access and get the output handler as usual if (msgHandler == null) msgHandler = getAnycastOutputHandler(); } //else // { //unsupported protocol type //return null // } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getControlHandler", msgHandler); return msgHandler; } }
public class class_name { @Override public ControlHandler getControlHandler( ProtocolType type, SIBUuid8 sourceMEUuid, ControlMessage msg) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "getControlHandler", new Object[] { type, sourceMEUuid, msg }); ControlHandler msgHandler = null; if (type == ProtocolType.UNICASTINPUT) { // do nothing, check the tSIB code, } else if (type == ProtocolType.UNICASTOUTPUT) { // do nothing, check the tSIB code, } else if (type == ProtocolType.PUBSUBINPUT) { msgHandler = (ControlHandler) inputHandler; // depends on control dependency: [if], data = [none] } else if (type == ProtocolType.PUBSUBOUTPUT) { msgHandler = _pubSubRealization.getControlHandler(sourceMEUuid); // depends on control dependency: [if], data = [none] } else if (type == ProtocolType.ANYCASTINPUT) { // For durable, AIHs are referenced by pseudo destination ID so check for that first SIBUuid12 destID = msg.getGuaranteedTargetDestinationDefinitionUUID(); SIBUuid12 gatheringTargetDestUuid = msg.getGuaranteedGatheringTargetUUID(); if (isPubSub()) { msgHandler = _protoRealization. getRemoteSupport(). getAnycastInputHandlerByPseudoDestId(destID); // depends on control dependency: [if], data = [none] } // Otherwise, use the uuid of the sourceCellule ME to find the AIH to handle the message. We assume that this // uuid corresponds to that used to choose the AIH initially, and that was used by the AIH as the // uuid of the DME to which it sent the request for the message. /** * 466323 * We now no longer create the AnycastInputHandler (+ its persistent resources) when * a message arrives and we cant find an existing one. * * If the RME AIH resources do not exist, this means we *must* have previously completed * a successful flush. This means that the DME has sent us a flush. If they have done * this then they must be cleaned up their end. * * We therefore do not create new resources when the AIH cannot be found. Instead we * generate warnings at the RemoteMessageReceiver level to indicate cleanup is required * on the DME. We should only be able to get into this situation if the msgStore for the * RME has been deleted (either db tables removed or ME was restarted based on a backup db). */ if (msgHandler == null) msgHandler = getAnycastInputHandler(sourceMEUuid, gatheringTargetDestUuid, false); } else if (type == ProtocolType.ANYCASTOUTPUT) { // For durable, AOHs are referenced by pseudo destination ID so check for that first SIBUuid12 destID = msg.getGuaranteedTargetDestinationDefinitionUUID(); msgHandler = _protoRealization. getRemoteSupport(). getAnycastOutputHandlerByPseudoDestId(destID); // depends on control dependency: [if], data = [none] // Otherwise, assume this is a queueing access and get the output handler as usual if (msgHandler == null) msgHandler = getAnycastOutputHandler(); } //else // { //unsupported protocol type //return null // } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getControlHandler", msgHandler); return msgHandler; } }
public class class_name { @Override public T addAsModules(final File... resources) throws IllegalArgumentException { // Precondition checks Validate.notNull(resources, "resources must be specified"); // Add each for (final File resource : resources) { this.addAsModule(resource); } // Return return this.covarientReturn(); } }
public class class_name { @Override public T addAsModules(final File... resources) throws IllegalArgumentException { // Precondition checks Validate.notNull(resources, "resources must be specified"); // Add each for (final File resource : resources) { this.addAsModule(resource); // depends on control dependency: [for], data = [resource] } // Return return this.covarientReturn(); } }
public class class_name { public static boolean hasCustomHashCode(Class c) { Class origClass = c; if (_customHash.containsKey(c)) { return _customHash.get(c); } while (!Object.class.equals(c)) { try { c.getDeclaredMethod("hashCode"); _customHash.put(origClass, true); return true; } catch (Exception ignored) { } c = c.getSuperclass(); } _customHash.put(origClass, false); return false; } }
public class class_name { public static boolean hasCustomHashCode(Class c) { Class origClass = c; if (_customHash.containsKey(c)) { return _customHash.get(c); // depends on control dependency: [if], data = [none] } while (!Object.class.equals(c)) { try { c.getDeclaredMethod("hashCode"); // depends on control dependency: [try], data = [none] _customHash.put(origClass, true); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (Exception ignored) { } // depends on control dependency: [catch], data = [none] c = c.getSuperclass(); // depends on control dependency: [while], data = [none] } _customHash.put(origClass, false); return false; } }
public class class_name { protected int indexOf(final Object o) { final int size = dataModel.getSize(); for (int i = 0; i < size; i++) { if (comparator == null) { if (o.equals(dataModel.getElementAt(i))) { return i; } } else if (comparator.compare(o, dataModel.getElementAt(i)) == 0) { return i; } } return -1; } }
public class class_name { protected int indexOf(final Object o) { final int size = dataModel.getSize(); for (int i = 0; i < size; i++) { if (comparator == null) { if (o.equals(dataModel.getElementAt(i))) { return i; // depends on control dependency: [if], data = [none] } } else if (comparator.compare(o, dataModel.getElementAt(i)) == 0) { return i; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { private synchronized Response doAuthenticatedRequest( final StitchAuthRequest stitchReq, final AuthInfo authInfo ) { try { return requestClient.doRequest(prepareAuthRequest(stitchReq, authInfo)); } catch (final StitchServiceException ex) { return handleAuthFailure(ex, stitchReq); } } }
public class class_name { private synchronized Response doAuthenticatedRequest( final StitchAuthRequest stitchReq, final AuthInfo authInfo ) { try { return requestClient.doRequest(prepareAuthRequest(stitchReq, authInfo)); // depends on control dependency: [try], data = [none] } catch (final StitchServiceException ex) { return handleAuthFailure(ex, stitchReq); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean overlaps(I other) { if ( other.getStart().isInfinite() || this.end.isInfinite() ) { return false; } T startA = this.getClosedFiniteStart(); T startB = other.getClosedFiniteStart(); if ((startA != null) && !startA.isBefore(startB)) { return false; } T endA = this.end.getTemporal(); T endB = other.getEnd().getTemporal(); if (this.getFactory().isCalendrical()) { if (this.end.isOpen()) { endA = this.getTimeLine().stepBackwards(endA); } if ((endA == null) || endA.isBefore(startB)) { return false; } else if (endB == null) { return true; } if (other.getEnd().isOpen()) { endB = this.getTimeLine().stepBackwards(endB); } } else { if (this.end.isClosed()) { endA = this.getTimeLine().stepForward(endA); if (endA == null) { return (endB == null); } } if (!endA.isAfter(startB)) { return false; } if (other.getEnd().isClosed()) { endB = this.getTimeLine().stepForward(endB); } } return ((endB == null) || endA.isBefore(endB)); } }
public class class_name { public boolean overlaps(I other) { if ( other.getStart().isInfinite() || this.end.isInfinite() ) { return false; // depends on control dependency: [if], data = [] } T startA = this.getClosedFiniteStart(); T startB = other.getClosedFiniteStart(); if ((startA != null) && !startA.isBefore(startB)) { return false; // depends on control dependency: [if], data = [none] } T endA = this.end.getTemporal(); T endB = other.getEnd().getTemporal(); if (this.getFactory().isCalendrical()) { if (this.end.isOpen()) { endA = this.getTimeLine().stepBackwards(endA); // depends on control dependency: [if], data = [none] } if ((endA == null) || endA.isBefore(startB)) { return false; // depends on control dependency: [if], data = [none] } else if (endB == null) { return true; // depends on control dependency: [if], data = [none] } if (other.getEnd().isOpen()) { endB = this.getTimeLine().stepBackwards(endB); // depends on control dependency: [if], data = [none] } } else { if (this.end.isClosed()) { endA = this.getTimeLine().stepForward(endA); // depends on control dependency: [if], data = [none] if (endA == null) { return (endB == null); // depends on control dependency: [if], data = [null)] } } if (!endA.isAfter(startB)) { return false; // depends on control dependency: [if], data = [none] } if (other.getEnd().isClosed()) { endB = this.getTimeLine().stepForward(endB); // depends on control dependency: [if], data = [none] } } return ((endB == null) || endA.isBefore(endB)); } }
public class class_name { private void slideKnob(Event event) { int x = DOM.eventGetClientX(event); if (x > 0) { int lineWidth = lineElement.getOffsetWidth(); int lineLeft = lineElement.getAbsoluteLeft(); double percent = (double) (x - lineLeft) / lineWidth * 1.0; setCurrentValue(getTotalRange() * percent + minValue, true); } } }
public class class_name { private void slideKnob(Event event) { int x = DOM.eventGetClientX(event); if (x > 0) { int lineWidth = lineElement.getOffsetWidth(); int lineLeft = lineElement.getAbsoluteLeft(); double percent = (double) (x - lineLeft) / lineWidth * 1.0; setCurrentValue(getTotalRange() * percent + minValue, true); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") public Object convertToEntity(Class entityType, String id, ObjectNode document) { try { if (ObjectNode.class.equals(entityType)) { return document; } Object defaultValue = InMemoryDocumentSessionOperations.getDefaultValue(entityType); Object entity = defaultValue; String documentType =_session.getConventions().getJavaClass(id, document); if (documentType != null) { Class type = Class.forName(documentType); if (entityType.isAssignableFrom(type)) { entity = _session.getConventions().getEntityMapper().treeToValue(document, type); } } if (entity == defaultValue) { entity = _session.getConventions().getEntityMapper().treeToValue(document, entityType); } if (id != null) { _session.getGenerateEntityIdOnTheClient().trySetIdentity(entity, id); } return entity; } catch (Exception e) { throw new IllegalStateException("Could not convert document " + id + " to entity of type " + entityType.getName(), e); } } }
public class class_name { @SuppressWarnings("unchecked") public Object convertToEntity(Class entityType, String id, ObjectNode document) { try { if (ObjectNode.class.equals(entityType)) { return document; // depends on control dependency: [if], data = [none] } Object defaultValue = InMemoryDocumentSessionOperations.getDefaultValue(entityType); Object entity = defaultValue; String documentType =_session.getConventions().getJavaClass(id, document); if (documentType != null) { Class type = Class.forName(documentType); if (entityType.isAssignableFrom(type)) { entity = _session.getConventions().getEntityMapper().treeToValue(document, type); // depends on control dependency: [if], data = [none] } } if (entity == defaultValue) { entity = _session.getConventions().getEntityMapper().treeToValue(document, entityType); // depends on control dependency: [if], data = [none] } if (id != null) { _session.getGenerateEntityIdOnTheClient().trySetIdentity(entity, id); // depends on control dependency: [if], data = [none] } return entity; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new IllegalStateException("Could not convert document " + id + " to entity of type " + entityType.getName(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final double getDouble(String attribute, String... path) { try { return Double.parseDouble(getNodeString(attribute, path)); } catch (final NumberFormatException exception) { throw new LionEngineException(exception, media); } } }
public class class_name { public final double getDouble(String attribute, String... path) { try { return Double.parseDouble(getNodeString(attribute, path)); // depends on control dependency: [try], data = [none] } catch (final NumberFormatException exception) { throw new LionEngineException(exception, media); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void setWindow(final TrainingParameters params) { if (leftWindow == -1 || rightWindow == -1) { leftWindow = getWindowRange(params).get(0); rightWindow = getWindowRange(params).get(1); } } }
public class class_name { public static void setWindow(final TrainingParameters params) { if (leftWindow == -1 || rightWindow == -1) { leftWindow = getWindowRange(params).get(0); // depends on control dependency: [if], data = [none] rightWindow = getWindowRange(params).get(1); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Database buildDerivatorDB(Relation<ParameterizationFunction> relation, CASHInterval interval) { DBIDs ids = interval.getIDs(); ProxyDatabase proxy = new ProxyDatabase(ids); int dim = dimensionality(relation); SimpleTypeInformation<DoubleVector> type = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); WritableDataStore<DoubleVector> prep = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, DoubleVector.class); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { prep.put(iter, DoubleVector.wrap(relation.get(iter).getColumnVector())); } if(LOG.isDebugging()) { LOG.debugFine("db fuer derivator : " + ids.size()); } MaterializedRelation<DoubleVector> prel = new MaterializedRelation<>(type, ids, null, prep); proxy.addRelation(prel); return proxy; } }
public class class_name { private Database buildDerivatorDB(Relation<ParameterizationFunction> relation, CASHInterval interval) { DBIDs ids = interval.getIDs(); ProxyDatabase proxy = new ProxyDatabase(ids); int dim = dimensionality(relation); SimpleTypeInformation<DoubleVector> type = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); WritableDataStore<DoubleVector> prep = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, DoubleVector.class); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { prep.put(iter, DoubleVector.wrap(relation.get(iter).getColumnVector())); // depends on control dependency: [for], data = [iter] } if(LOG.isDebugging()) { LOG.debugFine("db fuer derivator : " + ids.size()); // depends on control dependency: [if], data = [none] } MaterializedRelation<DoubleVector> prel = new MaterializedRelation<>(type, ids, null, prep); proxy.addRelation(prel); return proxy; } }
public class class_name { @Override public Integer fromString(Class targetClass, String s) { try { if (s == null) { return null; } Integer i = new Integer(s); return i; } catch (NumberFormatException e) { log .error("Number format exception, Caused by {}.", e); throw new PropertyAccessException(e); } } }
public class class_name { @Override public Integer fromString(Class targetClass, String s) { try { if (s == null) { return null; // depends on control dependency: [if], data = [none] } Integer i = new Integer(s); return i; // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { log .error("Number format exception, Caused by {}.", e); throw new PropertyAccessException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SuppressWarnings({"unchecked"}) public void importItem(Object item) { try { XMLStreamWriter writer = m_xmlWriter; Map<String, String> nsMap = m_namespaceMap; boolean hasDecendants = !m_elements.isEmpty(); if (hasDecendants) { writer.writeStartElement(m_itemElementName); } else { writer.writeEmptyElement(m_itemElementName); } Map<String, Object> convertedItem = (Map<String, Object>) item; for (Property property : m_attributes) { String prefix = property.getNamespacePrefix(); if (prefix == null) { prefix = ""; } String localName = property.getLocalName(); String namespace = nsMap.get(prefix); if (namespace == null) { namespace = ""; } writer.writeAttribute(prefix, namespace, localName, convertedItem.get(localName).toString()); } for (Property property : m_elements) { String prefix = property.getNamespacePrefix() == null ? "" : property.getNamespacePrefix(); String localName = property.getLocalName(); String namespace = nsMap.get(prefix) == null ? "" : nsMap.get(prefix); writer.writeStartElement(prefix, localName, namespace); writer.writeCharacters(convertedItem.get(localName).toString()); writer.writeEndElement(); } if (hasDecendants) { writer.writeEndElement(); } } catch (XMLStreamException e) { throw new RuntimeException(e); } } }
public class class_name { @SuppressWarnings({"unchecked"}) public void importItem(Object item) { try { XMLStreamWriter writer = m_xmlWriter; Map<String, String> nsMap = m_namespaceMap; boolean hasDecendants = !m_elements.isEmpty(); if (hasDecendants) { writer.writeStartElement(m_itemElementName); // depends on control dependency: [if], data = [none] } else { writer.writeEmptyElement(m_itemElementName); // depends on control dependency: [if], data = [none] } Map<String, Object> convertedItem = (Map<String, Object>) item; for (Property property : m_attributes) { String prefix = property.getNamespacePrefix(); if (prefix == null) { prefix = ""; // depends on control dependency: [if], data = [none] } String localName = property.getLocalName(); String namespace = nsMap.get(prefix); if (namespace == null) { namespace = ""; // depends on control dependency: [if], data = [none] } writer.writeAttribute(prefix, namespace, localName, convertedItem.get(localName).toString()); // depends on control dependency: [for], data = [none] } for (Property property : m_elements) { String prefix = property.getNamespacePrefix() == null ? "" : property.getNamespacePrefix(); String localName = property.getLocalName(); String namespace = nsMap.get(prefix) == null ? "" : nsMap.get(prefix); writer.writeStartElement(prefix, localName, namespace); // depends on control dependency: [for], data = [none] writer.writeCharacters(convertedItem.get(localName).toString()); // depends on control dependency: [for], data = [none] writer.writeEndElement(); // depends on control dependency: [for], data = [none] } if (hasDecendants) { writer.writeEndElement(); // depends on control dependency: [if], data = [none] } } catch (XMLStreamException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public SqlQuery addOrder(final List<Order> orders) { if (null != orders) { this.orders.addAll(orders); } return this; } }
public class class_name { public SqlQuery addOrder(final List<Order> orders) { if (null != orders) { this.orders.addAll(orders); // depends on control dependency: [if], data = [orders)] } return this; } }
public class class_name { public void copy(GVRPose src) { int numbones = getNumBones(); if (getSkeleton() != src.getSkeleton()) throw new IllegalArgumentException("GVRPose.copy: input pose does not have same skeleton as this pose"); src.sync(); for (int i = 0; i < numbones; ++i) { mBones[i].copy(src.getBone(i)); } } }
public class class_name { public void copy(GVRPose src) { int numbones = getNumBones(); if (getSkeleton() != src.getSkeleton()) throw new IllegalArgumentException("GVRPose.copy: input pose does not have same skeleton as this pose"); src.sync(); for (int i = 0; i < numbones; ++i) { mBones[i].copy(src.getBone(i)); // depends on control dependency: [for], data = [i] } } }
public class class_name { void get_cluster_from_dependency(final Dependency data, List<Integer> cluster4, List<Integer> cluster6, List<Integer> cluster) { if (use_cluster) { int L = data.forms.size(); for (int i = 0; i < L; ++i) { int form = data.forms.get(i); cluster4.add(i == 0 ? cluster4_types_alphabet.idOf(SpecialOption.ROOT) : form_to_cluster4.get(form)); cluster6.add(i == 0 ? cluster6_types_alphabet.idOf(SpecialOption.ROOT) : form_to_cluster6.get(form)); cluster.add(i == 0 ? cluster_types_alphabet.idOf(SpecialOption.ROOT) : form_to_cluster.get(form)); } } } }
public class class_name { void get_cluster_from_dependency(final Dependency data, List<Integer> cluster4, List<Integer> cluster6, List<Integer> cluster) { if (use_cluster) { int L = data.forms.size(); for (int i = 0; i < L; ++i) { int form = data.forms.get(i); cluster4.add(i == 0 ? cluster4_types_alphabet.idOf(SpecialOption.ROOT) : form_to_cluster4.get(form)); // depends on control dependency: [for], data = [i] cluster6.add(i == 0 ? cluster6_types_alphabet.idOf(SpecialOption.ROOT) : form_to_cluster6.get(form)); // depends on control dependency: [for], data = [i] cluster.add(i == 0 ? cluster_types_alphabet.idOf(SpecialOption.ROOT) : form_to_cluster.get(form)); // depends on control dependency: [for], data = [i] } } } }
public class class_name { public List<T> fetchList(int limit) throws SQLException, InstantiationException, IllegalAccessException { ArrayList<T> result = new ArrayList<T>(); if (primitive) { for (int i = 0; i < limit; i++) { if (!finished) { result.add(fetchSingleInternal()); next(); } else { break; } } } else { for (int i = 0; i < limit; i++) { if (!finished) { result.add(fetchSingleInternal()); next(); } else { break; } } } return result; } }
public class class_name { public List<T> fetchList(int limit) throws SQLException, InstantiationException, IllegalAccessException { ArrayList<T> result = new ArrayList<T>(); if (primitive) { for (int i = 0; i < limit; i++) { if (!finished) { result.add(fetchSingleInternal()); // depends on control dependency: [if], data = [none] next(); // depends on control dependency: [if], data = [none] } else { break; } } } else { for (int i = 0; i < limit; i++) { if (!finished) { result.add(fetchSingleInternal()); // depends on control dependency: [if], data = [none] next(); // depends on control dependency: [if], data = [none] } else { break; } } } return result; } }
public class class_name { private void fetchRemoteConnectionFromUrl(HttpServletRequest req){ String connection = req.getParameter("remoteConnection"); if(connection != null) try { connection = URLDecoder.decode(connection, "UTF-8"); } catch (UnsupportedEncodingException e) { return; } else return; String[] remoteHostAndPort; if( (remoteHostAndPort = connection.split(":")).length == 2 ){ String remoteHost = remoteHostAndPort[0]; int remotePort; try { remotePort = Integer.valueOf(remoteHostAndPort[1]); }catch (NumberFormatException e){ return; } try { if (!APILookupUtility.isLocal() && APILookupUtility.getCurrentRemoteInstance().equalsByKey(remoteHost + '-' + remotePort)) return; // Current remote connection already points to url from params }catch (IllegalStateException ignored){ // Means moskito has no remote connection while GET query specifies one. } RemoteInstance newRemoteInstance = new RemoteInstance(); newRemoteInstance.setHost(remoteHost); newRemoteInstance.setPort(remotePort); WebUIConfig.getInstance().addRemote(newRemoteInstance); APILookupUtility.setCurrentConnectivityMode(ConnectivityMode.REMOTE); APILookupUtility.setCurrentRemoteInstance(newRemoteInstance); } } }
public class class_name { private void fetchRemoteConnectionFromUrl(HttpServletRequest req){ String connection = req.getParameter("remoteConnection"); if(connection != null) try { connection = URLDecoder.decode(connection, "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { return; } // depends on control dependency: [catch], data = [none] else return; String[] remoteHostAndPort; if( (remoteHostAndPort = connection.split(":")).length == 2 ){ String remoteHost = remoteHostAndPort[0]; int remotePort; try { remotePort = Integer.valueOf(remoteHostAndPort[1]); // depends on control dependency: [try], data = [none] }catch (NumberFormatException e){ return; } // depends on control dependency: [catch], data = [none] try { if (!APILookupUtility.isLocal() && APILookupUtility.getCurrentRemoteInstance().equalsByKey(remoteHost + '-' + remotePort)) return; // Current remote connection already points to url from params }catch (IllegalStateException ignored){ // Means moskito has no remote connection while GET query specifies one. } // depends on control dependency: [catch], data = [none] RemoteInstance newRemoteInstance = new RemoteInstance(); newRemoteInstance.setHost(remoteHost); // depends on control dependency: [if], data = [none] newRemoteInstance.setPort(remotePort); // depends on control dependency: [if], data = [none] WebUIConfig.getInstance().addRemote(newRemoteInstance); // depends on control dependency: [if], data = [none] APILookupUtility.setCurrentConnectivityMode(ConnectivityMode.REMOTE); // depends on control dependency: [if], data = [none] APILookupUtility.setCurrentRemoteInstance(newRemoteInstance); // depends on control dependency: [if], data = [none] } } }
public class class_name { @CheckForNull public ActiveRule getActiveRule(String repositoryKey, String ruleKey) { for (ActiveRule activeRule : activeRules) { if (StringUtils.equals(activeRule.getRepositoryKey(), repositoryKey) && StringUtils.equals(activeRule.getRuleKey(), ruleKey) && activeRule.isEnabled()) { return activeRule; } } return null; } }
public class class_name { @CheckForNull public ActiveRule getActiveRule(String repositoryKey, String ruleKey) { for (ActiveRule activeRule : activeRules) { if (StringUtils.equals(activeRule.getRepositoryKey(), repositoryKey) && StringUtils.equals(activeRule.getRuleKey(), ruleKey) && activeRule.isEnabled()) { return activeRule; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Override @SuppressWarnings("checkstyle:illegalcatch") public void onNext(final T value) { beforeOnNext(); try { executor.submit(new Runnable() { @Override public void run() { try { handler.onNext(value); } catch (final Throwable t) { if (errorHandler != null) { errorHandler.onNext(t); } else { LOG.log(Level.SEVERE, name + " Exception from event handler", t); throw t; } } finally { afterOnNext(); } } }); } catch (final Exception e) { LOG.log(Level.SEVERE, "Encountered error when submitting to executor in ThreadPoolStage."); afterOnNext(); throw e; } } }
public class class_name { @Override @SuppressWarnings("checkstyle:illegalcatch") public void onNext(final T value) { beforeOnNext(); try { executor.submit(new Runnable() { @Override public void run() { try { handler.onNext(value); // depends on control dependency: [try], data = [none] } catch (final Throwable t) { if (errorHandler != null) { errorHandler.onNext(t); // depends on control dependency: [if], data = [none] } else { LOG.log(Level.SEVERE, name + " Exception from event handler", t); // depends on control dependency: [if], data = [none] throw t; } } finally { // depends on control dependency: [catch], data = [none] afterOnNext(); } } }); // depends on control dependency: [try], data = [none] } catch (final Exception e) { LOG.log(Level.SEVERE, "Encountered error when submitting to executor in ThreadPoolStage."); afterOnNext(); throw e; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <T extends Enum<T>> String[] enumNameToStringArray(T[] values) { int i = 0; String[] result = new String[values.length]; for (T value : values) { result[i++] = value.name(); } return result; } }
public class class_name { public static <T extends Enum<T>> String[] enumNameToStringArray(T[] values) { int i = 0; String[] result = new String[values.length]; for (T value : values) { result[i++] = value.name(); // depends on control dependency: [for], data = [value] } return result; } }
public class class_name { @Override public boolean offer(final T e) { if (null == e) { throw new NullPointerException("Null is not a valid element"); } // local load of field to avoid repeated loads after volatile reads final AtomicReferenceArray<Object> buffer = producerBuffer; final long index = lpProducerIndex(); final int mask = producerMask; final int offset = calcWrappedOffset(index, mask); if (index < producerLookAhead) { return writeToQueue(buffer, e, index, offset); } else { final int lookAheadStep = producerLookAheadStep; // go around the buffer or resize if full (unless we hit max capacity) int lookAheadElementOffset = calcWrappedOffset(index + lookAheadStep, mask); if (null == lvElement(buffer, lookAheadElementOffset)) { // LoadLoad producerLookAhead = index + lookAheadStep - 1; // joy, there's plenty of room return writeToQueue(buffer, e, index, offset); } else if (null == lvElement(buffer, calcWrappedOffset(index + 1, mask))) { // buffer is not full return writeToQueue(buffer, e, index, offset); } else { resize(buffer, index, offset, e, mask); // add a buffer and link old to new return true; } } } }
public class class_name { @Override public boolean offer(final T e) { if (null == e) { throw new NullPointerException("Null is not a valid element"); } // local load of field to avoid repeated loads after volatile reads final AtomicReferenceArray<Object> buffer = producerBuffer; final long index = lpProducerIndex(); final int mask = producerMask; final int offset = calcWrappedOffset(index, mask); if (index < producerLookAhead) { return writeToQueue(buffer, e, index, offset); // depends on control dependency: [if], data = [none] } else { final int lookAheadStep = producerLookAheadStep; // go around the buffer or resize if full (unless we hit max capacity) int lookAheadElementOffset = calcWrappedOffset(index + lookAheadStep, mask); if (null == lvElement(buffer, lookAheadElementOffset)) { // LoadLoad producerLookAhead = index + lookAheadStep - 1; // joy, there's plenty of room // depends on control dependency: [if], data = [none] return writeToQueue(buffer, e, index, offset); // depends on control dependency: [if], data = [none] } else if (null == lvElement(buffer, calcWrappedOffset(index + 1, mask))) { // buffer is not full return writeToQueue(buffer, e, index, offset); // depends on control dependency: [if], data = [none] } else { resize(buffer, index, offset, e, mask); // add a buffer and link old to new // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static boolean valueMatchesRegularExpression(String val, Pattern regexp) { Matcher m = regexp.matcher(val); try { return m.matches(); } catch (StackOverflowError e) { e.printStackTrace(); System.out.println("-> [" + val + "][" + regexp + "]"); System.out.println("-> " + val.length()); System.exit(0); } return false; } }
public class class_name { public static boolean valueMatchesRegularExpression(String val, Pattern regexp) { Matcher m = regexp.matcher(val); try { return m.matches(); // depends on control dependency: [try], data = [none] } catch (StackOverflowError e) { e.printStackTrace(); System.out.println("-> [" + val + "][" + regexp + "]"); System.out.println("-> " + val.length()); System.exit(0); } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { @Nullable private Animator createAnimator(@NonNull final View animatedView, @NonNull final View rootView, @NonNull final CircleRevealAnimation animation, @Nullable final AnimatorListener listener, final boolean show) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { long duration = getDuration(animatedView, animation); int horizontalDistance = Math.max(Math.abs(rootView.getLeft() - animation.getX()), Math.abs(rootView.getRight() - animation.getX())); int verticalDistance = Math.max(Math.abs(rootView.getTop() - animation.getY()), Math.abs(rootView.getBottom() - animation.getY())); float maxRadius = (float) Math .sqrt(Math.pow(horizontalDistance, 2) + Math.pow(verticalDistance, 2)); Animator animator = ViewAnimationUtils .createCircularReveal(animatedView, animation.getX(), animation.getY(), show ? animation.getRadius() : maxRadius, show ? maxRadius : animation.getRadius()); animator.setInterpolator(animation.getInterpolator()); animator.setStartDelay(animation.getStartDelay()); animator.setDuration(duration); if (listener != null) { animator.addListener(listener); } if (animation.getAlpha() != null) { ObjectAnimator alphaAnimator = ObjectAnimator .ofFloat(animatedView, "alpha", show ? animation.getAlpha() : 1, show ? 1 : animation.getAlpha()); alphaAnimator.setInterpolator(animation.getInterpolator()); alphaAnimator.setStartDelay(animation.getStartDelay()); alphaAnimator.setDuration(duration); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(animator, alphaAnimator); return animatorSet; } return animator; } return null; } }
public class class_name { @Nullable private Animator createAnimator(@NonNull final View animatedView, @NonNull final View rootView, @NonNull final CircleRevealAnimation animation, @Nullable final AnimatorListener listener, final boolean show) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { long duration = getDuration(animatedView, animation); int horizontalDistance = Math.max(Math.abs(rootView.getLeft() - animation.getX()), Math.abs(rootView.getRight() - animation.getX())); int verticalDistance = Math.max(Math.abs(rootView.getTop() - animation.getY()), Math.abs(rootView.getBottom() - animation.getY())); float maxRadius = (float) Math .sqrt(Math.pow(horizontalDistance, 2) + Math.pow(verticalDistance, 2)); Animator animator = ViewAnimationUtils .createCircularReveal(animatedView, animation.getX(), animation.getY(), show ? animation.getRadius() : maxRadius, show ? maxRadius : animation.getRadius()); animator.setInterpolator(animation.getInterpolator()); // depends on control dependency: [if], data = [none] animator.setStartDelay(animation.getStartDelay()); // depends on control dependency: [if], data = [none] animator.setDuration(duration); // depends on control dependency: [if], data = [none] if (listener != null) { animator.addListener(listener); // depends on control dependency: [if], data = [(listener] } if (animation.getAlpha() != null) { ObjectAnimator alphaAnimator = ObjectAnimator .ofFloat(animatedView, "alpha", show ? animation.getAlpha() : 1, show ? 1 : animation.getAlpha()); alphaAnimator.setInterpolator(animation.getInterpolator()); // depends on control dependency: [if], data = [none] alphaAnimator.setStartDelay(animation.getStartDelay()); // depends on control dependency: [if], data = [none] alphaAnimator.setDuration(duration); // depends on control dependency: [if], data = [none] AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(animator, alphaAnimator); // depends on control dependency: [if], data = [none] return animatorSet; // depends on control dependency: [if], data = [none] } return animator; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public KeyFrameMeta analyzeKeyFrames() { log.debug("analyzeKeyFrames"); if (frameMeta != null) { return frameMeta; } try { lock.acquire(); // check for cached frame information if (frameCache != null) { frameMeta = frameCache.loadKeyFrameMeta(file); if (frameMeta != null && frameMeta.duration > 0) { // frame data loaded, create other mappings duration = frameMeta.duration; frameMeta.audioOnly = true; posTimeMap = new HashMap<>(); for (int i = 0; i < frameMeta.positions.length; i++) { posTimeMap.put(frameMeta.positions[i], (float) frameMeta.timestamps[i]); } return frameMeta; } } // rewind to the beginning using a channel FileChannel channel = fis.getChannel(); log.debug("Position: {}", channel.position()); channel.position(0); // create an internal parsing stream @SuppressWarnings("resource") MP3Stream stream = new MP3Stream(fis); // frame holder frameList = new LinkedList<>(); // position and timestamp lists List<Long> positionList = new ArrayList<>(); List<Float> timestampList = new ArrayList<>(); dataRate = 0; long rate = 0; float time = 0f; // read the first frame and move on to all the following ones AudioFrame frame = stream.nextFrame(); while (frame != null) { long pos = channel.position() - 4; if (pos + frame.getLength() > fileSize) { // last frame is incomplete log.trace("Last frame was incomplete"); break; } // save frame ref frameList.add(frame); // add the position for this frame positionList.add(pos); // add the timestamp for this frame timestampList.add(time); // get the bitrate rate += frame.getBitRate() / 1000; // get the duration time += frame.getDuration(); // increase the frame counter frameCount++; // skip current frame stream.skipFrame(); // move to next frame frame = stream.nextFrame(); } // reset the file input stream position channel.position(0); log.trace("Finished with frame count: {}", frameCount); duration = (long) time; dataRate = (int) (rate / frameCount); posTimeMap = new HashMap<>(); frameMeta = new KeyFrameMeta(); frameMeta.duration = duration; frameMeta.positions = new long[positionList.size()]; frameMeta.timestamps = new int[timestampList.size()]; frameMeta.audioOnly = true; for (int i = 0; i < frameMeta.positions.length; i++) { frameMeta.positions[i] = positionList.get(i); frameMeta.timestamps[i] = timestampList.get(i).intValue(); posTimeMap.put(positionList.get(i), timestampList.get(i)); } if (frameCache != null) { frameCache.saveKeyFrameMeta(file, frameMeta); } } catch (InterruptedException e) { log.warn("Exception acquiring lock", e); } catch (Exception e) { log.warn("Exception analyzing frames", e); } finally { lock.release(); } log.debug("Analysis complete"); if (log.isTraceEnabled()) { log.trace("{}", frameMeta); } return frameMeta; } }
public class class_name { @Override public KeyFrameMeta analyzeKeyFrames() { log.debug("analyzeKeyFrames"); if (frameMeta != null) { return frameMeta; // depends on control dependency: [if], data = [none] } try { lock.acquire(); // depends on control dependency: [try], data = [none] // check for cached frame information if (frameCache != null) { frameMeta = frameCache.loadKeyFrameMeta(file); // depends on control dependency: [if], data = [none] if (frameMeta != null && frameMeta.duration > 0) { // frame data loaded, create other mappings duration = frameMeta.duration; // depends on control dependency: [if], data = [none] frameMeta.audioOnly = true; // depends on control dependency: [if], data = [none] posTimeMap = new HashMap<>(); // depends on control dependency: [if], data = [none] for (int i = 0; i < frameMeta.positions.length; i++) { posTimeMap.put(frameMeta.positions[i], (float) frameMeta.timestamps[i]); // depends on control dependency: [for], data = [i] } return frameMeta; // depends on control dependency: [if], data = [none] } } // rewind to the beginning using a channel FileChannel channel = fis.getChannel(); log.debug("Position: {}", channel.position()); // depends on control dependency: [try], data = [none] channel.position(0); // depends on control dependency: [try], data = [none] // create an internal parsing stream @SuppressWarnings("resource") MP3Stream stream = new MP3Stream(fis); // frame holder frameList = new LinkedList<>(); // depends on control dependency: [try], data = [none] // position and timestamp lists List<Long> positionList = new ArrayList<>(); List<Float> timestampList = new ArrayList<>(); dataRate = 0; // depends on control dependency: [try], data = [none] long rate = 0; float time = 0f; // read the first frame and move on to all the following ones AudioFrame frame = stream.nextFrame(); while (frame != null) { long pos = channel.position() - 4; if (pos + frame.getLength() > fileSize) { // last frame is incomplete log.trace("Last frame was incomplete"); // depends on control dependency: [if], data = [none] break; } // save frame ref frameList.add(frame); // depends on control dependency: [while], data = [(frame] // add the position for this frame positionList.add(pos); // depends on control dependency: [while], data = [none] // add the timestamp for this frame timestampList.add(time); // depends on control dependency: [while], data = [none] // get the bitrate rate += frame.getBitRate() / 1000; // depends on control dependency: [while], data = [none] // get the duration time += frame.getDuration(); // depends on control dependency: [while], data = [none] // increase the frame counter frameCount++; // depends on control dependency: [while], data = [none] // skip current frame stream.skipFrame(); // depends on control dependency: [while], data = [none] // move to next frame frame = stream.nextFrame(); // depends on control dependency: [while], data = [none] } // reset the file input stream position channel.position(0); // depends on control dependency: [try], data = [none] log.trace("Finished with frame count: {}", frameCount); // depends on control dependency: [try], data = [none] duration = (long) time; // depends on control dependency: [try], data = [none] dataRate = (int) (rate / frameCount); // depends on control dependency: [try], data = [none] posTimeMap = new HashMap<>(); // depends on control dependency: [try], data = [none] frameMeta = new KeyFrameMeta(); // depends on control dependency: [try], data = [none] frameMeta.duration = duration; // depends on control dependency: [try], data = [none] frameMeta.positions = new long[positionList.size()]; // depends on control dependency: [try], data = [none] frameMeta.timestamps = new int[timestampList.size()]; // depends on control dependency: [try], data = [none] frameMeta.audioOnly = true; // depends on control dependency: [try], data = [none] for (int i = 0; i < frameMeta.positions.length; i++) { frameMeta.positions[i] = positionList.get(i); // depends on control dependency: [for], data = [i] frameMeta.timestamps[i] = timestampList.get(i).intValue(); // depends on control dependency: [for], data = [i] posTimeMap.put(positionList.get(i), timestampList.get(i)); // depends on control dependency: [for], data = [i] } if (frameCache != null) { frameCache.saveKeyFrameMeta(file, frameMeta); // depends on control dependency: [if], data = [none] } } catch (InterruptedException e) { log.warn("Exception acquiring lock", e); } catch (Exception e) { // depends on control dependency: [catch], data = [none] log.warn("Exception analyzing frames", e); } finally { // depends on control dependency: [catch], data = [none] lock.release(); } log.debug("Analysis complete"); if (log.isTraceEnabled()) { log.trace("{}", frameMeta); // depends on control dependency: [if], data = [none] } return frameMeta; } }
public class class_name { @Override public final void writeSmallString(String value) { if (value.isEmpty()) { writeTo((byte) 0); return; } char[] chars = Utility.charArray(value); if (chars.length > 255) throw new ConvertException("'" + value + "' have very long length"); byte[] bytes = new byte[chars.length + 1]; bytes[0] = (byte) chars.length; for (int i = 0; i < chars.length; i++) { if (chars[i] > Byte.MAX_VALUE) throw new ConvertException("'" + value + "' have double-word"); bytes[i + 1] = (byte) chars[i]; } writeTo(bytes); } }
public class class_name { @Override public final void writeSmallString(String value) { if (value.isEmpty()) { writeTo((byte) 0); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } char[] chars = Utility.charArray(value); if (chars.length > 255) throw new ConvertException("'" + value + "' have very long length"); byte[] bytes = new byte[chars.length + 1]; bytes[0] = (byte) chars.length; for (int i = 0; i < chars.length; i++) { if (chars[i] > Byte.MAX_VALUE) throw new ConvertException("'" + value + "' have double-word"); bytes[i + 1] = (byte) chars[i]; // depends on control dependency: [for], data = [i] } writeTo(bytes); } }
public class class_name { public int setTo(ByteBuffer buf, int offset, int size, boolean copyData) { if (!isTruthy(buf) || !isTruthy(size)) { return (mError=BAD_TYPE); } uninit(); // The chunk must be at least the size of the string pool header. if (size < ResStringPool_header.SIZEOF) { ALOGW("Bad string block: data size %zu is too small to be a string block", size); return (mError=BAD_TYPE); } // The data is at least as big as a ResChunk_header, so we can safely validate the other // header fields. // `data + size` is safe because the source of `size` comes from the kernel/filesystem. if (validate_chunk(new ResChunk_header(buf, offset), ResStringPool_header.SIZEOF, size, "ResStringPool_header") != NO_ERROR) { ALOGW("Bad string block: malformed block dimensions"); return (mError=BAD_TYPE); } // final boolean notDeviceEndian = htods((short) 0xf0) != 0xf0; // // if (copyData || notDeviceEndian) { // mOwnedData = data; // if (mOwnedData == null) { // return (mError=NO_MEMORY); // } //// memcpy(mOwnedData, data, size); // data = mOwnedData; // } // The size has been checked, so it is safe to read the data in the ResStringPool_header // data structure. mHeader = new ResStringPool_header(buf, offset); // if (notDeviceEndian) { // ResStringPool_header h = final_cast<ResStringPool_header*>(mHeader); // h.header.headerSize = dtohs(mHeader.header.headerSize); // h.header.type = dtohs(mHeader.header.type); // h.header.size = dtohl(mHeader.header.size); // h.stringCount = dtohl(mHeader.stringCount); // h.styleCount = dtohl(mHeader.styleCount); // h.flags = dtohl(mHeader.flags); // h.stringsStart = dtohl(mHeader.stringsStart); // h.stylesStart = dtohl(mHeader.stylesStart); // } if (mHeader.header.headerSize > mHeader.header.size || mHeader.header.size > size) { ALOGW("Bad string block: header size %d or total size %d is larger than data size %d\n", (int)mHeader.header.headerSize, (int)mHeader.header.size, (int)size); return (mError=BAD_TYPE); } mSize = mHeader.header.size; mEntries = new IntArray(mHeader.myBuf(), mHeader.myOffset() + mHeader.header.headerSize); if (mHeader.stringCount > 0) { if ((mHeader.stringCount*4 /*sizeof(uint32_t)*/ < mHeader.stringCount) // uint32 overflow? || (mHeader.header.headerSize+(mHeader.stringCount*4 /*sizeof(uint32_t)*/)) > size) { ALOGW("Bad string block: entry of %d items extends past data size %d\n", (int)(mHeader.header.headerSize+(mHeader.stringCount*4/*sizeof(uint32_t)*/)), (int)size); return (mError=BAD_TYPE); } int charSize; if (isTruthy(mHeader.flags & ResStringPool_header.UTF8_FLAG)) { charSize = 1 /*sizeof(uint8_t)*/; } else { charSize = 2 /*sizeof(uint16_t)*/; } // There should be at least space for the smallest string // (2 bytes length, null terminator). if (mHeader.stringsStart >= (mSize - 2 /*sizeof(uint16_t)*/)) { ALOGW("Bad string block: string pool starts at %d, after total size %d\n", (int)mHeader.stringsStart, (int)mHeader.header.size); return (mError=BAD_TYPE); } mStrings = mHeader.stringsStart; if (mHeader.styleCount == 0) { mStringPoolSize = (mSize - mHeader.stringsStart) / charSize; } else { // check invariant: styles starts before end of data if (mHeader.stylesStart >= (mSize - 2 /*sizeof(uint16_t)*/)) { ALOGW("Bad style block: style block starts at %d past data size of %d\n", (int)mHeader.stylesStart, (int)mHeader.header.size); return (mError=BAD_TYPE); } // check invariant: styles follow the strings if (mHeader.stylesStart <= mHeader.stringsStart) { ALOGW("Bad style block: style block starts at %d, before strings at %d\n", (int)mHeader.stylesStart, (int)mHeader.stringsStart); return (mError=BAD_TYPE); } mStringPoolSize = (mHeader.stylesStart-mHeader.stringsStart)/charSize; } // check invariant: stringCount > 0 requires a string pool to exist if (mStringPoolSize == 0) { ALOGW("Bad string block: stringCount is %d but pool size is 0\n", (int)mHeader.stringCount); return (mError=BAD_TYPE); } // if (notDeviceEndian) { // int i; // uint32_t* e = final_cast<uint32_t*>(mEntries); // for (i=0; i<mHeader.stringCount; i++) { // e[i] = dtohl(mEntries[i]); // } // if (!(mHeader.flags&ResStringPool_header::UTF8_FLAG)) { // final uint16_t* strings = (final uint16_t*)mStrings; // uint16_t* s = final_cast<uint16_t*>(strings); // for (i=0; i<mStringPoolSize; i++) { // s[i] = dtohs(strings[i]); // } // } // } // if ((mHeader->flags&ResStringPool_header::UTF8_FLAG && // ((uint8_t*)mStrings)[mStringPoolSize-1] != 0) || // (!(mHeader->flags&ResStringPool_header::UTF8_FLAG) && // ((uint16_t*)mStrings)[mStringPoolSize-1] != 0)) { if ((isTruthy(mHeader.flags & ResStringPool_header.UTF8_FLAG) && (mHeader.getByte(mStrings + mStringPoolSize - 1) != 0)) || (!isTruthy(mHeader.flags & ResStringPool_header.UTF8_FLAG) && (mHeader.getShort(mStrings + mStringPoolSize * 2 - 2) != 0))) { ALOGW("Bad string block: last string is not 0-terminated\n"); return (mError=BAD_TYPE); } } else { mStrings = -1; mStringPoolSize = 0; } if (mHeader.styleCount > 0) { mEntryStyles = new IntArray(mEntries.myBuf(), mEntries.myOffset() + mHeader.stringCount * SIZEOF_INT); // invariant: integer overflow in calculating mEntryStyles if (mEntryStyles.myOffset() < mEntries.myOffset()) { ALOGW("Bad string block: integer overflow finding styles\n"); return (mError=BAD_TYPE); } // if (((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader) > (int)size) { if ((mEntryStyles.myOffset() - mHeader.myOffset()) > (int)size) { ALOGW("Bad string block: entry of %d styles extends past data size %d\n", (int)(mEntryStyles.myOffset()), (int)size); return (mError=BAD_TYPE); } mStyles = mHeader.stylesStart; if (mHeader.stylesStart >= mHeader.header.size) { ALOGW("Bad string block: style pool starts %d, after total size %d\n", (int)mHeader.stylesStart, (int)mHeader.header.size); return (mError=BAD_TYPE); } mStylePoolSize = (mHeader.header.size-mHeader.stylesStart) /* / sizeof(uint32_t)*/; // if (notDeviceEndian) { // size_t i; // uint32_t* e = final_cast<uint32_t*>(mEntryStyles); // for (i=0; i<mHeader.styleCount; i++) { // e[i] = dtohl(mEntryStyles[i]); // } // uint32_t* s = final_cast<uint32_t*>(mStyles); // for (i=0; i<mStylePoolSize; i++) { // s[i] = dtohl(mStyles[i]); // } // } // final ResStringPool_span endSpan = { // { htodl(ResStringPool_span.END) }, // htodl(ResStringPool_span.END), htodl(ResStringPool_span.END) // }; // if (memcmp(&mStyles[mStylePoolSize-(sizeof(endSpan)/sizeof(uint32_t))], // &endSpan, sizeof(endSpan)) != 0) { ResStringPool_span endSpan = new ResStringPool_span(buf, mHeader.myOffset() + mStyles + (mStylePoolSize - ResStringPool_span.SIZEOF /* / 4 */)); if (!endSpan.isEnd()) { ALOGW("Bad string block: last style is not 0xFFFFFFFF-terminated\n"); return (mError=BAD_TYPE); } } else { mEntryStyles = null; mStyles = 0; mStylePoolSize = 0; } return (mError=NO_ERROR); } }
public class class_name { public int setTo(ByteBuffer buf, int offset, int size, boolean copyData) { if (!isTruthy(buf) || !isTruthy(size)) { return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } uninit(); // The chunk must be at least the size of the string pool header. if (size < ResStringPool_header.SIZEOF) { ALOGW("Bad string block: data size %zu is too small to be a string block", size); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } // The data is at least as big as a ResChunk_header, so we can safely validate the other // header fields. // `data + size` is safe because the source of `size` comes from the kernel/filesystem. if (validate_chunk(new ResChunk_header(buf, offset), ResStringPool_header.SIZEOF, size, "ResStringPool_header") != NO_ERROR) { ALOGW("Bad string block: malformed block dimensions"); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } // final boolean notDeviceEndian = htods((short) 0xf0) != 0xf0; // // if (copyData || notDeviceEndian) { // mOwnedData = data; // if (mOwnedData == null) { // return (mError=NO_MEMORY); // } //// memcpy(mOwnedData, data, size); // data = mOwnedData; // } // The size has been checked, so it is safe to read the data in the ResStringPool_header // data structure. mHeader = new ResStringPool_header(buf, offset); // if (notDeviceEndian) { // ResStringPool_header h = final_cast<ResStringPool_header*>(mHeader); // h.header.headerSize = dtohs(mHeader.header.headerSize); // h.header.type = dtohs(mHeader.header.type); // h.header.size = dtohl(mHeader.header.size); // h.stringCount = dtohl(mHeader.stringCount); // h.styleCount = dtohl(mHeader.styleCount); // h.flags = dtohl(mHeader.flags); // h.stringsStart = dtohl(mHeader.stringsStart); // h.stylesStart = dtohl(mHeader.stylesStart); // } if (mHeader.header.headerSize > mHeader.header.size || mHeader.header.size > size) { ALOGW("Bad string block: header size %d or total size %d is larger than data size %d\n", (int)mHeader.header.headerSize, (int)mHeader.header.size, (int)size); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } mSize = mHeader.header.size; mEntries = new IntArray(mHeader.myBuf(), mHeader.myOffset() + mHeader.header.headerSize); if (mHeader.stringCount > 0) { if ((mHeader.stringCount*4 /*sizeof(uint32_t)*/ < mHeader.stringCount) // uint32 overflow? || (mHeader.header.headerSize+(mHeader.stringCount*4 /*sizeof(uint32_t)*/)) > size) { ALOGW("Bad string block: entry of %d items extends past data size %d\n", (int)(mHeader.header.headerSize+(mHeader.stringCount*4/*sizeof(uint32_t)*/)), (int)size); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } int charSize; if (isTruthy(mHeader.flags & ResStringPool_header.UTF8_FLAG)) { charSize = 1 /*sizeof(uint8_t)*/; // depends on control dependency: [if], data = [none] } else { charSize = 2 /*sizeof(uint16_t)*/; // depends on control dependency: [if], data = [none] } // There should be at least space for the smallest string // (2 bytes length, null terminator). if (mHeader.stringsStart >= (mSize - 2 /*sizeof(uint16_t)*/)) { ALOGW("Bad string block: string pool starts at %d, after total size %d\n", (int)mHeader.stringsStart, (int)mHeader.header.size); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } mStrings = mHeader.stringsStart; // depends on control dependency: [if], data = [none] if (mHeader.styleCount == 0) { mStringPoolSize = (mSize - mHeader.stringsStart) / charSize; // depends on control dependency: [if], data = [none] } else { // check invariant: styles starts before end of data if (mHeader.stylesStart >= (mSize - 2 /*sizeof(uint16_t)*/)) { ALOGW("Bad style block: style block starts at %d past data size of %d\n", (int)mHeader.stylesStart, (int)mHeader.header.size); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } // check invariant: styles follow the strings if (mHeader.stylesStart <= mHeader.stringsStart) { ALOGW("Bad style block: style block starts at %d, before strings at %d\n", (int)mHeader.stylesStart, (int)mHeader.stringsStart); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } mStringPoolSize = (mHeader.stylesStart-mHeader.stringsStart)/charSize; // depends on control dependency: [if], data = [none] } // check invariant: stringCount > 0 requires a string pool to exist if (mStringPoolSize == 0) { ALOGW("Bad string block: stringCount is %d but pool size is 0\n", (int)mHeader.stringCount); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } // if (notDeviceEndian) { // int i; // uint32_t* e = final_cast<uint32_t*>(mEntries); // for (i=0; i<mHeader.stringCount; i++) { // e[i] = dtohl(mEntries[i]); // } // if (!(mHeader.flags&ResStringPool_header::UTF8_FLAG)) { // final uint16_t* strings = (final uint16_t*)mStrings; // uint16_t* s = final_cast<uint16_t*>(strings); // for (i=0; i<mStringPoolSize; i++) { // s[i] = dtohs(strings[i]); // } // } // } // if ((mHeader->flags&ResStringPool_header::UTF8_FLAG && // ((uint8_t*)mStrings)[mStringPoolSize-1] != 0) || // (!(mHeader->flags&ResStringPool_header::UTF8_FLAG) && // ((uint16_t*)mStrings)[mStringPoolSize-1] != 0)) { if ((isTruthy(mHeader.flags & ResStringPool_header.UTF8_FLAG) && (mHeader.getByte(mStrings + mStringPoolSize - 1) != 0)) || (!isTruthy(mHeader.flags & ResStringPool_header.UTF8_FLAG) && (mHeader.getShort(mStrings + mStringPoolSize * 2 - 2) != 0))) { ALOGW("Bad string block: last string is not 0-terminated\n"); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } } else { mStrings = -1; // depends on control dependency: [if], data = [none] mStringPoolSize = 0; // depends on control dependency: [if], data = [none] } if (mHeader.styleCount > 0) { mEntryStyles = new IntArray(mEntries.myBuf(), mEntries.myOffset() + mHeader.stringCount * SIZEOF_INT); // depends on control dependency: [if], data = [none] // invariant: integer overflow in calculating mEntryStyles if (mEntryStyles.myOffset() < mEntries.myOffset()) { ALOGW("Bad string block: integer overflow finding styles\n"); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } // if (((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader) > (int)size) { if ((mEntryStyles.myOffset() - mHeader.myOffset()) > (int)size) { ALOGW("Bad string block: entry of %d styles extends past data size %d\n", (int)(mEntryStyles.myOffset()), (int)size); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } mStyles = mHeader.stylesStart; // depends on control dependency: [if], data = [none] if (mHeader.stylesStart >= mHeader.header.size) { ALOGW("Bad string block: style pool starts %d, after total size %d\n", (int)mHeader.stylesStart, (int)mHeader.header.size); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } mStylePoolSize = (mHeader.header.size-mHeader.stylesStart) /* / sizeof(uint32_t)*/; // depends on control dependency: [if], data = [none] // if (notDeviceEndian) { // size_t i; // uint32_t* e = final_cast<uint32_t*>(mEntryStyles); // for (i=0; i<mHeader.styleCount; i++) { // e[i] = dtohl(mEntryStyles[i]); // } // uint32_t* s = final_cast<uint32_t*>(mStyles); // for (i=0; i<mStylePoolSize; i++) { // s[i] = dtohl(mStyles[i]); // } // } // final ResStringPool_span endSpan = { // { htodl(ResStringPool_span.END) }, // htodl(ResStringPool_span.END), htodl(ResStringPool_span.END) // }; // if (memcmp(&mStyles[mStylePoolSize-(sizeof(endSpan)/sizeof(uint32_t))], // &endSpan, sizeof(endSpan)) != 0) { ResStringPool_span endSpan = new ResStringPool_span(buf, mHeader.myOffset() + mStyles + (mStylePoolSize - ResStringPool_span.SIZEOF /* / 4 */)); if (!endSpan.isEnd()) { ALOGW("Bad string block: last style is not 0xFFFFFFFF-terminated\n"); // depends on control dependency: [if], data = [none] return (mError=BAD_TYPE); // depends on control dependency: [if], data = [none] } } else { mEntryStyles = null; // depends on control dependency: [if], data = [none] mStyles = 0; // depends on control dependency: [if], data = [none] mStylePoolSize = 0; // depends on control dependency: [if], data = [none] } return (mError=NO_ERROR); } }
public class class_name { public static VersionNumber parseLastVersionNumber(@Nonnull final String text) { Check.notNull(text, "text"); final Matcher matcher = VERSIONNUMBER_WITH_SUFFIX.matcher(text); String[] split = null; String ext = null; while (matcher.find()) { split = matcher.group(MAJOR_INDEX).split("\\."); ext = matcher.group(EXTENSION_INDEX); } final String extension = ext == null ? VersionNumber.EMPTY_EXTENSION : trimRight(ext); return split == null ? VersionNumber.UNKNOWN : new VersionNumber(Arrays.asList(split), extension); } }
public class class_name { public static VersionNumber parseLastVersionNumber(@Nonnull final String text) { Check.notNull(text, "text"); final Matcher matcher = VERSIONNUMBER_WITH_SUFFIX.matcher(text); String[] split = null; String ext = null; while (matcher.find()) { split = matcher.group(MAJOR_INDEX).split("\\."); // depends on control dependency: [while], data = [none] ext = matcher.group(EXTENSION_INDEX); // depends on control dependency: [while], data = [none] } final String extension = ext == null ? VersionNumber.EMPTY_EXTENSION : trimRight(ext); return split == null ? VersionNumber.UNKNOWN : new VersionNumber(Arrays.asList(split), extension); } }
public class class_name { private void linkMembersToShapes(IntermediateModel model) { for (Map.Entry<String, ShapeModel> entry : model.getShapes().entrySet()) { if (entry.getValue().getMembers() != null) { for (MemberModel member : entry.getValue().getMembers()) { member.setShape( Utils.findShapeModelByC2jNameIfExists(model, member.getC2jShape())); } } } } }
public class class_name { private void linkMembersToShapes(IntermediateModel model) { for (Map.Entry<String, ShapeModel> entry : model.getShapes().entrySet()) { if (entry.getValue().getMembers() != null) { for (MemberModel member : entry.getValue().getMembers()) { member.setShape( Utils.findShapeModelByC2jNameIfExists(model, member.getC2jShape())); // depends on control dependency: [for], data = [member] } } } } }
public class class_name { public VariableInstance setVariableInstance(Long procInstId, String name, Object value) throws DataAccessException { TransactionWrapper transaction = null; EngineDataAccessDB edao = new EngineDataAccessDB(); try { transaction = edao.startTransaction(); VariableInstance varInst = edao.getVariableInstance(procInstId, name); if (varInst != null) { if (value instanceof String) varInst.setStringValue((String)value); else varInst.setData(value); edao.updateVariableInstance(varInst); } else { if (value != null) { ProcessInstance procInst = edao.getProcessInstance(procInstId); Process process = null; if (procInst.getProcessInstDefId() > 0L) process = ProcessCache.getProcessInstanceDefiniton(procInst.getProcessId(), procInst.getProcessInstDefId()); if (process == null) process = ProcessCache.getProcess(procInst.getProcessId()); Variable variable = process.getVariable(name); if (variable == null) { throw new DataAccessException("Variable " + name + " is not defined for process " + process.getId()); } varInst = new VariableInstance(); varInst.setName(name); varInst.setVariableId(variable.getId()); varInst.setType(variable.getType()); if (value instanceof String) varInst.setStringValue((String)value); else varInst.setData(value); edao.createVariableInstance(varInst, procInstId); } else varInst = null; } return varInst; } catch (SQLException e) { throw new DataAccessException(-1, "Failed to set variable value", e); } finally { edao.stopTransaction(transaction); } } }
public class class_name { public VariableInstance setVariableInstance(Long procInstId, String name, Object value) throws DataAccessException { TransactionWrapper transaction = null; EngineDataAccessDB edao = new EngineDataAccessDB(); try { transaction = edao.startTransaction(); VariableInstance varInst = edao.getVariableInstance(procInstId, name); if (varInst != null) { if (value instanceof String) varInst.setStringValue((String)value); else varInst.setData(value); edao.updateVariableInstance(varInst); // depends on control dependency: [if], data = [(varInst] } else { if (value != null) { ProcessInstance procInst = edao.getProcessInstance(procInstId); Process process = null; if (procInst.getProcessInstDefId() > 0L) process = ProcessCache.getProcessInstanceDefiniton(procInst.getProcessId(), procInst.getProcessInstDefId()); if (process == null) process = ProcessCache.getProcess(procInst.getProcessId()); Variable variable = process.getVariable(name); if (variable == null) { throw new DataAccessException("Variable " + name + " is not defined for process " + process.getId()); } varInst = new VariableInstance(); // depends on control dependency: [if], data = [none] varInst.setName(name); // depends on control dependency: [if], data = [none] varInst.setVariableId(variable.getId()); // depends on control dependency: [if], data = [none] varInst.setType(variable.getType()); // depends on control dependency: [if], data = [none] if (value instanceof String) varInst.setStringValue((String)value); else varInst.setData(value); edao.createVariableInstance(varInst, procInstId); // depends on control dependency: [if], data = [none] } else varInst = null; } return varInst; } catch (SQLException e) { throw new DataAccessException(-1, "Failed to set variable value", e); } finally { edao.stopTransaction(transaction); } } }
public class class_name { public boolean isIndexed(FeatureIndexType type) { boolean indexed = false; if (type == null) { indexed = isIndexed(); } else { switch (type) { case GEOPACKAGE: indexed = featureTableIndex.isIndexed(); break; case RTREE: indexed = rTreeIndexTableDao.has(); break; default: throw new GeoPackageException("Unsupported FeatureIndexType: " + type); } } return indexed; } }
public class class_name { public boolean isIndexed(FeatureIndexType type) { boolean indexed = false; if (type == null) { indexed = isIndexed(); // depends on control dependency: [if], data = [none] } else { switch (type) { case GEOPACKAGE: indexed = featureTableIndex.isIndexed(); break; case RTREE: indexed = rTreeIndexTableDao.has(); break; default: throw new GeoPackageException("Unsupported FeatureIndexType: " + type); } } return indexed; } }
public class class_name { static final int find(final int[] array, final int lgArrInts, final int coupon) { final int arrMask = array.length - 1; int probe = coupon & arrMask; final int loopIndex = probe; do { final int couponAtIdx = array[probe]; if (couponAtIdx == EMPTY) { return ~probe; //empty } else if (coupon == couponAtIdx) { return probe; //duplicate } final int stride = ((coupon & KEY_MASK_26) >>> lgArrInts) | 1; probe = (probe + stride) & arrMask; } while (probe != loopIndex); throw new SketchesArgumentException("Key not found and no empty slots!"); } }
public class class_name { static final int find(final int[] array, final int lgArrInts, final int coupon) { final int arrMask = array.length - 1; int probe = coupon & arrMask; final int loopIndex = probe; do { final int couponAtIdx = array[probe]; if (couponAtIdx == EMPTY) { return ~probe; //empty // depends on control dependency: [if], data = [none] } else if (coupon == couponAtIdx) { return probe; //duplicate // depends on control dependency: [if], data = [none] } final int stride = ((coupon & KEY_MASK_26) >>> lgArrInts) | 1; probe = (probe + stride) & arrMask; } while (probe != loopIndex); throw new SketchesArgumentException("Key not found and no empty slots!"); } }
public class class_name { public void write(OutputStream os) { List<String> ids = new ArrayList<String>(score.keySet()); final Map<String, Integer> score = this.score; Collections.sort(ids, new Comparator<String>() { @Override public int compare(String o1, String o2) { return score.get(o2).compareTo(score.get(o1)); } }); try { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os)); boolean notFirst = false; for (String id : ids) { if (notFirst) writer.write("\n"); else notFirst = true; writer.write(id + DELIM + score.get(id) + DELIM + convertContext(context.get(id))); } writer.close(); } catch (IOException e) { e.printStackTrace(); } } }
public class class_name { public void write(OutputStream os) { List<String> ids = new ArrayList<String>(score.keySet()); final Map<String, Integer> score = this.score; Collections.sort(ids, new Comparator<String>() { @Override public int compare(String o1, String o2) { return score.get(o2).compareTo(score.get(o1)); } }); try { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os)); boolean notFirst = false; for (String id : ids) { if (notFirst) writer.write("\n"); else notFirst = true; writer.write(id + DELIM + score.get(id) + DELIM + convertContext(context.get(id))); // depends on control dependency: [for], data = [id] } writer.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void transmit(String userId, JSONObject message){ JSONObject usrMsgJson = new JSONObject(); try { usrMsgJson.put(PnRTCMessage.JSON_USERMSG, message); this.pcClient.transmitMessage(userId, usrMsgJson); } catch (JSONException e){ e.printStackTrace(); } } }
public class class_name { public void transmit(String userId, JSONObject message){ JSONObject usrMsgJson = new JSONObject(); try { usrMsgJson.put(PnRTCMessage.JSON_USERMSG, message); // depends on control dependency: [try], data = [none] this.pcClient.transmitMessage(userId, usrMsgJson); // depends on control dependency: [try], data = [none] } catch (JSONException e){ e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { String database = catalog; // We avoid using information schema queries by default, because this appears to be an expensive // query (CONJ-41). if (table == null) { throw new SQLException("'table' parameter in getImportedKeys cannot be null"); } if (database == null && connection.nullCatalogMeansCurrent) { /* Treat null catalog as current */ return getImportedKeysUsingInformationSchema("", table); } if (database == null) { return getImportedKeysUsingInformationSchema(null, table); } if (database.isEmpty()) { database = connection.getCatalog(); if (database == null || database.isEmpty()) { return getImportedKeysUsingInformationSchema(database, table); } } try { return getImportedKeysUsingShowCreateTable(database, table); } catch (Exception e) { // Likely, parsing failed, try out I_S query. return getImportedKeysUsingInformationSchema(database, table); } } }
public class class_name { public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { String database = catalog; // We avoid using information schema queries by default, because this appears to be an expensive // query (CONJ-41). if (table == null) { throw new SQLException("'table' parameter in getImportedKeys cannot be null"); } if (database == null && connection.nullCatalogMeansCurrent) { /* Treat null catalog as current */ return getImportedKeysUsingInformationSchema("", table); } if (database == null) { return getImportedKeysUsingInformationSchema(null, table); } if (database.isEmpty()) { database = connection.getCatalog(); if (database == null || database.isEmpty()) { return getImportedKeysUsingInformationSchema(database, table); // depends on control dependency: [if], data = [(database] } } try { return getImportedKeysUsingShowCreateTable(database, table); } catch (Exception e) { // Likely, parsing failed, try out I_S query. return getImportedKeysUsingInformationSchema(database, table); } } }
public class class_name { public String getCurrentApplicationContextID() { WebSphereCDIDeployment cdiDeployment = getCurrentDeployment(); if (cdiDeployment == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getCurrentApplicationContextID returning null. cdiDeployment is null"); } return null; } String contextID = cdiDeployment.getDeploymentID(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getCurrentApplicationContextID successfully found a application context ID of: " + contextID); } return contextID; } }
public class class_name { public String getCurrentApplicationContextID() { WebSphereCDIDeployment cdiDeployment = getCurrentDeployment(); if (cdiDeployment == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getCurrentApplicationContextID returning null. cdiDeployment is null"); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } String contextID = cdiDeployment.getDeploymentID(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getCurrentApplicationContextID successfully found a application context ID of: " + contextID); // depends on control dependency: [if], data = [none] } return contextID; } }
public class class_name { private RValue[] executeExpressions(Tuple<Expr> expressions, CallStack frame) { RValue[][] results = new RValue[expressions.size()][]; int count = 0; for(int i=0;i!=expressions.size();++i) { results[i] = executeMultiReturnExpression(expressions.get(i),frame); count += results[i].length; } RValue[] rs = new RValue[count]; int j = 0; for(int i=0;i!=expressions.size();++i) { Object[] r = results[i]; System.arraycopy(r, 0, rs, j, r.length); j += r.length; } return rs; } }
public class class_name { private RValue[] executeExpressions(Tuple<Expr> expressions, CallStack frame) { RValue[][] results = new RValue[expressions.size()][]; int count = 0; for(int i=0;i!=expressions.size();++i) { results[i] = executeMultiReturnExpression(expressions.get(i),frame); // depends on control dependency: [for], data = [i] count += results[i].length; // depends on control dependency: [for], data = [i] } RValue[] rs = new RValue[count]; int j = 0; for(int i=0;i!=expressions.size();++i) { Object[] r = results[i]; System.arraycopy(r, 0, rs, j, r.length); // depends on control dependency: [for], data = [none] j += r.length; // depends on control dependency: [for], data = [none] } return rs; } }
public class class_name { @Override public String doGetNamespaceURI(String prefix) { // Note: base class checks for 'known' problems and prefixes: if (mNsByPrefix == null) { mNsByPrefix = buildByPrefixMap(); } Namespace ns = mNsByPrefix.get(prefix); if (ns == null && mParentCtxt != null) { return mParentCtxt.getNamespaceURI(prefix); } return (ns == null) ? null : ns.getNamespaceURI(); } }
public class class_name { @Override public String doGetNamespaceURI(String prefix) { // Note: base class checks for 'known' problems and prefixes: if (mNsByPrefix == null) { mNsByPrefix = buildByPrefixMap(); // depends on control dependency: [if], data = [none] } Namespace ns = mNsByPrefix.get(prefix); if (ns == null && mParentCtxt != null) { return mParentCtxt.getNamespaceURI(prefix); // depends on control dependency: [if], data = [none] } return (ns == null) ? null : ns.getNamespaceURI(); } }
public class class_name { public void setCertPathCheckers(List<PKIXCertPathChecker> checkers) { if (checkers != null) { List<PKIXCertPathChecker> tmpList = new ArrayList<PKIXCertPathChecker>(); for (PKIXCertPathChecker checker : checkers) { tmpList.add((PKIXCertPathChecker)checker.clone()); } this.certPathCheckers = tmpList; } else { this.certPathCheckers = new ArrayList<PKIXCertPathChecker>(); } } }
public class class_name { public void setCertPathCheckers(List<PKIXCertPathChecker> checkers) { if (checkers != null) { List<PKIXCertPathChecker> tmpList = new ArrayList<PKIXCertPathChecker>(); for (PKIXCertPathChecker checker : checkers) { tmpList.add((PKIXCertPathChecker)checker.clone()); // depends on control dependency: [for], data = [checker] } this.certPathCheckers = tmpList; // depends on control dependency: [if], data = [none] } else { this.certPathCheckers = new ArrayList<PKIXCertPathChecker>(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setSupportedInputModes(java.util.Collection<String> supportedInputModes) { if (supportedInputModes == null) { this.supportedInputModes = null; return; } this.supportedInputModes = new java.util.ArrayList<String>(supportedInputModes); } }
public class class_name { public void setSupportedInputModes(java.util.Collection<String> supportedInputModes) { if (supportedInputModes == null) { this.supportedInputModes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.supportedInputModes = new java.util.ArrayList<String>(supportedInputModes); } }
public class class_name { private EJSHome fireMetaDataCreatedAndStartBean(BeanMetaData bmd) // d648522 throws ContainerException { if (!bmd.isManagedBean()) // F743-34301.1 { try { // Fire the ComponentMetaData event to the listeners // (ie. we have loaded a new bean folks... ) if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "startBean: Fire Component Metadata created event to listeners for: " + bmd.j2eeName); bmd.ivMetaDataDestroyRequired = true; //d505055 fireMetaDataCreated(bmd); } catch (Throwable t) //197547 { FFDCFilter.processException(t, CLASS_NAME + "startBean", "445", this); throw new ContainerException("Failed to start " + bmd.j2eeName, t); } } return startBean(bmd); // d739043 } }
public class class_name { private EJSHome fireMetaDataCreatedAndStartBean(BeanMetaData bmd) // d648522 throws ContainerException { if (!bmd.isManagedBean()) // F743-34301.1 { try { // Fire the ComponentMetaData event to the listeners // (ie. we have loaded a new bean folks... ) if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "startBean: Fire Component Metadata created event to listeners for: " + bmd.j2eeName); bmd.ivMetaDataDestroyRequired = true; //d505055 // depends on control dependency: [try], data = [none] fireMetaDataCreated(bmd); // depends on control dependency: [try], data = [none] } catch (Throwable t) //197547 { FFDCFilter.processException(t, CLASS_NAME + "startBean", "445", this); throw new ContainerException("Failed to start " + bmd.j2eeName, t); } // depends on control dependency: [catch], data = [none] } return startBean(bmd); // d739043 } }
public class class_name { public static List<Column> findRequiredColumns( QueryContext context, PlanNode planNode ) { List<Column> columns = null; PlanNode node = planNode; // First find the columns from the nearest PROJECT ancestor ... do { switch (node.getType()) { case PROJECT: columns = node.getPropertyAsList(Property.PROJECT_COLUMNS, Column.class); node = null; break; default: node = node.getParent(); break; } } while (node != null); // Find the names of the selectors ... Set<SelectorName> names = new HashSet<SelectorName>(); for (PlanNode source : planNode.findAllAtOrBelow(Type.SOURCE)) { names.add(source.getProperty(Property.SOURCE_NAME, SelectorName.class)); SelectorName alias = source.getProperty(Property.SOURCE_ALIAS, SelectorName.class); if (alias != null) names.add(alias); } // Add the PROJECT columns first ... RequiredColumnVisitor collectionVisitor = new RequiredColumnVisitor(names); if (columns != null) { for (Column projectedColumn : columns) { collectionVisitor.visit(projectedColumn); } } // Now add the columns from the JOIN, SELECT, PROJECT and SORT ancestors ... node = planNode; do { switch (node.getType()) { case JOIN: List<Constraint> criteria = node.getPropertyAsList(Property.JOIN_CONSTRAINTS, Constraint.class); JoinCondition joinCondition = node.getProperty(Property.JOIN_CONDITION, JoinCondition.class); Visitors.visitAll(criteria, collectionVisitor); Visitors.visitAll(joinCondition, collectionVisitor); break; case SELECT: Constraint constraint = node.getProperty(Property.SELECT_CRITERIA, Constraint.class); Visitors.visitAll(constraint, collectionVisitor); break; case SORT: List<Object> orderBys = node.getPropertyAsList(Property.SORT_ORDER_BY, Object.class); if (orderBys != null && !orderBys.isEmpty()) { if (orderBys.get(0) instanceof Ordering) { for (int i = 0; i != orderBys.size(); ++i) { Ordering ordering = (Ordering)orderBys.get(i); Visitors.visitAll(ordering, collectionVisitor); } } } break; case PROJECT: if (node != planNode) { // Already handled above, but we can stop looking for columns ... return collectionVisitor.getRequiredColumns(); } break; default: break; } node = node.getParent(); } while (node != null); return collectionVisitor.getRequiredColumns(); } }
public class class_name { public static List<Column> findRequiredColumns( QueryContext context, PlanNode planNode ) { List<Column> columns = null; PlanNode node = planNode; // First find the columns from the nearest PROJECT ancestor ... do { switch (node.getType()) { case PROJECT: columns = node.getPropertyAsList(Property.PROJECT_COLUMNS, Column.class); node = null; break; default: node = node.getParent(); break; } } while (node != null); // Find the names of the selectors ... Set<SelectorName> names = new HashSet<SelectorName>(); for (PlanNode source : planNode.findAllAtOrBelow(Type.SOURCE)) { names.add(source.getProperty(Property.SOURCE_NAME, SelectorName.class)); // depends on control dependency: [for], data = [source] SelectorName alias = source.getProperty(Property.SOURCE_ALIAS, SelectorName.class); if (alias != null) names.add(alias); } // Add the PROJECT columns first ... RequiredColumnVisitor collectionVisitor = new RequiredColumnVisitor(names); if (columns != null) { for (Column projectedColumn : columns) { collectionVisitor.visit(projectedColumn); // depends on control dependency: [for], data = [projectedColumn] } } // Now add the columns from the JOIN, SELECT, PROJECT and SORT ancestors ... node = planNode; do { switch (node.getType()) { case JOIN: List<Constraint> criteria = node.getPropertyAsList(Property.JOIN_CONSTRAINTS, Constraint.class); JoinCondition joinCondition = node.getProperty(Property.JOIN_CONDITION, JoinCondition.class); Visitors.visitAll(criteria, collectionVisitor); Visitors.visitAll(joinCondition, collectionVisitor); break; case SELECT: Constraint constraint = node.getProperty(Property.SELECT_CRITERIA, Constraint.class); Visitors.visitAll(constraint, collectionVisitor); break; case SORT: List<Object> orderBys = node.getPropertyAsList(Property.SORT_ORDER_BY, Object.class); if (orderBys != null && !orderBys.isEmpty()) { if (orderBys.get(0) instanceof Ordering) { for (int i = 0; i != orderBys.size(); ++i) { Ordering ordering = (Ordering)orderBys.get(i); Visitors.visitAll(ordering, collectionVisitor); // depends on control dependency: [for], data = [none] } } } break; case PROJECT: if (node != planNode) { // Already handled above, but we can stop looking for columns ... return collectionVisitor.getRequiredColumns(); // depends on control dependency: [if], data = [none] } break; default: break; } node = node.getParent(); } while (node != null); return collectionVisitor.getRequiredColumns(); } }
public class class_name { public String getIntegerPartAfter(final int digit) { final int length = integerPart.length(); if(length < digit || digit <= 0) { return ""; } String num = integerPart.substring(0, (length - digit + 1)); if(isUseSeparator() && digit >= 4) { // 区切り文字を入れるために分割する。 StringBuilder sb = new StringBuilder(); for(int i=0; i < num.length(); i++) { char c = num.charAt(i); sb.append(c); // 現在の処理中の桁数 int itemDigit = length -i; if((itemDigit >= 3) && (itemDigit -1) % 3 == 0) { sb.append(","); } } num = sb.toString(); } return num; } }
public class class_name { public String getIntegerPartAfter(final int digit) { final int length = integerPart.length(); if(length < digit || digit <= 0) { return ""; // depends on control dependency: [if], data = [none] } String num = integerPart.substring(0, (length - digit + 1)); if(isUseSeparator() && digit >= 4) { // 区切り文字を入れるために分割する。 StringBuilder sb = new StringBuilder(); for(int i=0; i < num.length(); i++) { char c = num.charAt(i); sb.append(c); // depends on control dependency: [for], data = [none] // 現在の処理中の桁数 int itemDigit = length -i; if((itemDigit >= 3) && (itemDigit -1) % 3 == 0) { sb.append(","); // depends on control dependency: [if], data = [none] } } num = sb.toString(); // depends on control dependency: [if], data = [none] } return num; } }
public class class_name { public static boolean allJSONObjects(JSONArray array) throws JSONException { for (int i = 0; i < array.length(); ++i) { if (!(array.get(i) instanceof JSONObject)) { return false; } } return true; } }
public class class_name { public static boolean allJSONObjects(JSONArray array) throws JSONException { for (int i = 0; i < array.length(); ++i) { if (!(array.get(i) instanceof JSONObject)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public java.util.List<InventoryDeletionSummaryItem> getSummaryItems() { if (summaryItems == null) { summaryItems = new com.amazonaws.internal.SdkInternalList<InventoryDeletionSummaryItem>(); } return summaryItems; } }
public class class_name { public java.util.List<InventoryDeletionSummaryItem> getSummaryItems() { if (summaryItems == null) { summaryItems = new com.amazonaws.internal.SdkInternalList<InventoryDeletionSummaryItem>(); // depends on control dependency: [if], data = [none] } return summaryItems; } }