code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public V remove(@NonNull K key) { Entry<K, V> toRemove = get(key); if (toRemove == null) { return null; } mSize--; if (!mIterators.isEmpty()) { for (SupportRemove<K, V> iter : mIterators.keySet()) { iter.supportRemove(toRemove); } } if (toRemove.mPrevious != null) { toRemove.mPrevious.mNext = toRemove.mNext; } else { mStart = toRemove.mNext; } if (toRemove.mNext != null) { toRemove.mNext.mPrevious = toRemove.mPrevious; } else { mEnd = toRemove.mPrevious; } toRemove.mNext = null; toRemove.mPrevious = null; return toRemove.mValue; } }
public class class_name { public V remove(@NonNull K key) { Entry<K, V> toRemove = get(key); if (toRemove == null) { return null; // depends on control dependency: [if], data = [none] } mSize--; if (!mIterators.isEmpty()) { for (SupportRemove<K, V> iter : mIterators.keySet()) { iter.supportRemove(toRemove); // depends on control dependency: [for], data = [iter] } } if (toRemove.mPrevious != null) { toRemove.mPrevious.mNext = toRemove.mNext; // depends on control dependency: [if], data = [none] } else { mStart = toRemove.mNext; // depends on control dependency: [if], data = [none] } if (toRemove.mNext != null) { toRemove.mNext.mPrevious = toRemove.mPrevious; // depends on control dependency: [if], data = [none] } else { mEnd = toRemove.mPrevious; // depends on control dependency: [if], data = [none] } toRemove.mNext = null; toRemove.mPrevious = null; return toRemove.mValue; } }
public class class_name { public int compareTo(Object o) { ObjectStreamField f = (ObjectStreamField) o; boolean thisPrimitive = this.isPrimitive(); boolean fPrimitive = f.isPrimitive(); // If one is primitive and the other isn't, we have enough info to // compare if (thisPrimitive != fPrimitive) { return thisPrimitive ? -1 : 1; } // Either both primitives or both not primitives. Compare based on name. return this.getName().compareTo(f.getName()); } }
public class class_name { public int compareTo(Object o) { ObjectStreamField f = (ObjectStreamField) o; boolean thisPrimitive = this.isPrimitive(); boolean fPrimitive = f.isPrimitive(); // If one is primitive and the other isn't, we have enough info to // compare if (thisPrimitive != fPrimitive) { return thisPrimitive ? -1 : 1; // depends on control dependency: [if], data = [none] } // Either both primitives or both not primitives. Compare based on name. return this.getName().compareTo(f.getName()); } }
public class class_name { private Class<?> generateProfileAttributeArrayValueClass(CtClass concreteProfileEntityClass, String profileAttributeName, boolean unique) { CtClass concreteArrayValueClass = null; try { // define the concrete profile attribute array value class name String concreteArrayValueClassName = profileComponent.getProfileCmpInterfaceClass().getName() + "PEAAV_"+ClassGeneratorUtils.capitalize(profileAttributeName); // create javassist class concreteArrayValueClass = ClassGeneratorUtils.createClass(concreteArrayValueClassName, new String[]{Serializable.class.getName()}); // set inheritance ClassGeneratorUtils.createInheritanceLink(concreteArrayValueClass, ProfileEntityArrayAttributeValue.class.getName()); // annotate class with @Entity ClassGeneratorUtils.addAnnotation( Entity.class.getName(), new LinkedHashMap<String, Object>(), concreteArrayValueClass ); // generate a random table name addTableAnnotationToPEAAV("SLEE_PEAAV_"+profileComponent.getProfileCmpInterfaceClass().getSimpleName() + "_" + Math.abs((long)profileComponent.getComponentID().hashCode()) + profileAttributeName,unique,concreteArrayValueClass); // override @id String getIdNameMethodSrc = "public long getId() { return super.getId(); }"; CtMethod getIdNameMethod = CtNewMethod.make(getIdNameMethodSrc, concreteArrayValueClass); ClassGeneratorUtils.addAnnotation( Id.class.getName(), new LinkedHashMap<String, Object>(), getIdNameMethod); ClassGeneratorUtils.addAnnotation( GeneratedValue.class.getName(), new LinkedHashMap<String, Object>(), getIdNameMethod); concreteArrayValueClass.addMethod(getIdNameMethod); // override getter methods String getSerializableMethodSrc = "public "+Serializable.class.getName()+" getSerializable() { return super.getSerializable(); }"; CtMethod getSerializableMethod = CtNewMethod.make(getSerializableMethodSrc, concreteArrayValueClass); LinkedHashMap<String,Object> map = new LinkedHashMap<String, Object>(); map.put("name", "serializable"); map.put("length", 512); //if (unique)map.put("unique", true); ClassGeneratorUtils.addAnnotation(Column.class.getName(), map, getSerializableMethod); concreteArrayValueClass.addMethod(getSerializableMethod); String getStringMethodSrc = "public String getString() { return super.getString(); }"; CtMethod getStringMethod = CtNewMethod.make(getStringMethodSrc, concreteArrayValueClass); map = new LinkedHashMap<String, Object>(); map.put("name", "string"); //if (unique)map.put("unique", true); ClassGeneratorUtils.addAnnotation(Column.class.getName(), map, getStringMethod); concreteArrayValueClass.addMethod(getStringMethod); // FIXME add join columns here or in profile entity class to make // the relation without a join table, atm if this is changed, the // inserts on this table go with profile and table name as null %) // THE PROFILENTITY FIELD IN AAV CLASS IS REQUIRED FOR THE RELATION WITH PROFILE ENTITY CLASS WITHOUT A JOIN TABLE // add join column regarding the relation from array attr value to profile entity CtField ctField = ClassGeneratorUtils.addField(concreteProfileEntityClass, "owner", concreteArrayValueClass); ClassGeneratorUtils.generateSetter(ctField,null); CtMethod getter = ClassGeneratorUtils.generateGetter(ctField,null); //ClassGeneratorUtils.addAnnotation(ManyToOne.class.getName(), new LinkedHashMap<String, Object>(), getter); // ---- ConstPool cp = getter.getMethodInfo().getConstPool(); AnnotationsAttribute attr = (AnnotationsAttribute) getter.getMethodInfo().getAttribute(AnnotationsAttribute.visibleTag); if (attr == null) { attr = new AnnotationsAttribute(cp,AnnotationsAttribute.visibleTag); } Annotation manyToOne = new Annotation(ManyToOne.class.getName(), cp); manyToOne.addMemberValue("optional", new BooleanMemberValue(false,cp)); attr.addAnnotation(manyToOne); Annotation joinColumns = new Annotation(JoinColumns.class.getName(), cp); Annotation joinColumn1 = new Annotation(JoinColumn.class.getName(), cp); joinColumn1.addMemberValue("name", new StringMemberValue("owner_tableName", cp)); joinColumn1.addMemberValue("referencedColumnName", new StringMemberValue("tableName", cp)); Annotation joinColumn2 = new Annotation(JoinColumn.class.getName(), cp); joinColumn2.addMemberValue("name", new StringMemberValue("owner_profileName", cp)); joinColumn2.addMemberValue("referencedColumnName", new StringMemberValue("profileName", cp)); ArrayMemberValue joinColumnsMemberValue = new ArrayMemberValue(cp); joinColumnsMemberValue.setValue(new MemberValue[] { new AnnotationMemberValue(joinColumn1,cp), new AnnotationMemberValue(joinColumn2,cp)}); joinColumns.addMemberValue("value", joinColumnsMemberValue); attr.addAnnotation(joinColumns); getter.getMethodInfo().addAttribute(attr); // generate concrete setProfileEntity method String setProfileEntityMethodSrc = "public void setProfileEntity("+ProfileEntity.class.getName()+" profileEntity){ setOwner(("+concreteProfileEntityClass.getName()+")profileEntity); }"; CtMethod setProfileEntityMethod = CtMethod.make(setProfileEntityMethodSrc, concreteArrayValueClass); concreteArrayValueClass.addMethod(setProfileEntityMethod); // write and load the attr array value class String deployDir = profileComponent.getDeploymentDir().getAbsolutePath(); if (logger.isDebugEnabled()) { logger.debug( "Writing PROFILE ATTR ARRAY VALUE CONCRETE CLASS ( "+concreteArrayValueClass.getName()+" ) to: " + deployDir ); } concreteArrayValueClass.writeFile( deployDir ); return Thread.currentThread().getContextClassLoader().loadClass(concreteArrayValueClass.getName()); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } finally { if (concreteArrayValueClass != null) { concreteArrayValueClass.defrost(); } } } }
public class class_name { private Class<?> generateProfileAttributeArrayValueClass(CtClass concreteProfileEntityClass, String profileAttributeName, boolean unique) { CtClass concreteArrayValueClass = null; try { // define the concrete profile attribute array value class name String concreteArrayValueClassName = profileComponent.getProfileCmpInterfaceClass().getName() + "PEAAV_"+ClassGeneratorUtils.capitalize(profileAttributeName); // create javassist class concreteArrayValueClass = ClassGeneratorUtils.createClass(concreteArrayValueClassName, new String[]{Serializable.class.getName()}); // set inheritance ClassGeneratorUtils.createInheritanceLink(concreteArrayValueClass, ProfileEntityArrayAttributeValue.class.getName()); // annotate class with @Entity ClassGeneratorUtils.addAnnotation( Entity.class.getName(), new LinkedHashMap<String, Object>(), concreteArrayValueClass ); // generate a random table name addTableAnnotationToPEAAV("SLEE_PEAAV_"+profileComponent.getProfileCmpInterfaceClass().getSimpleName() + "_" + Math.abs((long)profileComponent.getComponentID().hashCode()) + profileAttributeName,unique,concreteArrayValueClass); // override @id String getIdNameMethodSrc = "public long getId() { return super.getId(); }"; CtMethod getIdNameMethod = CtNewMethod.make(getIdNameMethodSrc, concreteArrayValueClass); ClassGeneratorUtils.addAnnotation( Id.class.getName(), new LinkedHashMap<String, Object>(), getIdNameMethod); ClassGeneratorUtils.addAnnotation( GeneratedValue.class.getName(), new LinkedHashMap<String, Object>(), getIdNameMethod); concreteArrayValueClass.addMethod(getIdNameMethod); // override getter methods String getSerializableMethodSrc = "public "+Serializable.class.getName()+" getSerializable() { return super.getSerializable(); }"; CtMethod getSerializableMethod = CtNewMethod.make(getSerializableMethodSrc, concreteArrayValueClass); LinkedHashMap<String,Object> map = new LinkedHashMap<String, Object>(); map.put("name", "serializable"); map.put("length", 512); //if (unique)map.put("unique", true); ClassGeneratorUtils.addAnnotation(Column.class.getName(), map, getSerializableMethod); concreteArrayValueClass.addMethod(getSerializableMethod); String getStringMethodSrc = "public String getString() { return super.getString(); }"; CtMethod getStringMethod = CtNewMethod.make(getStringMethodSrc, concreteArrayValueClass); map = new LinkedHashMap<String, Object>(); map.put("name", "string"); //if (unique)map.put("unique", true); ClassGeneratorUtils.addAnnotation(Column.class.getName(), map, getStringMethod); concreteArrayValueClass.addMethod(getStringMethod); // FIXME add join columns here or in profile entity class to make // the relation without a join table, atm if this is changed, the // inserts on this table go with profile and table name as null %) // THE PROFILENTITY FIELD IN AAV CLASS IS REQUIRED FOR THE RELATION WITH PROFILE ENTITY CLASS WITHOUT A JOIN TABLE // add join column regarding the relation from array attr value to profile entity CtField ctField = ClassGeneratorUtils.addField(concreteProfileEntityClass, "owner", concreteArrayValueClass); ClassGeneratorUtils.generateSetter(ctField,null); CtMethod getter = ClassGeneratorUtils.generateGetter(ctField,null); //ClassGeneratorUtils.addAnnotation(ManyToOne.class.getName(), new LinkedHashMap<String, Object>(), getter); // ---- ConstPool cp = getter.getMethodInfo().getConstPool(); AnnotationsAttribute attr = (AnnotationsAttribute) getter.getMethodInfo().getAttribute(AnnotationsAttribute.visibleTag); if (attr == null) { attr = new AnnotationsAttribute(cp,AnnotationsAttribute.visibleTag); // depends on control dependency: [if], data = [none] } Annotation manyToOne = new Annotation(ManyToOne.class.getName(), cp); manyToOne.addMemberValue("optional", new BooleanMemberValue(false,cp)); attr.addAnnotation(manyToOne); Annotation joinColumns = new Annotation(JoinColumns.class.getName(), cp); Annotation joinColumn1 = new Annotation(JoinColumn.class.getName(), cp); joinColumn1.addMemberValue("name", new StringMemberValue("owner_tableName", cp)); joinColumn1.addMemberValue("referencedColumnName", new StringMemberValue("tableName", cp)); Annotation joinColumn2 = new Annotation(JoinColumn.class.getName(), cp); joinColumn2.addMemberValue("name", new StringMemberValue("owner_profileName", cp)); joinColumn2.addMemberValue("referencedColumnName", new StringMemberValue("profileName", cp)); ArrayMemberValue joinColumnsMemberValue = new ArrayMemberValue(cp); joinColumnsMemberValue.setValue(new MemberValue[] { new AnnotationMemberValue(joinColumn1,cp), new AnnotationMemberValue(joinColumn2,cp)}); joinColumns.addMemberValue("value", joinColumnsMemberValue); attr.addAnnotation(joinColumns); getter.getMethodInfo().addAttribute(attr); // generate concrete setProfileEntity method String setProfileEntityMethodSrc = "public void setProfileEntity("+ProfileEntity.class.getName()+" profileEntity){ setOwner(("+concreteProfileEntityClass.getName()+")profileEntity); }"; CtMethod setProfileEntityMethod = CtMethod.make(setProfileEntityMethodSrc, concreteArrayValueClass); concreteArrayValueClass.addMethod(setProfileEntityMethod); // write and load the attr array value class String deployDir = profileComponent.getDeploymentDir().getAbsolutePath(); if (logger.isDebugEnabled()) { logger.debug( "Writing PROFILE ATTR ARRAY VALUE CONCRETE CLASS ( "+concreteArrayValueClass.getName()+" ) to: " + deployDir ); } concreteArrayValueClass.writeFile( deployDir ); return Thread.currentThread().getContextClassLoader().loadClass(concreteArrayValueClass.getName()); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } finally { if (concreteArrayValueClass != null) { concreteArrayValueClass.defrost(); } } } }
public class class_name { public void setProperty(String key, String val) { ArrayList list = null; Object oldValue = null; oldValue = getProperty(key); appProps.setProperty(key, val); if (listeners.containsKey(key)) { list = (ArrayList)listeners.get(key); int len = list.size(); if (len > 0) { PropertyChangeEvent evt = new PropertyChangeEvent(this, key, oldValue, val); for (Object aList : list) { if (aList instanceof PropertyChangeListener) ((PropertyChangeListener) aList).propertyChange(evt); } } } } }
public class class_name { public void setProperty(String key, String val) { ArrayList list = null; Object oldValue = null; oldValue = getProperty(key); appProps.setProperty(key, val); if (listeners.containsKey(key)) { list = (ArrayList)listeners.get(key); // depends on control dependency: [if], data = [none] int len = list.size(); if (len > 0) { PropertyChangeEvent evt = new PropertyChangeEvent(this, key, oldValue, val); for (Object aList : list) { if (aList instanceof PropertyChangeListener) ((PropertyChangeListener) aList).propertyChange(evt); } } } } }
public class class_name { private void addLineString(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, LineString lineString) { List<Point> points = lineString.getPoints(); if (points.size() >= 2) { // Try to simplify the number of points in the LineString points = simplifyPoints(simplifyTolerance, points); for (int i = 0; i < points.size(); i++) { Point point = points.get(i); Point webMercatorPoint = transform.transform(point); float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox, webMercatorPoint.getX()); float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox, webMercatorPoint.getY()); if (i == 0) { path.moveTo(x, y); } else { path.lineTo(x, y); } } } } }
public class class_name { private void addLineString(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, LineString lineString) { List<Point> points = lineString.getPoints(); if (points.size() >= 2) { // Try to simplify the number of points in the LineString points = simplifyPoints(simplifyTolerance, points); // depends on control dependency: [if], data = [none] for (int i = 0; i < points.size(); i++) { Point point = points.get(i); Point webMercatorPoint = transform.transform(point); float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox, webMercatorPoint.getX()); float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox, webMercatorPoint.getY()); if (i == 0) { path.moveTo(x, y); // depends on control dependency: [if], data = [none] } else { path.lineTo(x, y); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static void setCookieValue(HttpServletResponse response, String cookieName, String cookieValue, int expireInHour) { Cookie cookie = new Cookie(cookieName, cookieValue); if (expireInHour > 0) { cookie.setMaxAge(60 * 60 * 24 * expireInHour); } else { cookie.setMaxAge(60 * 60 * 24); } response.addCookie(cookie); } }
public class class_name { public static void setCookieValue(HttpServletResponse response, String cookieName, String cookieValue, int expireInHour) { Cookie cookie = new Cookie(cookieName, cookieValue); if (expireInHour > 0) { cookie.setMaxAge(60 * 60 * 24 * expireInHour); // depends on control dependency: [if], data = [none] } else { cookie.setMaxAge(60 * 60 * 24); // depends on control dependency: [if], data = [none] } response.addCookie(cookie); } }
public class class_name { protected String findMatch(Parameter parameter) { for (String regex : overloadedNamesRegexs) { if (parameter.name().matches(regex)) { return regex; } } return null; } }
public class class_name { protected String findMatch(Parameter parameter) { for (String regex : overloadedNamesRegexs) { if (parameter.name().matches(regex)) { return regex; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static double calculateLofWithUpdate(int kn, int max, LofPoint addedPoint, LofDataSet dataSet) { // データ数が最大に達している場合には古い方からデータの削除を行う String deleteId = addPointToDataSet(max, addedPoint, dataSet); // K距離、K距離近傍、局所到達可能密度の更新を行う対象点の一覧を取得する。 Set<String> updateTargets = generateUpdateTargets(addedPoint, dataSet, deleteId); Collection<LofPoint> targetList = dataSet.getDataMap().values(); // K距離、K距離近傍を全て更新した後局所到達可能密度を更新する必要があるため、2ブロックに分けて行う。 for (LofPoint targetPoint : targetList) { if (updateTargets.contains(targetPoint.getDataId())) { // 対象点のK距離、K距離近傍を更新する。 updateKDistance(kn, targetPoint, dataSet); } } // K距離の更新によって「K距離が更新された点」をK距離近傍に含む点の到達可能距離/局所到達可能密度も更新される // 実質的にほぼすべての点の到達可能距離/局所到達可能密度が更新される形になるため、全点に対して算出を行う。 for (LofPoint targetPoint : targetList) { // 対象点の局所到達可能密度を更新する。 updateLrd(targetPoint, dataSet); } // 対象の局所外れ係数を算出する。「addedPoint」は必ずK距離、K距離近傍、局所到達可能密度の対象となり、値が設定されているためそのまま用いる。 double lof = calculateLof(addedPoint, dataSet); return lof; } }
public class class_name { public static double calculateLofWithUpdate(int kn, int max, LofPoint addedPoint, LofDataSet dataSet) { // データ数が最大に達している場合には古い方からデータの削除を行う String deleteId = addPointToDataSet(max, addedPoint, dataSet); // K距離、K距離近傍、局所到達可能密度の更新を行う対象点の一覧を取得する。 Set<String> updateTargets = generateUpdateTargets(addedPoint, dataSet, deleteId); Collection<LofPoint> targetList = dataSet.getDataMap().values(); // K距離、K距離近傍を全て更新した後局所到達可能密度を更新する必要があるため、2ブロックに分けて行う。 for (LofPoint targetPoint : targetList) { if (updateTargets.contains(targetPoint.getDataId())) { // 対象点のK距離、K距離近傍を更新する。 updateKDistance(kn, targetPoint, dataSet); // depends on control dependency: [if], data = [none] } } // K距離の更新によって「K距離が更新された点」をK距離近傍に含む点の到達可能距離/局所到達可能密度も更新される // 実質的にほぼすべての点の到達可能距離/局所到達可能密度が更新される形になるため、全点に対して算出を行う。 for (LofPoint targetPoint : targetList) { // 対象点の局所到達可能密度を更新する。 updateLrd(targetPoint, dataSet); // depends on control dependency: [for], data = [targetPoint] } // 対象の局所外れ係数を算出する。「addedPoint」は必ずK距離、K距離近傍、局所到達可能密度の対象となり、値が設定されているためそのまま用いる。 double lof = calculateLof(addedPoint, dataSet); return lof; } }
public class class_name { protected FromHostPrimitiveResult < T > fromHostInternal( Class < T > javaClass, CobolContext cobolContext, byte[] hostData, int start) { int hostBytesLen = getBytesLen(); int pos = start; // Copies the mainframe data into a byte buffer large enough for the // target // java Number and sets position to zero so that value can be extracted // straight away. ByteBuffer bb = ByteBuffer.allocate(bufferLen); if (bb.capacity() > hostBytesLen) { // More java capacity than host bytes // Left pad depending on sign byte padByte = (isSigned() && isNegative(hostData[start])) ? (byte) 0xFF : (byte) 0x00; for (int i = 0; i < bb.capacity() - hostBytesLen; i++) { bb.put(padByte); } } else { if (bb.capacity() < hostBytesLen) { // More host bytes than java capacity // If host first bytes are insignificant, we might still be // able to fit in the desired java Type int leading00 = 0; int leadingFF = 0; int excessBytes = hostBytesLen - bb.capacity(); while (pos < start + excessBytes) { if (hostData[pos] == (byte) 0x00) { leading00++; } else if (hostData[pos] == (byte) 0xFF) { leadingFF++; } pos++; } if ((leading00 != excessBytes) && (leadingFF != excessBytes || !isNegative(hostData[pos]))) { return new FromHostPrimitiveResult < T >( "Host " + hostBytesLen + " bytes numeric is too large for the target java type " + javaClass.getName(), hostData, start, hostBytesLen); } } // If the MSB is set for an unsigned numeric then it is not going to // fit in the target java Number (which is always signed) if (!isSigned() && isNegative(hostData[pos])) { return new FromHostPrimitiveResult < T >("Host unsigned " + hostBytesLen + " bytes numeric" + " is too large for the target java type " + javaClass.getName(), hostData, start, hostBytesLen); } } bb.put(hostData, pos, hostBytesLen - (pos - start)); bb.position(0); T value = valueOf(javaClass, bb, getFractionDigits()); return new FromHostPrimitiveResult < T >(value); } }
public class class_name { protected FromHostPrimitiveResult < T > fromHostInternal( Class < T > javaClass, CobolContext cobolContext, byte[] hostData, int start) { int hostBytesLen = getBytesLen(); int pos = start; // Copies the mainframe data into a byte buffer large enough for the // target // java Number and sets position to zero so that value can be extracted // straight away. ByteBuffer bb = ByteBuffer.allocate(bufferLen); if (bb.capacity() > hostBytesLen) { // More java capacity than host bytes // Left pad depending on sign byte padByte = (isSigned() && isNegative(hostData[start])) ? (byte) 0xFF : (byte) 0x00; for (int i = 0; i < bb.capacity() - hostBytesLen; i++) { bb.put(padByte); // depends on control dependency: [for], data = [none] } } else { if (bb.capacity() < hostBytesLen) { // More host bytes than java capacity // If host first bytes are insignificant, we might still be // able to fit in the desired java Type int leading00 = 0; int leadingFF = 0; int excessBytes = hostBytesLen - bb.capacity(); while (pos < start + excessBytes) { if (hostData[pos] == (byte) 0x00) { leading00++; // depends on control dependency: [if], data = [none] } else if (hostData[pos] == (byte) 0xFF) { leadingFF++; // depends on control dependency: [if], data = [none] } pos++; // depends on control dependency: [while], data = [none] } if ((leading00 != excessBytes) && (leadingFF != excessBytes || !isNegative(hostData[pos]))) { return new FromHostPrimitiveResult < T >( "Host " + hostBytesLen + " bytes numeric is too large for the target java type " + javaClass.getName(), hostData, start, hostBytesLen); // depends on control dependency: [if], data = [none] } } // If the MSB is set for an unsigned numeric then it is not going to // fit in the target java Number (which is always signed) if (!isSigned() && isNegative(hostData[pos])) { return new FromHostPrimitiveResult < T >("Host unsigned " + hostBytesLen + " bytes numeric" + " is too large for the target java type " + javaClass.getName(), hostData, start, hostBytesLen); // depends on control dependency: [if], data = [none] } } bb.put(hostData, pos, hostBytesLen - (pos - start)); bb.position(0); T value = valueOf(javaClass, bb, getFractionDigits()); return new FromHostPrimitiveResult < T >(value); } }
public class class_name { private void checkHkFirstMode() { final boolean guiceyFirstMode = context.option(JerseyExtensionsManagedByGuice); if (!guiceyFirstMode) { Preconditions.checkState(context.option(UseHkBridge), "HK2 management for jersey extensions is enabled by default " + "(InstallersOptions.JerseyExtensionsManagedByGuice), but HK2-guice bridge is not " + "enabled. Use GuiceyOptions.UseHkBridge option to enable bridge " + "(extra dependency is required)"); } } }
public class class_name { private void checkHkFirstMode() { final boolean guiceyFirstMode = context.option(JerseyExtensionsManagedByGuice); if (!guiceyFirstMode) { Preconditions.checkState(context.option(UseHkBridge), "HK2 management for jersey extensions is enabled by default " + "(InstallersOptions.JerseyExtensionsManagedByGuice), but HK2-guice bridge is not " + "enabled. Use GuiceyOptions.UseHkBridge option to enable bridge " + "(extra dependency is required)"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addNodes(DTMIterator iterator) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); if (null != iterator) // defensive to fix a bug that Sanjiva reported. { int obj; while (DTM.NULL != (obj = iterator.nextNode())) { addElement(obj); } } // checkDups(); } }
public class class_name { public void addNodes(DTMIterator iterator) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); if (null != iterator) // defensive to fix a bug that Sanjiva reported. { int obj; while (DTM.NULL != (obj = iterator.nextNode())) { addElement(obj); // depends on control dependency: [while], data = [none] } } // checkDups(); } }
public class class_name { public void evaluate(PermutationSolution<Integer> solution){ double fitness1 ; double fitness2 ; fitness1 = 0.0 ; fitness2 = 0.0 ; for (int i = 0; i < (numberOfCities - 1); i++) { int x ; int y ; x = solution.getVariableValue(i) ; y = solution.getVariableValue(i+1) ; fitness1 += distanceMatrix[x][y] ; fitness2 += costMatrix[x][y]; } int firstCity ; int lastCity ; firstCity = solution.getVariableValue(0) ; lastCity = solution.getVariableValue(numberOfCities - 1) ; fitness1 += distanceMatrix[firstCity][lastCity] ; fitness2 += costMatrix[firstCity][lastCity]; solution.setObjective(0, fitness1); solution.setObjective(1, fitness2); } }
public class class_name { public void evaluate(PermutationSolution<Integer> solution){ double fitness1 ; double fitness2 ; fitness1 = 0.0 ; fitness2 = 0.0 ; for (int i = 0; i < (numberOfCities - 1); i++) { int x ; int y ; x = solution.getVariableValue(i) ; // depends on control dependency: [for], data = [i] y = solution.getVariableValue(i+1) ; // depends on control dependency: [for], data = [i] fitness1 += distanceMatrix[x][y] ; // depends on control dependency: [for], data = [none] fitness2 += costMatrix[x][y]; // depends on control dependency: [for], data = [none] } int firstCity ; int lastCity ; firstCity = solution.getVariableValue(0) ; lastCity = solution.getVariableValue(numberOfCities - 1) ; fitness1 += distanceMatrix[firstCity][lastCity] ; fitness2 += costMatrix[firstCity][lastCity]; solution.setObjective(0, fitness1); solution.setObjective(1, fitness2); } }
public class class_name { private static void doAppendEscapedLiteral(Appendable sbuf, String value, boolean standardConformingStrings) throws SQLException { try { if (standardConformingStrings) { // With standard_conforming_strings on, escape only single-quotes. for (int i = 0; i < value.length(); ++i) { char ch = value.charAt(i); if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\'') { sbuf.append('\''); } sbuf.append(ch); } } else { // With standard_conforming_string off, escape backslashes and // single-quotes, but still escape single-quotes by doubling, to // avoid a security hazard if the reported value of // standard_conforming_strings is incorrect, or an error if // backslash_quote is off. for (int i = 0; i < value.length(); ++i) { char ch = value.charAt(i); if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\\' || ch == '\'') { sbuf.append(ch); } sbuf.append(ch); } } } catch (IOException e) { throw new PSQLException(GT.tr("No IOException expected from StringBuffer or StringBuilder"), PSQLState.UNEXPECTED_ERROR, e); } } }
public class class_name { private static void doAppendEscapedLiteral(Appendable sbuf, String value, boolean standardConformingStrings) throws SQLException { try { if (standardConformingStrings) { // With standard_conforming_strings on, escape only single-quotes. for (int i = 0; i < value.length(); ++i) { char ch = value.charAt(i); if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\'') { sbuf.append('\''); // depends on control dependency: [if], data = ['\'')] } sbuf.append(ch); } } else { // With standard_conforming_string off, escape backslashes and // single-quotes, but still escape single-quotes by doubling, to // avoid a security hazard if the reported value of // standard_conforming_strings is incorrect, or an error if // backslash_quote is off. for (int i = 0; i < value.length(); ++i) { char ch = value.charAt(i); if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\\' || ch == '\'') { sbuf.append(ch); } sbuf.append(ch); } } } catch (IOException e) { throw new PSQLException(GT.tr("No IOException expected from StringBuffer or StringBuilder"), PSQLState.UNEXPECTED_ERROR, e); } } }
public class class_name { public boolean match(final int value) { if (a == 0) { return value == b; } if (a > 0) { if (value < b) { return false; } return (value - b) % a == 0; } if (value > b) { return false; } return (b - value) % (-a) == 0; } }
public class class_name { public boolean match(final int value) { if (a == 0) { return value == b; // depends on control dependency: [if], data = [none] } if (a > 0) { if (value < b) { return false; // depends on control dependency: [if], data = [none] } return (value - b) % a == 0; // depends on control dependency: [if], data = [none] } if (value > b) { return false; // depends on control dependency: [if], data = [none] } return (b - value) % (-a) == 0; } }
public class class_name { public static String getVersion() { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader == null) { classLoader = Togglz.class.getClassLoader(); } URL url = classLoader.getResource("META-INF/maven/org.togglz/togglz-core/pom.properties"); if (url != null) { InputStream stream = null; try { stream = url.openStream(); Properties props = new Properties(); props.load(stream); return Strings.trimToNull(props.getProperty("version")); } catch (IOException e) { // ignore } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } } } return null; } }
public class class_name { public static String getVersion() { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader == null) { classLoader = Togglz.class.getClassLoader(); // depends on control dependency: [if], data = [none] } URL url = classLoader.getResource("META-INF/maven/org.togglz/togglz-core/pom.properties"); if (url != null) { InputStream stream = null; try { stream = url.openStream(); // depends on control dependency: [try], data = [none] Properties props = new Properties(); props.load(stream); // depends on control dependency: [try], data = [none] return Strings.trimToNull(props.getProperty("version")); // depends on control dependency: [try], data = [none] } catch (IOException e) { // ignore } finally { // depends on control dependency: [catch], data = [none] if (stream != null) { try { stream.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { // ignore } // depends on control dependency: [catch], data = [none] } } } return null; } }
public class class_name { public static boolean doesParameterExist(final HttpServletRequest request, final String name) { val parameter = request.getParameter(name); if (StringUtils.isBlank(parameter)) { LOGGER.error("Missing request parameter: [{}]", name); return false; } LOGGER.debug("Found provided request parameter [{}]", name); return true; } }
public class class_name { public static boolean doesParameterExist(final HttpServletRequest request, final String name) { val parameter = request.getParameter(name); if (StringUtils.isBlank(parameter)) { LOGGER.error("Missing request parameter: [{}]", name); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } LOGGER.debug("Found provided request parameter [{}]", name); return true; } }
public class class_name { static void rcvCreateProducerSess(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvCreateProducerSess", new Object[] { request, conversation, "" + requestNumber, "" + allocatedFromBufferPool, "" + partOfExchange }); ConversationState convState = (ConversationState) conversation.getAttachment(); short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId short orderId = request.getShort(); // BIT32 MessageOrderId short destinationTypeShort = request.getShort(); // BIT16 DestinationType boolean bindToQueuePoint = false; // Default value SIB0113.comms.1 start boolean preferLocalQueuePoint = true; // Default value final HandshakeProperties handshakeProps = conversation.getHandshakeProperties(); if (handshakeProps.getFapLevel() >= JFapChannelConstants.FAP_VERSION_9) { final short producerFlags = request.getShort(); if (producerFlags > CommsConstants.PF_MAX_VALID) { // The flags appear to be invalid if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Producer flags (" + producerFlags + ") > " + CommsConstants.PF_MAX_VALID); SIErrorException e = new SIErrorException(nls.getFormattedMessage("INVALID_PROP_SICO8018", new Object[] { "" + producerFlags }, null)); FFDCFilter.processException(e, CLASS_NAME + ".rcvCreateProducerSess", CommsConstants.STATICCATPRODUCER_CREATE_03); throw e; } bindToQueuePoint = (producerFlags & CommsConstants.PF_BIND_TO_QUEUE_POINT) != 0; preferLocalQueuePoint = (producerFlags & CommsConstants.PF_PREFER_LOCAL_QUEUE_POINT) != 0; } //SIB0113.comms.1 end if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "ConnectionObjectID", connectionObjectID); SibTr.debug(tc, "MessageOrderId", orderId); SibTr.debug(tc, "DestinationType", destinationTypeShort); SibTr.debug(tc, "BindToQueuePoint", bindToQueuePoint); //SIB0113.comms.1 SibTr.debug(tc, "PreferLocalQueuePoint", preferLocalQueuePoint); //SIB0113.comms.1 } /**************************************************************/ /* Destination Type */ /**************************************************************/ DestinationType destType = null; if (destinationTypeShort != CommsConstants.NO_DEST_TYPE) { destType = DestinationType.getDestinationType(destinationTypeShort); } try { /**************************************************************/ /* Destination information */ /**************************************************************/ SIDestinationAddress destAddress = request.getSIDestinationAddress(conversation.getHandshakeProperties().getFapLevel()); /**************************************************************/ /* Discriminator */ /**************************************************************/ String discriminator = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Discriminator:", discriminator); /**************************************************************/ /* Alternate User Id */ /**************************************************************/ String alternateUser = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Alternate User Id:", alternateUser); SICoreConnection connection = ((CATConnection) convState.getObject(connectionObjectID)).getSICoreConnection(); OrderingContext siOrder = null; if (orderId != CommsConstants.NO_ORDER_CONTEXT) { siOrder = ((CATOrderingContext) convState.getObject(orderId)).getOrderingContext(); } ProducerSession prodSession = connection.createProducerSession(destAddress, discriminator, destType, siOrder, alternateUser, bindToQueuePoint, //SIB0113.comms.1 preferLocalQueuePoint); //SIB0113.comms.1 short prodSessionObjectID = (short) convState.addObject(prodSession); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Producer Session Id:", prodSessionObjectID); StaticCATHelper.sendSessionCreateResponse(JFapChannelConstants.SEG_CREATE_PRODUCER_SESS_R, requestNumber, conversation, prodSessionObjectID, prodSession, destAddress); } catch (SINotAuthorizedException e) { // No FFDC Code Needed if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, null, conversation, requestNumber); } catch (SIException e) { //No FFDC code needed - processor will have already FFDC'ed any interesting ones.... if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATPRODUCER_CREATE_01, conversation, requestNumber); } catch (ConversationStateFullException e) { SILimitExceededException ex = new SILimitExceededException(nls.getFormattedMessage("MAX_SESSIONS_REACHED_SICO1019", new Object[] { "" + Short.MAX_VALUE }, null)); FFDCFilter.processException(ex, CLASS_NAME + ".rcvCreateProducerSess", CommsConstants.STATICCATPRODUCER_CREATE_02); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATPRODUCER_CREATE_02, conversation, requestNumber); } request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvCreateProducerSess"); } }
public class class_name { static void rcvCreateProducerSess(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvCreateProducerSess", new Object[] { request, conversation, "" + requestNumber, "" + allocatedFromBufferPool, "" + partOfExchange }); ConversationState convState = (ConversationState) conversation.getAttachment(); short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId short orderId = request.getShort(); // BIT32 MessageOrderId short destinationTypeShort = request.getShort(); // BIT16 DestinationType boolean bindToQueuePoint = false; // Default value SIB0113.comms.1 start boolean preferLocalQueuePoint = true; // Default value final HandshakeProperties handshakeProps = conversation.getHandshakeProperties(); if (handshakeProps.getFapLevel() >= JFapChannelConstants.FAP_VERSION_9) { final short producerFlags = request.getShort(); if (producerFlags > CommsConstants.PF_MAX_VALID) { // The flags appear to be invalid if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Producer flags (" + producerFlags + ") > " + CommsConstants.PF_MAX_VALID); SIErrorException e = new SIErrorException(nls.getFormattedMessage("INVALID_PROP_SICO8018", new Object[] { "" + producerFlags }, null)); FFDCFilter.processException(e, CLASS_NAME + ".rcvCreateProducerSess", CommsConstants.STATICCATPRODUCER_CREATE_03); // depends on control dependency: [if], data = [none] throw e; } bindToQueuePoint = (producerFlags & CommsConstants.PF_BIND_TO_QUEUE_POINT) != 0; // depends on control dependency: [if], data = [none] preferLocalQueuePoint = (producerFlags & CommsConstants.PF_PREFER_LOCAL_QUEUE_POINT) != 0; // depends on control dependency: [if], data = [none] } //SIB0113.comms.1 end if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "ConnectionObjectID", connectionObjectID); // depends on control dependency: [if], data = [none] SibTr.debug(tc, "MessageOrderId", orderId); // depends on control dependency: [if], data = [none] SibTr.debug(tc, "DestinationType", destinationTypeShort); // depends on control dependency: [if], data = [none] SibTr.debug(tc, "BindToQueuePoint", bindToQueuePoint); //SIB0113.comms.1 // depends on control dependency: [if], data = [none] SibTr.debug(tc, "PreferLocalQueuePoint", preferLocalQueuePoint); //SIB0113.comms.1 // depends on control dependency: [if], data = [none] } /**************************************************************/ /* Destination Type */ /**************************************************************/ DestinationType destType = null; if (destinationTypeShort != CommsConstants.NO_DEST_TYPE) { destType = DestinationType.getDestinationType(destinationTypeShort); // depends on control dependency: [if], data = [(destinationTypeShort] } try { /**************************************************************/ /* Destination information */ /**************************************************************/ SIDestinationAddress destAddress = request.getSIDestinationAddress(conversation.getHandshakeProperties().getFapLevel()); /**************************************************************/ /* Discriminator */ /**************************************************************/ String discriminator = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Discriminator:", discriminator); /**************************************************************/ /* Alternate User Id */ /**************************************************************/ String alternateUser = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Alternate User Id:", alternateUser); SICoreConnection connection = ((CATConnection) convState.getObject(connectionObjectID)).getSICoreConnection(); OrderingContext siOrder = null; if (orderId != CommsConstants.NO_ORDER_CONTEXT) { siOrder = ((CATOrderingContext) convState.getObject(orderId)).getOrderingContext(); // depends on control dependency: [if], data = [(orderId] } ProducerSession prodSession = connection.createProducerSession(destAddress, discriminator, destType, siOrder, alternateUser, bindToQueuePoint, //SIB0113.comms.1 preferLocalQueuePoint); //SIB0113.comms.1 short prodSessionObjectID = (short) convState.addObject(prodSession); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Producer Session Id:", prodSessionObjectID); StaticCATHelper.sendSessionCreateResponse(JFapChannelConstants.SEG_CREATE_PRODUCER_SESS_R, requestNumber, conversation, prodSessionObjectID, prodSession, destAddress); // depends on control dependency: [try], data = [none] } catch (SINotAuthorizedException e) { // No FFDC Code Needed if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, null, conversation, requestNumber); } catch (SIException e) // depends on control dependency: [catch], data = [none] { //No FFDC code needed - processor will have already FFDC'ed any interesting ones.... if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATPRODUCER_CREATE_01, conversation, requestNumber); } catch (ConversationStateFullException e) // depends on control dependency: [catch], data = [none] { SILimitExceededException ex = new SILimitExceededException(nls.getFormattedMessage("MAX_SESSIONS_REACHED_SICO1019", new Object[] { "" + Short.MAX_VALUE }, null)); FFDCFilter.processException(ex, CLASS_NAME + ".rcvCreateProducerSess", CommsConstants.STATICCATPRODUCER_CREATE_02); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATPRODUCER_CREATE_02, conversation, requestNumber); } // depends on control dependency: [catch], data = [none] request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvCreateProducerSess"); } }
public class class_name { private static PermutationParity fill2DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected, Point2d[] coordinates, int[] elevations, int offset) { int i = 0; coordinates[offset + 1] = a.getPoint2d(); elevations[offset + 1] = 0; int[] indices = new int[2]; for (IBond bond : connected) { if (!isDoubleBond(bond)) { IAtom other = bond.getOther(a); coordinates[i + offset] = other.getPoint2d(); elevations[i + offset] = elevation(bond, a); indices[i] = container.indexOf(other); i++; } } if (i == 1) { return PermutationParity.IDENTITY; } else { return new BasicPermutationParity(indices); } } }
public class class_name { private static PermutationParity fill2DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected, Point2d[] coordinates, int[] elevations, int offset) { int i = 0; coordinates[offset + 1] = a.getPoint2d(); elevations[offset + 1] = 0; int[] indices = new int[2]; for (IBond bond : connected) { if (!isDoubleBond(bond)) { IAtom other = bond.getOther(a); coordinates[i + offset] = other.getPoint2d(); // depends on control dependency: [if], data = [none] elevations[i + offset] = elevation(bond, a); // depends on control dependency: [if], data = [none] indices[i] = container.indexOf(other); // depends on control dependency: [if], data = [none] i++; // depends on control dependency: [if], data = [none] } } if (i == 1) { return PermutationParity.IDENTITY; // depends on control dependency: [if], data = [none] } else { return new BasicPermutationParity(indices); // depends on control dependency: [if], data = [(i] } } }
public class class_name { protected void parseValueConstraints( TokenStream tokens, JcrPropertyDefinitionTemplate propDefn ) { if (tokens.canConsume('<')) { List<String> defaultValues = parseStringList(tokens); if (!defaultValues.isEmpty()) { propDefn.setValueConstraints(strings(defaultValues)); } } } }
public class class_name { protected void parseValueConstraints( TokenStream tokens, JcrPropertyDefinitionTemplate propDefn ) { if (tokens.canConsume('<')) { List<String> defaultValues = parseStringList(tokens); if (!defaultValues.isEmpty()) { propDefn.setValueConstraints(strings(defaultValues)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static boolean hasValidAuthentication(String cookie) { boolean valid = false; if (StringUtils.isNotBlank(cookie)) { Config config = Application.getInstance(Config.class); String value = null; String [] contents = cookie.split(";"); for (String content : contents) { if (StringUtils.isNotBlank(content) && content.startsWith(config.getAuthenticationCookieName())) { value = StringUtils.substringAfter(content, config.getAuthenticationCookieName() + "="); value = PATTERN.matcher(value).replaceAll(""); } } if (StringUtils.isNotBlank(value)) { String jwt = Application.getInstance(Crypto.class).decrypt(value, config.getAuthenticationCookieEncryptionKey()); JwtConsumer jwtConsumer = new JwtConsumerBuilder() .setRequireExpirationTime() .setRequireSubject() .setVerificationKey(new HmacKey(config.getAuthenticationCookieSignKey().getBytes(StandardCharsets.UTF_8))) .setJwsAlgorithmConstraints(new AlgorithmConstraints(ConstraintType.WHITELIST, AlgorithmIdentifiers.HMAC_SHA512)) .build(); try { jwtConsumer.processToClaims(jwt); valid = true; } catch (InvalidJwtException e) { LOG.error("Failed to parse authentication cookie", e); } } } return valid; } }
public class class_name { public static boolean hasValidAuthentication(String cookie) { boolean valid = false; if (StringUtils.isNotBlank(cookie)) { Config config = Application.getInstance(Config.class); String value = null; String [] contents = cookie.split(";"); for (String content : contents) { if (StringUtils.isNotBlank(content) && content.startsWith(config.getAuthenticationCookieName())) { value = StringUtils.substringAfter(content, config.getAuthenticationCookieName() + "="); // depends on control dependency: [if], data = [none] value = PATTERN.matcher(value).replaceAll(""); // depends on control dependency: [if], data = [none] } } if (StringUtils.isNotBlank(value)) { String jwt = Application.getInstance(Crypto.class).decrypt(value, config.getAuthenticationCookieEncryptionKey()); JwtConsumer jwtConsumer = new JwtConsumerBuilder() .setRequireExpirationTime() .setRequireSubject() .setVerificationKey(new HmacKey(config.getAuthenticationCookieSignKey().getBytes(StandardCharsets.UTF_8))) .setJwsAlgorithmConstraints(new AlgorithmConstraints(ConstraintType.WHITELIST, AlgorithmIdentifiers.HMAC_SHA512)) .build(); try { jwtConsumer.processToClaims(jwt); // depends on control dependency: [try], data = [none] valid = true; // depends on control dependency: [try], data = [none] } catch (InvalidJwtException e) { LOG.error("Failed to parse authentication cookie", e); } // depends on control dependency: [catch], data = [none] } } return valid; } }
public class class_name { public URLConnection connectWithRedirect(URL theURL) throws IOException { URLConnection conn = null; String accept_header = buildAcceptHeader(); int redirect_count = 0; boolean done = false; while (!done) { if (theURL.getProtocol().equals("file")) { return null; } Boolean isHttp = (theURL.getProtocol().equals("http") || theURL .getProtocol().equals("https")); logger.debug("Requesting: " + theURL.toString()); conn = theURL.openConnection(); if (isHttp) { logger.debug("Accept: " + accept_header); conn.setRequestProperty("Accept", accept_header); } conn.setConnectTimeout(60000); conn.setReadTimeout(60000); conn.connect(); done = true; // by default quit after one request if (isHttp) { logger.debug("Response: " + conn.getHeaderField(0)); int rc = ((HttpURLConnection) conn).getResponseCode(); if ((rc == HttpURLConnection.HTTP_MOVED_PERM) || (rc == HttpURLConnection.HTTP_MOVED_TEMP) || (rc == HttpURLConnection.HTTP_SEE_OTHER) || (rc == 307)) { if (redirect_count > 10) { return null; // Error: too many redirects } redirect_count++; String loc = conn.getHeaderField("Location"); if (loc != null) { theURL = new URL(loc); done = false; } else { return null; // Bad redirect } } else if ((rc < 200) || (rc >= 300)) { return null; // Unsuccessful } } } return conn; } }
public class class_name { public URLConnection connectWithRedirect(URL theURL) throws IOException { URLConnection conn = null; String accept_header = buildAcceptHeader(); int redirect_count = 0; boolean done = false; while (!done) { if (theURL.getProtocol().equals("file")) { return null; // depends on control dependency: [if], data = [none] } Boolean isHttp = (theURL.getProtocol().equals("http") || theURL .getProtocol().equals("https")); logger.debug("Requesting: " + theURL.toString()); conn = theURL.openConnection(); if (isHttp) { logger.debug("Accept: " + accept_header); // depends on control dependency: [if], data = [none] conn.setRequestProperty("Accept", accept_header); // depends on control dependency: [if], data = [none] } conn.setConnectTimeout(60000); conn.setReadTimeout(60000); conn.connect(); done = true; // by default quit after one request if (isHttp) { logger.debug("Response: " + conn.getHeaderField(0)); // depends on control dependency: [if], data = [none] int rc = ((HttpURLConnection) conn).getResponseCode(); if ((rc == HttpURLConnection.HTTP_MOVED_PERM) || (rc == HttpURLConnection.HTTP_MOVED_TEMP) || (rc == HttpURLConnection.HTTP_SEE_OTHER) || (rc == 307)) { if (redirect_count > 10) { return null; // Error: too many redirects // depends on control dependency: [if], data = [none] } redirect_count++; // depends on control dependency: [if], data = [none] String loc = conn.getHeaderField("Location"); if (loc != null) { theURL = new URL(loc); // depends on control dependency: [if], data = [(loc] done = false; // depends on control dependency: [if], data = [none] } else { return null; // Bad redirect // depends on control dependency: [if], data = [none] } } else if ((rc < 200) || (rc >= 300)) { return null; // Unsuccessful // depends on control dependency: [if], data = [none] } } } return conn; } }
public class class_name { public static Object min(Comparable c1, Comparable c2) { if (c1 != null && c2 != null) { return c1.compareTo(c2) < 1 ? c1 : c2; } else { return c1 != null ? c1 : c2; } } }
public class class_name { public static Object min(Comparable c1, Comparable c2) { if (c1 != null && c2 != null) { return c1.compareTo(c2) < 1 ? c1 : c2; // depends on control dependency: [if], data = [none] } else { return c1 != null ? c1 : c2; // depends on control dependency: [if], data = [none] } } }
public class class_name { public ConversationReceiveListener dataReceived(WsByteBuffer data, int segmentType, int requestNumber, int priority, boolean allocatedFromBufferPool, boolean partOfExchange, Conversation conversation) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dataReceived", new Object[]{data, segmentType, requestNumber, priority, allocatedFromBufferPool, partOfExchange, }); // Wrap the byte buffer in a comms byte buffer for easier manipulation CommsByteBuffer buffer = bufferPool.allocate(); buffer.reset(data); // This flag will determine whether we can release the byte buffer at the end // of this method. Note we cannot release it if the message is destined for a // proxy queue - if we do, then when a client attempts to receive the message // it all falls over boolean releaseBuffer = true; // Now do a switch on the segment type that has been received switch (segmentType) { case (JFapChannelConstants.SEG_ASYNC_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received an ASYNC message"); releaseBuffer = false; processMessage(buffer, true, false, conversation, false); break; case (JFapChannelConstants.SEG_CHUNKED_ASYNC_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a chunked ASYNC message"); releaseBuffer = false; processMessage(buffer, true, false, conversation, true); break; case (JFapChannelConstants.SEG_BROWSE_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a BROWSE message"); releaseBuffer = false; processMessage(buffer, false, true, conversation, false); break; case (JFapChannelConstants.SEG_CHUNKED_BROWSE_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a chunked BROWSE message"); releaseBuffer = false; processMessage(buffer, false, true, conversation, true); break; case (JFapChannelConstants.SEG_PROXY_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a PROXY message"); releaseBuffer = false; processMessage(buffer, false, true, conversation, false); break; case (JFapChannelConstants.SEG_CHUNKED_PROXY_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a chunked PROXY message"); releaseBuffer = false; processMessage(buffer, false, true, conversation, true); break; case (JFapChannelConstants.SEG_EVENT_OCCURRED) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a Server Event"); processEvent(buffer, conversation); break; case (JFapChannelConstants.SEG_CONNECTION_INFO) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a connection info event"); processConnectionInfo(buffer, conversation); break; case (JFapChannelConstants.SEG_SEND_SCHEMA_NOREPLY) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a message schema"); processSchema(buffer, conversation); break; case (JFapChannelConstants.SEG_CHUNKED_SYNC_SESS_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a chunk of a SYNC message"); processSyncMessageChunk(buffer, conversation, false); break; case (JFapChannelConstants.SEG_CHUNKED_SYNC_CONN_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a chunk of a SYNC connection message"); processSyncMessageChunk(buffer, conversation, true); break; case (JFapChannelConstants.SEG_DESTINATION_LISTENER_CALLBACK_NOREPLY) : //SIB0137.comms.3 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a DestinationListener callback"); processDestinationListenerCallback(buffer, conversation); //SIB0137.comms.3 break; case (JFapChannelConstants.SEG_ASYNC_SESSION_STOPPED_NOREPLY) : //SIB0115d.comms if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received async session stopped callback"); processAsyncSessionStoppedCallback(buffer, conversation); //SIB0115d.comms break; case (JFapChannelConstants.SEG_REGISTER_CONSUMER_SET_MONITOR_CALLBACK_NOREPLY) : //F011127 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a ConsumerSetChangeCallback callback"); processConsumerSetChangeCallback(buffer, conversation); //F011127 break; default : // Here we have received something unexpected. Generate an // FFDC and close the conversation down. We do this as // something has obviously gone a bit wrong and this is // the safest thing to do at this point. // Get the connection info String connectionInfo = ((ClientConversationState) conversation.getAttachment()). getCommsConnection().getConnectionInfo(); String seg = segmentType + " (0x" + Integer.toHexString(segmentType).toUpperCase() + ")"; Exception e = new SIErrorException( nls.getFormattedMessage("UNEXPECTED_MESS_RECVD_SICO1010", new Object[] { seg, connectionInfo }, null) ); FFDCFilter.processException(e, CLASS_NAME + ".dataReceived", CommsConstants.PROXYRECEIVELISTENER_DATARCVD_01, new Object[] {SibTr.formatBytes(data.array(), 0, data.array().length), this}); SibTr.error(tc, "UNEXPECTED_MESS_RECVD_SICO1010", new Object[] { seg, connectionInfo }); // Try and close her down try { conversation.close(); } catch (SIConnectionLostException ce) { FFDCFilter.processException(e, CLASS_NAME + ".dataReceived", CommsConstants.PROXYRECEIVELISTENER_DATARCVD_02, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, ce.getMessage(), ce); } } // If we can release and repool the buffer do so. Otherwise, if it was used for a message // and cannot be released, simply repool any other resources except the actual buffer. if (allocatedFromBufferPool && releaseBuffer) { buffer.release(); } // else // { // buffer.release(false); // } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dataReceived"); // There is currently no requirement to change receive listeners in the client // so always return null return null; } }
public class class_name { public ConversationReceiveListener dataReceived(WsByteBuffer data, int segmentType, int requestNumber, int priority, boolean allocatedFromBufferPool, boolean partOfExchange, Conversation conversation) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dataReceived", new Object[]{data, segmentType, requestNumber, priority, allocatedFromBufferPool, partOfExchange, }); // Wrap the byte buffer in a comms byte buffer for easier manipulation CommsByteBuffer buffer = bufferPool.allocate(); buffer.reset(data); // This flag will determine whether we can release the byte buffer at the end // of this method. Note we cannot release it if the message is destined for a // proxy queue - if we do, then when a client attempts to receive the message // it all falls over boolean releaseBuffer = true; // Now do a switch on the segment type that has been received switch (segmentType) { case (JFapChannelConstants.SEG_ASYNC_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received an ASYNC message"); releaseBuffer = false; processMessage(buffer, true, false, conversation, false); break; case (JFapChannelConstants.SEG_CHUNKED_ASYNC_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a chunked ASYNC message"); releaseBuffer = false; processMessage(buffer, true, false, conversation, true); break; case (JFapChannelConstants.SEG_BROWSE_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a BROWSE message"); releaseBuffer = false; processMessage(buffer, false, true, conversation, false); break; case (JFapChannelConstants.SEG_CHUNKED_BROWSE_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a chunked BROWSE message"); releaseBuffer = false; processMessage(buffer, false, true, conversation, true); break; case (JFapChannelConstants.SEG_PROXY_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a PROXY message"); releaseBuffer = false; processMessage(buffer, false, true, conversation, false); break; case (JFapChannelConstants.SEG_CHUNKED_PROXY_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a chunked PROXY message"); releaseBuffer = false; processMessage(buffer, false, true, conversation, true); break; case (JFapChannelConstants.SEG_EVENT_OCCURRED) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a Server Event"); processEvent(buffer, conversation); break; case (JFapChannelConstants.SEG_CONNECTION_INFO) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a connection info event"); processConnectionInfo(buffer, conversation); break; case (JFapChannelConstants.SEG_SEND_SCHEMA_NOREPLY) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Received a message schema"); processSchema(buffer, conversation); break; case (JFapChannelConstants.SEG_CHUNKED_SYNC_SESS_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a chunk of a SYNC message"); processSyncMessageChunk(buffer, conversation, false); break; case (JFapChannelConstants.SEG_CHUNKED_SYNC_CONN_MESSAGE) : if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a chunk of a SYNC connection message"); processSyncMessageChunk(buffer, conversation, true); break; case (JFapChannelConstants.SEG_DESTINATION_LISTENER_CALLBACK_NOREPLY) : //SIB0137.comms.3 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a DestinationListener callback"); processDestinationListenerCallback(buffer, conversation); //SIB0137.comms.3 break; case (JFapChannelConstants.SEG_ASYNC_SESSION_STOPPED_NOREPLY) : //SIB0115d.comms if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received async session stopped callback"); processAsyncSessionStoppedCallback(buffer, conversation); //SIB0115d.comms break; case (JFapChannelConstants.SEG_REGISTER_CONSUMER_SET_MONITOR_CALLBACK_NOREPLY) : //F011127 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a ConsumerSetChangeCallback callback"); processConsumerSetChangeCallback(buffer, conversation); //F011127 break; default : // Here we have received something unexpected. Generate an // FFDC and close the conversation down. We do this as // something has obviously gone a bit wrong and this is // the safest thing to do at this point. // Get the connection info String connectionInfo = ((ClientConversationState) conversation.getAttachment()). getCommsConnection().getConnectionInfo(); String seg = segmentType + " (0x" + Integer.toHexString(segmentType).toUpperCase() + ")"; Exception e = new SIErrorException( nls.getFormattedMessage("UNEXPECTED_MESS_RECVD_SICO1010", new Object[] { seg, connectionInfo }, null) ); FFDCFilter.processException(e, CLASS_NAME + ".dataReceived", CommsConstants.PROXYRECEIVELISTENER_DATARCVD_01, new Object[] {SibTr.formatBytes(data.array(), 0, data.array().length), this}); SibTr.error(tc, "UNEXPECTED_MESS_RECVD_SICO1010", new Object[] { seg, connectionInfo }); // Try and close her down try { conversation.close(); // depends on control dependency: [try], data = [none] } catch (SIConnectionLostException ce) { FFDCFilter.processException(e, CLASS_NAME + ".dataReceived", CommsConstants.PROXYRECEIVELISTENER_DATARCVD_02, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, ce.getMessage(), ce); } // depends on control dependency: [catch], data = [none] } // If we can release and repool the buffer do so. Otherwise, if it was used for a message // and cannot be released, simply repool any other resources except the actual buffer. if (allocatedFromBufferPool && releaseBuffer) { buffer.release(); // depends on control dependency: [if], data = [none] } // else // { // buffer.release(false); // } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dataReceived"); // There is currently no requirement to change receive listeners in the client // so always return null return null; } }
public class class_name { public void updateDuration() { long minDuration = 0; Trajectory traj = this.getTrajectory(); for (int i = 0; i < traj.getDTs().length; i++) { minDuration += traj.getDTs()[i]*RESOLUTION; } duration = new AllenIntervalConstraint(AllenIntervalConstraint.Type.Duration, new Bounds(minDuration,APSPSolver.INF)); duration.setFrom(this); duration.setTo(this); boolean conAdd = this.getConstraintSolver().addConstraint(duration); if (conAdd) logger.fine("Added duration constriant " + duration); else throw new Error("Failed to add duration constriant " + duration); } }
public class class_name { public void updateDuration() { long minDuration = 0; Trajectory traj = this.getTrajectory(); for (int i = 0; i < traj.getDTs().length; i++) { minDuration += traj.getDTs()[i]*RESOLUTION; // depends on control dependency: [for], data = [i] } duration = new AllenIntervalConstraint(AllenIntervalConstraint.Type.Duration, new Bounds(minDuration,APSPSolver.INF)); duration.setFrom(this); duration.setTo(this); boolean conAdd = this.getConstraintSolver().addConstraint(duration); if (conAdd) logger.fine("Added duration constriant " + duration); else throw new Error("Failed to add duration constriant " + duration); } }
public class class_name { @Nonnull private static ESuccess _copyFileViaChannel (@Nonnull final File aSrcFile, @Nonnull final File aDestFile) { final FileChannel aSrcChannel = FileChannelHelper.getFileReadChannel (aSrcFile); if (aSrcChannel == null) return ESuccess.FAILURE; try { final FileChannel aDstChannel = FileChannelHelper.getFileWriteChannel (aDestFile, EAppend.TRUNCATE); if (aDstChannel == null) return ESuccess.FAILURE; try { FileLock aSrcLock = null; FileLock aDestLock = null; try { final long nBytesToRead = aSrcChannel.size (); // Shared read lock and exclusive write lock aSrcLock = aSrcChannel.lock (0, nBytesToRead, true); aDestLock = aDstChannel.lock (); // Main copying - the loop version is much quicker than then // transferTo with full size! long nBytesWritten = 0; final long nChunkSize = 1L * CGlobal.BYTES_PER_MEGABYTE; while (nBytesWritten < nBytesToRead) nBytesWritten += aSrcChannel.transferTo (nBytesWritten, nChunkSize, aDstChannel); if (nBytesToRead != nBytesWritten) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Failed to copy file. Meant to read " + nBytesToRead + " bytes but wrote " + nBytesWritten); return ESuccess.FAILURE; } return ESuccess.SUCCESS; } catch (final IOException ex) { throw new IllegalStateException ("Failed to copy from " + aSrcFile + " to " + aDestFile, ex); } finally { // Unlock ChannelHelper.release (aDestLock); ChannelHelper.release (aSrcLock); } } finally { ChannelHelper.close (aDstChannel); } } finally { ChannelHelper.close (aSrcChannel); } } }
public class class_name { @Nonnull private static ESuccess _copyFileViaChannel (@Nonnull final File aSrcFile, @Nonnull final File aDestFile) { final FileChannel aSrcChannel = FileChannelHelper.getFileReadChannel (aSrcFile); if (aSrcChannel == null) return ESuccess.FAILURE; try { final FileChannel aDstChannel = FileChannelHelper.getFileWriteChannel (aDestFile, EAppend.TRUNCATE); if (aDstChannel == null) return ESuccess.FAILURE; try { FileLock aSrcLock = null; FileLock aDestLock = null; try { final long nBytesToRead = aSrcChannel.size (); // Shared read lock and exclusive write lock aSrcLock = aSrcChannel.lock (0, nBytesToRead, true); // depends on control dependency: [try], data = [none] aDestLock = aDstChannel.lock (); // depends on control dependency: [try], data = [none] // Main copying - the loop version is much quicker than then // transferTo with full size! long nBytesWritten = 0; final long nChunkSize = 1L * CGlobal.BYTES_PER_MEGABYTE; while (nBytesWritten < nBytesToRead) nBytesWritten += aSrcChannel.transferTo (nBytesWritten, nChunkSize, aDstChannel); if (nBytesToRead != nBytesWritten) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Failed to copy file. Meant to read " + nBytesToRead + " bytes but wrote " + nBytesWritten); return ESuccess.FAILURE; // depends on control dependency: [if], data = [none] } return ESuccess.SUCCESS; // depends on control dependency: [try], data = [none] } catch (final IOException ex) { throw new IllegalStateException ("Failed to copy from " + aSrcFile + " to " + aDestFile, ex); } // depends on control dependency: [catch], data = [none] finally { // Unlock ChannelHelper.release (aDestLock); ChannelHelper.release (aSrcLock); } } finally { ChannelHelper.close (aDstChannel); } } finally { ChannelHelper.close (aSrcChannel); } } }
public class class_name { @Override public void releaseConnection() { Header header = getResponseHeader("content-type"); if (header != null) { String contentTypeHeader = header.getValue(); if (contentTypeHeader != null && contentTypeHeader.toLowerCase(Locale.ROOT).contains("text/event-stream")) { return; } } super.releaseConnection(); } }
public class class_name { @Override public void releaseConnection() { Header header = getResponseHeader("content-type"); if (header != null) { String contentTypeHeader = header.getValue(); if (contentTypeHeader != null && contentTypeHeader.toLowerCase(Locale.ROOT).contains("text/event-stream")) { return; // depends on control dependency: [if], data = [none] } } super.releaseConnection(); } }
public class class_name { protected void drawLabelTextAndBackground(Canvas canvas, char[] labelBuffer, int startIndex, int numChars, int autoBackgroundColor) { final float textX; final float textY; if (isValueLabelBackgroundEnabled) { if (isValueLabelBackgroundAuto) { labelBackgroundPaint.setColor(autoBackgroundColor); } canvas.drawRect(labelBackgroundRect, labelBackgroundPaint); textX = labelBackgroundRect.left + labelMargin; textY = labelBackgroundRect.bottom - labelMargin; } else { textX = labelBackgroundRect.left; textY = labelBackgroundRect.bottom; } canvas.drawText(labelBuffer, startIndex, numChars, textX, textY, labelPaint); } }
public class class_name { protected void drawLabelTextAndBackground(Canvas canvas, char[] labelBuffer, int startIndex, int numChars, int autoBackgroundColor) { final float textX; final float textY; if (isValueLabelBackgroundEnabled) { if (isValueLabelBackgroundAuto) { labelBackgroundPaint.setColor(autoBackgroundColor); // depends on control dependency: [if], data = [none] } canvas.drawRect(labelBackgroundRect, labelBackgroundPaint); // depends on control dependency: [if], data = [none] textX = labelBackgroundRect.left + labelMargin; // depends on control dependency: [if], data = [none] textY = labelBackgroundRect.bottom - labelMargin; // depends on control dependency: [if], data = [none] } else { textX = labelBackgroundRect.left; // depends on control dependency: [if], data = [none] textY = labelBackgroundRect.bottom; // depends on control dependency: [if], data = [none] } canvas.drawText(labelBuffer, startIndex, numChars, textX, textY, labelPaint); } }
public class class_name { private int getInBoundsX(int x) { if(x < 0) { x = 0; } else if(x > ((itemWidth + (int) dividerSize) * (values.length - 1))) { x = ((itemWidth + (int) dividerSize) * (values.length - 1)); } return x; } }
public class class_name { private int getInBoundsX(int x) { if(x < 0) { x = 0; // depends on control dependency: [if], data = [none] } else if(x > ((itemWidth + (int) dividerSize) * (values.length - 1))) { x = ((itemWidth + (int) dividerSize) * (values.length - 1)); // depends on control dependency: [if], data = [none] } return x; } }
public class class_name { @Override public boolean hasNext() { resetToLastKey(); if (mIsFirst) { mIsFirst = false; try { AtomicValue mItem1 = null; if (mOperand1 instanceof LiteralExpr) { mItem1 = ((LiteralExpr)mOperand1).evaluate(); } else if (mOperand1.hasNext()) { // atomize operand mItem1 = atomize(mOperand1); } if (mItem1 != null) { AtomicValue mItem2 = null; if (mOperand2 instanceof LiteralExpr) { mItem2 = ((LiteralExpr)mOperand2).evaluate(); } else if (mOperand2.hasNext()) { // atomize operand mItem2 = atomize(mOperand2); } if (mItem2 != null) { final AtomicValue result = operate(mItem1, mItem2); // add retrieved AtomicValue to item list final int itemKey = getItemList().addItem(result); moveTo(itemKey); return true; } } } catch (TTXPathException e) { throw new RuntimeException(e); } } // either not the first call, or empty sequence resetToStartKey(); return false; } }
public class class_name { @Override public boolean hasNext() { resetToLastKey(); if (mIsFirst) { mIsFirst = false; // depends on control dependency: [if], data = [none] try { AtomicValue mItem1 = null; if (mOperand1 instanceof LiteralExpr) { mItem1 = ((LiteralExpr)mOperand1).evaluate(); // depends on control dependency: [if], data = [none] } else if (mOperand1.hasNext()) { // atomize operand mItem1 = atomize(mOperand1); // depends on control dependency: [if], data = [none] } if (mItem1 != null) { AtomicValue mItem2 = null; if (mOperand2 instanceof LiteralExpr) { mItem2 = ((LiteralExpr)mOperand2).evaluate(); // depends on control dependency: [if], data = [none] } else if (mOperand2.hasNext()) { // atomize operand mItem2 = atomize(mOperand2); // depends on control dependency: [if], data = [none] } if (mItem2 != null) { final AtomicValue result = operate(mItem1, mItem2); // add retrieved AtomicValue to item list final int itemKey = getItemList().addItem(result); moveTo(itemKey); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } } catch (TTXPathException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } // either not the first call, or empty sequence resetToStartKey(); return false; } }
public class class_name { @Override public DataSet filterBy(int[] labels) { List<DataSet> list = asList(); List<DataSet> newList = new ArrayList<>(); List<Integer> labelList = new ArrayList<>(); for (int i : labels) labelList.add(i); for (DataSet d : list) { int outcome = d.outcome(); if (labelList.contains(outcome)) { newList.add(d); } } return DataSet.merge(newList); } }
public class class_name { @Override public DataSet filterBy(int[] labels) { List<DataSet> list = asList(); List<DataSet> newList = new ArrayList<>(); List<Integer> labelList = new ArrayList<>(); for (int i : labels) labelList.add(i); for (DataSet d : list) { int outcome = d.outcome(); if (labelList.contains(outcome)) { newList.add(d); // depends on control dependency: [if], data = [none] } } return DataSet.merge(newList); } }
public class class_name { private void addSignature(final String line, final String defaultMessage, final UnresolvableReporting report, final Set<String> missingClasses) throws ParseException,IOException { final String clazz, field, signature; String message = null; final Method method; int p = line.indexOf('@'); if (p >= 0) { signature = line.substring(0, p).trim(); message = line.substring(p + 1).trim(); } else { signature = line; message = defaultMessage; } if (line.isEmpty()) { throw new ParseException("Empty signature"); } p = signature.indexOf('#'); if (p >= 0) { clazz = signature.substring(0, p); final String s = signature.substring(p + 1); p = s.indexOf('('); if (p >= 0) { if (p == 0) { throw new ParseException("Invalid method signature (method name missing): " + signature); } // we ignore the return type, its just to match easier (so return type is void): try { method = Method.getMethod("void " + s, true); } catch (IllegalArgumentException iae) { throw new ParseException("Invalid method signature: " + signature); } field = null; } else { field = s; method = null; } } else { clazz = signature; method = null; field = null; } if (message != null && message.isEmpty()) { message = null; } // create printout message: final String printout = (message != null) ? (signature + " [" + message + "]") : signature; // check class & method/field signature, if it is really existent (in classpath), but we don't really load the class into JVM: if (AsmUtils.isGlob(clazz)) { if (method != null || field != null) { throw new ParseException(String.format(Locale.ENGLISH, "Class level glob pattern cannot be combined with methods/fields: %s", signature)); } classPatterns.add(new ClassPatternRule(clazz, message)); } else { final ClassSignature c; try { c = lookup.getClassFromClassLoader(clazz); } catch (ClassNotFoundException cnfe) { if (report.reportClassNotFound) { report.parseFailed(logger, String.format(Locale.ENGLISH, "Class '%s' not found on classpath", cnfe.getMessage()), signature); } else { missingClasses.add(clazz); } return; } if (method != null) { assert field == null; // list all methods with this signature: boolean found = false; for (final Method m : c.methods) { if (m.getName().equals(method.getName()) && Arrays.equals(m.getArgumentTypes(), method.getArgumentTypes())) { found = true; signatures.put(getKey(c.className, m), printout); // don't break when found, as there may be more covariant overrides! } } if (!found) { report.parseFailed(logger, "Method not found", signature); return; } } else if (field != null) { assert method == null; if (!c.fields.contains(field)) { report.parseFailed(logger, "Field not found", signature); return; } signatures.put(getKey(c.className, field), printout); } else { assert field == null && method == null; // only add the signature as class name signatures.put(getKey(c.className), printout); } } } }
public class class_name { private void addSignature(final String line, final String defaultMessage, final UnresolvableReporting report, final Set<String> missingClasses) throws ParseException,IOException { final String clazz, field, signature; String message = null; final Method method; int p = line.indexOf('@'); if (p >= 0) { signature = line.substring(0, p).trim(); message = line.substring(p + 1).trim(); } else { signature = line; message = defaultMessage; } if (line.isEmpty()) { throw new ParseException("Empty signature"); } p = signature.indexOf('#'); if (p >= 0) { clazz = signature.substring(0, p); final String s = signature.substring(p + 1); p = s.indexOf('('); if (p >= 0) { if (p == 0) { throw new ParseException("Invalid method signature (method name missing): " + signature); } // we ignore the return type, its just to match easier (so return type is void): try { method = Method.getMethod("void " + s, true); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException iae) { throw new ParseException("Invalid method signature: " + signature); } // depends on control dependency: [catch], data = [none] field = null; // depends on control dependency: [if], data = [none] } else { field = s; // depends on control dependency: [if], data = [none] method = null; // depends on control dependency: [if], data = [none] } } else { clazz = signature; method = null; field = null; } if (message != null && message.isEmpty()) { message = null; } // create printout message: final String printout = (message != null) ? (signature + " [" + message + "]") : signature; // check class & method/field signature, if it is really existent (in classpath), but we don't really load the class into JVM: if (AsmUtils.isGlob(clazz)) { if (method != null || field != null) { throw new ParseException(String.format(Locale.ENGLISH, "Class level glob pattern cannot be combined with methods/fields: %s", signature)); } classPatterns.add(new ClassPatternRule(clazz, message)); } else { final ClassSignature c; try { c = lookup.getClassFromClassLoader(clazz); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnfe) { if (report.reportClassNotFound) { report.parseFailed(logger, String.format(Locale.ENGLISH, "Class '%s' not found on classpath", cnfe.getMessage()), signature); } else { missingClasses.add(clazz); } return; } if (method != null) { assert field == null; // list all methods with this signature: boolean found = false; for (final Method m : c.methods) { if (m.getName().equals(method.getName()) && Arrays.equals(m.getArgumentTypes(), method.getArgumentTypes())) { found = true; signatures.put(getKey(c.className, m), printout); // don't break when found, as there may be more covariant overrides! } } if (!found) { report.parseFailed(logger, "Method not found", signature); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } else if (field != null) { // depends on control dependency: [catch], data = [none] assert method == null; if (!c.fields.contains(field)) { report.parseFailed(logger, "Field not found", signature); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } signatures.put(getKey(c.className, field), printout); } else { assert field == null && method == null; // only add the signature as class name signatures.put(getKey(c.className), printout); } } } }
public class class_name { public void marshall(Build build, ProtocolMarshaller protocolMarshaller) { if (build == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(build.getId(), ID_BINDING); protocolMarshaller.marshall(build.getArn(), ARN_BINDING); protocolMarshaller.marshall(build.getStartTime(), STARTTIME_BINDING); protocolMarshaller.marshall(build.getEndTime(), ENDTIME_BINDING); protocolMarshaller.marshall(build.getCurrentPhase(), CURRENTPHASE_BINDING); protocolMarshaller.marshall(build.getBuildStatus(), BUILDSTATUS_BINDING); protocolMarshaller.marshall(build.getSourceVersion(), SOURCEVERSION_BINDING); protocolMarshaller.marshall(build.getResolvedSourceVersion(), RESOLVEDSOURCEVERSION_BINDING); protocolMarshaller.marshall(build.getProjectName(), PROJECTNAME_BINDING); protocolMarshaller.marshall(build.getPhases(), PHASES_BINDING); protocolMarshaller.marshall(build.getSource(), SOURCE_BINDING); protocolMarshaller.marshall(build.getSecondarySources(), SECONDARYSOURCES_BINDING); protocolMarshaller.marshall(build.getSecondarySourceVersions(), SECONDARYSOURCEVERSIONS_BINDING); protocolMarshaller.marshall(build.getArtifacts(), ARTIFACTS_BINDING); protocolMarshaller.marshall(build.getSecondaryArtifacts(), SECONDARYARTIFACTS_BINDING); protocolMarshaller.marshall(build.getCache(), CACHE_BINDING); protocolMarshaller.marshall(build.getEnvironment(), ENVIRONMENT_BINDING); protocolMarshaller.marshall(build.getServiceRole(), SERVICEROLE_BINDING); protocolMarshaller.marshall(build.getLogs(), LOGS_BINDING); protocolMarshaller.marshall(build.getTimeoutInMinutes(), TIMEOUTINMINUTES_BINDING); protocolMarshaller.marshall(build.getQueuedTimeoutInMinutes(), QUEUEDTIMEOUTINMINUTES_BINDING); protocolMarshaller.marshall(build.getBuildComplete(), BUILDCOMPLETE_BINDING); protocolMarshaller.marshall(build.getInitiator(), INITIATOR_BINDING); protocolMarshaller.marshall(build.getVpcConfig(), VPCCONFIG_BINDING); protocolMarshaller.marshall(build.getNetworkInterface(), NETWORKINTERFACE_BINDING); protocolMarshaller.marshall(build.getEncryptionKey(), ENCRYPTIONKEY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Build build, ProtocolMarshaller protocolMarshaller) { if (build == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(build.getId(), ID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getStartTime(), STARTTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getEndTime(), ENDTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getCurrentPhase(), CURRENTPHASE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getBuildStatus(), BUILDSTATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getSourceVersion(), SOURCEVERSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getResolvedSourceVersion(), RESOLVEDSOURCEVERSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getProjectName(), PROJECTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getPhases(), PHASES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getSource(), SOURCE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getSecondarySources(), SECONDARYSOURCES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getSecondarySourceVersions(), SECONDARYSOURCEVERSIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getArtifacts(), ARTIFACTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getSecondaryArtifacts(), SECONDARYARTIFACTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getCache(), CACHE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getEnvironment(), ENVIRONMENT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getServiceRole(), SERVICEROLE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getLogs(), LOGS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getTimeoutInMinutes(), TIMEOUTINMINUTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getQueuedTimeoutInMinutes(), QUEUEDTIMEOUTINMINUTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getBuildComplete(), BUILDCOMPLETE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getInitiator(), INITIATOR_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getVpcConfig(), VPCCONFIG_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getNetworkInterface(), NETWORKINTERFACE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(build.getEncryptionKey(), ENCRYPTIONKEY_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected final void setRightMessage(@Nullable final CharSequence message, final boolean error) { if (message != null) { rightMessage.setVisibility(View.VISIBLE); rightMessage.setText(message); rightMessage.setTextColor(error ? getErrorColor() : getHelperTextColor()); rightMessage.setTag(error); } else { rightMessage.setTag(false); rightMessage.setVisibility(View.GONE); } } }
public class class_name { protected final void setRightMessage(@Nullable final CharSequence message, final boolean error) { if (message != null) { rightMessage.setVisibility(View.VISIBLE); // depends on control dependency: [if], data = [none] rightMessage.setText(message); // depends on control dependency: [if], data = [(message] rightMessage.setTextColor(error ? getErrorColor() : getHelperTextColor()); // depends on control dependency: [if], data = [none] rightMessage.setTag(error); // depends on control dependency: [if], data = [none] } else { rightMessage.setTag(false); // depends on control dependency: [if], data = [none] rightMessage.setVisibility(View.GONE); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void addFMPiece(StringBuilder sb, int value, int pad) { String val = Integer.toString(value); pad -= val.length(); while (pad-- > 0) { sb.append('0'); } sb.append(val); } }
public class class_name { private void addFMPiece(StringBuilder sb, int value, int pad) { String val = Integer.toString(value); pad -= val.length(); while (pad-- > 0) { sb.append('0'); // depends on control dependency: [while], data = [none] } sb.append(val); } }
public class class_name { @SuppressWarnings("unchecked") private void ensureCapacity(int capacity) { checkCapacity(capacity); Elem<V>[] newArray = (Elem<V>[]) Array.newInstance(Elem.class, capacity + 2); if (newArray.length >= array.length) { System.arraycopy(array, 0, newArray, 0, array.length); for (int i = array.length; i < newArray.length; i++) { newArray[i] = new Elem<V>(SUP_KEY, null); } } else { System.arraycopy(array, 0, newArray, 0, newArray.length); } array = newArray; } }
public class class_name { @SuppressWarnings("unchecked") private void ensureCapacity(int capacity) { checkCapacity(capacity); Elem<V>[] newArray = (Elem<V>[]) Array.newInstance(Elem.class, capacity + 2); if (newArray.length >= array.length) { System.arraycopy(array, 0, newArray, 0, array.length); // depends on control dependency: [if], data = [none] for (int i = array.length; i < newArray.length; i++) { newArray[i] = new Elem<V>(SUP_KEY, null); // depends on control dependency: [for], data = [i] } } else { System.arraycopy(array, 0, newArray, 0, newArray.length); // depends on control dependency: [if], data = [none] } array = newArray; } }
public class class_name { public String getFileLink() { if (m_resource != null) { return A_CmsJspValueWrapper.substituteLink(m_cms, m_cms.getSitePath(m_resource)); } else { return ""; } } }
public class class_name { public String getFileLink() { if (m_resource != null) { return A_CmsJspValueWrapper.substituteLink(m_cms, m_cms.getSitePath(m_resource)); // depends on control dependency: [if], data = [(m_resource] } else { return ""; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void clear(final SortedIntList<?>... lists) { for (final SortedIntList<?> list : lists) { if (list != null) { list.clear(); } } } }
public class class_name { public static void clear(final SortedIntList<?>... lists) { for (final SortedIntList<?> list : lists) { if (list != null) { list.clear(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static List<Locale> languagesByCountry(final String countryCode) { if (countryCode == null) { return Collections.emptyList(); } List<Locale> langs = cLanguagesByCountry.get(countryCode); if (langs == null) { langs = new ArrayList<>(); final List<Locale> locales = availableLocaleList(); for (final Locale locale : locales) { if (countryCode.equals(locale.getCountry()) && locale.getVariant().isEmpty()) { langs.add(locale); } } langs = Collections.unmodifiableList(langs); cLanguagesByCountry.putIfAbsent(countryCode, langs); langs = cLanguagesByCountry.get(countryCode); } return langs; } }
public class class_name { public static List<Locale> languagesByCountry(final String countryCode) { if (countryCode == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<Locale> langs = cLanguagesByCountry.get(countryCode); if (langs == null) { langs = new ArrayList<>(); // depends on control dependency: [if], data = [none] final List<Locale> locales = availableLocaleList(); for (final Locale locale : locales) { if (countryCode.equals(locale.getCountry()) && locale.getVariant().isEmpty()) { langs.add(locale); // depends on control dependency: [if], data = [none] } } langs = Collections.unmodifiableList(langs); // depends on control dependency: [if], data = [(langs] cLanguagesByCountry.putIfAbsent(countryCode, langs); // depends on control dependency: [if], data = [none] langs = cLanguagesByCountry.get(countryCode); // depends on control dependency: [if], data = [none] } return langs; } }
public class class_name { public static void fillRectangle(GrayF64 img, double value, int x0, int y0, int width, int height) { int x1 = x0 + width; int y1 = y0 + height; if( x0 < 0 ) x0 = 0; if( x1 > img.width ) x1 = img.width; if( y0 < 0 ) y0 = 0; if( y1 > img.height ) y1 = img.height; for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; x++) { img.set(x, y, value); } } } }
public class class_name { public static void fillRectangle(GrayF64 img, double value, int x0, int y0, int width, int height) { int x1 = x0 + width; int y1 = y0 + height; if( x0 < 0 ) x0 = 0; if( x1 > img.width ) x1 = img.width; if( y0 < 0 ) y0 = 0; if( y1 > img.height ) y1 = img.height; for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; x++) { img.set(x, y, value); // depends on control dependency: [for], data = [x] } } } }
public class class_name { @FFDCIgnore({ NamingException.class, NameNotFoundException.class }) private Attributes getAttributes(String name, String[] attrIds) throws WIMException { Attributes attributes = null; if (iLdapConfigMgr.getUseEncodingInSearchExpression() != null) name = LdapHelper.encodeAttribute(name, iLdapConfigMgr.getUseEncodingInSearchExpression()); if (iAttrRangeStep > 0) { attributes = getRangeAttributes(name, attrIds); } else { TimedDirContext ctx = iContextManager.getDirContext(); try { try { if (attrIds.length > 0) { attributes = ctx.getAttributes(new LdapName(name), attrIds); } else { attributes = new BasicAttributes(); } } catch (NamingException e) { if (!ContextManager.isConnectionException(e)) { throw e; } ctx = iContextManager.reCreateDirContext(ctx, e.toString()); if (attrIds.length > 0) { attributes = ctx.getAttributes(new LdapName(name), attrIds); } else { attributes = new BasicAttributes(); } } } catch (NameNotFoundException e) { String msg = Tr.formatMessage(tc, WIMMessageKey.LDAP_ENTRY_NOT_FOUND, WIMMessageHelper.generateMsgParms(name, e.toString(true))); throw new EntityNotFoundException(WIMMessageKey.LDAP_ENTRY_NOT_FOUND, msg, e); } catch (NamingException e) { String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true))); throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e); } finally { iContextManager.releaseDirContext(ctx); } } return attributes; } }
public class class_name { @FFDCIgnore({ NamingException.class, NameNotFoundException.class }) private Attributes getAttributes(String name, String[] attrIds) throws WIMException { Attributes attributes = null; if (iLdapConfigMgr.getUseEncodingInSearchExpression() != null) name = LdapHelper.encodeAttribute(name, iLdapConfigMgr.getUseEncodingInSearchExpression()); if (iAttrRangeStep > 0) { attributes = getRangeAttributes(name, attrIds); } else { TimedDirContext ctx = iContextManager.getDirContext(); try { try { if (attrIds.length > 0) { attributes = ctx.getAttributes(new LdapName(name), attrIds); // depends on control dependency: [if], data = [none] } else { attributes = new BasicAttributes(); // depends on control dependency: [if], data = [none] } } catch (NamingException e) { if (!ContextManager.isConnectionException(e)) { throw e; } ctx = iContextManager.reCreateDirContext(ctx, e.toString()); if (attrIds.length > 0) { attributes = ctx.getAttributes(new LdapName(name), attrIds); // depends on control dependency: [if], data = [none] } else { attributes = new BasicAttributes(); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } catch (NameNotFoundException e) { String msg = Tr.formatMessage(tc, WIMMessageKey.LDAP_ENTRY_NOT_FOUND, WIMMessageHelper.generateMsgParms(name, e.toString(true))); throw new EntityNotFoundException(WIMMessageKey.LDAP_ENTRY_NOT_FOUND, msg, e); } catch (NamingException e) { // depends on control dependency: [catch], data = [none] String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true))); throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e); } finally { // depends on control dependency: [catch], data = [none] iContextManager.releaseDirContext(ctx); } } return attributes; } }
public class class_name { @Override public int compareTo(ValidatorWrapper<T> other) { if (this == other || getName().equals(other.getName())) { return 0; } int result = getPriority().compareTo(other.getPriority()); if (result == 0) { result = getInsertionOrder().compareTo(other.getInsertionOrder()); } return result; } }
public class class_name { @Override public int compareTo(ValidatorWrapper<T> other) { if (this == other || getName().equals(other.getName())) { return 0; } // depends on control dependency: [if], data = [none] int result = getPriority().compareTo(other.getPriority()); if (result == 0) { result = getInsertionOrder().compareTo(other.getInsertionOrder()); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static void update(String sql, Object... arg) { Connection connection = JDBCUtils.getConnection(); PreparedStatement ps = null; try { ps = connection.prepareStatement(sql); for (int i = 0; i < arg.length; i++) { ps.setObject(i + 1, arg[i]); } ps.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } JDBCUtils.release(ps, connection); } }
public class class_name { public static void update(String sql, Object... arg) { Connection connection = JDBCUtils.getConnection(); PreparedStatement ps = null; try { ps = connection.prepareStatement(sql); // depends on control dependency: [try], data = [none] for (int i = 0; i < arg.length; i++) { ps.setObject(i + 1, arg[i]); // depends on control dependency: [for], data = [i] } ps.executeUpdate(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] JDBCUtils.release(ps, connection); } }
public class class_name { protected final void finish(Thread t) { if (t == null) { // nothing to terminate return; } try { StreamPumper s = null; if (t instanceof ThreadWithPumper) { s = ((ThreadWithPumper) t).getPumper(); } if (s != null && s.isFinished()) { return; } if (!t.isAlive()) { return; } if (s != null && !s.isFinished()) { s.stop(); } t.join(JOIN_TIMEOUT); while ((s == null || !s.isFinished()) && t.isAlive()) { t.interrupt(); t.join(JOIN_TIMEOUT); } } catch (InterruptedException e) { // ignore } } }
public class class_name { protected final void finish(Thread t) { if (t == null) { // nothing to terminate return; // depends on control dependency: [if], data = [none] } try { StreamPumper s = null; if (t instanceof ThreadWithPumper) { s = ((ThreadWithPumper) t).getPumper(); // depends on control dependency: [if], data = [none] } if (s != null && s.isFinished()) { return; // depends on control dependency: [if], data = [none] } if (!t.isAlive()) { return; // depends on control dependency: [if], data = [none] } if (s != null && !s.isFinished()) { s.stop(); // depends on control dependency: [if], data = [none] } t.join(JOIN_TIMEOUT); // depends on control dependency: [try], data = [none] while ((s == null || !s.isFinished()) && t.isAlive()) { t.interrupt(); // depends on control dependency: [while], data = [none] t.join(JOIN_TIMEOUT); // depends on control dependency: [while], data = [none] } } catch (InterruptedException e) { // ignore } // depends on control dependency: [catch], data = [none] } }
public class class_name { public OutlierResult run(Database database, Relation<? extends NumberVector> relation) { @SuppressWarnings("unchecked") PrimitiveDistanceQuery<? super NumberVector> distq = (PrimitiveDistanceQuery<? super NumberVector>) database.getDistanceQuery(relation, distanceFunction); Collection<? extends NumberVector> refPoints = refp.getReferencePoints(relation); if(refPoints.isEmpty()) { throw new AbortException("Cannot compute ROS without reference points!"); } DBIDs ids = relation.getDBIDs(); if(k >= ids.size()) { throw new AbortException("k must not be chosen larger than the database size!"); } // storage of distance/score values. WritableDoubleDataStore rbod_score = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_STATIC | DataStoreFactory.HINT_HOT, Double.NaN); // Compute density estimation: for(NumberVector refPoint : refPoints) { DoubleDBIDList referenceDists = computeDistanceVector(refPoint, relation, distq); updateDensities(rbod_score, referenceDists); } // compute maximum density DoubleMinMax mm = new DoubleMinMax(); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { mm.put(rbod_score.doubleValue(iditer)); } // compute ROS double scale = mm.getMax() > 0. ? 1. / mm.getMax() : 1.; mm.reset(); // Reuse for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { double score = 1 - (rbod_score.doubleValue(iditer) * scale); mm.put(score); rbod_score.putDouble(iditer, score); } DoubleRelation scoreResult = new MaterializedDoubleRelation("Reference-points Outlier Scores", "reference-outlier", rbod_score, relation.getDBIDs()); OutlierScoreMeta scoreMeta = new BasicOutlierScoreMeta(mm.getMin(), mm.getMax(), 0., 1., 0.); OutlierResult result = new OutlierResult(scoreMeta, scoreResult); // adds reference points to the result. header information for the // visualizer to find the reference points in the result result.addChildResult(new ReferencePointsResult<>("Reference points", "reference-points", refPoints)); return result; } }
public class class_name { public OutlierResult run(Database database, Relation<? extends NumberVector> relation) { @SuppressWarnings("unchecked") PrimitiveDistanceQuery<? super NumberVector> distq = (PrimitiveDistanceQuery<? super NumberVector>) database.getDistanceQuery(relation, distanceFunction); Collection<? extends NumberVector> refPoints = refp.getReferencePoints(relation); if(refPoints.isEmpty()) { throw new AbortException("Cannot compute ROS without reference points!"); } DBIDs ids = relation.getDBIDs(); if(k >= ids.size()) { throw new AbortException("k must not be chosen larger than the database size!"); } // storage of distance/score values. WritableDoubleDataStore rbod_score = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_STATIC | DataStoreFactory.HINT_HOT, Double.NaN); // Compute density estimation: for(NumberVector refPoint : refPoints) { DoubleDBIDList referenceDists = computeDistanceVector(refPoint, relation, distq); updateDensities(rbod_score, referenceDists); // depends on control dependency: [for], data = [none] } // compute maximum density DoubleMinMax mm = new DoubleMinMax(); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { mm.put(rbod_score.doubleValue(iditer)); // depends on control dependency: [for], data = [iditer] } // compute ROS double scale = mm.getMax() > 0. ? 1. / mm.getMax() : 1.; mm.reset(); // Reuse for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { double score = 1 - (rbod_score.doubleValue(iditer) * scale); mm.put(score); // depends on control dependency: [for], data = [none] rbod_score.putDouble(iditer, score); // depends on control dependency: [for], data = [iditer] } DoubleRelation scoreResult = new MaterializedDoubleRelation("Reference-points Outlier Scores", "reference-outlier", rbod_score, relation.getDBIDs()); OutlierScoreMeta scoreMeta = new BasicOutlierScoreMeta(mm.getMin(), mm.getMax(), 0., 1., 0.); OutlierResult result = new OutlierResult(scoreMeta, scoreResult); // adds reference points to the result. header information for the // visualizer to find the reference points in the result result.addChildResult(new ReferencePointsResult<>("Reference points", "reference-points", refPoints)); return result; } }
public class class_name { @Override public long get(TemporalUnit unit) { if (unit == ChronoUnit.YEARS) { return years; } else if (unit == ChronoUnit.MONTHS) { return months; } else if (unit == ChronoUnit.DAYS) { return days; } else { throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } } }
public class class_name { @Override public long get(TemporalUnit unit) { if (unit == ChronoUnit.YEARS) { return years; // depends on control dependency: [if], data = [none] } else if (unit == ChronoUnit.MONTHS) { return months; // depends on control dependency: [if], data = [none] } else if (unit == ChronoUnit.DAYS) { return days; // depends on control dependency: [if], data = [none] } else { throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } } }
public class class_name { private List<ColumnTypeDataPair> getColumnValues(Map<String, ParameterBindingDTO> bindValues) throws BindException { List<ColumnTypeDataPair> columns = new ArrayList<>(bindValues.size()); for (int i = 1; i <= bindValues.size(); i++) { // bindValues should have n entries with string keys 1 ... n and list values String key = Integer.toString(i); if (!bindValues.containsKey(key)) { throw new BindException( String.format("Bind map with %d columns should contain key \"%d\"", bindValues.size(), i), BindException.Type.SERIALIZATION); } ParameterBindingDTO value = bindValues.get(key); try { String type = value.getType(); List<String> list = (List<String>) value.getValue(); List<String> convertedList = new ArrayList<>(list.size()); if ("TIMESTAMP_LTZ".equals(type) || "TIMESTAMP_NTZ".equals(type)) { for (String e : list) { convertedList.add(synchronizedTimestampFormat(e)); } } else if ("DATE".equals(type)) { for (String e : list) { convertedList.add(synchronizedDateFormat(e)); } } else { convertedList = list; } columns.add(i - 1, new ColumnTypeDataPair(type, convertedList)); } catch (ClassCastException ex) { throw new BindException("Value in binding DTO could not be cast to a list", BindException.Type.SERIALIZATION); } } return columns; } }
public class class_name { private List<ColumnTypeDataPair> getColumnValues(Map<String, ParameterBindingDTO> bindValues) throws BindException { List<ColumnTypeDataPair> columns = new ArrayList<>(bindValues.size()); for (int i = 1; i <= bindValues.size(); i++) { // bindValues should have n entries with string keys 1 ... n and list values String key = Integer.toString(i); if (!bindValues.containsKey(key)) { throw new BindException( String.format("Bind map with %d columns should contain key \"%d\"", bindValues.size(), i), BindException.Type.SERIALIZATION); } ParameterBindingDTO value = bindValues.get(key); try { String type = value.getType(); List<String> list = (List<String>) value.getValue(); List<String> convertedList = new ArrayList<>(list.size()); if ("TIMESTAMP_LTZ".equals(type) || "TIMESTAMP_NTZ".equals(type)) { for (String e : list) { convertedList.add(synchronizedTimestampFormat(e)); // depends on control dependency: [for], data = [e] } } else if ("DATE".equals(type)) { for (String e : list) { convertedList.add(synchronizedDateFormat(e)); // depends on control dependency: [for], data = [e] } } else { convertedList = list; } columns.add(i - 1, new ColumnTypeDataPair(type, convertedList)); } catch (ClassCastException ex) { throw new BindException("Value in binding DTO could not be cast to a list", BindException.Type.SERIALIZATION); } } return columns; } }
public class class_name { private static Object defaultForType(Class<?> type) { if (!type.isPrimitive()) { return null; } if (type.equals(boolean.class)) { return false; } if (type.equals(long.class)) { return (long) 0L; } if (type.equals(int.class)) { return (int) 0; } if (type.equals(short.class)) { return (short) 0; } if (type.equals(byte.class)) { return (byte) 0; } if (type.equals(char.class)) { return (char) '\u0000'; } if (type.equals(float.class)) { return (float) 0.0f; } if (type.equals(double.class)) { return (double) 0.0d; } // should never happen throw new IllegalStateException("Unknown primitive type: " + type.getName()); } }
public class class_name { private static Object defaultForType(Class<?> type) { if (!type.isPrimitive()) { return null; // depends on control dependency: [if], data = [none] } if (type.equals(boolean.class)) { return false; // depends on control dependency: [if], data = [none] } if (type.equals(long.class)) { return (long) 0L; // depends on control dependency: [if], data = [none] } if (type.equals(int.class)) { return (int) 0; // depends on control dependency: [if], data = [none] } if (type.equals(short.class)) { return (short) 0; // depends on control dependency: [if], data = [none] } if (type.equals(byte.class)) { return (byte) 0; // depends on control dependency: [if], data = [none] } if (type.equals(char.class)) { return (char) '\u0000'; // depends on control dependency: [if], data = [none] } if (type.equals(float.class)) { return (float) 0.0f; // depends on control dependency: [if], data = [none] } if (type.equals(double.class)) { return (double) 0.0d; // depends on control dependency: [if], data = [none] } // should never happen throw new IllegalStateException("Unknown primitive type: " + type.getName()); } }
public class class_name { public void marshall(ValidationError validationError, ProtocolMarshaller protocolMarshaller) { if (validationError == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(validationError.getElementPath(), ELEMENTPATH_BINDING); protocolMarshaller.marshall(validationError.getErrorMessage(), ERRORMESSAGE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ValidationError validationError, ProtocolMarshaller protocolMarshaller) { if (validationError == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(validationError.getElementPath(), ELEMENTPATH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(validationError.getErrorMessage(), ERRORMESSAGE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static BlockLocation[] locatedBlocks2Locations(LocatedBlocks blocks) { if (blocks == null) { return new BlockLocation[0]; } int nrBlocks = blocks.locatedBlockCount(); BlockLocation[] blkLocations = new BlockLocation[nrBlocks]; if (nrBlocks == 0) { return blkLocations; } int idx = 0; for (LocatedBlock blk : blocks.getLocatedBlocks()) { assert idx < nrBlocks : "Incorrect index"; DatanodeInfo[] locations = blk.getLocations(); String[] hosts = new String[locations.length]; String[] names = new String[locations.length]; String[] racks = new String[locations.length]; for (int hCnt = 0; hCnt < locations.length; hCnt++) { hosts[hCnt] = locations[hCnt].getHostName(); names[hCnt] = locations[hCnt].getName(); NodeBase node = new NodeBase(names[hCnt], locations[hCnt].getNetworkLocation()); racks[hCnt] = node.toString(); } blkLocations[idx] = new BlockLocation(names, hosts, racks, blk.getStartOffset(), blk.getBlockSize(), blk.isCorrupt()); idx++; } return blkLocations; } }
public class class_name { public static BlockLocation[] locatedBlocks2Locations(LocatedBlocks blocks) { if (blocks == null) { return new BlockLocation[0]; // depends on control dependency: [if], data = [none] } int nrBlocks = blocks.locatedBlockCount(); BlockLocation[] blkLocations = new BlockLocation[nrBlocks]; if (nrBlocks == 0) { return blkLocations; // depends on control dependency: [if], data = [none] } int idx = 0; for (LocatedBlock blk : blocks.getLocatedBlocks()) { assert idx < nrBlocks : "Incorrect index"; DatanodeInfo[] locations = blk.getLocations(); String[] hosts = new String[locations.length]; String[] names = new String[locations.length]; String[] racks = new String[locations.length]; for (int hCnt = 0; hCnt < locations.length; hCnt++) { hosts[hCnt] = locations[hCnt].getHostName(); // depends on control dependency: [for], data = [hCnt] names[hCnt] = locations[hCnt].getName(); // depends on control dependency: [for], data = [hCnt] NodeBase node = new NodeBase(names[hCnt], locations[hCnt].getNetworkLocation()); racks[hCnt] = node.toString(); // depends on control dependency: [for], data = [hCnt] } blkLocations[idx] = new BlockLocation(names, hosts, racks, blk.getStartOffset(), blk.getBlockSize(), blk.isCorrupt()); // depends on control dependency: [for], data = [blk] idx++; // depends on control dependency: [for], data = [none] } return blkLocations; } }
public class class_name { public void setProperty(String key, Object value) { if (readOnly) { return; } if (value == null) { throw new IllegalArgumentException("value must not be null"); } Object o = content.get(key); if (!value.equals(o)) { updatedContent.put(key, value); updated = true; } else if (updatedContent.containsKey(key) && !value.equals(updatedContent.get(key))) { updatedContent.put(key, value); updated = true; } } }
public class class_name { public void setProperty(String key, Object value) { if (readOnly) { return; // depends on control dependency: [if], data = [none] } if (value == null) { throw new IllegalArgumentException("value must not be null"); } Object o = content.get(key); if (!value.equals(o)) { updatedContent.put(key, value); // depends on control dependency: [if], data = [none] updated = true; // depends on control dependency: [if], data = [none] } else if (updatedContent.containsKey(key) && !value.equals(updatedContent.get(key))) { updatedContent.put(key, value); // depends on control dependency: [if], data = [none] updated = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean isDelegatedFacesServlet(String className) { if (className == null) { // The class name can be null if this is e.g., a JSP mapped to // a servlet. return false; } try { Class<?> clazz = Class.forName(className); return DELEGATED_FACES_SERVLET_CLASS.isAssignableFrom(clazz); } catch (ClassNotFoundException cnfe) { return false; } } }
public class class_name { private boolean isDelegatedFacesServlet(String className) { if (className == null) { // The class name can be null if this is e.g., a JSP mapped to // a servlet. return false; // depends on control dependency: [if], data = [none] } try { Class<?> clazz = Class.forName(className); return DELEGATED_FACES_SERVLET_CLASS.isAssignableFrom(clazz); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnfe) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public HasNode normalize(String ref) { if (feature == null) { nodeName = PathUtil.normalizePaths(ref, new String[]{nodeName})[0]; } else { trueNode.normalize(ref); falseNode.normalize(ref); } return this; } }
public class class_name { public HasNode normalize(String ref) { if (feature == null) { nodeName = PathUtil.normalizePaths(ref, new String[]{nodeName})[0]; // depends on control dependency: [if], data = [none] } else { trueNode.normalize(ref); // depends on control dependency: [if], data = [none] falseNode.normalize(ref); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public ArrayList<MemorySegment> resetOverflowBuckets() { this.numOverflowSegments = 0; this.nextOverflowBucket = 0; ArrayList<MemorySegment> result = new ArrayList<MemorySegment>(this.overflowSegments.length); for(int i = 0; i < this.overflowSegments.length; i++) { if(this.overflowSegments[i] != null) { result.add(this.overflowSegments[i]); } } this.overflowSegments = new MemorySegment[2]; return result; } }
public class class_name { public ArrayList<MemorySegment> resetOverflowBuckets() { this.numOverflowSegments = 0; this.nextOverflowBucket = 0; ArrayList<MemorySegment> result = new ArrayList<MemorySegment>(this.overflowSegments.length); for(int i = 0; i < this.overflowSegments.length; i++) { if(this.overflowSegments[i] != null) { result.add(this.overflowSegments[i]); // depends on control dependency: [if], data = [(this.overflowSegments[i]] } } this.overflowSegments = new MemorySegment[2]; return result; } }
public class class_name { private static void getAugmentedScriptSet(int codePoint, ScriptSet result) { result.clear(); UScript.getScriptExtensions(codePoint, result); // Section 5.1 step 1 if (result.get(UScript.HAN)) { result.set(UScript.HAN_WITH_BOPOMOFO); result.set(UScript.JAPANESE); result.set(UScript.KOREAN); } if (result.get(UScript.HIRAGANA)) { result.set(UScript.JAPANESE); } if (result.get(UScript.KATAKANA)) { result.set(UScript.JAPANESE); } if (result.get(UScript.HANGUL)) { result.set(UScript.KOREAN); } if (result.get(UScript.BOPOMOFO)) { result.set(UScript.HAN_WITH_BOPOMOFO); } // Section 5.1 step 2 if (result.get(UScript.COMMON) || result.get(UScript.INHERITED)) { result.setAll(); } } }
public class class_name { private static void getAugmentedScriptSet(int codePoint, ScriptSet result) { result.clear(); UScript.getScriptExtensions(codePoint, result); // Section 5.1 step 1 if (result.get(UScript.HAN)) { result.set(UScript.HAN_WITH_BOPOMOFO); // depends on control dependency: [if], data = [none] result.set(UScript.JAPANESE); // depends on control dependency: [if], data = [none] result.set(UScript.KOREAN); // depends on control dependency: [if], data = [none] } if (result.get(UScript.HIRAGANA)) { result.set(UScript.JAPANESE); // depends on control dependency: [if], data = [none] } if (result.get(UScript.KATAKANA)) { result.set(UScript.JAPANESE); // depends on control dependency: [if], data = [none] } if (result.get(UScript.HANGUL)) { result.set(UScript.KOREAN); // depends on control dependency: [if], data = [none] } if (result.get(UScript.BOPOMOFO)) { result.set(UScript.HAN_WITH_BOPOMOFO); // depends on control dependency: [if], data = [none] } // Section 5.1 step 2 if (result.get(UScript.COMMON) || result.get(UScript.INHERITED)) { result.setAll(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void discardTombstones() { if (activeTransactions.isEmpty()) { Iterator<Map.Entry<K, MapEntryValue>> iterator = entries().entrySet().iterator(); while (iterator.hasNext()) { MapEntryValue value = iterator.next().getValue(); if (value.type() == MapEntryValue.Type.TOMBSTONE) { iterator.remove(); } } } else { long lowWaterMark = activeTransactions.values().stream() .mapToLong(TransactionScope::version) .min().getAsLong(); Iterator<Map.Entry<K, MapEntryValue>> iterator = entries().entrySet().iterator(); while (iterator.hasNext()) { MapEntryValue value = iterator.next().getValue(); if (value.type() == MapEntryValue.Type.TOMBSTONE && value.version < lowWaterMark) { iterator.remove(); } } } } }
public class class_name { private void discardTombstones() { if (activeTransactions.isEmpty()) { Iterator<Map.Entry<K, MapEntryValue>> iterator = entries().entrySet().iterator(); while (iterator.hasNext()) { MapEntryValue value = iterator.next().getValue(); if (value.type() == MapEntryValue.Type.TOMBSTONE) { iterator.remove(); // depends on control dependency: [if], data = [none] } } } else { long lowWaterMark = activeTransactions.values().stream() .mapToLong(TransactionScope::version) .min().getAsLong(); Iterator<Map.Entry<K, MapEntryValue>> iterator = entries().entrySet().iterator(); while (iterator.hasNext()) { MapEntryValue value = iterator.next().getValue(); if (value.type() == MapEntryValue.Type.TOMBSTONE && value.version < lowWaterMark) { iterator.remove(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public FastShortBuffer append(final FastShortBuffer buff) { if (buff.offset == 0) { return this; } append(buff.buffer, 0, buff.offset); return this; } }
public class class_name { public FastShortBuffer append(final FastShortBuffer buff) { if (buff.offset == 0) { return this; // depends on control dependency: [if], data = [none] } append(buff.buffer, 0, buff.offset); return this; } }
public class class_name { @Override public EClass getIfcSweptAreaSolid() { if (ifcSweptAreaSolidEClass == null) { ifcSweptAreaSolidEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(685); } return ifcSweptAreaSolidEClass; } }
public class class_name { @Override public EClass getIfcSweptAreaSolid() { if (ifcSweptAreaSolidEClass == null) { ifcSweptAreaSolidEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(685); // depends on control dependency: [if], data = [none] } return ifcSweptAreaSolidEClass; } }
public class class_name { protected String getNodeNutchContent(Element e, String key) { NodeList nodes = e.getElementsByTagNameNS(NUTCH_NS, key); String result = null; if (nodes != null && nodes.getLength() > 0) { result = getNodeTextValue(nodes.item(0)); } return (result == null || result.length() == 0)? null: result; } }
public class class_name { protected String getNodeNutchContent(Element e, String key) { NodeList nodes = e.getElementsByTagNameNS(NUTCH_NS, key); String result = null; if (nodes != null && nodes.getLength() > 0) { result = getNodeTextValue(nodes.item(0)); // depends on control dependency: [if], data = [(nodes] } return (result == null || result.length() == 0)? null: result; } }
public class class_name { public static base_responses unset(nitro_service client, rnat resources[], String[] args) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { rnat unsetresources[] = new rnat[resources.length]; for (int i=0;i<resources.length;i++){ unsetresources[i] = new rnat(); unsetresources[i].network = resources[i].network; unsetresources[i].netmask = resources[i].netmask; unsetresources[i].td = resources[i].td; unsetresources[i].aclname = resources[i].aclname; unsetresources[i].redirectport = resources[i].redirectport; unsetresources[i].natip = resources[i].natip; } result = unset_bulk_request(client, unsetresources,args); } return result; } }
public class class_name { public static base_responses unset(nitro_service client, rnat resources[], String[] args) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { rnat unsetresources[] = new rnat[resources.length]; for (int i=0;i<resources.length;i++){ unsetresources[i] = new rnat(); // depends on control dependency: [for], data = [i] unsetresources[i].network = resources[i].network; // depends on control dependency: [for], data = [i] unsetresources[i].netmask = resources[i].netmask; // depends on control dependency: [for], data = [i] unsetresources[i].td = resources[i].td; // depends on control dependency: [for], data = [i] unsetresources[i].aclname = resources[i].aclname; // depends on control dependency: [for], data = [i] unsetresources[i].redirectport = resources[i].redirectport; // depends on control dependency: [for], data = [i] unsetresources[i].natip = resources[i].natip; // depends on control dependency: [for], data = [i] } result = unset_bulk_request(client, unsetresources,args); } return result; } }
public class class_name { public static final double[] toArray(Point... points) { double[] res = new double[2*points.length]; int idx = 0; for (Point pp : points) { res[idx++] = pp.getX(); res[idx++] = pp.getY(); } return res; } }
public class class_name { public static final double[] toArray(Point... points) { double[] res = new double[2*points.length]; int idx = 0; for (Point pp : points) { res[idx++] = pp.getX(); // depends on control dependency: [for], data = [pp] res[idx++] = pp.getY(); // depends on control dependency: [for], data = [pp] } return res; } }
public class class_name { private BigInteger parseHexLiteral(Token input) { String text = input.text; // Start past 0x for (int i = 2; i != text.length(); ++i) { char c = text.charAt(i); if(c != '_' && !isHexDigit(c)) { syntaxError("invalid hex literal (invalid characters)", input); } } // Remove "0x" and "_" text = input.text.substring(2).replace("_", ""); return new BigInteger(text,16); } }
public class class_name { private BigInteger parseHexLiteral(Token input) { String text = input.text; // Start past 0x for (int i = 2; i != text.length(); ++i) { char c = text.charAt(i); if(c != '_' && !isHexDigit(c)) { syntaxError("invalid hex literal (invalid characters)", input); // depends on control dependency: [if], data = [none] } } // Remove "0x" and "_" text = input.text.substring(2).replace("_", ""); return new BigInteger(text,16); } }
public class class_name { public void loadAnalogiesFromFile(String analogy_file) { try { Scanner sc = new Scanner(new File(analogy_file)); while (sc.hasNext()) { String analogy = sc.next(); if (!isAnalogyFormat(analogy)) { System.err.println("\"" + analogy + "\" not in proper format."); continue; } String analogy_pair[] = analogy.split(":"); String A = analogy_pair[0]; String B = analogy_pair[1]; //1. Find alternates for A and B Synset[] A_prime = findAlternatives(A); Synset[] B_prime = findAlternatives(B); //2. Filter phrases ArrayList<String> tmp = new ArrayList<String>(filterPhrases(INDEX_DIR,A,B,A_prime,B_prime)); filtered_phrases.addAll(tmp); original_to_alternates.put(A+":"+B, tmp); } sc.close(); } catch (Exception e) { System.err.println("Could not read file."); } } }
public class class_name { public void loadAnalogiesFromFile(String analogy_file) { try { Scanner sc = new Scanner(new File(analogy_file)); while (sc.hasNext()) { String analogy = sc.next(); if (!isAnalogyFormat(analogy)) { System.err.println("\"" + analogy + "\" not in proper format."); // depends on control dependency: [if], data = [none] continue; } String analogy_pair[] = analogy.split(":"); String A = analogy_pair[0]; String B = analogy_pair[1]; //1. Find alternates for A and B Synset[] A_prime = findAlternatives(A); Synset[] B_prime = findAlternatives(B); //2. Filter phrases ArrayList<String> tmp = new ArrayList<String>(filterPhrases(INDEX_DIR,A,B,A_prime,B_prime)); filtered_phrases.addAll(tmp); // depends on control dependency: [while], data = [none] original_to_alternates.put(A+":"+B, tmp); // depends on control dependency: [while], data = [none] } sc.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.err.println("Could not read file."); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override @LogarithmicTime(amortized = true) @SuppressWarnings("unchecked") public AddressableHeap.Handle<K, V> insert(K key, V value) { if (other != this) { throw new IllegalStateException("A heap cannot be used after a meld"); } if (key == null) { throw new NullPointerException("Null keys not permitted"); } Node<K, V> n = createNode(key, value); // easy special cases if (size == 0) { root = n; size = 1; return n; } else if (size == 1) { int c; if (comparator == null) { c = ((Comparable<? super K>) key).compareTo(root.key); } else { c = comparator.compare(key, root.key); } if (c <= 0) { n.o_c = root; root.y_s = n; root = n; } else { root.o_c = n; n.y_s = root; } size = 2; return n; } if (comparator == null) { root = union(root, n); } else { root = unionWithComparator(root, n); } size++; return n; } }
public class class_name { @Override @LogarithmicTime(amortized = true) @SuppressWarnings("unchecked") public AddressableHeap.Handle<K, V> insert(K key, V value) { if (other != this) { throw new IllegalStateException("A heap cannot be used after a meld"); } if (key == null) { throw new NullPointerException("Null keys not permitted"); } Node<K, V> n = createNode(key, value); // easy special cases if (size == 0) { root = n; // depends on control dependency: [if], data = [none] size = 1; // depends on control dependency: [if], data = [none] return n; // depends on control dependency: [if], data = [none] } else if (size == 1) { int c; if (comparator == null) { c = ((Comparable<? super K>) key).compareTo(root.key); // depends on control dependency: [if], data = [none] } else { c = comparator.compare(key, root.key); // depends on control dependency: [if], data = [none] } if (c <= 0) { n.o_c = root; // depends on control dependency: [if], data = [none] root.y_s = n; // depends on control dependency: [if], data = [none] root = n; // depends on control dependency: [if], data = [none] } else { root.o_c = n; // depends on control dependency: [if], data = [none] n.y_s = root; // depends on control dependency: [if], data = [none] } size = 2; // depends on control dependency: [if], data = [none] return n; // depends on control dependency: [if], data = [none] } if (comparator == null) { root = union(root, n); // depends on control dependency: [if], data = [none] } else { root = unionWithComparator(root, n); // depends on control dependency: [if], data = [none] } size++; return n; } }
public class class_name { public boolean containsChannel(String channelName) { boolean found = false; for (int i = 0; i < channels.length; i++) { if (channels[i].getName().equals(channelName)) { found = true; break; } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "containsChannel: " + channelName + "=" + found); } return found; } }
public class class_name { public boolean containsChannel(String channelName) { boolean found = false; for (int i = 0; i < channels.length; i++) { if (channels[i].getName().equals(channelName)) { found = true; // depends on control dependency: [if], data = [none] break; } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "containsChannel: " + channelName + "=" + found); // depends on control dependency: [if], data = [none] } return found; } }
public class class_name { public boolean setNewAuthor(DefaultIssue issue, @Nullable String newAuthorLogin, IssueChangeContext context) { if (isNullOrEmpty(newAuthorLogin)) { return false; } checkState(issue.authorLogin() == null, "It's not possible to update the author with this method, please use setAuthorLogin()"); issue.setFieldChange(context, AUTHOR, null, newAuthorLogin); issue.setAuthorLogin(newAuthorLogin); issue.setUpdateDate(context.date()); issue.setChanged(true); // do not send notifications to prevent spam when installing the developer cockpit plugin return true; } }
public class class_name { public boolean setNewAuthor(DefaultIssue issue, @Nullable String newAuthorLogin, IssueChangeContext context) { if (isNullOrEmpty(newAuthorLogin)) { return false; // depends on control dependency: [if], data = [none] } checkState(issue.authorLogin() == null, "It's not possible to update the author with this method, please use setAuthorLogin()"); issue.setFieldChange(context, AUTHOR, null, newAuthorLogin); issue.setAuthorLogin(newAuthorLogin); issue.setUpdateDate(context.date()); issue.setChanged(true); // do not send notifications to prevent spam when installing the developer cockpit plugin return true; } }
public class class_name { public static <E extends Comparable<E>> List<Range<E>> getRanges(Collection<E> collection, int batchSize) { List<Range<E>> rangeList = new LinkedList<Range<E>>(); E currentMin = null; // Check for edge cases if ((collection != null) && (collection.size() > 0) && (batchSize > 0)) { int index = 1; for (E element : collection) { // Bootstrap first element in the next range if (currentMin == null) { currentMin = element; } int mod = index % batchSize; // On each batchSize items (and the last one) create a range if ((mod == 0) || (index == collection.size())) { Range<E> range = new Range<E>(currentMin, element); rangeList.add(range); currentMin = null; } index++; } } return rangeList; } }
public class class_name { public static <E extends Comparable<E>> List<Range<E>> getRanges(Collection<E> collection, int batchSize) { List<Range<E>> rangeList = new LinkedList<Range<E>>(); E currentMin = null; // Check for edge cases if ((collection != null) && (collection.size() > 0) && (batchSize > 0)) { int index = 1; for (E element : collection) { // Bootstrap first element in the next range if (currentMin == null) { currentMin = element; // depends on control dependency: [if], data = [none] } int mod = index % batchSize; // On each batchSize items (and the last one) create a range if ((mod == 0) || (index == collection.size())) { Range<E> range = new Range<E>(currentMin, element); rangeList.add(range); // depends on control dependency: [if], data = [none] currentMin = null; // depends on control dependency: [if], data = [none] } index++; // depends on control dependency: [for], data = [none] } } return rangeList; } }
public class class_name { public <T extends CharSequence> T notBlank(final T chars, final String message, final Object... values) { if (chars == null) { failNull(String.format(message, values)); } if (StringUtils.isBlank(chars)) { fail(String.format(message, values)); } return chars; } }
public class class_name { public <T extends CharSequence> T notBlank(final T chars, final String message, final Object... values) { if (chars == null) { failNull(String.format(message, values)); // depends on control dependency: [if], data = [none] } if (StringUtils.isBlank(chars)) { fail(String.format(message, values)); // depends on control dependency: [if], data = [none] } return chars; } }
public class class_name { void setScriptType(int type) { // OOo related code if (database.isStoredFileAccess()) { return; } // OOo end boolean needsCheckpoint = scriptFormat != type; scriptFormat = type; properties.setProperty(HsqlDatabaseProperties.hsqldb_script_format, String.valueOf(scriptFormat)); if (needsCheckpoint) { database.logger.needsCheckpoint = true; } } }
public class class_name { void setScriptType(int type) { // OOo related code if (database.isStoredFileAccess()) { return; // depends on control dependency: [if], data = [none] } // OOo end boolean needsCheckpoint = scriptFormat != type; scriptFormat = type; properties.setProperty(HsqlDatabaseProperties.hsqldb_script_format, String.valueOf(scriptFormat)); if (needsCheckpoint) { database.logger.needsCheckpoint = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { private URL loadResource(String configurationResourceName) { ClassLoader standardClassloader = ClassLoaderUtil.getStandardClassLoader(); URL url = null; if (standardClassloader != null) { url = standardClassloader.getResource(configurationResourceName); } if (url == null) { url = this.getClass().getResource(configurationResourceName); } log.info("Creating EhCacheFactory from a specified resource: " + configurationResourceName + " Resolved to URL: " + url); if (url == null) { log.warn("A configurationResourceName was set to {} but the resource could not be loaded from the classpath.Ehcache will configure itself using defaults." ,configurationResourceName); } return url; } }
public class class_name { private URL loadResource(String configurationResourceName) { ClassLoader standardClassloader = ClassLoaderUtil.getStandardClassLoader(); URL url = null; if (standardClassloader != null) { url = standardClassloader.getResource(configurationResourceName); // depends on control dependency: [if], data = [none] } if (url == null) { url = this.getClass().getResource(configurationResourceName); // depends on control dependency: [if], data = [none] } log.info("Creating EhCacheFactory from a specified resource: " + configurationResourceName + " Resolved to URL: " + url); if (url == null) { log.warn("A configurationResourceName was set to {} but the resource could not be loaded from the classpath.Ehcache will configure itself using defaults." ,configurationResourceName); // depends on control dependency: [if], data = [none] } return url; } }
public class class_name { public static DateTime toDateTime(Timestamp value) { if (value == null) { return null; } else { return new DateTime(value.getTime(), DateTimeZone.UTC); } } }
public class class_name { public static DateTime toDateTime(Timestamp value) { if (value == null) { return null; // depends on control dependency: [if], data = [none] } else { return new DateTime(value.getTime(), DateTimeZone.UTC); // depends on control dependency: [if], data = [(value] } } }
public class class_name { @SuppressWarnings("squid:S2259") public void value(String expectedPattern) { String value = checkValue(expectedPattern, 0, 0); String reason = NO_ELEMENT_FOUND; if (value == null && getElement().is().present()) { reason = "Element not input"; } assertNotNull(reason, value); assertTrue("Value Mismatch: value of '" + value + DOES_NOT_MATCH_PATTERN + expectedPattern + "'", value.matches(expectedPattern)); } }
public class class_name { @SuppressWarnings("squid:S2259") public void value(String expectedPattern) { String value = checkValue(expectedPattern, 0, 0); String reason = NO_ELEMENT_FOUND; if (value == null && getElement().is().present()) { reason = "Element not input"; // depends on control dependency: [if], data = [none] } assertNotNull(reason, value); assertTrue("Value Mismatch: value of '" + value + DOES_NOT_MATCH_PATTERN + expectedPattern + "'", value.matches(expectedPattern)); } }
public class class_name { public void closeMenu(boolean withAnim) { mMenuOpen = false; closeMenuDrawable(mMenuBtnDrawable, withAnim); if (mOnMenuClickListener != null) { mOnMenuClickListener.onMenuClosed(); } } }
public class class_name { public void closeMenu(boolean withAnim) { mMenuOpen = false; closeMenuDrawable(mMenuBtnDrawable, withAnim); if (mOnMenuClickListener != null) { mOnMenuClickListener.onMenuClosed(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void main(String[] args) throws Exception { SparkStreamingBinding binding = null; try { binding = SparkStreamingBindingFactory.build(BootstrapCluster.getProperties()); binding.init(); BootstrapCluster.createTransformers(binding.getStreamingContext().sparkContext(), binding.getSparkSession()); binding.startContext(); binding.awaitTermination(); } catch (Throwable error) { String msg = "Error trying to invoke BootstrapClusterStreaming.main: " + error; System.err.println(new Date()+ ": " + msg); error.printStackTrace(System.err); // required as in local mode the following seems to be lost LOG.error(msg, error); throw new IllegalStateException(msg, error); } finally { try { if (binding != null) { binding.close(); } } catch (Exception ex) { LOG.warn("Error on binding close: " + ex, ex); } } } }
public class class_name { public static void main(String[] args) throws Exception { SparkStreamingBinding binding = null; try { binding = SparkStreamingBindingFactory.build(BootstrapCluster.getProperties()); binding.init(); BootstrapCluster.createTransformers(binding.getStreamingContext().sparkContext(), binding.getSparkSession()); binding.startContext(); binding.awaitTermination(); } catch (Throwable error) { String msg = "Error trying to invoke BootstrapClusterStreaming.main: " + error; System.err.println(new Date()+ ": " + msg); error.printStackTrace(System.err); // required as in local mode the following seems to be lost LOG.error(msg, error); throw new IllegalStateException(msg, error); } finally { try { if (binding != null) { binding.close(); // depends on control dependency: [if], data = [none] } } catch (Exception ex) { LOG.warn("Error on binding close: " + ex, ex); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public Observable<ServiceResponse<OCR>> oCRUrlInputWithServiceResponseAsync(String language, String contentType, BodyModelModel imageUrl, Boolean cacheImage, Boolean enhanced) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (language == null) { throw new IllegalArgumentException("Parameter language is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (imageUrl == null) { throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null."); } Validator.validate(imageUrl); String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl()); return service.oCRUrlInput(language, cacheImage, enhanced, contentType, imageUrl, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<OCR>>>() { @Override public Observable<ServiceResponse<OCR>> call(Response<ResponseBody> response) { try { ServiceResponse<OCR> clientResponse = oCRUrlInputDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<OCR>> oCRUrlInputWithServiceResponseAsync(String language, String contentType, BodyModelModel imageUrl, Boolean cacheImage, Boolean enhanced) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (language == null) { throw new IllegalArgumentException("Parameter language is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (imageUrl == null) { throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null."); } Validator.validate(imageUrl); String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl()); return service.oCRUrlInput(language, cacheImage, enhanced, contentType, imageUrl, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<OCR>>>() { @Override public Observable<ServiceResponse<OCR>> call(Response<ResponseBody> response) { try { ServiceResponse<OCR> clientResponse = oCRUrlInputDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { private boolean isConnectorConfigured(Class connectorClass) { for (Connector connector : this.connectorMap.values()) { if (connectorClass.isInstance(connector)) { return true; } } return false; } }
public class class_name { private boolean isConnectorConfigured(Class connectorClass) { for (Connector connector : this.connectorMap.values()) { if (connectorClass.isInstance(connector)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public static String encode(String value) { try { // TODO: Potentially fix the plus signs that come out of encoding to be "%20" return URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new EsHadoopIllegalArgumentException("Cannot encode string [" + value + "]", e); } } }
public class class_name { public static String encode(String value) { try { // TODO: Potentially fix the plus signs that come out of encoding to be "%20" return URLEncoder.encode(value, "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { throw new EsHadoopIllegalArgumentException("Cannot encode string [" + value + "]", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void addFlow(Flow flow) { // add the flow stats to this app summary this.numberRuns++; this.jobCount += flow.getJobCount(); this.mapSlotMillis += flow.getMapSlotMillis(); this.reduceSlotMillis += flow.getReduceSlotMillis(); this.totalMaps += flow.getTotalMaps(); this.totalReduces += flow.getTotalReduces(); this.mbMillis += flow.getMegabyteMillis(); // add the queue of this flow to the set of queues in this app summary this.queues.add(flow.getQueue()); /** TODO add jobcost once job cost has been added to job details and flow */ // store the latest timestamp seen for this app summary // since these are epoch timestamps, a bigger number means more recent if ((this.lastRunId == 0L) || (this.lastRunId < flow.getRunId())) { this.lastRunId = flow.getRunId(); } // store the oldest seen timestamp seen for this app summary // since these are epoch timestamps, a smaller number means older run if ((this.firstRunId == 0L) || (this.firstRunId > flow.getRunId())) { this.firstRunId = flow.getRunId(); } } }
public class class_name { public void addFlow(Flow flow) { // add the flow stats to this app summary this.numberRuns++; this.jobCount += flow.getJobCount(); this.mapSlotMillis += flow.getMapSlotMillis(); this.reduceSlotMillis += flow.getReduceSlotMillis(); this.totalMaps += flow.getTotalMaps(); this.totalReduces += flow.getTotalReduces(); this.mbMillis += flow.getMegabyteMillis(); // add the queue of this flow to the set of queues in this app summary this.queues.add(flow.getQueue()); /** TODO add jobcost once job cost has been added to job details and flow */ // store the latest timestamp seen for this app summary // since these are epoch timestamps, a bigger number means more recent if ((this.lastRunId == 0L) || (this.lastRunId < flow.getRunId())) { this.lastRunId = flow.getRunId(); // depends on control dependency: [if], data = [none] } // store the oldest seen timestamp seen for this app summary // since these are epoch timestamps, a smaller number means older run if ((this.firstRunId == 0L) || (this.firstRunId > flow.getRunId())) { this.firstRunId = flow.getRunId(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public BufferedImage getSnapshot () { BufferedImage img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D gfx = img.createGraphics(); try { for (Mirage m : _mirages) { m.paint(gfx, 0, 0); } } finally { gfx.dispose(); } return img; } }
public class class_name { public BufferedImage getSnapshot () { BufferedImage img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D gfx = img.createGraphics(); try { for (Mirage m : _mirages) { m.paint(gfx, 0, 0); // depends on control dependency: [for], data = [m] } } finally { gfx.dispose(); } return img; } }
public class class_name { public static void OuterProductUpdate(final Matrix A, final Vec x, final Vec y, final double c, ExecutorService threadpool) { if(x.length() != A.rows() || y.length() != A.cols()) throw new ArithmeticException("Matrix dimensions do not agree with outer product"); if (x.isSparse()) { final ModifiableCountDownLatch mcdl = new ModifiableCountDownLatch(1); for (final IndexValue iv : x) { mcdl.countUp(); threadpool.submit(new Runnable() { @Override public void run() { A.updateRow(iv.getIndex(), iv.getValue() * c, y); mcdl.countDown(); } }); } mcdl.countDown(); try { mcdl.await(); } catch (InterruptedException ex) { Logger.getLogger(Matrix.class.getName()).log(Level.SEVERE, null, ex); } } else { final CountDownLatch latch = new CountDownLatch(LogicalCores); for(int id = 0; id < LogicalCores; id++) { final int threadID = id; threadpool.submit(new Runnable() { @Override public void run() { for(int i = threadID; i < x.length(); i+=LogicalCores) { double rowCosnt = c*x.get(i); A.updateRow(i, rowCosnt, y); } latch.countDown(); } }); } try { latch.await(); } catch (InterruptedException ex) { Logger.getLogger(Matrix.class.getName()).log(Level.SEVERE, null, ex); } } } }
public class class_name { public static void OuterProductUpdate(final Matrix A, final Vec x, final Vec y, final double c, ExecutorService threadpool) { if(x.length() != A.rows() || y.length() != A.cols()) throw new ArithmeticException("Matrix dimensions do not agree with outer product"); if (x.isSparse()) { final ModifiableCountDownLatch mcdl = new ModifiableCountDownLatch(1); for (final IndexValue iv : x) { mcdl.countUp(); // depends on control dependency: [for], data = [none] threadpool.submit(new Runnable() { @Override public void run() { A.updateRow(iv.getIndex(), iv.getValue() * c, y); mcdl.countDown(); } }); // depends on control dependency: [for], data = [none] } mcdl.countDown(); // depends on control dependency: [if], data = [none] try { mcdl.await(); // depends on control dependency: [try], data = [none] } catch (InterruptedException ex) { Logger.getLogger(Matrix.class.getName()).log(Level.SEVERE, null, ex); } // depends on control dependency: [catch], data = [none] } else { final CountDownLatch latch = new CountDownLatch(LogicalCores); for(int id = 0; id < LogicalCores; id++) { final int threadID = id; threadpool.submit(new Runnable() { @Override public void run() { for(int i = threadID; i < x.length(); i+=LogicalCores) { double rowCosnt = c*x.get(i); A.updateRow(i, rowCosnt, y); // depends on control dependency: [for], data = [i] } latch.countDown(); } }); // depends on control dependency: [for], data = [none] } try { latch.await(); // depends on control dependency: [try], data = [none] } catch (InterruptedException ex) { Logger.getLogger(Matrix.class.getName()).log(Level.SEVERE, null, ex); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public synchronized static void destroyInstance(String protocol) throws SyslogRuntimeException { if (StringUtils.isBlank(protocol)) { return; } String _protocol = protocol.toLowerCase(); if (instances.containsKey(_protocol)) { SyslogUtility.sleep(SyslogConstants.THREAD_LOOP_INTERVAL_DEFAULT); SyslogIF syslog = instances.get(_protocol); try { syslog.shutdown(); } finally { instances.remove(_protocol); } } else { throw new SyslogRuntimeException("Cannot destroy protocol \"%s\" instance; call shutdown instead", protocol); } } }
public class class_name { public synchronized static void destroyInstance(String protocol) throws SyslogRuntimeException { if (StringUtils.isBlank(protocol)) { return; } String _protocol = protocol.toLowerCase(); if (instances.containsKey(_protocol)) { SyslogUtility.sleep(SyslogConstants.THREAD_LOOP_INTERVAL_DEFAULT); SyslogIF syslog = instances.get(_protocol); try { syslog.shutdown(); // depends on control dependency: [try], data = [none] } finally { instances.remove(_protocol); } } else { throw new SyslogRuntimeException("Cannot destroy protocol \"%s\" instance; call shutdown instead", protocol); } } }
public class class_name { private void writePrefix(int type, int length) { if (length >= lnIsVarLen) { writeVarUInt(length); length = lnIsVarLen; } int offset = myOffset; if (--offset < 0) { offset = growBuffer(offset); } myBuffer[offset] = (byte) (type | length); myOffset = offset; } }
public class class_name { private void writePrefix(int type, int length) { if (length >= lnIsVarLen) { writeVarUInt(length); // depends on control dependency: [if], data = [(length] length = lnIsVarLen; // depends on control dependency: [if], data = [none] } int offset = myOffset; if (--offset < 0) { offset = growBuffer(offset); // depends on control dependency: [if], data = [none] } myBuffer[offset] = (byte) (type | length); myOffset = offset; } }
public class class_name { public void removeKeyListener(KeyListener listener) { keyListeners.remove(listener); keyListenersToAdd.remove(listener); if (!mouseListeners.contains(listener) && !controllerListeners.contains(listener)) { allListeners.remove(listener); } } }
public class class_name { public void removeKeyListener(KeyListener listener) { keyListeners.remove(listener); keyListenersToAdd.remove(listener); if (!mouseListeners.contains(listener) && !controllerListeners.contains(listener)) { allListeners.remove(listener); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void setLink(CmsObject cms, String resourcePath) { String link = resourcePath; try { // make sure the res is a folder cms.readFolder(resourcePath); // adjust the path if (resourcePath.endsWith(CmsToolManager.TOOLPATH_SEPARATOR)) { resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf(CmsToolManager.TOOLPATH_SEPARATOR)); } // set admin page as link link = CmsToolManager.VIEW_JSPPAGE_LOCATION; // try to use the folder default file as link CmsProperty prop = cms.readPropertyObject(resourcePath, CmsPropertyDefinition.PROPERTY_DEFAULT_FILE, false); String defFile = "index.jsp"; if (!prop.isNullProperty()) { defFile = prop.getValue(); } if (!defFile.startsWith(CmsToolManager.TOOLPATH_SEPARATOR)) { // try to use this relative link defFile = resourcePath + CmsToolManager.TOOLPATH_SEPARATOR + defFile; } if (defFile.indexOf("?") > 0) { if (cms.existsResource(defFile.substring(0, defFile.indexOf("?")))) { link = defFile; } } else if (cms.existsResource(defFile)) { link = defFile; } } catch (CmsException e) { // not a folder or no default file, ignore } setLink(link); } }
public class class_name { protected void setLink(CmsObject cms, String resourcePath) { String link = resourcePath; try { // make sure the res is a folder cms.readFolder(resourcePath); // depends on control dependency: [try], data = [none] // adjust the path if (resourcePath.endsWith(CmsToolManager.TOOLPATH_SEPARATOR)) { resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf(CmsToolManager.TOOLPATH_SEPARATOR)); // depends on control dependency: [if], data = [none] } // set admin page as link link = CmsToolManager.VIEW_JSPPAGE_LOCATION; // depends on control dependency: [try], data = [none] // try to use the folder default file as link CmsProperty prop = cms.readPropertyObject(resourcePath, CmsPropertyDefinition.PROPERTY_DEFAULT_FILE, false); String defFile = "index.jsp"; if (!prop.isNullProperty()) { defFile = prop.getValue(); // depends on control dependency: [if], data = [none] } if (!defFile.startsWith(CmsToolManager.TOOLPATH_SEPARATOR)) { // try to use this relative link defFile = resourcePath + CmsToolManager.TOOLPATH_SEPARATOR + defFile; // depends on control dependency: [if], data = [none] } if (defFile.indexOf("?") > 0) { if (cms.existsResource(defFile.substring(0, defFile.indexOf("?")))) { link = defFile; // depends on control dependency: [if], data = [none] } } else if (cms.existsResource(defFile)) { link = defFile; // depends on control dependency: [if], data = [none] } } catch (CmsException e) { // not a folder or no default file, ignore } // depends on control dependency: [catch], data = [none] setLink(link); } }
public class class_name { @Override protected void onDouble(Double floating, String fieldName, JsonParser jp) { if (resultStarted) { found = true; ClassUtil.setSilent(entity, fieldName, floating); } } }
public class class_name { @Override protected void onDouble(Double floating, String fieldName, JsonParser jp) { if (resultStarted) { found = true; // depends on control dependency: [if], data = [none] ClassUtil.setSilent(entity, fieldName, floating); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Object[] _asArray( final Object obj ) { Object[] array = null; if (obj instanceof Object[]) { array = (Object[])obj; if (array.length == 0) { throw new IllegalArgumentException( "ERROR: empty array" ); } } else { array = new Object[] { obj }; } return array; } }
public class class_name { private Object[] _asArray( final Object obj ) { Object[] array = null; if (obj instanceof Object[]) { array = (Object[])obj; // depends on control dependency: [if], data = [none] if (array.length == 0) { throw new IllegalArgumentException( "ERROR: empty array" ); } } else { array = new Object[] { obj }; // depends on control dependency: [if], data = [none] } return array; } }
public class class_name { @SuppressWarnings("squid:S1172") private void onCheckBoxChange(final ValueChangeEvent event) { if (hasCreatePermission() || hasUpdatePermission()) { if (!getValueTextArea().getValue().isEmpty() && !getKeyTextField().getValue().isEmpty()) { getMetadataWindow().setSaveButtonEnabled(true); } else { getMetadataWindow().setSaveButtonEnabled(false); } } } }
public class class_name { @SuppressWarnings("squid:S1172") private void onCheckBoxChange(final ValueChangeEvent event) { if (hasCreatePermission() || hasUpdatePermission()) { if (!getValueTextArea().getValue().isEmpty() && !getKeyTextField().getValue().isEmpty()) { getMetadataWindow().setSaveButtonEnabled(true); // depends on control dependency: [if], data = [none] } else { getMetadataWindow().setSaveButtonEnabled(false); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override protected void initGraphics() { super.initGraphics(); mouseEventHandler = e -> { final EventType TYPE = e.getEventType(); if (MouseEvent.MOUSE_PRESSED == TYPE) { dragStart = thumb.localToParent(e.getX(), e.getY()); formerThumbPos = (tile.getCurrentValue() - minValue) / range; tile.fireTileEvent(VALUE_CHANGING); } else if (MouseEvent.MOUSE_DRAGGED == TYPE) { Point2D currentPos = thumb.localToParent(e.getX(), e.getY()); double dragPos = currentPos.getX() - dragStart.getX(); thumbDragged((formerThumbPos + dragPos / trackLength)); } else if (MouseEvent.MOUSE_RELEASED == TYPE) { tile.fireTileEvent(VALUE_CHANGED); } }; titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); valueText = new Text(String.format(locale, formatString, (tile.getValue()))); valueText.setFill(tile.getValueColor()); Helper.enableNode(valueText, tile.isValueVisible()); unitText = new Text(tile.getUnit()); unitText.setFill(tile.getUnitColor()); Helper.enableNode(unitText, !tile.getUnit().isEmpty()); valueUnitFlow = new TextFlow(valueText, unitText); valueUnitFlow.setTextAlignment(TextAlignment.RIGHT); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setWrapText(true); description.setTextFill(tile.getTextColor()); Helper.enableNode(description, !tile.getDescription().isEmpty()); barBackground = new Rectangle(PREFERRED_WIDTH * 0.795, PREFERRED_HEIGHT * 0.0275); bar = new Rectangle(0, PREFERRED_HEIGHT * 0.0275); thumb = new Circle(PREFERRED_WIDTH * 0.09); thumb.setEffect(shadow); getPane().getChildren().addAll(titleText, text, valueUnitFlow, description, barBackground, bar, thumb); } }
public class class_name { @Override protected void initGraphics() { super.initGraphics(); mouseEventHandler = e -> { final EventType TYPE = e.getEventType(); if (MouseEvent.MOUSE_PRESSED == TYPE) { dragStart = thumb.localToParent(e.getX(), e.getY()); // depends on control dependency: [if], data = [none] formerThumbPos = (tile.getCurrentValue() - minValue) / range; // depends on control dependency: [if], data = [none] tile.fireTileEvent(VALUE_CHANGING); // depends on control dependency: [if], data = [none] } else if (MouseEvent.MOUSE_DRAGGED == TYPE) { Point2D currentPos = thumb.localToParent(e.getX(), e.getY()); double dragPos = currentPos.getX() - dragStart.getX(); thumbDragged((formerThumbPos + dragPos / trackLength)); // depends on control dependency: [if], data = [none] } else if (MouseEvent.MOUSE_RELEASED == TYPE) { tile.fireTileEvent(VALUE_CHANGED); // depends on control dependency: [if], data = [none] } }; titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); valueText = new Text(String.format(locale, formatString, (tile.getValue()))); valueText.setFill(tile.getValueColor()); Helper.enableNode(valueText, tile.isValueVisible()); unitText = new Text(tile.getUnit()); unitText.setFill(tile.getUnitColor()); Helper.enableNode(unitText, !tile.getUnit().isEmpty()); valueUnitFlow = new TextFlow(valueText, unitText); valueUnitFlow.setTextAlignment(TextAlignment.RIGHT); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setWrapText(true); description.setTextFill(tile.getTextColor()); Helper.enableNode(description, !tile.getDescription().isEmpty()); barBackground = new Rectangle(PREFERRED_WIDTH * 0.795, PREFERRED_HEIGHT * 0.0275); bar = new Rectangle(0, PREFERRED_HEIGHT * 0.0275); thumb = new Circle(PREFERRED_WIDTH * 0.09); thumb.setEffect(shadow); getPane().getChildren().addAll(titleText, text, valueUnitFlow, description, barBackground, bar, thumb); } }
public class class_name { private void unregisterJmxExpose() { if (jmxNames.isEmpty()) { return; } try { final MBeanServer platformMBeanServer = MBeans.getPlatformMBeanServer(); for (final ObjectName name : jmxNames) { platformMBeanServer.unregisterMBean(name); } } catch (final JMException e) { LOG.warn("failed to unregister JMX beans", e); } } }
public class class_name { private void unregisterJmxExpose() { if (jmxNames.isEmpty()) { return; // depends on control dependency: [if], data = [none] } try { final MBeanServer platformMBeanServer = MBeans.getPlatformMBeanServer(); for (final ObjectName name : jmxNames) { platformMBeanServer.unregisterMBean(name); // depends on control dependency: [for], data = [name] } } catch (final JMException e) { LOG.warn("failed to unregister JMX beans", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final EObject ruleXPostfixOperation() throws RecognitionException { EObject current = null; EObject this_XMemberFeatureCall_0 = null; enterRule(); try { // InternalXbase.g:1520:2: ( (this_XMemberFeatureCall_0= ruleXMemberFeatureCall ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? ) ) // InternalXbase.g:1521:2: (this_XMemberFeatureCall_0= ruleXMemberFeatureCall ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? ) { // InternalXbase.g:1521:2: (this_XMemberFeatureCall_0= ruleXMemberFeatureCall ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? ) // InternalXbase.g:1522:3: this_XMemberFeatureCall_0= ruleXMemberFeatureCall ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXPostfixOperationAccess().getXMemberFeatureCallParserRuleCall_0()); } pushFollow(FOLLOW_21); this_XMemberFeatureCall_0=ruleXMemberFeatureCall(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current = this_XMemberFeatureCall_0; afterParserOrEnumRuleCall(); } // InternalXbase.g:1530:3: ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? int alt22=2; int LA22_0 = input.LA(1); if ( (LA22_0==43) ) { int LA22_1 = input.LA(2); if ( (synpred13_InternalXbase()) ) { alt22=1; } } else if ( (LA22_0==44) ) { int LA22_2 = input.LA(2); if ( (synpred13_InternalXbase()) ) { alt22=1; } } switch (alt22) { case 1 : // InternalXbase.g:1531:4: ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) { // InternalXbase.g:1541:4: ( () ( ( ruleOpPostfix ) ) ) // InternalXbase.g:1542:5: () ( ( ruleOpPostfix ) ) { // InternalXbase.g:1542:5: () // InternalXbase.g:1543:6: { if ( state.backtracking==0 ) { current = forceCreateModelElementAndSet( grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0(), current); } } // InternalXbase.g:1549:5: ( ( ruleOpPostfix ) ) // InternalXbase.g:1550:6: ( ruleOpPostfix ) { // InternalXbase.g:1550:6: ( ruleOpPostfix ) // InternalXbase.g:1551:7: ruleOpPostfix { if ( state.backtracking==0 ) { if (current==null) { current = createModelElement(grammarAccess.getXPostfixOperationRule()); } } if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXPostfixOperationAccess().getFeatureJvmIdentifiableElementCrossReference_1_0_1_0()); } pushFollow(FOLLOW_2); ruleOpPostfix(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { afterParserOrEnumRuleCall(); } } } } } break; } } } if ( state.backtracking==0 ) { leaveRule(); } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject ruleXPostfixOperation() throws RecognitionException { EObject current = null; EObject this_XMemberFeatureCall_0 = null; enterRule(); try { // InternalXbase.g:1520:2: ( (this_XMemberFeatureCall_0= ruleXMemberFeatureCall ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? ) ) // InternalXbase.g:1521:2: (this_XMemberFeatureCall_0= ruleXMemberFeatureCall ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? ) { // InternalXbase.g:1521:2: (this_XMemberFeatureCall_0= ruleXMemberFeatureCall ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? ) // InternalXbase.g:1522:3: this_XMemberFeatureCall_0= ruleXMemberFeatureCall ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXPostfixOperationAccess().getXMemberFeatureCallParserRuleCall_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_21); this_XMemberFeatureCall_0=ruleXMemberFeatureCall(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current = this_XMemberFeatureCall_0; // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } // InternalXbase.g:1530:3: ( ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) )? int alt22=2; int LA22_0 = input.LA(1); if ( (LA22_0==43) ) { int LA22_1 = input.LA(2); if ( (synpred13_InternalXbase()) ) { alt22=1; // depends on control dependency: [if], data = [none] } } else if ( (LA22_0==44) ) { int LA22_2 = input.LA(2); if ( (synpred13_InternalXbase()) ) { alt22=1; // depends on control dependency: [if], data = [none] } } switch (alt22) { case 1 : // InternalXbase.g:1531:4: ( ( () ( ( ruleOpPostfix ) ) ) )=> ( () ( ( ruleOpPostfix ) ) ) { // InternalXbase.g:1541:4: ( () ( ( ruleOpPostfix ) ) ) // InternalXbase.g:1542:5: () ( ( ruleOpPostfix ) ) { // InternalXbase.g:1542:5: () // InternalXbase.g:1543:6: { if ( state.backtracking==0 ) { current = forceCreateModelElementAndSet( grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0(), current); // depends on control dependency: [if], data = [none] } } // InternalXbase.g:1549:5: ( ( ruleOpPostfix ) ) // InternalXbase.g:1550:6: ( ruleOpPostfix ) { // InternalXbase.g:1550:6: ( ruleOpPostfix ) // InternalXbase.g:1551:7: ruleOpPostfix { if ( state.backtracking==0 ) { if (current==null) { current = createModelElement(grammarAccess.getXPostfixOperationRule()); // depends on control dependency: [if], data = [none] } } if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXPostfixOperationAccess().getFeatureJvmIdentifiableElementCrossReference_1_0_1_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_2); ruleOpPostfix(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } } } break; } } } if ( state.backtracking==0 ) { leaveRule(); // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { @Override public Map<BeanId, Bean> getBeanToValidate(Collection<Bean> beans) throws AbortRuntimeException { Map<BeanId, Bean> beansToValidate = new HashMap<>(); for (Bean bean : beans) { Map<BeanId, Bean> predecessors = new HashMap<>(); // beans read from xml storage will only have their basic properties initialized... // ... but we also need set the direct references/predecessors for beans to validate Map<BeanId, Bean> beansToValidateSubset = getDirectSuccessors(bean); beansToValidateSubset.put(bean.getId(), bean); for (Bean toValidate : beansToValidateSubset.values()) { predecessors.putAll(getDirectPredecessors(toValidate)); } for (Bean predecessor : predecessors.values()) { for (BeanId ref : predecessor.getReferences()) { Bean b = storage.get(ref); if (b == null) { throw CFG301_MISSING_RUNTIME_REF(predecessor.getId()); } ref.setBean(b); } } for (Bean toValidate : beansToValidateSubset.values()) { // list references of beansToValidate should now // be available in predecessors. for (BeanId ref : toValidate.getReferences()) { Bean predecessor = predecessors.get(ref); if (predecessor == null) { throw new IllegalStateException("Bug in algorithm. Reference [" + ref + "] of [" + toValidate.getId() + "] should be available in predecessors."); } ref.setBean(predecessor); } } beansToValidate.putAll(predecessors); } return beansToValidate; } }
public class class_name { @Override public Map<BeanId, Bean> getBeanToValidate(Collection<Bean> beans) throws AbortRuntimeException { Map<BeanId, Bean> beansToValidate = new HashMap<>(); for (Bean bean : beans) { Map<BeanId, Bean> predecessors = new HashMap<>(); // beans read from xml storage will only have their basic properties initialized... // ... but we also need set the direct references/predecessors for beans to validate Map<BeanId, Bean> beansToValidateSubset = getDirectSuccessors(bean); beansToValidateSubset.put(bean.getId(), bean); for (Bean toValidate : beansToValidateSubset.values()) { predecessors.putAll(getDirectPredecessors(toValidate)); // depends on control dependency: [for], data = [toValidate] } for (Bean predecessor : predecessors.values()) { for (BeanId ref : predecessor.getReferences()) { Bean b = storage.get(ref); if (b == null) { throw CFG301_MISSING_RUNTIME_REF(predecessor.getId()); } ref.setBean(b); // depends on control dependency: [for], data = [ref] } } for (Bean toValidate : beansToValidateSubset.values()) { // list references of beansToValidate should now // be available in predecessors. for (BeanId ref : toValidate.getReferences()) { Bean predecessor = predecessors.get(ref); if (predecessor == null) { throw new IllegalStateException("Bug in algorithm. Reference [" + ref + "] of [" + toValidate.getId() + "] should be available in predecessors."); } ref.setBean(predecessor); // depends on control dependency: [for], data = [ref] } } beansToValidate.putAll(predecessors); } return beansToValidate; } }
public class class_name { private boolean changed(MemberId leader, Collection<MemberId> members) { checkNotNull(members, "members"); checkArgument(!members.isEmpty(), "members cannot be empty"); if (leader != null && !members.contains(leader)) { leader = null; } if (!Objects.equals(this.leader, leader)) { return true; } else if (!matches(this.members, members)) { return true; } return false; } }
public class class_name { private boolean changed(MemberId leader, Collection<MemberId> members) { checkNotNull(members, "members"); checkArgument(!members.isEmpty(), "members cannot be empty"); if (leader != null && !members.contains(leader)) { leader = null; // depends on control dependency: [if], data = [none] } if (!Objects.equals(this.leader, leader)) { return true; // depends on control dependency: [if], data = [none] } else if (!matches(this.members, members)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private List<String> calculateTranscriptHgvs(Variant variant, Transcript transcript, String geneId) { String mutationType = ">"; // Populate HGVSName parse tree. HgvsStringBuilder hgvsStringBuilder = new HgvsStringBuilder(); // Populate coordinates. // Use cDNA coordinates. hgvsStringBuilder.setKind(isCoding(transcript) ? HgvsStringBuilder.Kind.CODING : HgvsStringBuilder.Kind.NON_CODING); hgvsStringBuilder.setCdnaStart(genomicToCdnaCoord(transcript, variant.getStart())); hgvsStringBuilder.setCdnaEnd(hgvsStringBuilder.getCdnaStart()); // Populate prefix. hgvsStringBuilder.setTranscriptId(transcript.getId()); hgvsStringBuilder.setGeneId(geneId); String reference; String alternate; // Convert alleles to transcript strand. if (transcript.getStrand().equals("-")) { reference = String.valueOf(VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant.getReference().charAt(0))); alternate = String.valueOf(VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant.getAlternate().charAt(0))); } else { reference = variant.getReference(); alternate = variant.getAlternate(); } // Populate alleles. hgvsStringBuilder.setMutationType(mutationType); hgvsStringBuilder.setReference(reference); hgvsStringBuilder.setAlternate(alternate); return Collections.singletonList(hgvsStringBuilder.format()); } }
public class class_name { private List<String> calculateTranscriptHgvs(Variant variant, Transcript transcript, String geneId) { String mutationType = ">"; // Populate HGVSName parse tree. HgvsStringBuilder hgvsStringBuilder = new HgvsStringBuilder(); // Populate coordinates. // Use cDNA coordinates. hgvsStringBuilder.setKind(isCoding(transcript) ? HgvsStringBuilder.Kind.CODING : HgvsStringBuilder.Kind.NON_CODING); hgvsStringBuilder.setCdnaStart(genomicToCdnaCoord(transcript, variant.getStart())); hgvsStringBuilder.setCdnaEnd(hgvsStringBuilder.getCdnaStart()); // Populate prefix. hgvsStringBuilder.setTranscriptId(transcript.getId()); hgvsStringBuilder.setGeneId(geneId); String reference; String alternate; // Convert alleles to transcript strand. if (transcript.getStrand().equals("-")) { reference = String.valueOf(VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant.getReference().charAt(0))); // depends on control dependency: [if], data = [none] alternate = String.valueOf(VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant.getAlternate().charAt(0))); // depends on control dependency: [if], data = [none] } else { reference = variant.getReference(); // depends on control dependency: [if], data = [none] alternate = variant.getAlternate(); // depends on control dependency: [if], data = [none] } // Populate alleles. hgvsStringBuilder.setMutationType(mutationType); hgvsStringBuilder.setReference(reference); hgvsStringBuilder.setAlternate(alternate); return Collections.singletonList(hgvsStringBuilder.format()); } }
public class class_name { public List<Label> getStoryLabels() { if (!isAnnotationPresent(Stories.class)) { return Collections.emptyList(); } List<Label> result = new ArrayList<>(); for (String story : getAnnotation(Stories.class).value()) { result.add(createStoryLabel(story)); } return result; } }
public class class_name { public List<Label> getStoryLabels() { if (!isAnnotationPresent(Stories.class)) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<Label> result = new ArrayList<>(); for (String story : getAnnotation(Stories.class).value()) { result.add(createStoryLabel(story)); // depends on control dependency: [for], data = [story] } return result; } }
public class class_name { public void deleteById(String id) { if (idToVersion.containsKey(id)) { String version = idToVersion.remove(id); expirationVersion.remove(version); versionToItem.remove(version); if (collectionCachePath != null && !collectionCachePath.resolve(version).toFile().delete()) { log.debug("couldn't delete " + version); } } } }
public class class_name { public void deleteById(String id) { if (idToVersion.containsKey(id)) { String version = idToVersion.remove(id); expirationVersion.remove(version); // depends on control dependency: [if], data = [none] versionToItem.remove(version); // depends on control dependency: [if], data = [none] if (collectionCachePath != null && !collectionCachePath.resolve(version).toFile().delete()) { log.debug("couldn't delete " + version); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void checkUUIDOfSiteRoot(CmsSite site, CmsObject clone, CmsObject cms_offline) { CmsUUID id = null; try { id = clone.readResource(site.getSiteRoot()).getStructureId(); } catch (CmsException e) { //Ok, site root not available for online repository. } if (id == null) { try { id = cms_offline.readResource(site.getSiteRoot()).getStructureId(); m_onlyOfflineSites.add(site); } catch (CmsException e) { //Siteroot not valid for on- and offline repository. } } if (id != null) { site.setSiteRootUUID(id); m_siteUUIDs.put(id, site); } } }
public class class_name { private void checkUUIDOfSiteRoot(CmsSite site, CmsObject clone, CmsObject cms_offline) { CmsUUID id = null; try { id = clone.readResource(site.getSiteRoot()).getStructureId(); // depends on control dependency: [try], data = [none] } catch (CmsException e) { //Ok, site root not available for online repository. } // depends on control dependency: [catch], data = [none] if (id == null) { try { id = cms_offline.readResource(site.getSiteRoot()).getStructureId(); // depends on control dependency: [try], data = [none] m_onlyOfflineSites.add(site); // depends on control dependency: [try], data = [none] } catch (CmsException e) { //Siteroot not valid for on- and offline repository. } // depends on control dependency: [catch], data = [none] } if (id != null) { site.setSiteRootUUID(id); // depends on control dependency: [if], data = [(id] m_siteUUIDs.put(id, site); // depends on control dependency: [if], data = [(id] } } }
public class class_name { private void visit(XmlSchemaChoice xsdChoice, RootCompositeType compositeTypes, String choiceTypeName) { Map < String, Object > alternatives = new LinkedHashMap < String, Object >(); int fieldIndex = 0; for (XmlSchemaChoiceMember alternative : xsdChoice.getItems()) { if (alternative instanceof XmlSchemaElement) { addField(fieldIndex, alternative, alternatives, compositeTypes); fieldIndex++; } } compositeTypes.choiceTypes.put(choiceTypeName, alternatives); } }
public class class_name { private void visit(XmlSchemaChoice xsdChoice, RootCompositeType compositeTypes, String choiceTypeName) { Map < String, Object > alternatives = new LinkedHashMap < String, Object >(); int fieldIndex = 0; for (XmlSchemaChoiceMember alternative : xsdChoice.getItems()) { if (alternative instanceof XmlSchemaElement) { addField(fieldIndex, alternative, alternatives, compositeTypes); // depends on control dependency: [if], data = [none] fieldIndex++; // depends on control dependency: [if], data = [none] } } compositeTypes.choiceTypes.put(choiceTypeName, alternatives); } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfCityFurniture() { if (_GenericApplicationPropertyOfCityFurniture == null) { _GenericApplicationPropertyOfCityFurniture = new ArrayList<JAXBElement<Object>>(); } return this._GenericApplicationPropertyOfCityFurniture; } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfCityFurniture() { if (_GenericApplicationPropertyOfCityFurniture == null) { _GenericApplicationPropertyOfCityFurniture = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none] } return this._GenericApplicationPropertyOfCityFurniture; } }
public class class_name { protected void setDynamicInfo(List<AdditionalInfoItem> info) { for (AdditionalInfoItem item : m_dynamicInfo) { item.removeFromParent(); } for (AdditionalInfoItem item : info) { m_dynamicInfo.add(item); m_additionalInfo.add(item); } updateTruncation(); } }
public class class_name { protected void setDynamicInfo(List<AdditionalInfoItem> info) { for (AdditionalInfoItem item : m_dynamicInfo) { item.removeFromParent(); // depends on control dependency: [for], data = [item] } for (AdditionalInfoItem item : info) { m_dynamicInfo.add(item); // depends on control dependency: [for], data = [item] m_additionalInfo.add(item); // depends on control dependency: [for], data = [item] } updateTruncation(); } }
public class class_name { final ServiceController<?> addRelativePathService(final ServiceTarget serviceTarget, final String pathName, final String path, final boolean possiblyAbsolute, final String relativeTo) { if (possiblyAbsolute && AbstractPathService.isAbsoluteUnixOrWindowsPath(path)) { return addAbsolutePathService(serviceTarget, pathName, path); } else { return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget); } } }
public class class_name { final ServiceController<?> addRelativePathService(final ServiceTarget serviceTarget, final String pathName, final String path, final boolean possiblyAbsolute, final String relativeTo) { if (possiblyAbsolute && AbstractPathService.isAbsoluteUnixOrWindowsPath(path)) { return addAbsolutePathService(serviceTarget, pathName, path); // depends on control dependency: [if], data = [none] } else { return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) { ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); if (result != null) { if (treePath != null) result.setTreePath(treePath); } else { result = new ConstructorDocImpl(this, meth, treePath); methodMap.put(meth, result); } } }
public class class_name { protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) { ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); if (result != null) { if (treePath != null) result.setTreePath(treePath); } else { result = new ConstructorDocImpl(this, meth, treePath); // depends on control dependency: [if], data = [none] methodMap.put(meth, result); // depends on control dependency: [if], data = [none] } } }