code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static boolean deleteAtomic(ZooKeeperClient zk, String path, String expectedValue) { final Stat stat = new Stat(); String value = getWithStat(zk, path, stat); if (!expectedValue.equals(value)) { return false; } try { zk.get().delete(path, stat.getVersion()); return true; } catch (Exception e) { LOG.error("Failed to delete path "+path+" with expected value '"+expectedValue+"'", e); } return false; } }
public class class_name { public static boolean deleteAtomic(ZooKeeperClient zk, String path, String expectedValue) { final Stat stat = new Stat(); String value = getWithStat(zk, path, stat); if (!expectedValue.equals(value)) { return false; // depends on control dependency: [if], data = [none] } try { zk.get().delete(path, stat.getVersion()); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error("Failed to delete path "+path+" with expected value '"+expectedValue+"'", e); } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public static void main(final String[] pArgs) throws IOException { int subsampleFactor = 1; Rectangle sourceRegion = null; boolean readLayers = false; boolean readThumbnails = false; int idx = 0; while (pArgs[idx].charAt(0) == '-') { if (pArgs[idx].equals("-s") || pArgs[idx].equals("--subsampling")) { subsampleFactor = Integer.parseInt(pArgs[++idx]); } else if (pArgs[idx].equals("-r") || pArgs[idx].equals("--sourceregion")) { int xw = Integer.parseInt(pArgs[++idx]); int yh = Integer.parseInt(pArgs[++idx]); try { int w = Integer.parseInt(pArgs[idx + 1]); int h = Integer.parseInt(pArgs[idx + 2]); idx += 2; // x y w h sourceRegion = new Rectangle(xw, yh, w, h); } catch (NumberFormatException e) { // w h sourceRegion = new Rectangle(xw, yh); } System.out.println("sourceRegion: " + sourceRegion); } else if (pArgs[idx].equals("-l") || pArgs[idx].equals("--layers")) { readLayers = true; } else if (pArgs[idx].equals("-t") || pArgs[idx].equals("--thumbnails")) { readThumbnails = true; } else { System.err.println("Usage: java PSDImageReader [-s <subsample factor>] [-r [<x y>] <w h>] <image file>"); System.exit(1); } idx++; } PSDImageReader imageReader = new PSDImageReader(null); for (; idx < pArgs.length; idx++) { File file = new File(pArgs[idx]); System.out.println(); System.out.println("file: " + file.getAbsolutePath()); ImageInputStream stream = ImageIO.createImageInputStream(file); imageReader.setInput(stream); imageReader.readHeader(); System.out.println("imageReader.header: " + imageReader.header); imageReader.readImageResources(true); System.out.println("imageReader.imageResources: " + imageReader.metadata.imageResources); System.out.println(); imageReader.readLayerAndMaskInfo(true); System.out.println("imageReader.layerInfo: " + imageReader.metadata.layerInfo); /* // System.out.println("imageReader.globalLayerMask: " + imageReader.globalLayerMask); System.out.println(); IIOMetadata metadata = imageReader.getImageMetadata(0); Node node; XMLSerializer serializer; node = metadata.getAsTree(IIOMetadataFormatImpl.standardMetadataFormatName); serializer = new XMLSerializer(System.out, System.getProperty("file.encoding")); serializer.serialize(node, true); System.out.println(); node = metadata.getAsTree(PSDMetadata.NATIVE_METADATA_FORMAT_NAME); // serializer = new XMLSerializer(System.out, System.getProperty("file.encoding")); serializer.serialize(node, true); */ if (readThumbnails && imageReader.hasThumbnails(0)) { int thumbnails = imageReader.getNumThumbnails(0); for (int i = 0; i < thumbnails; i++) { showIt(imageReader.readThumbnail(0, i), String.format("Thumbnail %d", i)); } } long start = System.currentTimeMillis(); ImageReadParam param = imageReader.getDefaultReadParam(); if (sourceRegion != null) { param.setSourceRegion(sourceRegion); } if (subsampleFactor > 1) { param.setSourceSubsampling(subsampleFactor, subsampleFactor, 0, 0); } // param.setDestinationType(imageReader.getRawImageType(0)); BufferedImage image = imageReader.read(0, param); System.out.println("read time: " + (System.currentTimeMillis() - start)); System.out.println("image: " + image); if (image.getType() == BufferedImage.TYPE_CUSTOM) { try { ColorConvertOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB), null); GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); image = op.filter(image, gc.createCompatibleImage(image.getWidth(), image.getHeight(), image.getTransparency())); } catch (Exception e) { e.printStackTrace(); image = ImageUtil.accelerate(image); } System.out.println("conversion time: " + (System.currentTimeMillis() - start)); System.out.println("image: " + image); } showIt(image, file.getName()); if (readLayers) { int images = imageReader.getNumImages(true); for (int i = 1; i < images; i++) { start = System.currentTimeMillis(); BufferedImage layer = imageReader.read(i); System.out.println("layer read time: " + (System.currentTimeMillis() - start)); System.err.println("layer: " + layer); if (layer != null && layer.getType() == BufferedImage.TYPE_CUSTOM) { try { ColorConvertOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB), null); GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); layer = op.filter(layer, gc.createCompatibleImage(layer.getWidth(), layer.getHeight(), layer.getTransparency())); } catch (Exception e) { e.printStackTrace(); layer = ImageUtil.accelerate(layer); } System.out.println("layer conversion time: " + (System.currentTimeMillis() - start)); System.out.println("layer: " + layer); } showIt(layer, "layer " + i); } } } } }
public class class_name { public static void main(final String[] pArgs) throws IOException { int subsampleFactor = 1; Rectangle sourceRegion = null; boolean readLayers = false; boolean readThumbnails = false; int idx = 0; while (pArgs[idx].charAt(0) == '-') { if (pArgs[idx].equals("-s") || pArgs[idx].equals("--subsampling")) { subsampleFactor = Integer.parseInt(pArgs[++idx]); // depends on control dependency: [if], data = [none] } else if (pArgs[idx].equals("-r") || pArgs[idx].equals("--sourceregion")) { int xw = Integer.parseInt(pArgs[++idx]); int yh = Integer.parseInt(pArgs[++idx]); try { int w = Integer.parseInt(pArgs[idx + 1]); int h = Integer.parseInt(pArgs[idx + 2]); idx += 2; // depends on control dependency: [try], data = [none] // x y w h sourceRegion = new Rectangle(xw, yh, w, h); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { // w h sourceRegion = new Rectangle(xw, yh); } // depends on control dependency: [catch], data = [none] System.out.println("sourceRegion: " + sourceRegion); // depends on control dependency: [if], data = [none] } else if (pArgs[idx].equals("-l") || pArgs[idx].equals("--layers")) { readLayers = true; // depends on control dependency: [if], data = [none] } else if (pArgs[idx].equals("-t") || pArgs[idx].equals("--thumbnails")) { readThumbnails = true; // depends on control dependency: [if], data = [none] } else { System.err.println("Usage: java PSDImageReader [-s <subsample factor>] [-r [<x y>] <w h>] <image file>"); // depends on control dependency: [if], data = [none] System.exit(1); // depends on control dependency: [if], data = [none] } idx++; } PSDImageReader imageReader = new PSDImageReader(null); for (; idx < pArgs.length; idx++) { File file = new File(pArgs[idx]); System.out.println(); System.out.println("file: " + file.getAbsolutePath()); ImageInputStream stream = ImageIO.createImageInputStream(file); imageReader.setInput(stream); imageReader.readHeader(); System.out.println("imageReader.header: " + imageReader.header); imageReader.readImageResources(true); System.out.println("imageReader.imageResources: " + imageReader.metadata.imageResources); System.out.println(); imageReader.readLayerAndMaskInfo(true); System.out.println("imageReader.layerInfo: " + imageReader.metadata.layerInfo); /* // System.out.println("imageReader.globalLayerMask: " + imageReader.globalLayerMask); System.out.println(); IIOMetadata metadata = imageReader.getImageMetadata(0); Node node; XMLSerializer serializer; node = metadata.getAsTree(IIOMetadataFormatImpl.standardMetadataFormatName); serializer = new XMLSerializer(System.out, System.getProperty("file.encoding")); serializer.serialize(node, true); System.out.println(); node = metadata.getAsTree(PSDMetadata.NATIVE_METADATA_FORMAT_NAME); // serializer = new XMLSerializer(System.out, System.getProperty("file.encoding")); serializer.serialize(node, true); */ if (readThumbnails && imageReader.hasThumbnails(0)) { int thumbnails = imageReader.getNumThumbnails(0); for (int i = 0; i < thumbnails; i++) { showIt(imageReader.readThumbnail(0, i), String.format("Thumbnail %d", i)); // depends on control dependency: [for], data = [i] } } long start = System.currentTimeMillis(); ImageReadParam param = imageReader.getDefaultReadParam(); if (sourceRegion != null) { param.setSourceRegion(sourceRegion); } if (subsampleFactor > 1) { param.setSourceSubsampling(subsampleFactor, subsampleFactor, 0, 0); } // param.setDestinationType(imageReader.getRawImageType(0)); BufferedImage image = imageReader.read(0, param); System.out.println("read time: " + (System.currentTimeMillis() - start)); System.out.println("image: " + image); if (image.getType() == BufferedImage.TYPE_CUSTOM) { try { ColorConvertOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB), null); GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); image = op.filter(image, gc.createCompatibleImage(image.getWidth(), image.getHeight(), image.getTransparency())); } catch (Exception e) { e.printStackTrace(); image = ImageUtil.accelerate(image); } System.out.println("conversion time: " + (System.currentTimeMillis() - start)); System.out.println("image: " + image); } showIt(image, file.getName()); if (readLayers) { int images = imageReader.getNumImages(true); for (int i = 1; i < images; i++) { start = System.currentTimeMillis(); BufferedImage layer = imageReader.read(i); System.out.println("layer read time: " + (System.currentTimeMillis() - start)); System.err.println("layer: " + layer); if (layer != null && layer.getType() == BufferedImage.TYPE_CUSTOM) { try { ColorConvertOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB), null); GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); layer = op.filter(layer, gc.createCompatibleImage(layer.getWidth(), layer.getHeight(), layer.getTransparency())); } catch (Exception e) { e.printStackTrace(); layer = ImageUtil.accelerate(layer); } System.out.println("layer conversion time: " + (System.currentTimeMillis() - start)); System.out.println("layer: " + layer); } showIt(layer, "layer " + i); } } } } }
public class class_name { @Activate protected void activate(ComponentContext context, Map<String, Object> config) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(this, tc, "Activating ", config); } // handle config (such as TCP factory info) before registering // factories, as the register will trigger an automatic load of any // delayed configuration, and we need the config before that happens modified(config); this.chfw.registerFactory("TCPChannel", TCPChannelFactory.class); this.chfw.registerFactory("UDPChannel", UDPChannelFactory.class); instance.get().set(this); // required components have been activated } }
public class class_name { @Activate protected void activate(ComponentContext context, Map<String, Object> config) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(this, tc, "Activating ", config); // depends on control dependency: [if], data = [none] } // handle config (such as TCP factory info) before registering // factories, as the register will trigger an automatic load of any // delayed configuration, and we need the config before that happens modified(config); this.chfw.registerFactory("TCPChannel", TCPChannelFactory.class); this.chfw.registerFactory("UDPChannel", UDPChannelFactory.class); instance.get().set(this); // required components have been activated } }
public class class_name { public void trainOnInstanceImpl(Instance inst) { accumulatedError= Math.abs(this.prediction(inst)-inst.classValue()) + fadingFactor*accumulatedError; nError=1+fadingFactor*nError; // Initialise Perceptron if necessary if (this.initialisePerceptron) { //this.fadingFactor=this.fadingFactorOption.getValue(); //this.classifierRandom.setSeed(randomSeedOption.getValue()); this.classifierRandom.setSeed(randomSeed); this.initialisePerceptron = false; // not in resetLearningImpl() because it needs Instance! this.weightAttribute = new double[inst.numAttributes()]; for (int j = 0; j < inst.numAttributes(); j++) { weightAttribute[j] = 2 * this.classifierRandom.nextDouble() - 1; } // Update Learning Rate learningRatio = originalLearningRatio; //this.learningRateDecay = learningRateDecayOption.getValue(); } // Update attribute statistics this.perceptronInstancesSeen++; this.perceptronYSeen++; for(int j = 0; j < inst.numAttributes() -1; j++) { perceptronattributeStatistics.addToValue(j, inst.value(j)); squaredperceptronattributeStatistics.addToValue(j, inst.value(j)*inst.value(j)); } this.perceptronsumY += inst.classValue(); this.squaredperceptronsumY += inst.classValue() * inst.classValue(); if(!constantLearningRatioDecay){ learningRatio = originalLearningRatio / (1+ perceptronInstancesSeen*learningRateDecay); } this.updateWeights(inst,learningRatio); //this.printPerceptron(); } }
public class class_name { public void trainOnInstanceImpl(Instance inst) { accumulatedError= Math.abs(this.prediction(inst)-inst.classValue()) + fadingFactor*accumulatedError; nError=1+fadingFactor*nError; // Initialise Perceptron if necessary if (this.initialisePerceptron) { //this.fadingFactor=this.fadingFactorOption.getValue(); //this.classifierRandom.setSeed(randomSeedOption.getValue()); this.classifierRandom.setSeed(randomSeed); // depends on control dependency: [if], data = [none] this.initialisePerceptron = false; // not in resetLearningImpl() because it needs Instance! // depends on control dependency: [if], data = [none] this.weightAttribute = new double[inst.numAttributes()]; // depends on control dependency: [if], data = [none] for (int j = 0; j < inst.numAttributes(); j++) { weightAttribute[j] = 2 * this.classifierRandom.nextDouble() - 1; // depends on control dependency: [for], data = [j] } // Update Learning Rate learningRatio = originalLearningRatio; // depends on control dependency: [if], data = [none] //this.learningRateDecay = learningRateDecayOption.getValue(); } // Update attribute statistics this.perceptronInstancesSeen++; this.perceptronYSeen++; for(int j = 0; j < inst.numAttributes() -1; j++) { perceptronattributeStatistics.addToValue(j, inst.value(j)); // depends on control dependency: [for], data = [j] squaredperceptronattributeStatistics.addToValue(j, inst.value(j)*inst.value(j)); // depends on control dependency: [for], data = [j] } this.perceptronsumY += inst.classValue(); this.squaredperceptronsumY += inst.classValue() * inst.classValue(); if(!constantLearningRatioDecay){ learningRatio = originalLearningRatio / (1+ perceptronInstancesSeen*learningRateDecay); // depends on control dependency: [if], data = [none] } this.updateWeights(inst,learningRatio); //this.printPerceptron(); } }
public class class_name { public ListPolicyVersionsResult withVersions(PolicyVersion... versions) { if (this.versions == null) { setVersions(new com.amazonaws.internal.SdkInternalList<PolicyVersion>(versions.length)); } for (PolicyVersion ele : versions) { this.versions.add(ele); } return this; } }
public class class_name { public ListPolicyVersionsResult withVersions(PolicyVersion... versions) { if (this.versions == null) { setVersions(new com.amazonaws.internal.SdkInternalList<PolicyVersion>(versions.length)); // depends on control dependency: [if], data = [none] } for (PolicyVersion ele : versions) { this.versions.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public Field createFieldDecimalSpinner( Field formFieldParam, double minParam, double maxParam, double stepFactorParam, String prefixParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Decimal); formFieldParam.setTypeMetaData( this.getMetaDataForDecimalAs( FieldMetaData.Decimal.SPINNER, minParam,maxParam, stepFactorParam, prefixParam)); } return new Field(this.putJson( formFieldParam, WS.Path.FormField.Version1.formFieldCreate())); } }
public class class_name { public Field createFieldDecimalSpinner( Field formFieldParam, double minParam, double maxParam, double stepFactorParam, String prefixParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none] } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Decimal); // depends on control dependency: [if], data = [none] formFieldParam.setTypeMetaData( this.getMetaDataForDecimalAs( FieldMetaData.Decimal.SPINNER, minParam,maxParam, stepFactorParam, prefixParam)); // depends on control dependency: [if], data = [none] } return new Field(this.putJson( formFieldParam, WS.Path.FormField.Version1.formFieldCreate())); } }
public class class_name { public String getBasicJobName() { if (jobName != null) { int index = jobName.indexOf(NAME_DELIMITER); if (index != -1) { return jobName.substring(0, index); } } return jobName; } }
public class class_name { public String getBasicJobName() { if (jobName != null) { int index = jobName.indexOf(NAME_DELIMITER); if (index != -1) { return jobName.substring(0, index); // depends on control dependency: [if], data = [none] } } return jobName; } }
public class class_name { public void marshall(GetApnsVoipChannelRequest getApnsVoipChannelRequest, ProtocolMarshaller protocolMarshaller) { if (getApnsVoipChannelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getApnsVoipChannelRequest.getApplicationId(), APPLICATIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetApnsVoipChannelRequest getApnsVoipChannelRequest, ProtocolMarshaller protocolMarshaller) { if (getApnsVoipChannelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getApnsVoipChannelRequest.getApplicationId(), APPLICATIONID_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 { @SuppressWarnings({"rawtypes", "unchecked"}) private void handleSetSubEntities(Object obj, Class<?> clazz, Entity entity, List<ReflectedInfo> fieldInfo) throws Siren4JConversionException { if (!CollectionUtils.isEmpty(entity.getEntities())) { for (Entity ent : entity.getEntities()) { //Skip embedded as we can't deal with them. if (StringUtils.isNotBlank(ent.getHref())) { continue; } String[] rel = ent.getRel(); if (ArrayUtils.isEmpty(rel)) { throw new Siren4JConversionException("No relationship set on sub entity. Can't go on."); } String fieldKey = rel.length == 1 ? rel[0] : ArrayUtils.toString(rel); ReflectedInfo info = ReflectionUtils.getFieldInfoByEffectiveName(fieldInfo, fieldKey); if (info != null) { try { Object subObj = toObject(ent); if (subObj != null) { if (subObj.getClass().equals(CollectionResource.class)) { ReflectionUtils.setFieldValue(obj, info, subObj); continue; // If subObj is collection resource then continue // or it will get wrapped into another collection which we don't want. } if (isCollection(obj, info.getField())) { //If we are a collection we need to add each subObj via the add method //and not a setter. So we need to grab the collection from the field value. try { Collection coll = (Collection) info.getField().get(obj); if (coll == null) { //In the highly unlikely event that no collection is set on the //field value we will create a new collection here. coll = new CollectionResource(); ReflectionUtils.setFieldValue(obj, info, coll); } coll.add(subObj); } catch (Exception e) { throw new Siren4JConversionException(e); } } else { ReflectionUtils.setFieldValue(obj, info, subObj); } } } catch (Siren4JException e) { throw new Siren4JConversionException(e); } } else { throw new Siren4JConversionException( "Unable to find field: " + fieldKey + " for class: " + clazz.getName()); } } } } }
public class class_name { @SuppressWarnings({"rawtypes", "unchecked"}) private void handleSetSubEntities(Object obj, Class<?> clazz, Entity entity, List<ReflectedInfo> fieldInfo) throws Siren4JConversionException { if (!CollectionUtils.isEmpty(entity.getEntities())) { for (Entity ent : entity.getEntities()) { //Skip embedded as we can't deal with them. if (StringUtils.isNotBlank(ent.getHref())) { continue; } String[] rel = ent.getRel(); if (ArrayUtils.isEmpty(rel)) { throw new Siren4JConversionException("No relationship set on sub entity. Can't go on."); } String fieldKey = rel.length == 1 ? rel[0] : ArrayUtils.toString(rel); ReflectedInfo info = ReflectionUtils.getFieldInfoByEffectiveName(fieldInfo, fieldKey); if (info != null) { try { Object subObj = toObject(ent); if (subObj != null) { if (subObj.getClass().equals(CollectionResource.class)) { ReflectionUtils.setFieldValue(obj, info, subObj); // depends on control dependency: [if], data = [none] continue; // If subObj is collection resource then continue // or it will get wrapped into another collection which we don't want. } if (isCollection(obj, info.getField())) { //If we are a collection we need to add each subObj via the add method //and not a setter. So we need to grab the collection from the field value. try { Collection coll = (Collection) info.getField().get(obj); if (coll == null) { //In the highly unlikely event that no collection is set on the //field value we will create a new collection here. coll = new CollectionResource(); // depends on control dependency: [if], data = [none] ReflectionUtils.setFieldValue(obj, info, coll); // depends on control dependency: [if], data = [none] } coll.add(subObj); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new Siren4JConversionException(e); } // depends on control dependency: [catch], data = [none] } else { ReflectionUtils.setFieldValue(obj, info, subObj); // depends on control dependency: [if], data = [none] } } } catch (Siren4JException e) { throw new Siren4JConversionException(e); } // depends on control dependency: [catch], data = [none] } else { throw new Siren4JConversionException( "Unable to find field: " + fieldKey + " for class: " + clazz.getName()); } } } } }
public class class_name { private ParseTree parseTryStatement() { SourcePosition start = getTreeStartLocation(); eat(TokenType.TRY); ParseTree body = parseBlock(); ParseTree catchBlock = null; if (peek(TokenType.CATCH)) { catchBlock = parseCatch(); } ParseTree finallyBlock = null; if (peek(TokenType.FINALLY)) { finallyBlock = parseFinallyBlock(); } if (catchBlock == null && finallyBlock == null) { reportError("'catch' or 'finally' expected."); } return new TryStatementTree(getTreeLocation(start), body, catchBlock, finallyBlock); } }
public class class_name { private ParseTree parseTryStatement() { SourcePosition start = getTreeStartLocation(); eat(TokenType.TRY); ParseTree body = parseBlock(); ParseTree catchBlock = null; if (peek(TokenType.CATCH)) { catchBlock = parseCatch(); // depends on control dependency: [if], data = [none] } ParseTree finallyBlock = null; if (peek(TokenType.FINALLY)) { finallyBlock = parseFinallyBlock(); // depends on control dependency: [if], data = [none] } if (catchBlock == null && finallyBlock == null) { reportError("'catch' or 'finally' expected."); // depends on control dependency: [if], data = [none] } return new TryStatementTree(getTreeLocation(start), body, catchBlock, finallyBlock); } }
public class class_name { public Query addParameters(Object... values) { for (Object v : values) { if (v instanceof String) { addParameter((String) v); } else if (v instanceof Integer) { addParameter((Integer) v); } else if (v instanceof Long) { addParameter((Long) v); } else if(v instanceof Double) { addParameter((Double) v); } else if (v instanceof Boolean) { addParameter((Boolean) v); } else if (v instanceof Date) { addParameter((Date) v); } else if (v instanceof Timestamp) { addParameter((Timestamp) v); } else { throw new IllegalArgumentException( "Type " + v.getClass().getName() + " is not supported by automatic property assignment"); } } return this; } }
public class class_name { public Query addParameters(Object... values) { for (Object v : values) { if (v instanceof String) { addParameter((String) v); // depends on control dependency: [if], data = [none] } else if (v instanceof Integer) { addParameter((Integer) v); // depends on control dependency: [if], data = [none] } else if (v instanceof Long) { addParameter((Long) v); // depends on control dependency: [if], data = [none] } else if(v instanceof Double) { addParameter((Double) v); // depends on control dependency: [if], data = [none] } else if (v instanceof Boolean) { addParameter((Boolean) v); // depends on control dependency: [if], data = [none] } else if (v instanceof Date) { addParameter((Date) v); // depends on control dependency: [if], data = [none] } else if (v instanceof Timestamp) { addParameter((Timestamp) v); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException( "Type " + v.getClass().getName() + " is not supported by automatic property assignment"); } } return this; } }
public class class_name { public static TransactionAnnotationValues of(final AnnotationParser annotationParser, final AnnotatedElement annotatedElement) { if (!annotationParser.hasAnnotationOn(annotatedElement)) { return null; } return new TransactionAnnotationValues(annotationParser.of(annotatedElement)); } }
public class class_name { public static TransactionAnnotationValues of(final AnnotationParser annotationParser, final AnnotatedElement annotatedElement) { if (!annotationParser.hasAnnotationOn(annotatedElement)) { return null; // depends on control dependency: [if], data = [none] } return new TransactionAnnotationValues(annotationParser.of(annotatedElement)); } }
public class class_name { public int xIndex(int loc) { int chars1 = 0; int chars2 = 0; int last_chars1 = 0; int last_chars2 = 0; Change lastDiff = null; for (Change aDiff : getChangeList()) { if (aDiff.operation != Operation.INSERT) { // Equality or deletion. chars1 += aDiff.text.length(); } if (aDiff.operation != Operation.DELETE) { // Equality or insertion. chars2 += aDiff.text.length(); } if (chars1 > loc) { // Overshot the location. lastDiff = aDiff; break; } last_chars1 = chars1; last_chars2 = chars2; } if (lastDiff != null && lastDiff.operation == Operation.DELETE) { // The location was deleted. return last_chars2; } // Add the remaining character length. return last_chars2 + (loc - last_chars1); } }
public class class_name { public int xIndex(int loc) { int chars1 = 0; int chars2 = 0; int last_chars1 = 0; int last_chars2 = 0; Change lastDiff = null; for (Change aDiff : getChangeList()) { if (aDiff.operation != Operation.INSERT) { // Equality or deletion. chars1 += aDiff.text.length(); // depends on control dependency: [if], data = [none] } if (aDiff.operation != Operation.DELETE) { // Equality or insertion. chars2 += aDiff.text.length(); // depends on control dependency: [if], data = [none] } if (chars1 > loc) { // Overshot the location. lastDiff = aDiff; // depends on control dependency: [if], data = [none] break; } last_chars1 = chars1; // depends on control dependency: [for], data = [none] last_chars2 = chars2; // depends on control dependency: [for], data = [none] } if (lastDiff != null && lastDiff.operation == Operation.DELETE) { // The location was deleted. return last_chars2; // depends on control dependency: [if], data = [none] } // Add the remaining character length. return last_chars2 + (loc - last_chars1); } }
public class class_name { public synchronized static void silenceLogging() { if (SplitlogLoggerFactory.state == SplitlogLoggingState.OFF) { return; } SplitlogLoggerFactory.state = SplitlogLoggingState.OFF; SplitlogLoggerFactory.messageCounter.set(0); /* * intentionally using the original logger so that this message can not * be silenced */ LoggerFactory.getLogger(SplitlogLoggerFactory.class).info("Forcibly disabled Splitlog's internal logging."); } }
public class class_name { public synchronized static void silenceLogging() { if (SplitlogLoggerFactory.state == SplitlogLoggingState.OFF) { return; // depends on control dependency: [if], data = [none] } SplitlogLoggerFactory.state = SplitlogLoggingState.OFF; SplitlogLoggerFactory.messageCounter.set(0); /* * intentionally using the original logger so that this message can not * be silenced */ LoggerFactory.getLogger(SplitlogLoggerFactory.class).info("Forcibly disabled Splitlog's internal logging."); } }
public class class_name { @Override public EClass getIfcController() { if (ifcControllerEClass == null) { ifcControllerEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(139); } return ifcControllerEClass; } }
public class class_name { @Override public EClass getIfcController() { if (ifcControllerEClass == null) { ifcControllerEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(139); // depends on control dependency: [if], data = [none] } return ifcControllerEClass; } }
public class class_name { public ListTagsResult withResourceTagList(ResourceTag... resourceTagList) { if (this.resourceTagList == null) { setResourceTagList(new com.amazonaws.internal.SdkInternalList<ResourceTag>(resourceTagList.length)); } for (ResourceTag ele : resourceTagList) { this.resourceTagList.add(ele); } return this; } }
public class class_name { public ListTagsResult withResourceTagList(ResourceTag... resourceTagList) { if (this.resourceTagList == null) { setResourceTagList(new com.amazonaws.internal.SdkInternalList<ResourceTag>(resourceTagList.length)); // depends on control dependency: [if], data = [none] } for (ResourceTag ele : resourceTagList) { this.resourceTagList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void updateApptentiveInteractionTheme(Context context, Resources.Theme interactionTheme) { /* Step 1: Apply Apptentive default theme layer. * If host activity is an activity, the base theme already has Apptentive defaults applied, so skip Step 1. * If parent activity is NOT an activity, first apply Apptentive defaults. */ if (!(context instanceof Activity)) { // If host context is not an activity, i.e. application context, treat it as initial theme setup interactionTheme.applyStyle(R.style.ApptentiveTheme_Base_Versioned, true); } // Step 2: Inherit app default appcompat theme if there is one specified in app's AndroidManifest if (appDefaultAppCompatThemeId != 0) { interactionTheme.applyStyle(appDefaultAppCompatThemeId, true); } // Step 3: Restore Apptentive UI window properties that may have been overridden in Step 2. This theme // is to ensure Apptentive interaction has a modal feel-n-look. interactionTheme.applyStyle(R.style.ApptentiveBaseFrameTheme, true); // Step 4: Apply optional theme override specified in host app's style int themeOverrideResId = context.getResources().getIdentifier("ApptentiveThemeOverride", "style", getApplicationContext().getPackageName()); if (themeOverrideResId != 0) { interactionTheme.applyStyle(themeOverrideResId, true); } // Step 5: Update status bar color /* Obtain the default status bar color. When an Apptentive Modal interaction is shown, * a translucent overlay would be applied on top of statusBarColorDefault */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int transparentColor = ContextCompat.getColor(context, android.R.color.transparent); TypedArray a = interactionTheme.obtainStyledAttributes(new int[]{android.R.attr.statusBarColor}); try { statusBarColorDefault = a.getColor(0, transparentColor); } finally { a.recycle(); } } // Step 6: Update toolbar overlay theme int toolbarThemeId = Util.getResourceIdFromAttribute(interactionTheme, R.attr.apptentiveToolbarTheme); apptentiveToolbarTheme.setTo(interactionTheme); apptentiveToolbarTheme.applyStyle(toolbarThemeId, true); } }
public class class_name { public void updateApptentiveInteractionTheme(Context context, Resources.Theme interactionTheme) { /* Step 1: Apply Apptentive default theme layer. * If host activity is an activity, the base theme already has Apptentive defaults applied, so skip Step 1. * If parent activity is NOT an activity, first apply Apptentive defaults. */ if (!(context instanceof Activity)) { // If host context is not an activity, i.e. application context, treat it as initial theme setup interactionTheme.applyStyle(R.style.ApptentiveTheme_Base_Versioned, true); // depends on control dependency: [if], data = [none] } // Step 2: Inherit app default appcompat theme if there is one specified in app's AndroidManifest if (appDefaultAppCompatThemeId != 0) { interactionTheme.applyStyle(appDefaultAppCompatThemeId, true); // depends on control dependency: [if], data = [(appDefaultAppCompatThemeId] } // Step 3: Restore Apptentive UI window properties that may have been overridden in Step 2. This theme // is to ensure Apptentive interaction has a modal feel-n-look. interactionTheme.applyStyle(R.style.ApptentiveBaseFrameTheme, true); // Step 4: Apply optional theme override specified in host app's style int themeOverrideResId = context.getResources().getIdentifier("ApptentiveThemeOverride", "style", getApplicationContext().getPackageName()); if (themeOverrideResId != 0) { interactionTheme.applyStyle(themeOverrideResId, true); // depends on control dependency: [if], data = [(themeOverrideResId] } // Step 5: Update status bar color /* Obtain the default status bar color. When an Apptentive Modal interaction is shown, * a translucent overlay would be applied on top of statusBarColorDefault */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int transparentColor = ContextCompat.getColor(context, android.R.color.transparent); TypedArray a = interactionTheme.obtainStyledAttributes(new int[]{android.R.attr.statusBarColor}); try { statusBarColorDefault = a.getColor(0, transparentColor); // depends on control dependency: [try], data = [none] } finally { a.recycle(); } } // Step 6: Update toolbar overlay theme int toolbarThemeId = Util.getResourceIdFromAttribute(interactionTheme, R.attr.apptentiveToolbarTheme); apptentiveToolbarTheme.setTo(interactionTheme); apptentiveToolbarTheme.applyStyle(toolbarThemeId, true); } }
public class class_name { @Deprecated public java.util.List<String> getIpRanges() { if (ipv4Ranges == null) { ipv4Ranges = new com.amazonaws.internal.SdkInternalList<IpRange>(); } return newLegacyIpRangeList(ipv4Ranges); } }
public class class_name { @Deprecated public java.util.List<String> getIpRanges() { if (ipv4Ranges == null) { ipv4Ranges = new com.amazonaws.internal.SdkInternalList<IpRange>(); // depends on control dependency: [if], data = [none] } return newLegacyIpRangeList(ipv4Ranges); } }
public class class_name { public void marshall(UpdateUserRequestItem updateUserRequestItem, ProtocolMarshaller protocolMarshaller) { if (updateUserRequestItem == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateUserRequestItem.getUserId(), USERID_BINDING); protocolMarshaller.marshall(updateUserRequestItem.getLicenseType(), LICENSETYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateUserRequestItem updateUserRequestItem, ProtocolMarshaller protocolMarshaller) { if (updateUserRequestItem == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateUserRequestItem.getUserId(), USERID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateUserRequestItem.getLicenseType(), LICENSETYPE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private EventCallBackStruct getEventCallBackStruct(String eventName) { Enumeration keys = event_callback_map.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); // Notifd do not use tango host int start = key.indexOf('/', "tango:// ".length()); String shortName = key.substring(start+1); if (eventName.equalsIgnoreCase(shortName)) { return event_callback_map.get(key); } } return null; } }
public class class_name { private EventCallBackStruct getEventCallBackStruct(String eventName) { Enumeration keys = event_callback_map.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); // Notifd do not use tango host int start = key.indexOf('/', "tango:// ".length()); String shortName = key.substring(start+1); if (eventName.equalsIgnoreCase(shortName)) { return event_callback_map.get(key); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public KeyArea setupKey(int iKeyArea) { KeyArea keyArea = null; if (iKeyArea == 0) { keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY); keyArea.addKeyField(ID, DBConstants.ASCENDING); } if (iKeyArea == 1) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CLASS_NAME_KEY); keyArea.addKeyField(CLASS_NAME, DBConstants.ASCENDING); } if (iKeyArea == 2) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CLASS_SOURCE_FILE_KEY); keyArea.addKeyField(CLASS_SOURCE_FILE, DBConstants.ASCENDING); keyArea.addKeyField(CLASS_NAME, DBConstants.ASCENDING); } if (iKeyArea == 3) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, BASE_CLASS_NAME_KEY); keyArea.addKeyField(BASE_CLASS_NAME, DBConstants.ASCENDING); } if (iKeyArea == 4) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CLASS_PROJECT_ID_KEY); keyArea.addKeyField(CLASS_PROJECT_ID, DBConstants.ASCENDING); keyArea.addKeyField(CLASS_NAME, DBConstants.ASCENDING); } if (keyArea == null) keyArea = super.setupKey(iKeyArea); return keyArea; } }
public class class_name { public KeyArea setupKey(int iKeyArea) { KeyArea keyArea = null; if (iKeyArea == 0) { keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY); // depends on control dependency: [if], data = [none] keyArea.addKeyField(ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] } if (iKeyArea == 1) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CLASS_NAME_KEY); // depends on control dependency: [if], data = [none] keyArea.addKeyField(CLASS_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] } if (iKeyArea == 2) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CLASS_SOURCE_FILE_KEY); // depends on control dependency: [if], data = [none] keyArea.addKeyField(CLASS_SOURCE_FILE, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] keyArea.addKeyField(CLASS_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] } if (iKeyArea == 3) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, BASE_CLASS_NAME_KEY); // depends on control dependency: [if], data = [none] keyArea.addKeyField(BASE_CLASS_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] } if (iKeyArea == 4) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CLASS_PROJECT_ID_KEY); // depends on control dependency: [if], data = [none] keyArea.addKeyField(CLASS_PROJECT_ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] keyArea.addKeyField(CLASS_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] } if (keyArea == null) keyArea = super.setupKey(iKeyArea); return keyArea; } }
public class class_name { synchronized void offer(TransactionTask task) { Iv2Trace.logTransactionTaskQueueOffer(task); TransactionState txnState = task.getTransactionState(); if (!m_backlog.isEmpty()) { /* * This branch happens during regular execution when a multi-part is in progress. * The first task for the multi-part is the head of the queue, and all the single parts * are being queued behind it. The txnid check catches tasks that are part of the multi-part * and immediately queues them for execution. If any multi-part txn with smaller txnId shows up, * it must from repair process, just let it through. */ if (txnState.isSinglePartition() ){ m_backlog.addLast(task); return; } //It is possible a RO MP read with higher TxnId could be executed before a RO MP reader with lower TxnId //so do not offer them to the site task queue in the same time, place it in the backlog instead. However, //if it is an MP Write with a lower TxnId than the TxnId at the head of the backlog it could be a repair //task so put the MP Write task into the Scoreboard or the SiteTaskQueue TransactionTask headTask = m_backlog.getFirst(); if (txnState.isReadOnly() && headTask.getTransactionState().isReadOnly() ? TxnEgo.getSequence(task.getTxnId()) != TxnEgo.getSequence(headTask.getTxnId()) : TxnEgo.getSequence(task.getTxnId()) > TxnEgo.getSequence(headTask.getTxnId())) { m_backlog.addLast(task); } else if (task.needCoordination() && m_scoreboardEnabled) { /* * This branch coordinates FragmentTask or CompletedTransactionTask, * holds the tasks until all the sites on the node receive the task. * Task with newer spHandle will */ coordinatedTaskQueueOffer(task); } else { taskQueueOffer(task); } } else { /* * Base case nothing queued nothing in progress * If the task is a multipart then put an entry in the backlog which * will act as a barrier for single parts, queuing them for execution after the * multipart */ if (!txnState.isSinglePartition()) { m_backlog.addLast(task); } /* * This branch coordinates FragmentTask or CompletedTransactionTask, * holds the tasks until all the sites on the node receive the task. * Task with newer spHandle will */ if (task.needCoordination() && m_scoreboardEnabled) { coordinatedTaskQueueOffer(task); } else { taskQueueOffer(task); } } } }
public class class_name { synchronized void offer(TransactionTask task) { Iv2Trace.logTransactionTaskQueueOffer(task); TransactionState txnState = task.getTransactionState(); if (!m_backlog.isEmpty()) { /* * This branch happens during regular execution when a multi-part is in progress. * The first task for the multi-part is the head of the queue, and all the single parts * are being queued behind it. The txnid check catches tasks that are part of the multi-part * and immediately queues them for execution. If any multi-part txn with smaller txnId shows up, * it must from repair process, just let it through. */ if (txnState.isSinglePartition() ){ m_backlog.addLast(task); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } //It is possible a RO MP read with higher TxnId could be executed before a RO MP reader with lower TxnId //so do not offer them to the site task queue in the same time, place it in the backlog instead. However, //if it is an MP Write with a lower TxnId than the TxnId at the head of the backlog it could be a repair //task so put the MP Write task into the Scoreboard or the SiteTaskQueue TransactionTask headTask = m_backlog.getFirst(); if (txnState.isReadOnly() && headTask.getTransactionState().isReadOnly() ? TxnEgo.getSequence(task.getTxnId()) != TxnEgo.getSequence(headTask.getTxnId()) : TxnEgo.getSequence(task.getTxnId()) > TxnEgo.getSequence(headTask.getTxnId())) { m_backlog.addLast(task); // depends on control dependency: [if], data = [none] } else if (task.needCoordination() && m_scoreboardEnabled) { /* * This branch coordinates FragmentTask or CompletedTransactionTask, * holds the tasks until all the sites on the node receive the task. * Task with newer spHandle will */ coordinatedTaskQueueOffer(task); // depends on control dependency: [if], data = [none] } else { taskQueueOffer(task); // depends on control dependency: [if], data = [none] } } else { /* * Base case nothing queued nothing in progress * If the task is a multipart then put an entry in the backlog which * will act as a barrier for single parts, queuing them for execution after the * multipart */ if (!txnState.isSinglePartition()) { m_backlog.addLast(task); // depends on control dependency: [if], data = [none] } /* * This branch coordinates FragmentTask or CompletedTransactionTask, * holds the tasks until all the sites on the node receive the task. * Task with newer spHandle will */ if (task.needCoordination() && m_scoreboardEnabled) { coordinatedTaskQueueOffer(task); // depends on control dependency: [if], data = [none] } else { taskQueueOffer(task); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public <CAUSE extends RuntimeException> void handle(Class<CAUSE> appExType, UserMessages messages, HandledAppExResponseCall<CAUSE> causeLambda) { assertArgumentNotNull("appExType", appExType); assertArgumentNotNull("messages", messages); assertArgumentNotNull("causeLambda", causeLambda); if (appExType.isAssignableFrom(cause.getClass())) { messagesSaver.save(messages); @SuppressWarnings("unchecked") final CAUSE castCause = (CAUSE) cause; // safety because of in if-isAssignableFrom() response = causeLambda.callback(castCause); // not null, undefined allowed if (response == null) { throw new IllegalStateException("Cannot return null response from application handling.", cause); } } } }
public class class_name { public <CAUSE extends RuntimeException> void handle(Class<CAUSE> appExType, UserMessages messages, HandledAppExResponseCall<CAUSE> causeLambda) { assertArgumentNotNull("appExType", appExType); assertArgumentNotNull("messages", messages); assertArgumentNotNull("causeLambda", causeLambda); if (appExType.isAssignableFrom(cause.getClass())) { messagesSaver.save(messages); // depends on control dependency: [if], data = [none] @SuppressWarnings("unchecked") final CAUSE castCause = (CAUSE) cause; // safety because of in if-isAssignableFrom() response = causeLambda.callback(castCause); // not null, undefined allowed // depends on control dependency: [if], data = [none] if (response == null) { throw new IllegalStateException("Cannot return null response from application handling.", cause); } } } }
public class class_name { private static Set<String> getIndexedColumnSetForTable(Table table) { HashSet<String> columns = new HashSet<>(); for (Index index : table.getIndexes()) { for (ColumnRef colRef : index.getColumns()) { columns.add(colRef.getColumn().getTypeName()); } } return columns; } }
public class class_name { private static Set<String> getIndexedColumnSetForTable(Table table) { HashSet<String> columns = new HashSet<>(); for (Index index : table.getIndexes()) { for (ColumnRef colRef : index.getColumns()) { columns.add(colRef.getColumn().getTypeName()); // depends on control dependency: [for], data = [colRef] } } return columns; } }
public class class_name { public boolean finish() { boolean ok = true; java.util.Iterator iter; logger.debug("Now finish " + getName() + " id= " + getID()); authorityName = null; dataType = null; dataFormatType = null; defaultService = null; gc = null; tc = null; docs = new ArrayList<>(); metadata = new ArrayList<>(); properties = new ArrayList<>(); creators = new ArrayList<>(); contributors = new ArrayList<>(); dates = new ArrayList<>(); keywords = new ArrayList<>(); projects = new ArrayList<>(); publishers = new ArrayList<>(); variables = new ArrayList<>(); canonicalize(); // canonicalize thredds metadata transfer2PublicMetadata(tm, true); // add local metadata transfer2PublicMetadata(tmi, true); // add local inherited metadata transferInheritable2PublicMetadata((InvDatasetImpl) getParent()); // add inheritable metadata from parents // build the expanded access list access = new ArrayList<>(); // add access element if urlPath is specified if ((urlPath != null) && (getServiceDefault() != null)) { InvAccessImpl a = new InvAccessImpl(this, urlPath, getServiceDefault()); a.setSize(size); a.finish(); addExpandedAccess(a); } // add local access elements iter = accessLocal.iterator(); while (iter.hasNext()) { InvAccessImpl a = (InvAccessImpl) iter.next(); a.finish(); addExpandedAccess(a); } // recurse into child datasets. if (!(this instanceof InvCatalogRef)) { for (InvDataset invDataset : this.getDatasets()) { InvDatasetImpl curDs = (InvDatasetImpl) invDataset; ok &= curDs.finish(); } } return ok; } }
public class class_name { public boolean finish() { boolean ok = true; java.util.Iterator iter; logger.debug("Now finish " + getName() + " id= " + getID()); authorityName = null; dataType = null; dataFormatType = null; defaultService = null; gc = null; tc = null; docs = new ArrayList<>(); metadata = new ArrayList<>(); properties = new ArrayList<>(); creators = new ArrayList<>(); contributors = new ArrayList<>(); dates = new ArrayList<>(); keywords = new ArrayList<>(); projects = new ArrayList<>(); publishers = new ArrayList<>(); variables = new ArrayList<>(); canonicalize(); // canonicalize thredds metadata transfer2PublicMetadata(tm, true); // add local metadata transfer2PublicMetadata(tmi, true); // add local inherited metadata transferInheritable2PublicMetadata((InvDatasetImpl) getParent()); // add inheritable metadata from parents // build the expanded access list access = new ArrayList<>(); // add access element if urlPath is specified if ((urlPath != null) && (getServiceDefault() != null)) { InvAccessImpl a = new InvAccessImpl(this, urlPath, getServiceDefault()); a.setSize(size); // depends on control dependency: [if], data = [none] a.finish(); // depends on control dependency: [if], data = [none] addExpandedAccess(a); // depends on control dependency: [if], data = [none] } // add local access elements iter = accessLocal.iterator(); while (iter.hasNext()) { InvAccessImpl a = (InvAccessImpl) iter.next(); a.finish(); // depends on control dependency: [while], data = [none] addExpandedAccess(a); // depends on control dependency: [while], data = [none] } // recurse into child datasets. if (!(this instanceof InvCatalogRef)) { for (InvDataset invDataset : this.getDatasets()) { InvDatasetImpl curDs = (InvDatasetImpl) invDataset; ok &= curDs.finish(); // depends on control dependency: [for], data = [none] } } return ok; } }
public class class_name { public void marshall(SkillSummary skillSummary, ProtocolMarshaller protocolMarshaller) { if (skillSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(skillSummary.getSkillId(), SKILLID_BINDING); protocolMarshaller.marshall(skillSummary.getSkillName(), SKILLNAME_BINDING); protocolMarshaller.marshall(skillSummary.getSupportsLinking(), SUPPORTSLINKING_BINDING); protocolMarshaller.marshall(skillSummary.getEnablementType(), ENABLEMENTTYPE_BINDING); protocolMarshaller.marshall(skillSummary.getSkillType(), SKILLTYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SkillSummary skillSummary, ProtocolMarshaller protocolMarshaller) { if (skillSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(skillSummary.getSkillId(), SKILLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillSummary.getSkillName(), SKILLNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillSummary.getSupportsLinking(), SUPPORTSLINKING_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillSummary.getEnablementType(), ENABLEMENTTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillSummary.getSkillType(), SKILLTYPE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Optional<String> getNonRDFSourceDescribedByUri(final String resourceUri) throws IOException { Optional<String> nonRdfSourceDescUri = Optional.empty(); final Header[] links = getLinkHeaders(resourceUri); if ( links != null ) { String descriptionUri = null; boolean isNonRDFSource = false; for ( final Header h : links ) { final FcrepoLink link = new FcrepoLink(h.getValue()); if ( link.getRel().equals("describedby") ) { descriptionUri = link.getUri().toString(); } else if ( link.getUri().toString().contains(NON_RDF_SOURCE_URI)) { isNonRDFSource = true; } } LOGGER.debug("isNonRDFSource: " + isNonRDFSource); if (isNonRDFSource && descriptionUri != null) { nonRdfSourceDescUri = Optional.of(descriptionUri); } } return nonRdfSourceDescUri; } }
public class class_name { private Optional<String> getNonRDFSourceDescribedByUri(final String resourceUri) throws IOException { Optional<String> nonRdfSourceDescUri = Optional.empty(); final Header[] links = getLinkHeaders(resourceUri); if ( links != null ) { String descriptionUri = null; boolean isNonRDFSource = false; for ( final Header h : links ) { final FcrepoLink link = new FcrepoLink(h.getValue()); if ( link.getRel().equals("describedby") ) { descriptionUri = link.getUri().toString(); // depends on control dependency: [if], data = [none] } else if ( link.getUri().toString().contains(NON_RDF_SOURCE_URI)) { isNonRDFSource = true; // depends on control dependency: [if], data = [none] } } LOGGER.debug("isNonRDFSource: " + isNonRDFSource); if (isNonRDFSource && descriptionUri != null) { nonRdfSourceDescUri = Optional.of(descriptionUri); } } return nonRdfSourceDescUri; } }
public class class_name { void submit() { // if (!m_dateField.isValid()) { // return; // } long current = System.currentTimeMillis(); Date dateValue = m_dateField.getDate(); long publishTime = dateValue.getTime(); if (current > publishTime) { m_context.error( new CmsException(Messages.get().container(Messages.ERR_PUBLISH_SCHEDULED_DATE_IN_PAST_1, dateValue))); } else { try { // make copies from the admin cmsobject and the user cmsobject // get the admin cms object CmsWorkplaceAction action = CmsWorkplaceAction.getInstance(); CmsObject cmsAdmin = action.getCmsAdminObject(); // get the user cms object CmsObject cms = OpenCms.initCmsObject(m_context.getCms()); // set the current user site to the admin cms object cmsAdmin.getRequestContext().setSiteRoot(cms.getRequestContext().getSiteRoot()); CmsProject tmpProject = createTempProject(cmsAdmin, m_context.getResources(), dateValue); // set project as current project cmsAdmin.getRequestContext().setCurrentProject(tmpProject); cms.getRequestContext().setCurrentProject(tmpProject); Set<CmsUUID> changeIds = new HashSet<CmsUUID>(); for (CmsResource resource : m_context.getResources()) { addToTempProject(cmsAdmin, cms, resource, tmpProject); if (resource.isFolder() && m_includeSubResources.getValue().booleanValue()) { List<CmsResource> subResources = cms.readResources( resource, CmsResourceFilter.ONLY_VISIBLE.addExcludeState(CmsResourceState.STATE_UNCHANGED), true); for (CmsResource sub : subResources) { // check publish permissions on sub resource if (cms.hasPermissions( sub, CmsPermissionSet.ACCESS_DIRECT_PUBLISH, false, CmsResourceFilter.ALL)) { addToTempProject(cmsAdmin, cms, sub, tmpProject); } } } changeIds.add(resource.getStructureId()); } // create a new scheduled job CmsScheduledJobInfo job = new CmsScheduledJobInfo(); // the job name String jobName = tmpProject.getName(); jobName = jobName.replace("&#47;", "/"); // set the job parameters job.setJobName(jobName); job.setClassName("org.opencms.scheduler.jobs.CmsPublishScheduledJob"); // create the cron expression Calendar calendar = Calendar.getInstance(); calendar.setTime(dateValue); String cronExpr = "" + calendar.get(Calendar.SECOND) + " " + calendar.get(Calendar.MINUTE) + " " + calendar.get(Calendar.HOUR_OF_DAY) + " " + calendar.get(Calendar.DAY_OF_MONTH) + " " + (calendar.get(Calendar.MONTH) + 1) + " " + "?" + " " + calendar.get(Calendar.YEAR); // set the cron expression job.setCronExpression(cronExpr); // set the job active job.setActive(true); // create the context info CmsContextInfo contextInfo = new CmsContextInfo(); contextInfo.setProjectName(tmpProject.getName()); contextInfo.setUserName(cmsAdmin.getRequestContext().getCurrentUser().getName()); // create the job schedule parameter SortedMap<String, String> params = new TreeMap<String, String>(); // the user to send mail to String userName = m_context.getCms().getRequestContext().getCurrentUser().getName(); params.put(CmsPublishScheduledJob.PARAM_USER, userName); // the job name params.put(CmsPublishScheduledJob.PARAM_JOBNAME, jobName); // the link check params.put(CmsPublishScheduledJob.PARAM_LINKCHECK, "true"); // add the job schedule parameter job.setParameters(params); // add the context info to the scheduled job job.setContextInfo(contextInfo); // add the job to the scheduled job list OpenCms.getScheduleManager().scheduleJob(cmsAdmin, job); // update the XML configuration OpenCms.writeConfiguration(CmsSchedulerConfiguration.class); m_context.finish(changeIds); } catch (CmsException ex) { LOG.error("Error performing publish scheduled dialog operation.", ex); m_context.error(ex); } } } }
public class class_name { void submit() { // if (!m_dateField.isValid()) { // return; // } long current = System.currentTimeMillis(); Date dateValue = m_dateField.getDate(); long publishTime = dateValue.getTime(); if (current > publishTime) { m_context.error( new CmsException(Messages.get().container(Messages.ERR_PUBLISH_SCHEDULED_DATE_IN_PAST_1, dateValue))); // depends on control dependency: [if], data = [none] } else { try { // make copies from the admin cmsobject and the user cmsobject // get the admin cms object CmsWorkplaceAction action = CmsWorkplaceAction.getInstance(); CmsObject cmsAdmin = action.getCmsAdminObject(); // get the user cms object CmsObject cms = OpenCms.initCmsObject(m_context.getCms()); // set the current user site to the admin cms object cmsAdmin.getRequestContext().setSiteRoot(cms.getRequestContext().getSiteRoot()); // depends on control dependency: [try], data = [none] CmsProject tmpProject = createTempProject(cmsAdmin, m_context.getResources(), dateValue); // set project as current project cmsAdmin.getRequestContext().setCurrentProject(tmpProject); // depends on control dependency: [try], data = [none] cms.getRequestContext().setCurrentProject(tmpProject); // depends on control dependency: [try], data = [none] Set<CmsUUID> changeIds = new HashSet<CmsUUID>(); for (CmsResource resource : m_context.getResources()) { addToTempProject(cmsAdmin, cms, resource, tmpProject); // depends on control dependency: [for], data = [resource] if (resource.isFolder() && m_includeSubResources.getValue().booleanValue()) { List<CmsResource> subResources = cms.readResources( resource, CmsResourceFilter.ONLY_VISIBLE.addExcludeState(CmsResourceState.STATE_UNCHANGED), true); for (CmsResource sub : subResources) { // check publish permissions on sub resource if (cms.hasPermissions( sub, CmsPermissionSet.ACCESS_DIRECT_PUBLISH, false, CmsResourceFilter.ALL)) { addToTempProject(cmsAdmin, cms, sub, tmpProject); // depends on control dependency: [if], data = [none] } } } changeIds.add(resource.getStructureId()); // depends on control dependency: [for], data = [resource] } // create a new scheduled job CmsScheduledJobInfo job = new CmsScheduledJobInfo(); // the job name String jobName = tmpProject.getName(); jobName = jobName.replace("&#47;", "/"); // depends on control dependency: [try], data = [none] // set the job parameters job.setJobName(jobName); // depends on control dependency: [try], data = [none] job.setClassName("org.opencms.scheduler.jobs.CmsPublishScheduledJob"); // depends on control dependency: [try], data = [none] // create the cron expression Calendar calendar = Calendar.getInstance(); calendar.setTime(dateValue); // depends on control dependency: [try], data = [none] String cronExpr = "" + calendar.get(Calendar.SECOND) + " " + calendar.get(Calendar.MINUTE) + " " + calendar.get(Calendar.HOUR_OF_DAY) + " " + calendar.get(Calendar.DAY_OF_MONTH) + " " + (calendar.get(Calendar.MONTH) + 1) + " " + "?" + " " + calendar.get(Calendar.YEAR); // set the cron expression job.setCronExpression(cronExpr); // depends on control dependency: [try], data = [none] // set the job active job.setActive(true); // depends on control dependency: [try], data = [none] // create the context info CmsContextInfo contextInfo = new CmsContextInfo(); contextInfo.setProjectName(tmpProject.getName()); // depends on control dependency: [try], data = [none] contextInfo.setUserName(cmsAdmin.getRequestContext().getCurrentUser().getName()); // depends on control dependency: [try], data = [none] // create the job schedule parameter SortedMap<String, String> params = new TreeMap<String, String>(); // the user to send mail to String userName = m_context.getCms().getRequestContext().getCurrentUser().getName(); params.put(CmsPublishScheduledJob.PARAM_USER, userName); // depends on control dependency: [try], data = [none] // the job name params.put(CmsPublishScheduledJob.PARAM_JOBNAME, jobName); // depends on control dependency: [try], data = [none] // the link check params.put(CmsPublishScheduledJob.PARAM_LINKCHECK, "true"); // depends on control dependency: [try], data = [none] // add the job schedule parameter job.setParameters(params); // depends on control dependency: [try], data = [none] // add the context info to the scheduled job job.setContextInfo(contextInfo); // depends on control dependency: [try], data = [none] // add the job to the scheduled job list OpenCms.getScheduleManager().scheduleJob(cmsAdmin, job); // depends on control dependency: [try], data = [none] // update the XML configuration OpenCms.writeConfiguration(CmsSchedulerConfiguration.class); // depends on control dependency: [try], data = [none] m_context.finish(changeIds); // depends on control dependency: [try], data = [none] } catch (CmsException ex) { LOG.error("Error performing publish scheduled dialog operation.", ex); m_context.error(ex); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static boolean equalsOrDie(int expected, int got) { if (expected != got) { return die(Boolean.class, "Expected was", expected, "but we got ", got); } return true; } }
public class class_name { public static boolean equalsOrDie(int expected, int got) { if (expected != got) { return die(Boolean.class, "Expected was", expected, "but we got ", got); // depends on control dependency: [if], data = [got)] } return true; } }
public class class_name { public void run() { while (running) { try { cleanUpInitializedJobsList(); selectJobsToInitialize(); if (!this.isInterrupted()) { Thread.sleep(sleepInterval); } } catch (InterruptedException e) { LOG.error("Job Initialization poller interrupted" + StringUtils.stringifyException(e)); } } } }
public class class_name { public void run() { while (running) { try { cleanUpInitializedJobsList(); // depends on control dependency: [try], data = [none] selectJobsToInitialize(); // depends on control dependency: [try], data = [none] if (!this.isInterrupted()) { Thread.sleep(sleepInterval); // depends on control dependency: [if], data = [none] } } catch (InterruptedException e) { LOG.error("Job Initialization poller interrupted" + StringUtils.stringifyException(e)); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private void showProcessScopePanels() { if (rules.containsKey(type) && (rules.get(type) & OPTION_PROCESS_SCOPE) != 0) { jPanelPID.setVisible(jRadioScopePerProcess.isSelected()); jPanelPrimaryMetrics.removeAll(); jPanelAdditionaMetrics.removeAll(); Enumeration<AbstractButton> enu = buttonGroupMetrics.getElements(); while (enu.hasMoreElements()) { buttonGroupMetrics.remove(enu.nextElement()); } String[] primaryMetrics = null; String[] additionalMetrics = null; if (jRadioScopePerProcess.isSelected()) { if (type.equals(METRIC_CPU)) { primaryMetrics = cpuProcessMetricsPrimary; } else if (type.equals(METRIC_MEM)) { primaryMetrics = memProcessMetricsPrimary; additionalMetrics = memProcessMetricsAdditional; } } else { if (type.equals(METRIC_CPU)) { primaryMetrics = cpuMetricsPrimary; additionalMetrics = cpuMetricsAdditional; } else if (type.equals(METRIC_MEM)) { primaryMetrics = memMetricsPrimary; additionalMetrics = memMetricsAdditional; } } fillMetrics(primaryMetrics, jPanelPrimaryMetrics); fillMetrics(additionalMetrics, jPanelAdditionaMetrics); jLabelUnit.setEnabled(false); jComboBoxUnit.setEnabled(false); } repack(); } }
public class class_name { private void showProcessScopePanels() { if (rules.containsKey(type) && (rules.get(type) & OPTION_PROCESS_SCOPE) != 0) { jPanelPID.setVisible(jRadioScopePerProcess.isSelected()); // depends on control dependency: [if], data = [none] jPanelPrimaryMetrics.removeAll(); // depends on control dependency: [if], data = [none] jPanelAdditionaMetrics.removeAll(); // depends on control dependency: [if], data = [none] Enumeration<AbstractButton> enu = buttonGroupMetrics.getElements(); while (enu.hasMoreElements()) { buttonGroupMetrics.remove(enu.nextElement()); // depends on control dependency: [while], data = [none] } String[] primaryMetrics = null; String[] additionalMetrics = null; if (jRadioScopePerProcess.isSelected()) { if (type.equals(METRIC_CPU)) { primaryMetrics = cpuProcessMetricsPrimary; // depends on control dependency: [if], data = [none] } else if (type.equals(METRIC_MEM)) { primaryMetrics = memProcessMetricsPrimary; // depends on control dependency: [if], data = [none] additionalMetrics = memProcessMetricsAdditional; // depends on control dependency: [if], data = [none] } } else { if (type.equals(METRIC_CPU)) { primaryMetrics = cpuMetricsPrimary; // depends on control dependency: [if], data = [none] additionalMetrics = cpuMetricsAdditional; // depends on control dependency: [if], data = [none] } else if (type.equals(METRIC_MEM)) { primaryMetrics = memMetricsPrimary; // depends on control dependency: [if], data = [none] additionalMetrics = memMetricsAdditional; // depends on control dependency: [if], data = [none] } } fillMetrics(primaryMetrics, jPanelPrimaryMetrics); // depends on control dependency: [if], data = [none] fillMetrics(additionalMetrics, jPanelAdditionaMetrics); // depends on control dependency: [if], data = [none] jLabelUnit.setEnabled(false); // depends on control dependency: [if], data = [none] jComboBoxUnit.setEnabled(false); // depends on control dependency: [if], data = [none] } repack(); } }
public class class_name { public LR0ItemSet calc(LR0ItemSet initialItemSet) { LR0ItemSet result = closures.get(initialItemSet); if (result == null) { return calculate(initialItemSet); } return result; } }
public class class_name { public LR0ItemSet calc(LR0ItemSet initialItemSet) { LR0ItemSet result = closures.get(initialItemSet); if (result == null) { return calculate(initialItemSet); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public ClassSelector except(String... propertyNames) { if(ArrayUtils.isEmpty(propertyNames)){ return this; } boolean updated = false; for (String propertyToRemove : propertyNames) { if (removePropertySelector(propertyToRemove)) { updated = true; } } if (updated) { compositeSelector = new CompositeSelector(this.propertySelectors); } return this; } }
public class class_name { public ClassSelector except(String... propertyNames) { if(ArrayUtils.isEmpty(propertyNames)){ return this; // depends on control dependency: [if], data = [none] } boolean updated = false; for (String propertyToRemove : propertyNames) { if (removePropertySelector(propertyToRemove)) { updated = true; // depends on control dependency: [if], data = [none] } } if (updated) { compositeSelector = new CompositeSelector(this.propertySelectors); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { private void recurse(Stream bounds, String arg) { // Refuse if we've reached our recursion limit. streamIndex++; if (streamIndex == streams.length) { return; } // Trim the '{' and '}' bounding characters. bounds.pos++; bounds.end--; // Set the bounds of the tag, allocating a new stream on the stack if necessary. if (streams[streamIndex] == null) { streams[streamIndex] = bounds.copy(); } else { streams[streamIndex].setFrom(bounds); } // Execute the formatter recursively on the current bounds, then // pop the stack. format(streams[streamIndex], arg); streamIndex--; } }
public class class_name { private void recurse(Stream bounds, String arg) { // Refuse if we've reached our recursion limit. streamIndex++; if (streamIndex == streams.length) { return; // depends on control dependency: [if], data = [none] } // Trim the '{' and '}' bounding characters. bounds.pos++; bounds.end--; // Set the bounds of the tag, allocating a new stream on the stack if necessary. if (streams[streamIndex] == null) { streams[streamIndex] = bounds.copy(); // depends on control dependency: [if], data = [none] } else { streams[streamIndex].setFrom(bounds); // depends on control dependency: [if], data = [none] } // Execute the formatter recursively on the current bounds, then // pop the stack. format(streams[streamIndex], arg); streamIndex--; } }
public class class_name { private boolean resolveToOuterNested(ClassNode type) { CompileUnit compileUnit = currentClass.getCompileUnit(); String typeName = type.getName(); ModuleNode module = currentClass.getModule(); for (ImportNode importNode : module.getStaticImports().values()) { String importFieldName = importNode.getFieldName(); String importAlias = importNode.getAlias(); if (!typeName.equals(importAlias)) continue; ConstructedOuterNestedClassNode constructedOuterNestedClassNode = tryToConstructOuterNestedClassNodeViaStaticImport(compileUnit, importNode, importFieldName); if (null != constructedOuterNestedClassNode) { compileUnit.addClassNodeToResolve(constructedOuterNestedClassNode); return true; } } for (Map.Entry<String, ClassNode> entry : compileUnit.getClassesToCompile().entrySet()) { ClassNode outerClassNode = entry.getValue(); ConstructedOuterNestedClassNode constructedOuterNestedClassNode = tryToConstructOuterNestedClassNode(type, outerClassNode); if (null != constructedOuterNestedClassNode) { compileUnit.addClassNodeToResolve(constructedOuterNestedClassNode); return true; } } boolean toResolveFurther = false; for (ImportNode importNode : module.getStaticStarImports().values()) { ConstructedOuterNestedClassNode constructedOuterNestedClassNode = tryToConstructOuterNestedClassNodeViaStaticImport(compileUnit, importNode, typeName); if (null != constructedOuterNestedClassNode) { compileUnit.addClassNodeToResolve(constructedOuterNestedClassNode); toResolveFurther = true; // do not return here to try all static star imports because currently we do not know which outer class the class to resolve is declared in. } } return toResolveFurther; } }
public class class_name { private boolean resolveToOuterNested(ClassNode type) { CompileUnit compileUnit = currentClass.getCompileUnit(); String typeName = type.getName(); ModuleNode module = currentClass.getModule(); for (ImportNode importNode : module.getStaticImports().values()) { String importFieldName = importNode.getFieldName(); String importAlias = importNode.getAlias(); if (!typeName.equals(importAlias)) continue; ConstructedOuterNestedClassNode constructedOuterNestedClassNode = tryToConstructOuterNestedClassNodeViaStaticImport(compileUnit, importNode, importFieldName); if (null != constructedOuterNestedClassNode) { compileUnit.addClassNodeToResolve(constructedOuterNestedClassNode); // depends on control dependency: [if], data = [constructedOuterNestedClassNode)] return true; // depends on control dependency: [if], data = [none] } } for (Map.Entry<String, ClassNode> entry : compileUnit.getClassesToCompile().entrySet()) { ClassNode outerClassNode = entry.getValue(); ConstructedOuterNestedClassNode constructedOuterNestedClassNode = tryToConstructOuterNestedClassNode(type, outerClassNode); if (null != constructedOuterNestedClassNode) { compileUnit.addClassNodeToResolve(constructedOuterNestedClassNode); // depends on control dependency: [if], data = [constructedOuterNestedClassNode)] return true; // depends on control dependency: [if], data = [none] } } boolean toResolveFurther = false; for (ImportNode importNode : module.getStaticStarImports().values()) { ConstructedOuterNestedClassNode constructedOuterNestedClassNode = tryToConstructOuterNestedClassNodeViaStaticImport(compileUnit, importNode, typeName); if (null != constructedOuterNestedClassNode) { compileUnit.addClassNodeToResolve(constructedOuterNestedClassNode); // depends on control dependency: [if], data = [constructedOuterNestedClassNode)] toResolveFurther = true; // do not return here to try all static star imports because currently we do not know which outer class the class to resolve is declared in. // depends on control dependency: [if], data = [none] } } return toResolveFurther; } }
public class class_name { public static long decodeBase32(String hash) { boolean isNegative = hash.startsWith("-"); int startIndex = isNegative ? 1 : 0; long base = 1; long result = 0; for (int i = hash.length() - 1; i >= startIndex; i--) { int j = getCharIndex(hash.charAt(i)); result = result + base * j; base = base * 32; } if (isNegative) result *= -1; return result; } }
public class class_name { public static long decodeBase32(String hash) { boolean isNegative = hash.startsWith("-"); int startIndex = isNegative ? 1 : 0; long base = 1; long result = 0; for (int i = hash.length() - 1; i >= startIndex; i--) { int j = getCharIndex(hash.charAt(i)); result = result + base * j; // depends on control dependency: [for], data = [none] base = base * 32; // depends on control dependency: [for], data = [none] } if (isNegative) result *= -1; return result; } }
public class class_name { @SuppressWarnings({ "rawtypes", "unchecked" }) public static int getPriority(Class type) { int prio = 1; Priority priority = (Priority)type.getAnnotation(Priority.class); if (priority != null) { prio = priority.value(); } return prio; } }
public class class_name { @SuppressWarnings({ "rawtypes", "unchecked" }) public static int getPriority(Class type) { int prio = 1; Priority priority = (Priority)type.getAnnotation(Priority.class); if (priority != null) { prio = priority.value(); // depends on control dependency: [if], data = [none] } return prio; } }
public class class_name { public static int listSearchCaseInsensitive(List<String> source, String target) { for (int i = 0; i < source.size(); i++) { if (target.equalsIgnoreCase(source.get(i))) { return i; } } return -1; } }
public class class_name { public static int listSearchCaseInsensitive(List<String> source, String target) { for (int i = 0; i < source.size(); i++) { if (target.equalsIgnoreCase(source.get(i))) { return i; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { @Override public EClass getIfcTShapeProfileDef() { if (ifcTShapeProfileDefEClass == null) { ifcTShapeProfileDefEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(694); } return ifcTShapeProfileDefEClass; } }
public class class_name { @Override public EClass getIfcTShapeProfileDef() { if (ifcTShapeProfileDefEClass == null) { ifcTShapeProfileDefEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(694); // depends on control dependency: [if], data = [none] } return ifcTShapeProfileDefEClass; } }
public class class_name { public void run(InputProvider inputProvider) throws IOException { Object result = null; while (!(result instanceof ExitRequest)) { // Handles ExitRequest thrown from Quit command Input input; try { input = inputProvider.readInput(); } catch (Exception e) { if (e instanceof ExitRequest) { // Handles ExitRequest thrown from hitting CTRL-C break; } resultHandler.handleResult(e); continue; } if (input == null) { break; } result = evaluate(input); if (result != NO_INPUT && !(result instanceof ExitRequest)) { resultHandler.handleResult(result); } } } }
public class class_name { public void run(InputProvider inputProvider) throws IOException { Object result = null; while (!(result instanceof ExitRequest)) { // Handles ExitRequest thrown from Quit command Input input; try { input = inputProvider.readInput(); // depends on control dependency: [try], data = [none] } catch (Exception e) { if (e instanceof ExitRequest) { // Handles ExitRequest thrown from hitting CTRL-C break; } resultHandler.handleResult(e); continue; } // depends on control dependency: [catch], data = [none] if (input == null) { break; } result = evaluate(input); if (result != NO_INPUT && !(result instanceof ExitRequest)) { resultHandler.handleResult(result); // depends on control dependency: [if], data = [(result] } } } }
public class class_name { public static void ignoreAllCerts() { try { HttpsURLConnection.setDefaultSSLSocketFactory(TrustAllX509SocketFactory.getSSLSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier(AllowAllHostnameVerifier.ALLOW_ALL_HOSTNAMES); } catch (Exception e) { throw new RuntimeException("Failed to set 'Trust all' default SSL SocketFactory and Hostname Verifier", e); } } }
public class class_name { public static void ignoreAllCerts() { try { HttpsURLConnection.setDefaultSSLSocketFactory(TrustAllX509SocketFactory.getSSLSocketFactory()); // depends on control dependency: [try], data = [none] HttpsURLConnection.setDefaultHostnameVerifier(AllowAllHostnameVerifier.ALLOW_ALL_HOSTNAMES); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException("Failed to set 'Trust all' default SSL SocketFactory and Hostname Verifier", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean checkForeignSecurityAttributesChanged(MESubscription sub, boolean foreignSecuredProxy, String MESubUserId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkForeignSecurityAttributesChanged", new Object[] { sub, new Boolean(foreignSecuredProxy), MESubUserId }); boolean attrChanged = false; if(foreignSecuredProxy) { if(sub.isForeignSecuredProxy()) { // Need to check the userids if(MESubUserId != null) { if(sub.getMESubUserId() != null) { // Neither string is null, check whether they // are equal if(!MESubUserId.equals(sub.getMESubUserId())) { sub.setMESubUserId(MESubUserId); attrChanged = true; } } else { // Stored subscription was null sub.setMESubUserId(MESubUserId); attrChanged = true; } } else // MESubUserid is null { if(sub.getMESubUserId() != null) { sub.setMESubUserId(null); attrChanged = true; } } } else { // The stored subscription was not foreign secured sub.setForeignSecuredProxy(true); sub.setMESubUserId(MESubUserId); attrChanged = true; } } else // the new proxy sub is not foreign secured { if(sub.isForeignSecuredProxy()) { // The stored subscription was foreign secured sub.setForeignSecuredProxy(false); sub.setMESubUserId(null); attrChanged = true; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkForeignSecurityAttributesChanged", new Boolean(attrChanged)); return attrChanged; } }
public class class_name { private boolean checkForeignSecurityAttributesChanged(MESubscription sub, boolean foreignSecuredProxy, String MESubUserId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkForeignSecurityAttributesChanged", new Object[] { sub, new Boolean(foreignSecuredProxy), MESubUserId }); boolean attrChanged = false; if(foreignSecuredProxy) { if(sub.isForeignSecuredProxy()) { // Need to check the userids if(MESubUserId != null) { if(sub.getMESubUserId() != null) { // Neither string is null, check whether they // are equal if(!MESubUserId.equals(sub.getMESubUserId())) { sub.setMESubUserId(MESubUserId); // depends on control dependency: [if], data = [none] attrChanged = true; // depends on control dependency: [if], data = [none] } } else { // Stored subscription was null sub.setMESubUserId(MESubUserId); // depends on control dependency: [if], data = [none] attrChanged = true; // depends on control dependency: [if], data = [none] } } else // MESubUserid is null { if(sub.getMESubUserId() != null) { sub.setMESubUserId(null); // depends on control dependency: [if], data = [null)] attrChanged = true; // depends on control dependency: [if], data = [none] } } } else { // The stored subscription was not foreign secured sub.setForeignSecuredProxy(true); // depends on control dependency: [if], data = [none] sub.setMESubUserId(MESubUserId); // depends on control dependency: [if], data = [none] attrChanged = true; // depends on control dependency: [if], data = [none] } } else // the new proxy sub is not foreign secured { if(sub.isForeignSecuredProxy()) { // The stored subscription was foreign secured sub.setForeignSecuredProxy(false); // depends on control dependency: [if], data = [none] sub.setMESubUserId(null); // depends on control dependency: [if], data = [none] attrChanged = true; // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkForeignSecurityAttributesChanged", new Boolean(attrChanged)); return attrChanged; } }
public class class_name { protected void processClass (File source) { CtClass clazz; InputStream in = null; try { clazz = _pool.makeClass(in = new BufferedInputStream(new FileInputStream(source))); } catch (IOException ioe) { System.err.println("Failed to load " + source + ": " + ioe); return; } finally { StreamUtil.close(in); } try { if (clazz.subtypeOf(_streamable)) { processStreamable(source, clazz); } } catch (NotFoundException nfe) { System.err.println("Error processing class [class=" + clazz.getName() + ", error=" + nfe + "]."); } } }
public class class_name { protected void processClass (File source) { CtClass clazz; InputStream in = null; try { clazz = _pool.makeClass(in = new BufferedInputStream(new FileInputStream(source))); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { System.err.println("Failed to load " + source + ": " + ioe); return; } finally { // depends on control dependency: [catch], data = [none] StreamUtil.close(in); } try { if (clazz.subtypeOf(_streamable)) { processStreamable(source, clazz); // depends on control dependency: [if], data = [none] } } catch (NotFoundException nfe) { System.err.println("Error processing class [class=" + clazz.getName() + ", error=" + nfe + "]."); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String getParameter(List<FileItem> items, String name) { for (FileItem i : items) { if (i.isFormField() && i.getFieldName().equals(name)) { return i.getString(); } } return null; } }
public class class_name { private String getParameter(List<FileItem> items, String name) { for (FileItem i : items) { if (i.isFormField() && i.getFieldName().equals(name)) { return i.getString(); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static int d(String msg) { // This is a quick check to avoid the expensive stack trace reflection. if (!activated) { return 0; } String caller = LogHelper.getCaller(); if (caller != null) { return d(caller, msg); } return 0; } }
public class class_name { public static int d(String msg) { // This is a quick check to avoid the expensive stack trace reflection. if (!activated) { return 0; // depends on control dependency: [if], data = [none] } String caller = LogHelper.getCaller(); if (caller != null) { return d(caller, msg); // depends on control dependency: [if], data = [(caller] } return 0; } }
public class class_name { @SuppressWarnings("unused") public static boolean isValidUri(String uri) { boolean result = false; try { new URI(uri); result = true; } catch (Exception e) { // nothing to do } return result; } }
public class class_name { @SuppressWarnings("unused") public static boolean isValidUri(String uri) { boolean result = false; try { new URI(uri); // depends on control dependency: [try], data = [none] result = true; // depends on control dependency: [try], data = [none] } catch (Exception e) { // nothing to do } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { @Requires({ "kind != null", "kind.isOld()", "list != null" }) protected void invokeOldValues(ContractKind kind, List<Integer> list) { List<MethodContractHandle> olds = contracts.getMethodHandles(kind, methodName, methodDesc, 0); if (olds.isEmpty()) { return; } for (MethodContractHandle h : olds) { MethodNode contractMethod = injectContractMethod(h); int k = h.getKey(); if (!statik) { loadThis(); } loadArgs(); invokeContractMethod(contractMethod); storeLocal(list.get(k)); } } }
public class class_name { @Requires({ "kind != null", "kind.isOld()", "list != null" }) protected void invokeOldValues(ContractKind kind, List<Integer> list) { List<MethodContractHandle> olds = contracts.getMethodHandles(kind, methodName, methodDesc, 0); if (olds.isEmpty()) { return; // depends on control dependency: [if], data = [none] } for (MethodContractHandle h : olds) { MethodNode contractMethod = injectContractMethod(h); int k = h.getKey(); if (!statik) { loadThis(); // depends on control dependency: [if], data = [none] } loadArgs(); // depends on control dependency: [for], data = [none] invokeContractMethod(contractMethod); // depends on control dependency: [for], data = [h] storeLocal(list.get(k)); // depends on control dependency: [for], data = [none] } } }
public class class_name { protected Properties loadProperties(String fileName) { final Properties props = new Properties(); final InputStream ins = LastaDiProperties.class.getClassLoader().getResourceAsStream(fileName); if (ins == null) { return null; } try { props.load(ins); } catch (RuntimeException | IOException e) { handleLoadingFailureException(fileName, e); } finally { try { ins.close(); } catch (IOException ignored) {} } mergePropIfExists(fileName, props); return props; } }
public class class_name { protected Properties loadProperties(String fileName) { final Properties props = new Properties(); final InputStream ins = LastaDiProperties.class.getClassLoader().getResourceAsStream(fileName); if (ins == null) { return null; // depends on control dependency: [if], data = [none] } try { props.load(ins); // depends on control dependency: [try], data = [none] } catch (RuntimeException | IOException e) { handleLoadingFailureException(fileName, e); } finally { // depends on control dependency: [catch], data = [none] try { ins.close(); // depends on control dependency: [try], data = [none] } catch (IOException ignored) {} // depends on control dependency: [catch], data = [none] } mergePropIfExists(fileName, props); return props; } }
public class class_name { private static int convertStyle(String style) { if (style.equals(NlsFormatterManager.STYLE_SHORT)) { return DateFormat.SHORT; } else if (style.equals(NlsFormatterManager.STYLE_LONG)) { return DateFormat.LONG; } else if (style.equals(NlsFormatterManager.STYLE_MEDIUM)) { return DateFormat.MEDIUM; } else if (style.equals(NlsFormatterManager.STYLE_FULL)) { return DateFormat.FULL; } else { throw new IllegalArgumentException(style); } } }
public class class_name { private static int convertStyle(String style) { if (style.equals(NlsFormatterManager.STYLE_SHORT)) { return DateFormat.SHORT; // depends on control dependency: [if], data = [none] } else if (style.equals(NlsFormatterManager.STYLE_LONG)) { return DateFormat.LONG; // depends on control dependency: [if], data = [none] } else if (style.equals(NlsFormatterManager.STYLE_MEDIUM)) { return DateFormat.MEDIUM; // depends on control dependency: [if], data = [none] } else if (style.equals(NlsFormatterManager.STYLE_FULL)) { return DateFormat.FULL; // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException(style); } } }
public class class_name { @Override protected void preparePaintComponent(final Request request) { if (OPTION_CONTENT1.equals(rbSelect.getSelected())) { content.setText("This is content 1"); } else if (OPTION_CONTENT2.equals(rbSelect.getSelected())) { content.setText("This is content 2"); } else if (OPTION_CONTENT3.equals(rbSelect.getSelected())) { content.setText("This is content 3"); } else { content.setText(null); } } }
public class class_name { @Override protected void preparePaintComponent(final Request request) { if (OPTION_CONTENT1.equals(rbSelect.getSelected())) { content.setText("This is content 1"); // depends on control dependency: [if], data = [none] } else if (OPTION_CONTENT2.equals(rbSelect.getSelected())) { content.setText("This is content 2"); // depends on control dependency: [if], data = [none] } else if (OPTION_CONTENT3.equals(rbSelect.getSelected())) { content.setText("This is content 3"); // depends on control dependency: [if], data = [none] } else { content.setText(null); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void destroy() { logger.info("Stopping jBPM Executor component"); if (scheduler != null) { if (loadTaskFuture != null) { loadTaskFuture.cancel(true); } scheduler.shutdownNow(); boolean terminated; try { terminated = scheduler.awaitTermination(60, TimeUnit.SECONDS); if (!terminated) { logger.warn("Timeout occured while waiting on all jobs to be terminated"); scheduler.shutdownNow(); } } catch (InterruptedException e) { } } } }
public class class_name { public void destroy() { logger.info("Stopping jBPM Executor component"); if (scheduler != null) { if (loadTaskFuture != null) { loadTaskFuture.cancel(true); // depends on control dependency: [if], data = [none] } scheduler.shutdownNow(); // depends on control dependency: [if], data = [none] boolean terminated; try { terminated = scheduler.awaitTermination(60, TimeUnit.SECONDS); // depends on control dependency: [try], data = [none] if (!terminated) { logger.warn("Timeout occured while waiting on all jobs to be terminated"); // depends on control dependency: [if], data = [none] scheduler.shutdownNow(); // depends on control dependency: [if], data = [none] } } catch (InterruptedException e) { } // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected void initDatabaseExportObject() { Object o; if (CmsStringUtil.isEmpty(getParamAction())) { o = new CmsExportParameters(); } else { // this is not the initial call, get the job object from session o = getDialogObject(); } if (!(o instanceof CmsExportParameters)) { // create a new export parameters object m_exportParams = new CmsExportParameters(); } else { // reuse export parameters object stored in session m_exportParams = (CmsExportParameters)o; } if (CmsStringUtil.isEmpty(getParamAction()) && (m_exportParams.getResources().size() < 1)) { // on initial call, at least on resource input field has to be present List initialPaths = new ArrayList(1); initialPaths.add("/"); m_exportParams.setResources(initialPaths); } } }
public class class_name { protected void initDatabaseExportObject() { Object o; if (CmsStringUtil.isEmpty(getParamAction())) { o = new CmsExportParameters(); // depends on control dependency: [if], data = [none] } else { // this is not the initial call, get the job object from session o = getDialogObject(); // depends on control dependency: [if], data = [none] } if (!(o instanceof CmsExportParameters)) { // create a new export parameters object m_exportParams = new CmsExportParameters(); // depends on control dependency: [if], data = [none] } else { // reuse export parameters object stored in session m_exportParams = (CmsExportParameters)o; // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isEmpty(getParamAction()) && (m_exportParams.getResources().size() < 1)) { // on initial call, at least on resource input field has to be present List initialPaths = new ArrayList(1); initialPaths.add("/"); // depends on control dependency: [if], data = [none] m_exportParams.setResources(initialPaths); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void addMinMax(String chars) { for (int i = 0; i < chars.length(); i++) { int c = chars.codePointAt(i); if (min == -1 || min > c) { min = c; } if (max == -1 || max < c) { max = c; } } } }
public class class_name { private void addMinMax(String chars) { for (int i = 0; i < chars.length(); i++) { int c = chars.codePointAt(i); if (min == -1 || min > c) { min = c; // depends on control dependency: [if], data = [none] } if (max == -1 || max < c) { max = c; // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void writeTo(ErrorMessage errorMessage, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { ContainerRequestContext request = requestProvider.get(); int status = errorMessage.getStatus(); String tplName = getErrorTemplate(status); if (StringUtils.isBlank(tplName)) { if (StringUtils.isBlank(defaultErrorTemplate)) { if (status < 500) { switch (status) { case 401: case 403: case 405: case 406: case 415: tplName = DEFAULT_400_BLACK_ERROR_PAGE; break; default: tplName = DEFAULT_400_ORANGE_ERROR_PAGE; } } else { switch (status) { case 501: tplName = DEFAULT_500_PURPLE_ERROR_PAGE; break; default: tplName = DEFAULT_500_RED_PRODUCT_ERROR_PAGE; } } } else { tplName = defaultErrorTemplate; } } Viewable viewable = createViewable(tplName, request, status, errorMessage.getThrowable(), errorMessage); writeViewable(viewable, mediaType, httpHeaders, entityStream); } }
public class class_name { @Override public void writeTo(ErrorMessage errorMessage, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { ContainerRequestContext request = requestProvider.get(); int status = errorMessage.getStatus(); String tplName = getErrorTemplate(status); if (StringUtils.isBlank(tplName)) { if (StringUtils.isBlank(defaultErrorTemplate)) { if (status < 500) { switch (status) { case 401: case 403: case 405: case 406: case 415: tplName = DEFAULT_400_BLACK_ERROR_PAGE; break; default: tplName = DEFAULT_400_ORANGE_ERROR_PAGE; } } else { switch (status) { case 501: tplName = DEFAULT_500_PURPLE_ERROR_PAGE; break; default: tplName = DEFAULT_500_RED_PRODUCT_ERROR_PAGE; } } } else { tplName = defaultErrorTemplate; // depends on control dependency: [if], data = [none] } } Viewable viewable = createViewable(tplName, request, status, errorMessage.getThrowable(), errorMessage); writeViewable(viewable, mediaType, httpHeaders, entityStream); } }
public class class_name { public static int getLineCount(final String text) { final Matcher matcher = LINE_FINDER.matcher(text); int i = 0; while (matcher.find()) { i++; } return i; } }
public class class_name { public static int getLineCount(final String text) { final Matcher matcher = LINE_FINDER.matcher(text); int i = 0; while (matcher.find()) { i++; // depends on control dependency: [while], data = [none] } return i; } }
public class class_name { private static String parseRelativeURL(URL url, String spec) { String path = url.getPath(); String result; int index = path.indexOf("!/"); if (index == -1) { // The "jar" protocol requires that the path contain an entry path. // For backwards compatibility, we do not. Instead, we just // canonicalize the base URL. try { url = Utils.newURL(Utils.newURL(path), spec); } catch (MalformedURLException ex) { throw new RuntimeException(ex); } result = url.toString(); } else { String entry; if (spec.startsWith("/")) { // This is an absolute entry path, so we ignore the existing // entry path. entry = canonicalize(spec); } else { // Extract the existing entry path. entry = path.substring(index + 1); if (entry.endsWith("/")) { // The entry ends with '/', so we can directly append the // relative entry path. entry = canonicalize(entry + spec); } else if (entry.endsWith("/.")) { // We don't want the logic below because "." is not a // "true" basename. entry = canonicalize(entry + '/' + spec); } else { // Strip off the basename with a ".." path segment and // append the relative entry path. entry = canonicalize(entry + "/../" + spec); } } result = path.substring(0, index) + '!' + entry; } return result; } }
public class class_name { private static String parseRelativeURL(URL url, String spec) { String path = url.getPath(); String result; int index = path.indexOf("!/"); if (index == -1) { // The "jar" protocol requires that the path contain an entry path. // For backwards compatibility, we do not. Instead, we just // canonicalize the base URL. try { url = Utils.newURL(Utils.newURL(path), spec); // depends on control dependency: [try], data = [none] } catch (MalformedURLException ex) { throw new RuntimeException(ex); } // depends on control dependency: [catch], data = [none] result = url.toString(); // depends on control dependency: [if], data = [none] } else { String entry; if (spec.startsWith("/")) { // This is an absolute entry path, so we ignore the existing // entry path. entry = canonicalize(spec); // depends on control dependency: [if], data = [none] } else { // Extract the existing entry path. entry = path.substring(index + 1); // depends on control dependency: [if], data = [none] if (entry.endsWith("/")) { // The entry ends with '/', so we can directly append the // relative entry path. entry = canonicalize(entry + spec); // depends on control dependency: [if], data = [none] } else if (entry.endsWith("/.")) { // We don't want the logic below because "." is not a // "true" basename. entry = canonicalize(entry + '/' + spec); // depends on control dependency: [if], data = [none] } else { // Strip off the basename with a ".." path segment and // append the relative entry path. entry = canonicalize(entry + "/../" + spec); // depends on control dependency: [if], data = [none] } } result = path.substring(0, index) + '!' + entry; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public <T> Batcher<T> build(BatchListener<T> listener) { requireNonNull(listener); checkState(maxSize != UNSET_INT || interval != UNSET_INT, "All batchers are required to have either a time or size bound."); ExecutorService handler = (listenerService == null ? newCachedThreadPool() : listenerService); BlockingQueue<T> backingQueue = (maxBufferSize == UNSET_INT ? new LinkedBlockingQueue<T>() : new ArrayBlockingQueue<T>(maxBufferSize)); if (maxSize != UNSET_INT && interval != UNSET_INT) { return new TimeOrSizeBatcher<>(backingQueue, listener, handler, maxSize, interval) .start(); } else if (maxSize != UNSET_INT) { return new SizeBatcher<>(backingQueue, listener, handler, maxSize) .start(); } else { return new TimeBatcher<>(backingQueue, listener, handler, interval) .start(); } } }
public class class_name { public <T> Batcher<T> build(BatchListener<T> listener) { requireNonNull(listener); checkState(maxSize != UNSET_INT || interval != UNSET_INT, "All batchers are required to have either a time or size bound."); ExecutorService handler = (listenerService == null ? newCachedThreadPool() : listenerService); BlockingQueue<T> backingQueue = (maxBufferSize == UNSET_INT ? new LinkedBlockingQueue<T>() : new ArrayBlockingQueue<T>(maxBufferSize)); if (maxSize != UNSET_INT && interval != UNSET_INT) { return new TimeOrSizeBatcher<>(backingQueue, listener, handler, maxSize, interval) .start(); // depends on control dependency: [if], data = [none] } else if (maxSize != UNSET_INT) { return new SizeBatcher<>(backingQueue, listener, handler, maxSize) .start(); // depends on control dependency: [if], data = [none] } else { return new TimeBatcher<>(backingQueue, listener, handler, interval) .start(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static long calculateCutoffMB(Configuration config, long containerMemoryMB) { Preconditions.checkArgument(containerMemoryMB > 0); // (1) check cutoff ratio final float memoryCutoffRatio = config.getFloat( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO); if (memoryCutoffRatio >= 1 || memoryCutoffRatio <= 0) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO.key() + "' must be between 0 and 1. Value given=" + memoryCutoffRatio); } // (2) check min cutoff value final int minCutoff = config.getInteger( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN); if (minCutoff >= containerMemoryMB) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN.key() + "'='" + minCutoff + "' is larger than the total container memory " + containerMemoryMB); } // (3) check between heap and off-heap long cutoff = (long) (containerMemoryMB * memoryCutoffRatio); if (cutoff < minCutoff) { cutoff = minCutoff; } return cutoff; } }
public class class_name { public static long calculateCutoffMB(Configuration config, long containerMemoryMB) { Preconditions.checkArgument(containerMemoryMB > 0); // (1) check cutoff ratio final float memoryCutoffRatio = config.getFloat( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO); if (memoryCutoffRatio >= 1 || memoryCutoffRatio <= 0) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO.key() + "' must be between 0 and 1. Value given=" + memoryCutoffRatio); } // (2) check min cutoff value final int minCutoff = config.getInteger( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN); if (minCutoff >= containerMemoryMB) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN.key() + "'='" + minCutoff + "' is larger than the total container memory " + containerMemoryMB); } // (3) check between heap and off-heap long cutoff = (long) (containerMemoryMB * memoryCutoffRatio); if (cutoff < minCutoff) { cutoff = minCutoff; // depends on control dependency: [if], data = [none] } return cutoff; } }
public class class_name { public EEnum getOBPXoaOrent() { if (obpXoaOrentEEnum == null) { obpXoaOrentEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(54); } return obpXoaOrentEEnum; } }
public class class_name { public EEnum getOBPXoaOrent() { if (obpXoaOrentEEnum == null) { obpXoaOrentEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(54); // depends on control dependency: [if], data = [none] } return obpXoaOrentEEnum; } }
public class class_name { public void closeAsync() throws IOException { if (anyAreSet(state, FLAG_CLOSED) || servletRequestContext.getOriginalResponse().isTreatAsCommitted()) { return; } if (!servletRequestContext.getExchange().isInIoThread()) { servletRequestContext.getExchange().getIoThread().execute(new Runnable() { @Override public void run() { try { closeAsync(); } catch (IOException e) { UndertowLogger.REQUEST_IO_LOGGER.closeAsyncFailed(e); } } }); return; } try { setFlags(FLAG_CLOSED); clearFlags(FLAG_READY); if (allAreClear(state, FLAG_WRITE_STARTED) && channel == null) { if (servletRequestContext.getOriginalResponse().getHeader(Headers.TRANSFER_ENCODING_STRING) == null) { if (buffer == null) { servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, "0"); } else { servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, Integer.toString(buffer.position())); } } } createChannel(); if (buffer != null) { if (!flushBufferAsync(true)) { return; } if (pooledBuffer != null) { pooledBuffer.close(); buffer = null; } else { buffer = null; } } channel.shutdownWrites(); setFlags(FLAG_DELEGATE_SHUTDOWN); if (!channel.flush()) { channel.resumeWrites(); } } catch (IOException | RuntimeException | Error e) { if (pooledBuffer != null) { pooledBuffer.close(); pooledBuffer = null; buffer = null; } throw e; } } }
public class class_name { public void closeAsync() throws IOException { if (anyAreSet(state, FLAG_CLOSED) || servletRequestContext.getOriginalResponse().isTreatAsCommitted()) { return; } if (!servletRequestContext.getExchange().isInIoThread()) { servletRequestContext.getExchange().getIoThread().execute(new Runnable() { @Override public void run() { try { closeAsync(); // depends on control dependency: [try], data = [none] } catch (IOException e) { UndertowLogger.REQUEST_IO_LOGGER.closeAsyncFailed(e); } // depends on control dependency: [catch], data = [none] } }); return; } try { setFlags(FLAG_CLOSED); clearFlags(FLAG_READY); if (allAreClear(state, FLAG_WRITE_STARTED) && channel == null) { if (servletRequestContext.getOriginalResponse().getHeader(Headers.TRANSFER_ENCODING_STRING) == null) { if (buffer == null) { servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, "0"); } else { servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, Integer.toString(buffer.position())); } } } createChannel(); if (buffer != null) { if (!flushBufferAsync(true)) { return; } if (pooledBuffer != null) { pooledBuffer.close(); buffer = null; } else { buffer = null; } } channel.shutdownWrites(); setFlags(FLAG_DELEGATE_SHUTDOWN); if (!channel.flush()) { channel.resumeWrites(); } } catch (IOException | RuntimeException | Error e) { if (pooledBuffer != null) { pooledBuffer.close(); pooledBuffer = null; buffer = null; } throw e; } } }
public class class_name { public List<Client> findAllClients(int profileId) throws Exception { ArrayList<Client> clients = new ArrayList<Client>(); PreparedStatement query = null; ResultSet results = null; try (Connection sqlConnection = sqlService.getConnection()) { query = sqlConnection.prepareStatement( "SELECT * FROM " + Constants.DB_TABLE_CLIENT + " WHERE " + Constants.GENERIC_PROFILE_ID + " = ?" ); query.setInt(1, profileId); results = query.executeQuery(); while (results.next()) { clients.add(this.getClientFromResultSet(results)); } } catch (Exception e) { throw e; } finally { try { if (results != null) { results.close(); } } catch (Exception e) { } try { if (query != null) { query.close(); } } catch (Exception e) { } } return clients; } }
public class class_name { public List<Client> findAllClients(int profileId) throws Exception { ArrayList<Client> clients = new ArrayList<Client>(); PreparedStatement query = null; ResultSet results = null; try (Connection sqlConnection = sqlService.getConnection()) { query = sqlConnection.prepareStatement( "SELECT * FROM " + Constants.DB_TABLE_CLIENT + " WHERE " + Constants.GENERIC_PROFILE_ID + " = ?" ); query.setInt(1, profileId); results = query.executeQuery(); while (results.next()) { clients.add(this.getClientFromResultSet(results)); } } catch (Exception e) { throw e; } finally { try { if (results != null) { results.close(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { } // depends on control dependency: [catch], data = [none] try { if (query != null) { query.close(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { } // depends on control dependency: [catch], data = [none] } return clients; } }
public class class_name { protected boolean isBaseEmpty() { if (myUndeclaredExtensions != null) { for (ExtensionDt next : myUndeclaredExtensions) { if (next == null) { continue; } if (!next.isEmpty()) { return false; } } } if (myUndeclaredModifierExtensions != null) { for (ExtensionDt next : myUndeclaredModifierExtensions) { if (next == null) { continue; } if (!next.isEmpty()) { return false; } } } return true; } }
public class class_name { protected boolean isBaseEmpty() { if (myUndeclaredExtensions != null) { for (ExtensionDt next : myUndeclaredExtensions) { if (next == null) { continue; } if (!next.isEmpty()) { return false; // depends on control dependency: [if], data = [none] } } } if (myUndeclaredModifierExtensions != null) { for (ExtensionDt next : myUndeclaredModifierExtensions) { if (next == null) { continue; } if (!next.isEmpty()) { return false; // depends on control dependency: [if], data = [none] } } } return true; } }
public class class_name { public static String getRepeatedEnumConverterName(Field field) { if (field.isRepeated()) { return "__" + Formatter.toCamelCase(field.getName()) + "Converter"; } throw new IllegalArgumentException(field.toString()); } }
public class class_name { public static String getRepeatedEnumConverterName(Field field) { if (field.isRepeated()) { return "__" + Formatter.toCamelCase(field.getName()) + "Converter"; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException(field.toString()); } }
public class class_name { private static void doTaskHooksTranslation(Config heronConfig) { List<String> hooks = heronConfig.getAutoTaskHooks(); if (hooks != null && !hooks.isEmpty()) { heronConfig.put(backtype.storm.Config.STORMCOMPAT_TOPOLOGY_AUTO_TASK_HOOKS, hooks); List<String> translationHooks = new LinkedList<>(); translationHooks.add(ITaskHookDelegate.class.getName()); heronConfig.setAutoTaskHooks(translationHooks); } } }
public class class_name { private static void doTaskHooksTranslation(Config heronConfig) { List<String> hooks = heronConfig.getAutoTaskHooks(); if (hooks != null && !hooks.isEmpty()) { heronConfig.put(backtype.storm.Config.STORMCOMPAT_TOPOLOGY_AUTO_TASK_HOOKS, hooks); // depends on control dependency: [if], data = [none] List<String> translationHooks = new LinkedList<>(); translationHooks.add(ITaskHookDelegate.class.getName()); // depends on control dependency: [if], data = [none] heronConfig.setAutoTaskHooks(translationHooks); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Xid[] recover(int flag) throws XAException { // Check preconditions if (flag != TMSTARTRSCAN && flag != TMENDRSCAN && flag != TMNOFLAGS && flag != (TMSTARTRSCAN | TMENDRSCAN)) { throw new PGXAException(GT.tr("Invalid flags {0}", flag), XAException.XAER_INVAL); } // We don't check for precondition 2, because we would have to add some additional state in // this object to keep track of recovery scans. // All clear. We return all the xids in the first TMSTARTRSCAN call, and always return // an empty array otherwise. if ((flag & TMSTARTRSCAN) == 0) { return new Xid[0]; } else { try { Statement stmt = conn.createStatement(); try { // If this connection is simultaneously used for a transaction, // this query gets executed inside that transaction. It's OK, // except if the transaction is in abort-only state and the // backed refuses to process new queries. Hopefully not a problem // in practise. ResultSet rs = stmt.executeQuery( "SELECT gid FROM pg_prepared_xacts where database = current_database()"); LinkedList<Xid> l = new LinkedList<Xid>(); while (rs.next()) { Xid recoveredXid = RecoveredXid.stringToXid(rs.getString(1)); if (recoveredXid != null) { l.add(recoveredXid); } } rs.close(); return l.toArray(new Xid[0]); } finally { stmt.close(); } } catch (SQLException ex) { throw new PGXAException(GT.tr("Error during recover"), ex, XAException.XAER_RMERR); } } } }
public class class_name { @Override public Xid[] recover(int flag) throws XAException { // Check preconditions if (flag != TMSTARTRSCAN && flag != TMENDRSCAN && flag != TMNOFLAGS && flag != (TMSTARTRSCAN | TMENDRSCAN)) { throw new PGXAException(GT.tr("Invalid flags {0}", flag), XAException.XAER_INVAL); } // We don't check for precondition 2, because we would have to add some additional state in // this object to keep track of recovery scans. // All clear. We return all the xids in the first TMSTARTRSCAN call, and always return // an empty array otherwise. if ((flag & TMSTARTRSCAN) == 0) { return new Xid[0]; } else { try { Statement stmt = conn.createStatement(); try { // If this connection is simultaneously used for a transaction, // this query gets executed inside that transaction. It's OK, // except if the transaction is in abort-only state and the // backed refuses to process new queries. Hopefully not a problem // in practise. ResultSet rs = stmt.executeQuery( "SELECT gid FROM pg_prepared_xacts where database = current_database()"); LinkedList<Xid> l = new LinkedList<Xid>(); while (rs.next()) { Xid recoveredXid = RecoveredXid.stringToXid(rs.getString(1)); if (recoveredXid != null) { l.add(recoveredXid); // depends on control dependency: [if], data = [(recoveredXid] } } rs.close(); // depends on control dependency: [try], data = [none] return l.toArray(new Xid[0]); // depends on control dependency: [try], data = [none] } finally { stmt.close(); } } catch (SQLException ex) { throw new PGXAException(GT.tr("Error during recover"), ex, XAException.XAER_RMERR); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public final void exclusiveOrExpression() throws RecognitionException { int exclusiveOrExpression_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 114) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:5: ( andExpression ( '^' andExpression )* ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:9: andExpression ( '^' andExpression )* { pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression5158); andExpression(); state._fsp--; if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:23: ( '^' andExpression )* loop146: while (true) { int alt146=2; int LA146_0 = input.LA(1); if ( (LA146_0==61) ) { alt146=1; } switch (alt146) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:25: '^' andExpression { match(input,61,FOLLOW_61_in_exclusiveOrExpression5162); if (state.failed) return; pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression5164); andExpression(); state._fsp--; if (state.failed) return; } break; default : break loop146; } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 114, exclusiveOrExpression_StartIndex); } } } }
public class class_name { public final void exclusiveOrExpression() throws RecognitionException { int exclusiveOrExpression_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 114) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:5: ( andExpression ( '^' andExpression )* ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:9: andExpression ( '^' andExpression )* { pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression5158); andExpression(); state._fsp--; if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:23: ( '^' andExpression )* loop146: while (true) { int alt146=2; int LA146_0 = input.LA(1); if ( (LA146_0==61) ) { alt146=1; // depends on control dependency: [if], data = [none] } switch (alt146) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1154:25: '^' andExpression { match(input,61,FOLLOW_61_in_exclusiveOrExpression5162); if (state.failed) return; pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression5164); andExpression(); state._fsp--; if (state.failed) return; } break; default : break loop146; } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 114, exclusiveOrExpression_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { protected Boolean _hasSideEffects(XUnaryOperation expression, ISideEffectContext context) { if (expression.isTypeLiteral() || expression.isPackageFragment()) { return Boolean.FALSE; } if (hasSideEffects(expression.getOperand(), context)) { return true; } return false; } }
public class class_name { protected Boolean _hasSideEffects(XUnaryOperation expression, ISideEffectContext context) { if (expression.isTypeLiteral() || expression.isPackageFragment()) { return Boolean.FALSE; // depends on control dependency: [if], data = [none] } if (hasSideEffects(expression.getOperand(), context)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public List <AddOn> getNewAddOns(AddOnCollection aoc) { List<AddOn> newAddOns = new ArrayList<>(); for (AddOn ao : aoc.getAddOns()) { boolean isNew = true; for (AddOn addOn : addOns) { try { if (ao.isSameAddOn(addOn)) { isNew = false; break; } } catch (Exception e) { logger.error(e.getMessage(), e); } } if (isNew) { newAddOns.add(ao); } } return newAddOns; } }
public class class_name { public List <AddOn> getNewAddOns(AddOnCollection aoc) { List<AddOn> newAddOns = new ArrayList<>(); for (AddOn ao : aoc.getAddOns()) { boolean isNew = true; for (AddOn addOn : addOns) { try { if (ao.isSameAddOn(addOn)) { isNew = false; // depends on control dependency: [if], data = [none] break; } } catch (Exception e) { logger.error(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } if (isNew) { newAddOns.add(ao); // depends on control dependency: [if], data = [none] } } return newAddOns; } }
public class class_name { public Cell<C, T> columnDefaults(int column) { Cell<C, T> cell = columnDefaults.size() > column ? columnDefaults.get(column) : null; if (cell == null) { cell = toolkit.obtainCell(this); cell.clear(); if (column >= columnDefaults.size()) { for (int i = columnDefaults.size(); i < column; i++) columnDefaults.add(null); columnDefaults.add(cell); } else columnDefaults.set(column, cell); } return cell; } }
public class class_name { public Cell<C, T> columnDefaults(int column) { Cell<C, T> cell = columnDefaults.size() > column ? columnDefaults.get(column) : null; if (cell == null) { cell = toolkit.obtainCell(this); // depends on control dependency: [if], data = [none] cell.clear(); // depends on control dependency: [if], data = [none] if (column >= columnDefaults.size()) { for (int i = columnDefaults.size(); i < column; i++) columnDefaults.add(null); columnDefaults.add(cell); // depends on control dependency: [if], data = [none] } else columnDefaults.set(column, cell); } return cell; } }
public class class_name { public ICalComponentScribe<? extends ICalComponent> getComponentScribe(Class<? extends ICalComponent> clazz) { ICalComponentScribe<? extends ICalComponent> scribe = experimentalCompByClass.get(clazz); if (scribe != null) { return scribe; } return standardCompByClass.get(clazz); } }
public class class_name { public ICalComponentScribe<? extends ICalComponent> getComponentScribe(Class<? extends ICalComponent> clazz) { ICalComponentScribe<? extends ICalComponent> scribe = experimentalCompByClass.get(clazz); if (scribe != null) { return scribe; // depends on control dependency: [if], data = [none] } return standardCompByClass.get(clazz); } }
public class class_name { public String getPlainTextContext(int fromPos, int toPos, String contents) { String text = contents.replace('\n', ' ').replace('\r', ' ').replace('\t', ' '); // calculate context region: int startContent = fromPos - contextSize; String prefix = "..."; String postfix = "..."; String markerPrefix = " "; if (startContent < 0) { prefix = ""; markerPrefix = ""; startContent = 0; } int endContent = toPos + contextSize; if (endContent > text.length()) { postfix = ""; endContent = text.length(); } StringBuilder marker = getMarker(fromPos, toPos, text.length() + prefix.length()); // now build context string plus marker: return prefix + text.substring(startContent, endContent) + postfix + '\n' + markerPrefix + marker.substring(startContent, endContent); } }
public class class_name { public String getPlainTextContext(int fromPos, int toPos, String contents) { String text = contents.replace('\n', ' ').replace('\r', ' ').replace('\t', ' '); // calculate context region: int startContent = fromPos - contextSize; String prefix = "..."; String postfix = "..."; String markerPrefix = " "; if (startContent < 0) { prefix = ""; markerPrefix = ""; startContent = 0; // depends on control dependency: [if], data = [none] } int endContent = toPos + contextSize; if (endContent > text.length()) { postfix = ""; endContent = text.length(); // depends on control dependency: [if], data = [none] } StringBuilder marker = getMarker(fromPos, toPos, text.length() + prefix.length()); // now build context string plus marker: return prefix + text.substring(startContent, endContent) + postfix + '\n' + markerPrefix + marker.substring(startContent, endContent); } }
public class class_name { public void setSL(java.util.Collection<String> sL) { if (sL == null) { this.sL = null; return; } this.sL = new java.util.ArrayList<String>(sL); } }
public class class_name { public void setSL(java.util.Collection<String> sL) { if (sL == null) { this.sL = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.sL = new java.util.ArrayList<String>(sL); } }
public class class_name { private void exposeVariables() throws JspTagException { if (deferredExpression == null) { /* * We need to support null items returned from next(); we * do this simply by passing such non-items through to the * scoped variable as effectively 'null' (that is, by calling * removeAttribute()). * * Also, just to be defensive, we handle the case of a null * 'status' object as well. * * We call getCurrent() and getLoopStatus() (instead of just using * 'item' and 'status') to bridge to subclasses correctly. * A subclass can override getCurrent() or getLoopStatus() but still * depend on our doStartTag() and doAfterBody(), which call this * method (exposeVariables()), to expose 'item' and 'status' * correctly. */ if (itemId != null) { if (getCurrent() == null) { pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE); } else { pageContext.setAttribute(itemId, getCurrent()); } } } else { //this is using a DeferredExpression ELContext myELContext = pageContext.getELContext(); VariableMapper vm = myELContext.getVariableMapper(); vm.setVariable(itemId, (ValueExpression) getCurrent()); } if (statusId != null) { if (getLoopStatus() == null) { pageContext.removeAttribute(statusId, PageContext.PAGE_SCOPE); } else { pageContext.setAttribute(statusId, getLoopStatus()); } } } }
public class class_name { private void exposeVariables() throws JspTagException { if (deferredExpression == null) { /* * We need to support null items returned from next(); we * do this simply by passing such non-items through to the * scoped variable as effectively 'null' (that is, by calling * removeAttribute()). * * Also, just to be defensive, we handle the case of a null * 'status' object as well. * * We call getCurrent() and getLoopStatus() (instead of just using * 'item' and 'status') to bridge to subclasses correctly. * A subclass can override getCurrent() or getLoopStatus() but still * depend on our doStartTag() and doAfterBody(), which call this * method (exposeVariables()), to expose 'item' and 'status' * correctly. */ if (itemId != null) { if (getCurrent() == null) { pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE); // depends on control dependency: [if], data = [none] } else { pageContext.setAttribute(itemId, getCurrent()); // depends on control dependency: [if], data = [none] } } } else { //this is using a DeferredExpression ELContext myELContext = pageContext.getELContext(); VariableMapper vm = myELContext.getVariableMapper(); vm.setVariable(itemId, (ValueExpression) getCurrent()); } if (statusId != null) { if (getLoopStatus() == null) { pageContext.removeAttribute(statusId, PageContext.PAGE_SCOPE); } else { pageContext.setAttribute(statusId, getLoopStatus()); } } } }
public class class_name { public static List<String> removeRedundancies(List<String> resourcenames) { if ((resourcenames == null) || (resourcenames.isEmpty())) { return new ArrayList<String>(); } if (resourcenames.size() == 1) { // if there is only one resource name in the list, there can be no redundancies return new ArrayList<String>(resourcenames); } // check all resources names and see if a parent folder name is contained List<String> result = new ArrayList<String>(resourcenames.size()); List<String> base = new ArrayList<String>(resourcenames); Collections.sort(base); Iterator<String> i = base.iterator(); while (i.hasNext()) { // check all resource names in the list String resourcename = i.next(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(resourcename)) { // skip empty strings continue; } boolean valid = true; for (int j = (result.size() - 1); j >= 0; j--) { // check if this resource name is indirectly contained because a parent folder name is contained String check = result.get(j); if ((CmsResource.isFolder(check) && resourcename.startsWith(check)) || resourcename.equals(check)) { valid = false; break; } } if (valid) { // a parent folder name is not already contained in the result result.add(resourcename); } } return result; } }
public class class_name { public static List<String> removeRedundancies(List<String> resourcenames) { if ((resourcenames == null) || (resourcenames.isEmpty())) { return new ArrayList<String>(); // depends on control dependency: [if], data = [none] } if (resourcenames.size() == 1) { // if there is only one resource name in the list, there can be no redundancies return new ArrayList<String>(resourcenames); // depends on control dependency: [if], data = [none] } // check all resources names and see if a parent folder name is contained List<String> result = new ArrayList<String>(resourcenames.size()); List<String> base = new ArrayList<String>(resourcenames); Collections.sort(base); Iterator<String> i = base.iterator(); while (i.hasNext()) { // check all resource names in the list String resourcename = i.next(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(resourcename)) { // skip empty strings continue; } boolean valid = true; for (int j = (result.size() - 1); j >= 0; j--) { // check if this resource name is indirectly contained because a parent folder name is contained String check = result.get(j); if ((CmsResource.isFolder(check) && resourcename.startsWith(check)) || resourcename.equals(check)) { valid = false; // depends on control dependency: [if], data = [none] break; } } if (valid) { // a parent folder name is not already contained in the result result.add(resourcename); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public void removeItemDecoration(ItemDecoration decor) { mItemDecorations.remove(decor); if (mItemDecorations.isEmpty()) { setWillNotDraw(ViewCompat.getOverScrollMode(this) == ViewCompat.OVER_SCROLL_NEVER); } markItemDecorInsetsDirty(); requestLayout(); } }
public class class_name { public void removeItemDecoration(ItemDecoration decor) { mItemDecorations.remove(decor); if (mItemDecorations.isEmpty()) { setWillNotDraw(ViewCompat.getOverScrollMode(this) == ViewCompat.OVER_SCROLL_NEVER); // depends on control dependency: [if], data = [none] } markItemDecorInsetsDirty(); requestLayout(); } }
public class class_name { public void showViewAndWait(Window window, Modality modality) { if (isPrimaryStageView) { showView(modality); // this modality will be ignored anyway return; } if (stage == null || currentStageModality != modality || !Objects.equals(stage.getOwner(), window)) { stage = createStage(modality); stage.initOwner(window); } stage.showAndWait(); } }
public class class_name { public void showViewAndWait(Window window, Modality modality) { if (isPrimaryStageView) { showView(modality); // this modality will be ignored anyway // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (stage == null || currentStageModality != modality || !Objects.equals(stage.getOwner(), window)) { stage = createStage(modality); // depends on control dependency: [if], data = [none] stage.initOwner(window); // depends on control dependency: [if], data = [none] } stage.showAndWait(); } }
public class class_name { public void sendPoisonPill(Collection<Integer> hostIds, String err, int cause) { for (int hostId : hostIds) { Iterator<ForeignHost> it = m_foreignHosts.get(hostId).iterator(); // No need to overdose the poison pill if (it.hasNext()) { ForeignHost fh = it.next(); if (fh.isUp()) { fh.sendPoisonPill(err, cause); } } } } }
public class class_name { public void sendPoisonPill(Collection<Integer> hostIds, String err, int cause) { for (int hostId : hostIds) { Iterator<ForeignHost> it = m_foreignHosts.get(hostId).iterator(); // No need to overdose the poison pill if (it.hasNext()) { ForeignHost fh = it.next(); if (fh.isUp()) { fh.sendPoisonPill(err, cause); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static void saveColorPository (ColorPository posit, File root) { File path = new File(root, CONFIG_PATH); try { CompiledConfig.saveConfig(path, posit); } catch (IOException ioe) { log.warning("Failure saving color pository", "path", path, "error", ioe); } } }
public class class_name { public static void saveColorPository (ColorPository posit, File root) { File path = new File(root, CONFIG_PATH); try { CompiledConfig.saveConfig(path, posit); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { log.warning("Failure saving color pository", "path", path, "error", ioe); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean[][] getTruthTable(int colCount) { boolean[][] table = new boolean[colCount][(int) Math.pow(2, colCount)]; for (int i = 1; i <= colCount; i++) { for (int j = 0; j < (int) Math.pow(2, colCount); j++) { //System.out.println(i+" "+j+" "+(int) Math.floor(j/Math.pow(2,i-1))); table[i - 1][j] = (((int) Math.floor(j / Math.pow(2, i - 1))) % 2) == 0; } } return table; } }
public class class_name { public static boolean[][] getTruthTable(int colCount) { boolean[][] table = new boolean[colCount][(int) Math.pow(2, colCount)]; for (int i = 1; i <= colCount; i++) { for (int j = 0; j < (int) Math.pow(2, colCount); j++) { //System.out.println(i+" "+j+" "+(int) Math.floor(j/Math.pow(2,i-1))); table[i - 1][j] = (((int) Math.floor(j / Math.pow(2, i - 1))) % 2) == 0; // depends on control dependency: [for], data = [j] } } return table; } }
public class class_name { @SuppressWarnings("unchecked") @Override public int doStartTag() throws JspException { super.doStartTag(); if(AssertUtils.isNotEmpty(this.url)) { final HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); Object object = request.getAttribute(JavascriptIncludeTag.JAVASCRIPT_INCLUDE_URL_TAG); List<String> urls; if(object == null) { urls = new ArrayList<String>(); request.setAttribute(JavascriptIncludeTag.JAVASCRIPT_INCLUDE_URL_TAG, urls); } else { urls = (List<String>) object; } if(this.appendContext) { url = UriUtils.addWebPaths(request.getContextPath(), url); } // do not add a duplicate url here if(!urls.contains(url)) { urls.add(url); } return SKIP_BODY; } return EVAL_BODY_BUFFERED; } }
public class class_name { @SuppressWarnings("unchecked") @Override public int doStartTag() throws JspException { super.doStartTag(); if(AssertUtils.isNotEmpty(this.url)) { final HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); Object object = request.getAttribute(JavascriptIncludeTag.JAVASCRIPT_INCLUDE_URL_TAG); List<String> urls; if(object == null) { urls = new ArrayList<String>(); // depends on control dependency: [if], data = [none] request.setAttribute(JavascriptIncludeTag.JAVASCRIPT_INCLUDE_URL_TAG, urls); // depends on control dependency: [if], data = [none] } else { urls = (List<String>) object; // depends on control dependency: [if], data = [none] } if(this.appendContext) { url = UriUtils.addWebPaths(request.getContextPath(), url); // depends on control dependency: [if], data = [none] } // do not add a duplicate url here if(!urls.contains(url)) { urls.add(url); // depends on control dependency: [if], data = [none] } return SKIP_BODY; } return EVAL_BODY_BUFFERED; } }
public class class_name { public void unlockSet(int requestNumber, SIMessageHandle[] msgHandles, boolean reply) // f199593, F219476.2 { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlockSet", new Object[] { requestNumber, msgHandles, reply }); checkNotBrowserSession(); // F171893 if (subConsumer != null) { subConsumer.unlockSet(requestNumber, msgHandles, reply); // f199593, F219476.2 } else { super.unlockSet(requestNumber, msgHandles, reply); // f199593, F219476.2 } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlockSet"); } }
public class class_name { public void unlockSet(int requestNumber, SIMessageHandle[] msgHandles, boolean reply) // f199593, F219476.2 { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlockSet", new Object[] { requestNumber, msgHandles, reply }); checkNotBrowserSession(); // F171893 if (subConsumer != null) { subConsumer.unlockSet(requestNumber, msgHandles, reply); // f199593, F219476.2 // depends on control dependency: [if], data = [none] } else { super.unlockSet(requestNumber, msgHandles, reply); // f199593, F219476.2 // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlockSet"); } }
public class class_name { private void addHttpSessionIdListener(HttpSessionIdListener listener, boolean securityCheckNeeded) throws SecurityException { if (securityCheckNeeded) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(perm); } } ((IHttpSessionContext31)this.getSessionContext()).addHttpSessionIdListener(listener, name); } }
public class class_name { private void addHttpSessionIdListener(HttpSessionIdListener listener, boolean securityCheckNeeded) throws SecurityException { if (securityCheckNeeded) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(perm); // depends on control dependency: [if], data = [none] } } ((IHttpSessionContext31)this.getSessionContext()).addHttpSessionIdListener(listener, name); } }
public class class_name { public boolean injectNextEvent() { if (this.getProcessor().hasNext()) { ContentEvent event = this.getProcessor().nextEvent(); this.getOutputStream().put(event); return true; } return false; } }
public class class_name { public boolean injectNextEvent() { if (this.getProcessor().hasNext()) { ContentEvent event = this.getProcessor().nextEvent(); this.getOutputStream().put(event); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static void assertNull(String message, Object o) { if (o == null) { pass(message); } else { fail(message, "'" + o + "' is not null"); } } }
public class class_name { public static void assertNull(String message, Object o) { if (o == null) { pass(message); // depends on control dependency: [if], data = [none] } else { fail(message, "'" + o + "' is not null"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static lbroute6[] get(nitro_service service, String network[]) throws Exception{ if (network !=null && network.length>0) { lbroute6 response[] = new lbroute6[network.length]; lbroute6 obj[] = new lbroute6[network.length]; for (int i=0;i<network.length;i++) { obj[i] = new lbroute6(); obj[i].set_network(network[i]); response[i] = (lbroute6) obj[i].get_resource(service); } return response; } return null; } }
public class class_name { public static lbroute6[] get(nitro_service service, String network[]) throws Exception{ if (network !=null && network.length>0) { lbroute6 response[] = new lbroute6[network.length]; lbroute6 obj[] = new lbroute6[network.length]; for (int i=0;i<network.length;i++) { obj[i] = new lbroute6(); // depends on control dependency: [for], data = [i] obj[i].set_network(network[i]); // depends on control dependency: [for], data = [i] response[i] = (lbroute6) obj[i].get_resource(service); // depends on control dependency: [for], data = [i] } return response; } return null; } }
public class class_name { public static StringBuilder encode(CharSequence src, boolean[] caseFlags) throws StringPrepParseException{ int n, delta, handledCPCount, basicLength, bias, j, m, q, k, t, srcCPCount; char c, c2; int srcLength = src.length(); int[] cpBuffer = new int[srcLength]; StringBuilder dest = new StringBuilder(srcLength); /* * Handle the basic code points and * convert extended ones to UTF-32 in cpBuffer (caseFlag in sign bit): */ srcCPCount=0; for(j=0; j<srcLength; ++j) { c=src.charAt(j); if(isBasic(c)) { cpBuffer[srcCPCount++]=0; dest.append(caseFlags!=null ? asciiCaseMap(c, caseFlags[j]) : c); } else { n=((caseFlags!=null && caseFlags[j])? 1 : 0)<<31L; if(!UTF16.isSurrogate(c)) { n|=c; } else if(UTF16.isLeadSurrogate(c) && (j+1)<srcLength && UTF16.isTrailSurrogate(c2=src.charAt(j+1))) { ++j; n|=UCharacter.getCodePoint(c, c2); } else { /* error: unmatched surrogate */ throw new StringPrepParseException("Illegal char found",StringPrepParseException.ILLEGAL_CHAR_FOUND); } cpBuffer[srcCPCount++]=n; } } /* Finish the basic string - if it is not empty - with a delimiter. */ basicLength=dest.length(); if(basicLength>0) { dest.append(DELIMITER); } /* * handledCPCount is the number of code points that have been handled * basicLength is the number of basic code points * destLength is the number of chars that have been output */ /* Initialize the state: */ n=INITIAL_N; delta=0; bias=INITIAL_BIAS; /* Main encoding loop: */ for(handledCPCount=basicLength; handledCPCount<srcCPCount; /* no op */) { /* * All non-basic code points < n have been handled already. * Find the next larger one: */ for(m=0x7fffffff, j=0; j<srcCPCount; ++j) { q=cpBuffer[j]&0x7fffffff; /* remove case flag from the sign bit */ if(n<=q && q<m) { m=q; } } /* * Increase delta enough to advance the decoder's * <n,i> state to <m,0>, but guard against overflow: */ if(m-n>(0x7fffffff-delta)/(handledCPCount+1)) { throw new IllegalStateException("Internal program error"); } delta+=(m-n)*(handledCPCount+1); n=m; /* Encode a sequence of same code points n */ for(j=0; j<srcCPCount; ++j) { q=cpBuffer[j]&0x7fffffff; /* remove case flag from the sign bit */ if(q<n) { ++delta; } else if(q==n) { /* Represent delta as a generalized variable-length integer: */ for(q=delta, k=BASE; /* no condition */; k+=BASE) { /** RAM: comment out the old code for conformance with draft-ietf-idn-punycode-03.txt t=k-bias; if(t<TMIN) { t=TMIN; } else if(t>TMAX) { t=TMAX; } */ t=k-bias; if(t<TMIN) { t=TMIN; } else if(k>=(bias+TMAX)) { t=TMAX; } if(q<t) { break; } dest.append(digitToBasic(t+(q-t)%(BASE-t), false)); q=(q-t)/(BASE-t); } dest.append(digitToBasic(q, (cpBuffer[j]<0))); bias=adaptBias(delta, handledCPCount+1,(handledCPCount==basicLength)); delta=0; ++handledCPCount; } } ++delta; ++n; } return dest; } }
public class class_name { public static StringBuilder encode(CharSequence src, boolean[] caseFlags) throws StringPrepParseException{ int n, delta, handledCPCount, basicLength, bias, j, m, q, k, t, srcCPCount; char c, c2; int srcLength = src.length(); int[] cpBuffer = new int[srcLength]; StringBuilder dest = new StringBuilder(srcLength); /* * Handle the basic code points and * convert extended ones to UTF-32 in cpBuffer (caseFlag in sign bit): */ srcCPCount=0; for(j=0; j<srcLength; ++j) { c=src.charAt(j); if(isBasic(c)) { cpBuffer[srcCPCount++]=0; // depends on control dependency: [if], data = [none] dest.append(caseFlags!=null ? asciiCaseMap(c, caseFlags[j]) : c); // depends on control dependency: [if], data = [none] } else { n=((caseFlags!=null && caseFlags[j])? 1 : 0)<<31L; // depends on control dependency: [if], data = [none] if(!UTF16.isSurrogate(c)) { n|=c; // depends on control dependency: [if], data = [none] } else if(UTF16.isLeadSurrogate(c) && (j+1)<srcLength && UTF16.isTrailSurrogate(c2=src.charAt(j+1))) { ++j; // depends on control dependency: [if], data = [none] n|=UCharacter.getCodePoint(c, c2); // depends on control dependency: [if], data = [none] } else { /* error: unmatched surrogate */ throw new StringPrepParseException("Illegal char found",StringPrepParseException.ILLEGAL_CHAR_FOUND); } cpBuffer[srcCPCount++]=n; // depends on control dependency: [if], data = [none] } } /* Finish the basic string - if it is not empty - with a delimiter. */ basicLength=dest.length(); if(basicLength>0) { dest.append(DELIMITER); } /* * handledCPCount is the number of code points that have been handled * basicLength is the number of basic code points * destLength is the number of chars that have been output */ /* Initialize the state: */ n=INITIAL_N; delta=0; bias=INITIAL_BIAS; /* Main encoding loop: */ for(handledCPCount=basicLength; handledCPCount<srcCPCount; /* no op */) { /* * All non-basic code points < n have been handled already. * Find the next larger one: */ for(m=0x7fffffff, j=0; j<srcCPCount; ++j) { q=cpBuffer[j]&0x7fffffff; /* remove case flag from the sign bit */ if(n<=q && q<m) { m=q; // depends on control dependency: [if], data = [none] } } /* * Increase delta enough to advance the decoder's * <n,i> state to <m,0>, but guard against overflow: */ if(m-n>(0x7fffffff-delta)/(handledCPCount+1)) { throw new IllegalStateException("Internal program error"); } delta+=(m-n)*(handledCPCount+1); n=m; /* Encode a sequence of same code points n */ for(j=0; j<srcCPCount; ++j) { q=cpBuffer[j]&0x7fffffff; /* remove case flag from the sign bit */ if(q<n) { ++delta; } else if(q==n) { /* Represent delta as a generalized variable-length integer: */ for(q=delta, k=BASE; /* no condition */; k+=BASE) { /** RAM: comment out the old code for conformance with draft-ietf-idn-punycode-03.txt t=k-bias; if(t<TMIN) { t=TMIN; } else if(t>TMAX) { t=TMAX; } */ t=k-bias; if(t<TMIN) { t=TMIN; } else if(k>=(bias+TMAX)) { t=TMAX; } if(q<t) { break; } dest.append(digitToBasic(t+(q-t)%(BASE-t), false)); q=(q-t)/(BASE-t); } dest.append(digitToBasic(q, (cpBuffer[j]<0))); bias=adaptBias(delta, handledCPCount+1,(handledCPCount==basicLength)); delta=0; ++handledCPCount; } } ++delta; ++n; } return dest; } }
public class class_name { public XML addClass(Class<?> aClass, Global global, Attribute[] attributes){ XmlClass xmlClass = new XmlClass(); xmlClass.name = aClass.getName(); xmlJmapper.classes.add(xmlClass); if(!isEmpty(attributes)){ xmlClass.attributes = new ArrayList<XmlAttribute>(); addAttributes(aClass, attributes); } if(global != null) addGlobal(aClass, global); return this; } }
public class class_name { public XML addClass(Class<?> aClass, Global global, Attribute[] attributes){ XmlClass xmlClass = new XmlClass(); xmlClass.name = aClass.getName(); xmlJmapper.classes.add(xmlClass); if(!isEmpty(attributes)){ xmlClass.attributes = new ArrayList<XmlAttribute>(); // depends on control dependency: [if], data = [none] addAttributes(aClass, attributes); // depends on control dependency: [if], data = [none] } if(global != null) addGlobal(aClass, global); return this; } }
public class class_name { public boolean runOnMainThreadDelayed(Runnable r, long delayMillis) { assert handler != null; if (!sanityCheck("runOnMainThreadDelayed " + r + " delayMillis = " + delayMillis)) { return false; } return handler.postDelayed(r, delayMillis); } }
public class class_name { public boolean runOnMainThreadDelayed(Runnable r, long delayMillis) { assert handler != null; if (!sanityCheck("runOnMainThreadDelayed " + r + " delayMillis = " + delayMillis)) { return false; // depends on control dependency: [if], data = [none] } return handler.postDelayed(r, delayMillis); } }
public class class_name { public void setNotificationsWithSubscribers(java.util.Collection<NotificationWithSubscribers> notificationsWithSubscribers) { if (notificationsWithSubscribers == null) { this.notificationsWithSubscribers = null; return; } this.notificationsWithSubscribers = new java.util.ArrayList<NotificationWithSubscribers>(notificationsWithSubscribers); } }
public class class_name { public void setNotificationsWithSubscribers(java.util.Collection<NotificationWithSubscribers> notificationsWithSubscribers) { if (notificationsWithSubscribers == null) { this.notificationsWithSubscribers = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.notificationsWithSubscribers = new java.util.ArrayList<NotificationWithSubscribers>(notificationsWithSubscribers); } }
public class class_name { @Override public void visit(Node node) throws ELException { if (node instanceof AstFunction) { AstFunction funcNode = (AstFunction) node; Method m = null; if (this.fnMapper != null) { m = fnMapper.resolveFunction(funcNode.getPrefix(), funcNode .getLocalName()); } // References to variables that refer to lambda expressions will be // parsed as functions. This is handled at runtime but at this point // need to treat it as a variable rather than a function. if (m == null && this.varMapper != null && funcNode.getPrefix().length() == 0) { this.varMapper.resolveVariable(funcNode.getLocalName()); return; } if (this.fnMapper == null) { throw new ELException(MessageFactory.get("error.fnMapper.null")); } if (m == null) { throw new ELException(MessageFactory.get( "error.fnMapper.method", funcNode.getOutputName())); } int methodParameterCount = m.getParameterTypes().length; // AstFunction->MethodParameters->Parameters() int inputParameterCount = node.jjtGetChild(0).jjtGetNumChildren(); if (m.isVarArgs() && inputParameterCount < methodParameterCount - 1 || !m.isVarArgs() && inputParameterCount != methodParameterCount) { throw new ELException(MessageFactory.get( "error.fnMapper.paramcount", funcNode.getOutputName(), "" + methodParameterCount, "" + node.jjtGetChild(0).jjtGetNumChildren())); } } else if (node instanceof AstIdentifier && this.varMapper != null) { String variable = ((AstIdentifier) node).getImage(); // simply capture it this.varMapper.resolveVariable(variable); } } }
public class class_name { @Override public void visit(Node node) throws ELException { if (node instanceof AstFunction) { AstFunction funcNode = (AstFunction) node; Method m = null; if (this.fnMapper != null) { m = fnMapper.resolveFunction(funcNode.getPrefix(), funcNode .getLocalName()); // depends on control dependency: [if], data = [none] } // References to variables that refer to lambda expressions will be // parsed as functions. This is handled at runtime but at this point // need to treat it as a variable rather than a function. if (m == null && this.varMapper != null && funcNode.getPrefix().length() == 0) { this.varMapper.resolveVariable(funcNode.getLocalName()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (this.fnMapper == null) { throw new ELException(MessageFactory.get("error.fnMapper.null")); } if (m == null) { throw new ELException(MessageFactory.get( "error.fnMapper.method", funcNode.getOutputName())); } int methodParameterCount = m.getParameterTypes().length; // AstFunction->MethodParameters->Parameters() int inputParameterCount = node.jjtGetChild(0).jjtGetNumChildren(); if (m.isVarArgs() && inputParameterCount < methodParameterCount - 1 || !m.isVarArgs() && inputParameterCount != methodParameterCount) { throw new ELException(MessageFactory.get( "error.fnMapper.paramcount", funcNode.getOutputName(), "" + methodParameterCount, "" + node.jjtGetChild(0).jjtGetNumChildren())); } } else if (node instanceof AstIdentifier && this.varMapper != null) { String variable = ((AstIdentifier) node).getImage(); // simply capture it this.varMapper.resolveVariable(variable); } } }
public class class_name { synchronized IndexReader[] getIndexReaders(String[] indexNames, IndexListener listener) throws IOException { Set<String> names = new HashSet<String>(Arrays.asList(indexNames)); Map<ReadOnlyIndexReader, PersistentIndex> indexReaders = new HashMap<ReadOnlyIndexReader, PersistentIndex>(); try { for (Iterator<PersistentIndex> it = indexes.iterator(); it.hasNext();) { PersistentIndex index = it.next(); if (names.contains(index.getName())) { indexReaders.put(index.getReadOnlyIndexReader(listener), index); } } } catch (IOException e) { // release readers obtained so far for (Iterator<Entry<ReadOnlyIndexReader, PersistentIndex>> it = indexReaders.entrySet().iterator(); it .hasNext();) { Map.Entry<ReadOnlyIndexReader, PersistentIndex> entry = it.next(); final ReadOnlyIndexReader reader = entry.getKey(); try { SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { reader.release(); return null; } }); } catch (IOException ex) { LOG.warn("Exception releasing index reader: " + ex); } (entry.getValue()).resetListener(); } throw e; } return indexReaders.keySet().toArray(new IndexReader[indexReaders.size()]); } }
public class class_name { synchronized IndexReader[] getIndexReaders(String[] indexNames, IndexListener listener) throws IOException { Set<String> names = new HashSet<String>(Arrays.asList(indexNames)); Map<ReadOnlyIndexReader, PersistentIndex> indexReaders = new HashMap<ReadOnlyIndexReader, PersistentIndex>(); try { for (Iterator<PersistentIndex> it = indexes.iterator(); it.hasNext();) { PersistentIndex index = it.next(); if (names.contains(index.getName())) { indexReaders.put(index.getReadOnlyIndexReader(listener), index); // depends on control dependency: [if], data = [none] } } } catch (IOException e) { // release readers obtained so far for (Iterator<Entry<ReadOnlyIndexReader, PersistentIndex>> it = indexReaders.entrySet().iterator(); it .hasNext();) { Map.Entry<ReadOnlyIndexReader, PersistentIndex> entry = it.next(); final ReadOnlyIndexReader reader = entry.getKey(); try { SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { reader.release(); return null; } }); // depends on control dependency: [try], data = [none] } catch (IOException ex) { LOG.warn("Exception releasing index reader: " + ex); } // depends on control dependency: [catch], data = [none] (entry.getValue()).resetListener(); // depends on control dependency: [for], data = [none] } throw e; } // depends on control dependency: [catch], data = [none] return indexReaders.keySet().toArray(new IndexReader[indexReaders.size()]); } }
public class class_name { private ResourceAssignment getExistingResourceAssignment(Resource resource) { ResourceAssignment assignment = null; Integer resourceUniqueID = null; if (resource != null) { Iterator<ResourceAssignment> iter = m_assignments.iterator(); resourceUniqueID = resource.getUniqueID(); while (iter.hasNext() == true) { assignment = iter.next(); Integer uniqueID = assignment.getResourceUniqueID(); if (uniqueID != null && uniqueID.equals(resourceUniqueID) == true) { break; } assignment = null; } } return assignment; } }
public class class_name { private ResourceAssignment getExistingResourceAssignment(Resource resource) { ResourceAssignment assignment = null; Integer resourceUniqueID = null; if (resource != null) { Iterator<ResourceAssignment> iter = m_assignments.iterator(); resourceUniqueID = resource.getUniqueID(); // depends on control dependency: [if], data = [none] while (iter.hasNext() == true) { assignment = iter.next(); // depends on control dependency: [while], data = [none] Integer uniqueID = assignment.getResourceUniqueID(); if (uniqueID != null && uniqueID.equals(resourceUniqueID) == true) { break; } assignment = null; // depends on control dependency: [while], data = [none] } } return assignment; } }
public class class_name { @Override public Iterator<KFoldSplitter.Split> split(final Dataframe dataset) { final int n = dataset.size(); if(k<=0 || n<=k) { throw new IllegalArgumentException("Invalid number of folds."); } else if(k == 1) { //by convention we the train and test datasets are the same. we need to copy both of them to ensure the original data won't be modified. return Arrays.asList(new Split(dataset.copy(), dataset.copy())).iterator(); } //shuffle the ids of the records final Integer[] ids = new Integer[n]; int j = 0; for(Integer rId : dataset.index()) { ids[j++]=rId; } PHPMethods.shuffle(ids, random); //estimate the size of fold. we floor the number here final int foldSize= n/k; return new Iterator<Split>() { private int counter = 0; /** {@inheritDoc} */ @Override public boolean hasNext() { return counter < k; } /** {@inheritDoc} */ @Override public Split next() { logger.info("Kfold {}", counter); //We consider as fold window the part of the ids which are used for test FlatDataList trainIds = new FlatDataList(new ArrayList<>(n-foldSize)); FlatDataList testIds = new FlatDataList(new ArrayList<>(foldSize)); for(int i=0;i<n;i++) { if(counter*foldSize<=i && i<(counter+1)*foldSize) { testIds.add(ids[i]); } else { trainIds.add(ids[i]); } } counter++; return new Split(dataset.getSubset(trainIds), dataset.getSubset(testIds)); } }; } }
public class class_name { @Override public Iterator<KFoldSplitter.Split> split(final Dataframe dataset) { final int n = dataset.size(); if(k<=0 || n<=k) { throw new IllegalArgumentException("Invalid number of folds."); } else if(k == 1) { //by convention we the train and test datasets are the same. we need to copy both of them to ensure the original data won't be modified. return Arrays.asList(new Split(dataset.copy(), dataset.copy())).iterator(); // depends on control dependency: [if], data = [none] } //shuffle the ids of the records final Integer[] ids = new Integer[n]; int j = 0; for(Integer rId : dataset.index()) { ids[j++]=rId; // depends on control dependency: [for], data = [rId] } PHPMethods.shuffle(ids, random); //estimate the size of fold. we floor the number here final int foldSize= n/k; return new Iterator<Split>() { private int counter = 0; /** {@inheritDoc} */ @Override public boolean hasNext() { return counter < k; } /** {@inheritDoc} */ @Override public Split next() { logger.info("Kfold {}", counter); //We consider as fold window the part of the ids which are used for test FlatDataList trainIds = new FlatDataList(new ArrayList<>(n-foldSize)); FlatDataList testIds = new FlatDataList(new ArrayList<>(foldSize)); for(int i=0;i<n;i++) { if(counter*foldSize<=i && i<(counter+1)*foldSize) { testIds.add(ids[i]); // depends on control dependency: [if], data = [none] } else { trainIds.add(ids[i]); // depends on control dependency: [if], data = [none] } } counter++; return new Split(dataset.getSubset(trainIds), dataset.getSubset(testIds)); } }; } }
public class class_name { public Logger getLogger(String name) { // the root logger is called "" in JUL if (name.equalsIgnoreCase(Logger.ROOT_LOGGER_NAME)) { name = ""; } Logger slf4jLogger = loggerMap.get(name); if (slf4jLogger != null) return slf4jLogger; else { java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(name); Logger newInstance = new JDK14LoggerAdapter(julLogger); Logger oldInstance = loggerMap.putIfAbsent(name, newInstance); return oldInstance == null ? newInstance : oldInstance; } } }
public class class_name { public Logger getLogger(String name) { // the root logger is called "" in JUL if (name.equalsIgnoreCase(Logger.ROOT_LOGGER_NAME)) { name = ""; // depends on control dependency: [if], data = [none] } Logger slf4jLogger = loggerMap.get(name); if (slf4jLogger != null) return slf4jLogger; else { java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(name); Logger newInstance = new JDK14LoggerAdapter(julLogger); Logger oldInstance = loggerMap.putIfAbsent(name, newInstance); return oldInstance == null ? newInstance : oldInstance; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void debug(Object object) { if (level <= DEBUG) { if (object instanceof Throwable) { debugThrowable((Throwable) object); } else { debugString("" + object); } } } }
public class class_name { @Override public void debug(Object object) { if (level <= DEBUG) { if (object instanceof Throwable) { debugThrowable((Throwable) object); // depends on control dependency: [if], data = [none] } else { debugString("" + object); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public int controlledPoll(final ControlledFragmentHandler fragmentHandler, final int fragmentLimit) { final Image[] images = this.images; final int length = images.length; int fragmentsRead = 0; int startingIndex = roundRobinIndex++; if (startingIndex >= length) { roundRobinIndex = startingIndex = 0; } for (int i = startingIndex; i < length && fragmentsRead < fragmentLimit; i++) { fragmentsRead += images[i].controlledPoll(fragmentHandler, fragmentLimit - fragmentsRead); } for (int i = 0; i < startingIndex && fragmentsRead < fragmentLimit; i++) { fragmentsRead += images[i].controlledPoll(fragmentHandler, fragmentLimit - fragmentsRead); } return fragmentsRead; } }
public class class_name { public int controlledPoll(final ControlledFragmentHandler fragmentHandler, final int fragmentLimit) { final Image[] images = this.images; final int length = images.length; int fragmentsRead = 0; int startingIndex = roundRobinIndex++; if (startingIndex >= length) { roundRobinIndex = startingIndex = 0; // depends on control dependency: [if], data = [none] } for (int i = startingIndex; i < length && fragmentsRead < fragmentLimit; i++) { fragmentsRead += images[i].controlledPoll(fragmentHandler, fragmentLimit - fragmentsRead); // depends on control dependency: [for], data = [i] } for (int i = 0; i < startingIndex && fragmentsRead < fragmentLimit; i++) { fragmentsRead += images[i].controlledPoll(fragmentHandler, fragmentLimit - fragmentsRead); // depends on control dependency: [for], data = [i] } return fragmentsRead; } }
public class class_name { private void awaitAndInformListener(final AnalysisJob job, final AnalysisJobMetrics analysisJobMetrics, final RowProcessingMetrics rowProcessingMetrics, final AnalysisResultFuture resultFuture) { SharedExecutorService.get().execute(new Runnable() { @Override public void run() { resultFuture.await(); if (resultFuture.isSuccessful()) { _analysisListener.jobSuccess(job, analysisJobMetrics); } } }); } }
public class class_name { private void awaitAndInformListener(final AnalysisJob job, final AnalysisJobMetrics analysisJobMetrics, final RowProcessingMetrics rowProcessingMetrics, final AnalysisResultFuture resultFuture) { SharedExecutorService.get().execute(new Runnable() { @Override public void run() { resultFuture.await(); if (resultFuture.isSuccessful()) { _analysisListener.jobSuccess(job, analysisJobMetrics); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { public JsonModelBuilder<T> rm(String... names) { for (String name : names) { rmSub(name); } return this; } }
public class class_name { public JsonModelBuilder<T> rm(String... names) { for (String name : names) { rmSub(name); // depends on control dependency: [for], data = [name] } return this; } }
public class class_name { public synchronized int getUniqueRequestNumber() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getUniqueRequestNumber"); // Always add two requestNumber += 2; if (requestNumber > Short.MAX_VALUE) { // Reset the number to 0 for even, or 1 for odd requestNumber = requestNumber % 2; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getUniqueRequestNumber", "" + requestNumber); return requestNumber; } }
public class class_name { public synchronized int getUniqueRequestNumber() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getUniqueRequestNumber"); // Always add two requestNumber += 2; if (requestNumber > Short.MAX_VALUE) { // Reset the number to 0 for even, or 1 for odd requestNumber = requestNumber % 2; // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getUniqueRequestNumber", "" + requestNumber); return requestNumber; } }
public class class_name { public final hqlParser.aliasedExpression_return aliasedExpression() throws RecognitionException { hqlParser.aliasedExpression_return retval = new hqlParser.aliasedExpression_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token AS151=null; ParserRuleReturnScope expression150 =null; ParserRuleReturnScope identifier152 =null; CommonTree AS151_tree=null; try { // hql.g:376:2: ( expression ( AS ^ identifier )? ) // hql.g:376:4: expression ( AS ^ identifier )? { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_expression_in_aliasedExpression1820); expression150=expression(); state._fsp--; adaptor.addChild(root_0, expression150.getTree()); // hql.g:376:15: ( AS ^ identifier )? int alt50=2; int LA50_0 = input.LA(1); if ( (LA50_0==AS) ) { alt50=1; } switch (alt50) { case 1 : // hql.g:376:17: AS ^ identifier { AS151=(Token)match(input,AS,FOLLOW_AS_in_aliasedExpression1824); AS151_tree = (CommonTree)adaptor.create(AS151); root_0 = (CommonTree)adaptor.becomeRoot(AS151_tree, root_0); pushFollow(FOLLOW_identifier_in_aliasedExpression1827); identifier152=identifier(); state._fsp--; adaptor.addChild(root_0, identifier152.getTree()); } break; } } retval.stop = input.LT(-1); retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; } }
public class class_name { public final hqlParser.aliasedExpression_return aliasedExpression() throws RecognitionException { hqlParser.aliasedExpression_return retval = new hqlParser.aliasedExpression_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token AS151=null; ParserRuleReturnScope expression150 =null; ParserRuleReturnScope identifier152 =null; CommonTree AS151_tree=null; try { // hql.g:376:2: ( expression ( AS ^ identifier )? ) // hql.g:376:4: expression ( AS ^ identifier )? { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_expression_in_aliasedExpression1820); expression150=expression(); state._fsp--; adaptor.addChild(root_0, expression150.getTree()); // hql.g:376:15: ( AS ^ identifier )? int alt50=2; int LA50_0 = input.LA(1); if ( (LA50_0==AS) ) { alt50=1; // depends on control dependency: [if], data = [none] } switch (alt50) { case 1 : // hql.g:376:17: AS ^ identifier { AS151=(Token)match(input,AS,FOLLOW_AS_in_aliasedExpression1824); AS151_tree = (CommonTree)adaptor.create(AS151); root_0 = (CommonTree)adaptor.becomeRoot(AS151_tree, root_0); pushFollow(FOLLOW_identifier_in_aliasedExpression1827); identifier152=identifier(); state._fsp--; adaptor.addChild(root_0, identifier152.getTree()); } break; } } retval.stop = input.LT(-1); retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; } }