code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @RequestMapping(method = RequestMethod.POST, params = "action=addFolder") public ModelAndView addFolder( HttpServletRequest request, HttpServletResponse response, @RequestParam("targetId") String targetId, @RequestParam(value = "siblingId", required = false) String siblingId, @RequestBody(required = false) Map<String, Map<String, String>> attributes) { IUserLayoutManager ulm = userInstanceManager .getUserInstance(request) .getPreferencesManager() .getUserLayoutManager(); final Locale locale = RequestContextUtils.getLocale(request); if (!ulm.getNode(targetId).isAddChildAllowed()) { response.setStatus(HttpServletResponse.SC_FORBIDDEN); return new ModelAndView( "jsonView", Collections.singletonMap( "error", getMessage("error.add.element", "Unable to add element", locale))); } UserLayoutFolderDescription newFolder = new UserLayoutFolderDescription(); newFolder.setHidden(false); newFolder.setImmutable(false); newFolder.setAddChildAllowed(true); newFolder.setFolderType(IUserLayoutFolderDescription.REGULAR_TYPE); // Update the attributes based on the supplied JSON (optional request body name-value pairs) if (attributes != null && !attributes.isEmpty()) { setObjectAttributes(newFolder, request, attributes); } ulm.addNode(newFolder, targetId, siblingId); try { ulm.saveUserLayout(); } catch (PortalException e) { return handlePersistError(request, response, e); } Map<String, Object> model = new HashMap<>(); model.put("response", getMessage("success.add.folder", "Added a new folder", locale)); model.put("folderId", newFolder.getId()); model.put("immutable", newFolder.isImmutable()); return new ModelAndView("jsonView", model); } }
public class class_name { @RequestMapping(method = RequestMethod.POST, params = "action=addFolder") public ModelAndView addFolder( HttpServletRequest request, HttpServletResponse response, @RequestParam("targetId") String targetId, @RequestParam(value = "siblingId", required = false) String siblingId, @RequestBody(required = false) Map<String, Map<String, String>> attributes) { IUserLayoutManager ulm = userInstanceManager .getUserInstance(request) .getPreferencesManager() .getUserLayoutManager(); final Locale locale = RequestContextUtils.getLocale(request); if (!ulm.getNode(targetId).isAddChildAllowed()) { response.setStatus(HttpServletResponse.SC_FORBIDDEN); // depends on control dependency: [if], data = [none] return new ModelAndView( "jsonView", Collections.singletonMap( "error", getMessage("error.add.element", "Unable to add element", locale))); // depends on control dependency: [if], data = [none] } UserLayoutFolderDescription newFolder = new UserLayoutFolderDescription(); newFolder.setHidden(false); newFolder.setImmutable(false); newFolder.setAddChildAllowed(true); newFolder.setFolderType(IUserLayoutFolderDescription.REGULAR_TYPE); // Update the attributes based on the supplied JSON (optional request body name-value pairs) if (attributes != null && !attributes.isEmpty()) { setObjectAttributes(newFolder, request, attributes); // depends on control dependency: [if], data = [none] } ulm.addNode(newFolder, targetId, siblingId); try { ulm.saveUserLayout(); // depends on control dependency: [try], data = [none] } catch (PortalException e) { return handlePersistError(request, response, e); } // depends on control dependency: [catch], data = [none] Map<String, Object> model = new HashMap<>(); model.put("response", getMessage("success.add.folder", "Added a new folder", locale)); model.put("folderId", newFolder.getId()); model.put("immutable", newFolder.isImmutable()); return new ModelAndView("jsonView", model); } }
public class class_name { @Override public void sawOpcode(int seen) { int index; switch (state) { case SEEN_NOTHING: if (seen == Const.BIPUSH) { arraySize = getIntConstant(); if (arraySize > 0) { state = State.SEEN_ARRAY_SIZE; } } else if ((seen >= Const.ICONST_M1) && (seen <= Const.ICONST_5)) { arraySize = seen - Const.ICONST_M1 - 1; if (arraySize > 0) { state = State.SEEN_ARRAY_SIZE; } } break; case SEEN_ARRAY_SIZE: if ((seen == Const.ANEWARRAY) || (seen == Const.NEWARRAY)) { state = State.SEEN_NEWARRAY; storeCount = 0; } else { state = State.SEEN_NOTHING; } break; case SEEN_NEWARRAY: if (seen == Const.DUP) { state = State.SEEN_DUP; } else { state = State.SEEN_NOTHING; } break; case SEEN_DUP: if (seen == Const.BIPUSH) { index = getIntConstant(); } else if ((seen >= Const.ICONST_M1) && (seen <= Const.ICONST_5)) { index = seen - Const.ICONST_M1 - 1; } else { state = State.SEEN_NOTHING; return; } if (index != storeCount) { state = State.SEEN_NOTHING; } else { state = State.SEEN_INDEX; } break; case SEEN_INDEX: if ((seen == Const.LDC) || (seen == Const.LDC_W)) { state = State.SEEN_LDC; } else { state = State.SEEN_NOTHING; } break; case SEEN_LDC: if ((seen >= Const.IASTORE) && (seen <= Const.SASTORE)) { if ((++storeCount) == arraySize) { state = State.SEEN_INDEX_STORE; } else { state = State.SEEN_NEWARRAY; } } break; case SEEN_INDEX_STORE: if (OpcodeUtils.isAStore(seen)) { bugReporter.reportBug(new BugInstance(this, BugType.SACM_STATIC_ARRAY_CREATED_IN_METHOD.name(), (arraySize < 3) ? LOW_PRIORITY : ((arraySize < 10) ? NORMAL_PRIORITY : HIGH_PRIORITY)).addClass(this).addMethod(this) .addSourceLine(this, getPC())); } state = State.SEEN_NOTHING; break; } } }
public class class_name { @Override public void sawOpcode(int seen) { int index; switch (state) { case SEEN_NOTHING: if (seen == Const.BIPUSH) { arraySize = getIntConstant(); // depends on control dependency: [if], data = [none] if (arraySize > 0) { state = State.SEEN_ARRAY_SIZE; // depends on control dependency: [if], data = [none] } } else if ((seen >= Const.ICONST_M1) && (seen <= Const.ICONST_5)) { arraySize = seen - Const.ICONST_M1 - 1; // depends on control dependency: [if], data = [none] if (arraySize > 0) { state = State.SEEN_ARRAY_SIZE; // depends on control dependency: [if], data = [none] } } break; case SEEN_ARRAY_SIZE: if ((seen == Const.ANEWARRAY) || (seen == Const.NEWARRAY)) { state = State.SEEN_NEWARRAY; // depends on control dependency: [if], data = [none] storeCount = 0; // depends on control dependency: [if], data = [none] } else { state = State.SEEN_NOTHING; // depends on control dependency: [if], data = [none] } break; case SEEN_NEWARRAY: if (seen == Const.DUP) { state = State.SEEN_DUP; // depends on control dependency: [if], data = [none] } else { state = State.SEEN_NOTHING; // depends on control dependency: [if], data = [none] } break; case SEEN_DUP: if (seen == Const.BIPUSH) { index = getIntConstant(); // depends on control dependency: [if], data = [none] } else if ((seen >= Const.ICONST_M1) && (seen <= Const.ICONST_5)) { index = seen - Const.ICONST_M1 - 1; // depends on control dependency: [if], data = [none] } else { state = State.SEEN_NOTHING; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (index != storeCount) { state = State.SEEN_NOTHING; // depends on control dependency: [if], data = [none] } else { state = State.SEEN_INDEX; // depends on control dependency: [if], data = [none] } break; case SEEN_INDEX: if ((seen == Const.LDC) || (seen == Const.LDC_W)) { state = State.SEEN_LDC; // depends on control dependency: [if], data = [none] } else { state = State.SEEN_NOTHING; // depends on control dependency: [if], data = [none] } break; case SEEN_LDC: if ((seen >= Const.IASTORE) && (seen <= Const.SASTORE)) { if ((++storeCount) == arraySize) { state = State.SEEN_INDEX_STORE; // depends on control dependency: [if], data = [none] } else { state = State.SEEN_NEWARRAY; // depends on control dependency: [if], data = [none] } } break; case SEEN_INDEX_STORE: if (OpcodeUtils.isAStore(seen)) { bugReporter.reportBug(new BugInstance(this, BugType.SACM_STATIC_ARRAY_CREATED_IN_METHOD.name(), (arraySize < 3) ? LOW_PRIORITY : ((arraySize < 10) ? NORMAL_PRIORITY : HIGH_PRIORITY)).addClass(this).addMethod(this) .addSourceLine(this, getPC())); // depends on control dependency: [if], data = [none] } state = State.SEEN_NOTHING; break; } } }
public class class_name { int getMemcachedExpirationTimeToSet() { /* SRV.13.4 ("Deployment Descriptor"): If the timeout is 0 or less, the container * ensures the default behaviour of sessions is never to time out. */ if ( maxInactiveInterval <= 0 ) { return 0; } if ( !_sticky ) { return 2 * maxInactiveInterval; } final long timeIdleInMillis = System.currentTimeMillis() - getThisAccessedTimeInternal(); /* rounding is just for tests, as they are using actually seconds for testing. * with a default setup 1 second difference wouldn't matter... */ final int timeIdle = Math.round( (float)timeIdleInMillis / 1000L ); final int expirationTime = getMaxInactiveInterval() - timeIdle; final int processExpiresOffset = getManager().getProcessExpiresFrequency() * getManager().getContext().getBackgroundProcessorDelay(); return expirationTime + processExpiresOffset; } }
public class class_name { int getMemcachedExpirationTimeToSet() { /* SRV.13.4 ("Deployment Descriptor"): If the timeout is 0 or less, the container * ensures the default behaviour of sessions is never to time out. */ if ( maxInactiveInterval <= 0 ) { return 0; // depends on control dependency: [if], data = [none] } if ( !_sticky ) { return 2 * maxInactiveInterval; // depends on control dependency: [if], data = [none] } final long timeIdleInMillis = System.currentTimeMillis() - getThisAccessedTimeInternal(); /* rounding is just for tests, as they are using actually seconds for testing. * with a default setup 1 second difference wouldn't matter... */ final int timeIdle = Math.round( (float)timeIdleInMillis / 1000L ); final int expirationTime = getMaxInactiveInterval() - timeIdle; final int processExpiresOffset = getManager().getProcessExpiresFrequency() * getManager().getContext().getBackgroundProcessorDelay(); return expirationTime + processExpiresOffset; } }
public class class_name { static URI parseURI(final String string) { try { return string != null ? new URI(string) : null; } catch (URISyntaxException e) { throw new IllegalArgumentException(format( "Invalid URI value: %s.", string )); } } }
public class class_name { static URI parseURI(final String string) { try { return string != null ? new URI(string) : null; // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { throw new IllegalArgumentException(format( "Invalid URI value: %s.", string )); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SuppressWarnings("unchecked") public final CompiledBlockVisitor visit() { this.visitStart(); final byte[] compiledData = this.compiledBlock.getCompiledData(); JBBPIntCounter positionAtCompiledBlock = new JBBPIntCounter(0); int positionAtNamedFieldList = 0; int positionAtVarLengthProcessors = 0; while (positionAtCompiledBlock.get() < compiledData.length) { final int theOffset = positionAtCompiledBlock.get(); final int c = compiledData[positionAtCompiledBlock.getAndIncrement()] & 0xFF; final boolean wideCode = (c & JBBPCompiler.FLAG_WIDE) != 0; final int ec = wideCode ? compiledData[positionAtCompiledBlock.getAndIncrement()] & 0xFF : 0; final boolean altFileType = (ec & JBBPCompiler.EXT_FLAG_EXTRA_DIFF_TYPE) != 0; final boolean extraFieldNumAsExpr = (ec & JBBPCompiler.EXT_FLAG_EXTRA_AS_EXPRESSION) != 0; final int code = (ec << 8) | c; final JBBPNamedFieldInfo name = (code & JBBPCompiler.FLAG_NAMED) == 0 ? null : this.compiledBlock.getNamedFields()[positionAtNamedFieldList++]; final JBBPByteOrder byteOrder = (code & JBBPCompiler.FLAG_LITTLE_ENDIAN) == 0 ? JBBPByteOrder.BIG_ENDIAN : JBBPByteOrder.LITTLE_ENDIAN; final JBBPIntegerValueEvaluator extraFieldValueEvaluator; if (extraFieldNumAsExpr) { extraFieldValueEvaluator = this.compiledBlock.getArraySizeEvaluators()[positionAtVarLengthProcessors++]; } else { extraFieldValueEvaluator = null; } final JBBPIntegerValueEvaluator arraySizeEvaluator; boolean readWholeStream = false; switch (code & (JBBPCompiler.FLAG_ARRAY | (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8))) { case JBBPCompiler.FLAG_ARRAY: { arraySizeEvaluator = new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); } break; case (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8): { arraySizeEvaluator = new IntConstValueEvaluator(-1); readWholeStream = true; } break; case JBBPCompiler.FLAG_ARRAY | (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8): { arraySizeEvaluator = this.compiledBlock.getArraySizeEvaluators()[positionAtVarLengthProcessors++]; } break; default: { // it is not an array, just a single field arraySizeEvaluator = null; } break; } final int theCode = code & 0xF; switch (theCode) { case JBBPCompiler.CODE_RESET_COUNTER: { visitActionItem(theOffset, code, null); } break; case JBBPCompiler.CODE_SKIP: case JBBPCompiler.CODE_ALIGN: { final JBBPIntegerValueEvaluator evaluator = extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); if (altFileType) { if (theCode == JBBPCompiler.CODE_SKIP) { visitValField(theOffset, name, evaluator); } else { throw new Error("Unexpected code:" + theCode); } } else { visitActionItem(theOffset, theCode, evaluator); } } break; case JBBPCompiler.CODE_BIT: { final JBBPIntegerValueEvaluator numberOfBits = extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); visitBitField(theOffset, name, numberOfBits, arraySizeEvaluator); } break; case JBBPCompiler.CODE_BOOL: case JBBPCompiler.CODE_BYTE: case JBBPCompiler.CODE_UBYTE: case JBBPCompiler.CODE_SHORT: case JBBPCompiler.CODE_USHORT: case JBBPCompiler.CODE_INT: case JBBPCompiler.CODE_LONG: { visitPrimitiveField(theOffset, theCode, name, byteOrder, readWholeStream, altFileType, arraySizeEvaluator); } break; case JBBPCompiler.CODE_STRUCT_START: { visitStructureStart(theOffset, name, arraySizeEvaluator); } break; case JBBPCompiler.CODE_STRUCT_END: { JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock); visitStructureEnd(theOffset, name); } break; case JBBPCompiler.CODE_VAR: { final JBBPIntegerValueEvaluator extraDataValueEvaluator = extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); visitVarField(theOffset, name, byteOrder, readWholeStream, arraySizeEvaluator, extraDataValueEvaluator); } break; case JBBPCompiler.CODE_CUSTOMTYPE: { final JBBPIntegerValueEvaluator extraDataValueEvaluator = extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); final JBBPFieldTypeParameterContainer fieldTypeInfo = this.compiledBlock.getCustomTypeFields()[JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)]; visitCustomField(theOffset, fieldTypeInfo, name, byteOrder, readWholeStream, arraySizeEvaluator, extraDataValueEvaluator); } break; default: throw new Error("Unexpected code, contact developer!"); } } this.visitEnd(); return this; } }
public class class_name { @SuppressWarnings("unchecked") public final CompiledBlockVisitor visit() { this.visitStart(); final byte[] compiledData = this.compiledBlock.getCompiledData(); JBBPIntCounter positionAtCompiledBlock = new JBBPIntCounter(0); int positionAtNamedFieldList = 0; int positionAtVarLengthProcessors = 0; while (positionAtCompiledBlock.get() < compiledData.length) { final int theOffset = positionAtCompiledBlock.get(); final int c = compiledData[positionAtCompiledBlock.getAndIncrement()] & 0xFF; final boolean wideCode = (c & JBBPCompiler.FLAG_WIDE) != 0; final int ec = wideCode ? compiledData[positionAtCompiledBlock.getAndIncrement()] & 0xFF : 0; final boolean altFileType = (ec & JBBPCompiler.EXT_FLAG_EXTRA_DIFF_TYPE) != 0; final boolean extraFieldNumAsExpr = (ec & JBBPCompiler.EXT_FLAG_EXTRA_AS_EXPRESSION) != 0; final int code = (ec << 8) | c; final JBBPNamedFieldInfo name = (code & JBBPCompiler.FLAG_NAMED) == 0 ? null : this.compiledBlock.getNamedFields()[positionAtNamedFieldList++]; final JBBPByteOrder byteOrder = (code & JBBPCompiler.FLAG_LITTLE_ENDIAN) == 0 ? JBBPByteOrder.BIG_ENDIAN : JBBPByteOrder.LITTLE_ENDIAN; final JBBPIntegerValueEvaluator extraFieldValueEvaluator; if (extraFieldNumAsExpr) { extraFieldValueEvaluator = this.compiledBlock.getArraySizeEvaluators()[positionAtVarLengthProcessors++]; // depends on control dependency: [if], data = [none] } else { extraFieldValueEvaluator = null; // depends on control dependency: [if], data = [none] } final JBBPIntegerValueEvaluator arraySizeEvaluator; boolean readWholeStream = false; switch (code & (JBBPCompiler.FLAG_ARRAY | (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8))) { case JBBPCompiler.FLAG_ARRAY: { arraySizeEvaluator = new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); } break; case (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8): { arraySizeEvaluator = new IntConstValueEvaluator(-1); readWholeStream = true; } break; case JBBPCompiler.FLAG_ARRAY | (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8): { arraySizeEvaluator = this.compiledBlock.getArraySizeEvaluators()[positionAtVarLengthProcessors++]; } break; default: { // it is not an array, just a single field arraySizeEvaluator = null; } break; } final int theCode = code & 0xF; switch (theCode) { case JBBPCompiler.CODE_RESET_COUNTER: { visitActionItem(theOffset, code, null); } break; case JBBPCompiler.CODE_SKIP: case JBBPCompiler.CODE_ALIGN: { final JBBPIntegerValueEvaluator evaluator = extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); if (altFileType) { if (theCode == JBBPCompiler.CODE_SKIP) { visitValField(theOffset, name, evaluator); // depends on control dependency: [if], data = [none] } else { throw new Error("Unexpected code:" + theCode); } } else { visitActionItem(theOffset, theCode, evaluator); } } break; case JBBPCompiler.CODE_BIT: { final JBBPIntegerValueEvaluator numberOfBits = extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); visitBitField(theOffset, name, numberOfBits, arraySizeEvaluator); } break; case JBBPCompiler.CODE_BOOL: case JBBPCompiler.CODE_BYTE: case JBBPCompiler.CODE_UBYTE: case JBBPCompiler.CODE_SHORT: case JBBPCompiler.CODE_USHORT: case JBBPCompiler.CODE_INT: case JBBPCompiler.CODE_LONG: { visitPrimitiveField(theOffset, theCode, name, byteOrder, readWholeStream, altFileType, arraySizeEvaluator); } break; case JBBPCompiler.CODE_STRUCT_START: { visitStructureStart(theOffset, name, arraySizeEvaluator); } break; case JBBPCompiler.CODE_STRUCT_END: { JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock); visitStructureEnd(theOffset, name); } break; case JBBPCompiler.CODE_VAR: { final JBBPIntegerValueEvaluator extraDataValueEvaluator = extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); visitVarField(theOffset, name, byteOrder, readWholeStream, arraySizeEvaluator, extraDataValueEvaluator); } break; case JBBPCompiler.CODE_CUSTOMTYPE: { final JBBPIntegerValueEvaluator extraDataValueEvaluator = extraFieldNumAsExpr ? extraFieldValueEvaluator : new IntConstValueEvaluator(JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)); final JBBPFieldTypeParameterContainer fieldTypeInfo = this.compiledBlock.getCustomTypeFields()[JBBPUtils.unpackInt(compiledData, positionAtCompiledBlock)]; visitCustomField(theOffset, fieldTypeInfo, name, byteOrder, readWholeStream, arraySizeEvaluator, extraDataValueEvaluator); } break; default: throw new Error("Unexpected code, contact developer!"); } } this.visitEnd(); return this; } }
public class class_name { public void marshall(DescribeConfigRulesRequest describeConfigRulesRequest, ProtocolMarshaller protocolMarshaller) { if (describeConfigRulesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeConfigRulesRequest.getConfigRuleNames(), CONFIGRULENAMES_BINDING); protocolMarshaller.marshall(describeConfigRulesRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeConfigRulesRequest describeConfigRulesRequest, ProtocolMarshaller protocolMarshaller) { if (describeConfigRulesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeConfigRulesRequest.getConfigRuleNames(), CONFIGRULENAMES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeConfigRulesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <N extends ImageBase,D extends ImageBase<D>> void divide(N imgA, D imgB , N output) { if( imgA instanceof ImageGray && imgB instanceof ImageGray ) { if (GrayF32.class == imgA.getClass()) { PixelMath.divide((GrayF32) imgA, (GrayF32) imgB, (GrayF32) output); } else if (GrayF64.class == imgA.getClass()) { PixelMath.divide((GrayF64) imgA, (GrayF64) imgB, (GrayF64) output); } } else if( imgA instanceof Planar && imgB instanceof ImageGray ) { Planar in = (Planar) imgA; Planar out = (Planar) output; for (int i = 0; i < in.getNumBands(); i++) { if (GrayF32.class == imgB.getClass()) { PixelMath.divide((GrayF32) in.getBand(i), (GrayF32) imgB, (GrayF32) out.getBand(i)); } else if (GrayF64.class == imgB.getClass()) { PixelMath.divide((GrayF64) in.getBand(i), (GrayF64) imgB, (GrayF64) out.getBand(i)); } } } else if( imgA instanceof Planar && imgB instanceof Planar ) { Planar inA = (Planar) imgA; Planar inB = (Planar) imgB; Planar out = (Planar) output; for (int i = 0; i < inA.getNumBands(); i++) { divide(inA.getBand(i), inB.getBand(i), out.getBand(i)); } } else { throw new IllegalArgumentException("Unknown image Type: "+imgA.getClass().getSimpleName()); } } }
public class class_name { public static <N extends ImageBase,D extends ImageBase<D>> void divide(N imgA, D imgB , N output) { if( imgA instanceof ImageGray && imgB instanceof ImageGray ) { if (GrayF32.class == imgA.getClass()) { PixelMath.divide((GrayF32) imgA, (GrayF32) imgB, (GrayF32) output); // depends on control dependency: [if], data = [none] } else if (GrayF64.class == imgA.getClass()) { PixelMath.divide((GrayF64) imgA, (GrayF64) imgB, (GrayF64) output); // depends on control dependency: [if], data = [none] } } else if( imgA instanceof Planar && imgB instanceof ImageGray ) { Planar in = (Planar) imgA; Planar out = (Planar) output; for (int i = 0; i < in.getNumBands(); i++) { if (GrayF32.class == imgB.getClass()) { PixelMath.divide((GrayF32) in.getBand(i), (GrayF32) imgB, (GrayF32) out.getBand(i)); // depends on control dependency: [if], data = [none] } else if (GrayF64.class == imgB.getClass()) { PixelMath.divide((GrayF64) in.getBand(i), (GrayF64) imgB, (GrayF64) out.getBand(i)); // depends on control dependency: [if], data = [none] } } } else if( imgA instanceof Planar && imgB instanceof Planar ) { Planar inA = (Planar) imgA; Planar inB = (Planar) imgB; Planar out = (Planar) output; for (int i = 0; i < inA.getNumBands(); i++) { divide(inA.getBand(i), inB.getBand(i), out.getBand(i)); // depends on control dependency: [for], data = [i] } } else { throw new IllegalArgumentException("Unknown image Type: "+imgA.getClass().getSimpleName()); } } }
public class class_name { public static Vector getModularChar(int[] data, int offset) throws Exception { int val=0; Vector bytes = new Vector(); boolean read = true; int offsett = offset; int fac = 1; while (read) { int bytee = ((Integer)getBits(data, 8, offsett)).intValue(); offsett = offsett + 8; if ((bytee & 0x80)==0) { read = false; if ((bytee & 0x40)>0) { fac = -1; bytee = bytee & 0xbf; } } bytes.add(new Integer(bytee & 0x7f)); } if (bytes.size()==1) val = ((Integer)bytes.get(0)).intValue(); else if (bytes.size()==2) val = ((Integer)bytes.get(0)).intValue() | (((Integer)bytes.get(1)).intValue() << 7); else if (bytes.size()==3) val = ((Integer)bytes.get(0)).intValue() | (((Integer)bytes.get(1)).intValue() << 7) | (((Integer)bytes.get(2)).intValue() << 14); else if (bytes.size()==4) val = ((Integer)bytes.get(0)).intValue() | (((Integer)bytes.get(1)).intValue() << 7) | (((Integer)bytes.get(2)).intValue() << 14) | (((Integer)bytes.get(3)).intValue() << 21); else System.out.println("Unexpected byte array length: " + bytes.size()); Vector v = new Vector(); v.add(new Integer(offsett)); v.add(new Integer(fac*val)); return v; } }
public class class_name { public static Vector getModularChar(int[] data, int offset) throws Exception { int val=0; Vector bytes = new Vector(); boolean read = true; int offsett = offset; int fac = 1; while (read) { int bytee = ((Integer)getBits(data, 8, offsett)).intValue(); offsett = offsett + 8; if ((bytee & 0x80)==0) { read = false; // depends on control dependency: [if], data = [none] if ((bytee & 0x40)>0) { fac = -1; // depends on control dependency: [if], data = [none] bytee = bytee & 0xbf; // depends on control dependency: [if], data = [none] } } bytes.add(new Integer(bytee & 0x7f)); } if (bytes.size()==1) val = ((Integer)bytes.get(0)).intValue(); else if (bytes.size()==2) val = ((Integer)bytes.get(0)).intValue() | (((Integer)bytes.get(1)).intValue() << 7); else if (bytes.size()==3) val = ((Integer)bytes.get(0)).intValue() | (((Integer)bytes.get(1)).intValue() << 7) | (((Integer)bytes.get(2)).intValue() << 14); else if (bytes.size()==4) val = ((Integer)bytes.get(0)).intValue() | (((Integer)bytes.get(1)).intValue() << 7) | (((Integer)bytes.get(2)).intValue() << 14) | (((Integer)bytes.get(3)).intValue() << 21); else System.out.println("Unexpected byte array length: " + bytes.size()); Vector v = new Vector(); v.add(new Integer(offsett)); v.add(new Integer(fac*val)); return v; } }
public class class_name { public static String replacePropertiesInString(final String line, Properties properties) { StringBuffer newStr = new StringBuffer(); boolean isVarComplete = false; StringBuffer propertyName = new StringBuffer(); int startIndex = 0; int curIndex; int searchIndex; while ((searchIndex = line.indexOf(PROPERTY_MARKER, startIndex)) != -1) { //first check if property Marker is escaped by '\' character if (searchIndex != 0 && line.charAt((searchIndex-1)) == '\\') { newStr.append(line.substring(startIndex, searchIndex-1)); newStr.append(PROPERTY_MARKER); startIndex = searchIndex + 1; continue; } isVarComplete = false; curIndex = searchIndex + 1; while (curIndex < line.length() && !isVarComplete) { if ((line.charAt(curIndex) == PROPERTY_MARKER) || (curIndex+1 == line.length())) { isVarComplete = true; } if (!isVarComplete) { propertyName.append(line.charAt(curIndex)); } ++curIndex; } if (!properties.containsKey(propertyName.toString())) { throw new CitrusRuntimeException("No such property '" + PROPERTY_MARKER + propertyName.toString() + PROPERTY_MARKER + "'"); } newStr.append(line.substring(startIndex, searchIndex)); newStr.append(properties.getProperty(propertyName.toString(), "")); // property value startIndex = curIndex; propertyName = new StringBuffer(); isVarComplete = false; } newStr.append(line.substring(startIndex)); return newStr.toString(); } }
public class class_name { public static String replacePropertiesInString(final String line, Properties properties) { StringBuffer newStr = new StringBuffer(); boolean isVarComplete = false; StringBuffer propertyName = new StringBuffer(); int startIndex = 0; int curIndex; int searchIndex; while ((searchIndex = line.indexOf(PROPERTY_MARKER, startIndex)) != -1) { //first check if property Marker is escaped by '\' character if (searchIndex != 0 && line.charAt((searchIndex-1)) == '\\') { newStr.append(line.substring(startIndex, searchIndex-1)); // depends on control dependency: [if], data = [none] newStr.append(PROPERTY_MARKER); // depends on control dependency: [if], data = [none] startIndex = searchIndex + 1; // depends on control dependency: [if], data = [none] continue; } isVarComplete = false; // depends on control dependency: [while], data = [none] curIndex = searchIndex + 1; // depends on control dependency: [while], data = [none] while (curIndex < line.length() && !isVarComplete) { if ((line.charAt(curIndex) == PROPERTY_MARKER) || (curIndex+1 == line.length())) { isVarComplete = true; // depends on control dependency: [if], data = [none] } if (!isVarComplete) { propertyName.append(line.charAt(curIndex)); // depends on control dependency: [if], data = [none] } ++curIndex; // depends on control dependency: [while], data = [none] } if (!properties.containsKey(propertyName.toString())) { throw new CitrusRuntimeException("No such property '" + PROPERTY_MARKER + propertyName.toString() + PROPERTY_MARKER + "'"); } newStr.append(line.substring(startIndex, searchIndex)); // depends on control dependency: [while], data = [none] newStr.append(properties.getProperty(propertyName.toString(), "")); // property value // depends on control dependency: [while], data = [none] startIndex = curIndex; // depends on control dependency: [while], data = [none] propertyName = new StringBuffer(); // depends on control dependency: [while], data = [none] isVarComplete = false; // depends on control dependency: [while], data = [none] } newStr.append(line.substring(startIndex)); return newStr.toString(); } }
public class class_name { @Override public Connection getConnection() { Optional<LocalTransactionContext> txContext = currentTxContext(); try { if (txContext.isPresent()) { return txContext.get().getConnection(); } else { if (!this.unmanagedTransaction.isPresent()) { this.unmanagedTransaction = Optional .of(new LocalTransactionContext(this.connectionSupplier, this.sqlFilterManager)); } return this.unmanagedTransaction.get().getConnection(); } } catch (SQLException ex) { ex.printStackTrace(); return null; } } }
public class class_name { @Override public Connection getConnection() { Optional<LocalTransactionContext> txContext = currentTxContext(); try { if (txContext.isPresent()) { return txContext.get().getConnection(); // depends on control dependency: [if], data = [none] } else { if (!this.unmanagedTransaction.isPresent()) { this.unmanagedTransaction = Optional .of(new LocalTransactionContext(this.connectionSupplier, this.sqlFilterManager)); // depends on control dependency: [if], data = [none] } return this.unmanagedTransaction.get().getConnection(); // depends on control dependency: [if], data = [none] } } catch (SQLException ex) { ex.printStackTrace(); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean isNotEmpty(CharSequence... css) { for (CharSequence cs : css) { if (StringUtils.isNullOrEmpty(cs)) { return false; } } return true; } }
public class class_name { public static boolean isNotEmpty(CharSequence... css) { for (CharSequence cs : css) { if (StringUtils.isNullOrEmpty(cs)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private final int getIndexFor(String word) { Integer index = termToIndex.get(word); if (index == null) { synchronized(this) { // recheck to see if the term was added while blocking index = termToIndex.get(word); // if another thread has not already added this word while the // current thread was blocking waiting on the lock, then add it. if (index == null) { int i = wordIndexCounter++; termToIndex.put(word, i); return i; // avoid the auto-boxing to assign i to index } } } return index; } }
public class class_name { private final int getIndexFor(String word) { Integer index = termToIndex.get(word); if (index == null) { synchronized(this) { // depends on control dependency: [if], data = [none] // recheck to see if the term was added while blocking index = termToIndex.get(word); // if another thread has not already added this word while the // current thread was blocking waiting on the lock, then add it. if (index == null) { int i = wordIndexCounter++; termToIndex.put(word, i); // depends on control dependency: [if], data = [none] return i; // avoid the auto-boxing to assign i to index // depends on control dependency: [if], data = [none] } } } return index; } }
public class class_name { protected String getExpressionTextForLanguage(DmnExpressionImpl expression, String expressionLanguage) { String expressionText = expression.getExpression(); if (expressionText != null) { if (isJuelExpression(expressionLanguage) && !StringUtil.isExpression(expressionText)) { return "${" + expressionText + "}"; } else { return expressionText; } } else { return null; } } }
public class class_name { protected String getExpressionTextForLanguage(DmnExpressionImpl expression, String expressionLanguage) { String expressionText = expression.getExpression(); if (expressionText != null) { if (isJuelExpression(expressionLanguage) && !StringUtil.isExpression(expressionText)) { return "${" + expressionText + "}"; // depends on control dependency: [if], data = [none] } else { return expressionText; // depends on control dependency: [if], data = [none] } } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private final Collection<List<String>> catalogKeys(final Collection<String> keyCollections) { final Map<Session, List<String>> catalogMap = new HashMap<Session, List<String>>(); for (String key : keyCollections) { Session index = this.sessionLocator.getSessionByKey(key); List<String> tmpKeys = catalogMap.get(index); if (tmpKeys == null) { tmpKeys = new ArrayList<String>(10); catalogMap.put(index, tmpKeys); } tmpKeys.add(key); } Collection<List<String>> catalogKeys = catalogMap.values(); return catalogKeys; } }
public class class_name { private final Collection<List<String>> catalogKeys(final Collection<String> keyCollections) { final Map<Session, List<String>> catalogMap = new HashMap<Session, List<String>>(); for (String key : keyCollections) { Session index = this.sessionLocator.getSessionByKey(key); List<String> tmpKeys = catalogMap.get(index); if (tmpKeys == null) { tmpKeys = new ArrayList<String>(10); // depends on control dependency: [if], data = [none] catalogMap.put(index, tmpKeys); // depends on control dependency: [if], data = [none] } tmpKeys.add(key); // depends on control dependency: [for], data = [key] } Collection<List<String>> catalogKeys = catalogMap.values(); return catalogKeys; } }
public class class_name { private static Node getQualifiedMemberAccess(AbstractCompiler compiler, Node member, Node staticAccess, Node instanceAccess) { Node context = member.isStaticMember() ? staticAccess : instanceAccess; context = context.cloneTree(); if (member.isComputedProp()) { return IR.getelem(context, member.removeFirstChild()); } else { return NodeUtil.newPropertyAccess(compiler, context, member.getString()); } } }
public class class_name { private static Node getQualifiedMemberAccess(AbstractCompiler compiler, Node member, Node staticAccess, Node instanceAccess) { Node context = member.isStaticMember() ? staticAccess : instanceAccess; context = context.cloneTree(); if (member.isComputedProp()) { return IR.getelem(context, member.removeFirstChild()); // depends on control dependency: [if], data = [none] } else { return NodeUtil.newPropertyAccess(compiler, context, member.getString()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void useProject(String projectName) { removeProject(projectName); recentProjectsList.addFirst(projectName); while (recentProjectsList.size() > MAX_RECENT_FILES) { recentProjectsList.removeLast(); } } }
public class class_name { public void useProject(String projectName) { removeProject(projectName); recentProjectsList.addFirst(projectName); while (recentProjectsList.size() > MAX_RECENT_FILES) { recentProjectsList.removeLast(); // depends on control dependency: [while], data = [none] } } }
public class class_name { protected void createFindbugsEngine() { findbugsEngine = new Java(); findbugsEngine.setProject(getProject()); findbugsEngine.setTaskName(getTaskName()); findbugsEngine.setFork(true); if (jvm.length() > 0) { findbugsEngine.setJvm(jvm); } findbugsEngine.setTimeout(timeout); if (debug) { jvmargs = jvmargs + " -Dfindbugs.debug=true"; } jvmargs = jvmargs + " -Dfindbugs.hostApp=FBAntTask"; findbugsEngine.createJvmarg().setLine(jvmargs); // Add JVM arguments for system properties for (SystemProperty systemProperty : systemPropertyList) { String jvmArg = "-D" + systemProperty.getName() + "=" + systemProperty.getValue(); findbugsEngine.createJvmarg().setValue(jvmArg); } if (homeDir != null) { // Use findbugs.home to locate findbugs.jar and the standard // plugins. This is the usual means of initialization. File findbugsLib = new File(homeDir, "lib"); if (!findbugsLib.exists() && "lib".equals(homeDir.getName())) { findbugsLib = homeDir; homeDir = homeDir.getParentFile(); } File findbugsLibFindBugs = new File(findbugsLib, "spotbugs.jar"); // log("executing using home dir [" + homeDir + "]"); if (findbugsLibFindBugs.exists()) { findbugsEngine.setClasspath(new Path(getProject(), findbugsLibFindBugs.getPath())); } else { throw new IllegalArgumentException("Can't find spotbugs.jar in " + findbugsLib); } findbugsEngine.createJvmarg().setValue("-Dspotbugs.home=" + homeDir.getPath()); } else { // Use an explicitly specified classpath and list of plugin Jars // to initialize. This is useful for other tools which may have // FindBugs installed using a non-standard directory layout. findbugsEngine.setClasspath(classpath); } if (pluginList != null) { addArg("-pluginList"); addArg(pluginList.toString()); } // Set the main class to be whatever the subclass's constructor // specified. findbugsEngine.setClassname(mainClass); } }
public class class_name { protected void createFindbugsEngine() { findbugsEngine = new Java(); findbugsEngine.setProject(getProject()); findbugsEngine.setTaskName(getTaskName()); findbugsEngine.setFork(true); if (jvm.length() > 0) { findbugsEngine.setJvm(jvm); // depends on control dependency: [if], data = [none] } findbugsEngine.setTimeout(timeout); if (debug) { jvmargs = jvmargs + " -Dfindbugs.debug=true"; // depends on control dependency: [if], data = [none] } jvmargs = jvmargs + " -Dfindbugs.hostApp=FBAntTask"; findbugsEngine.createJvmarg().setLine(jvmargs); // Add JVM arguments for system properties for (SystemProperty systemProperty : systemPropertyList) { String jvmArg = "-D" + systemProperty.getName() + "=" + systemProperty.getValue(); findbugsEngine.createJvmarg().setValue(jvmArg); // depends on control dependency: [for], data = [none] } if (homeDir != null) { // Use findbugs.home to locate findbugs.jar and the standard // plugins. This is the usual means of initialization. File findbugsLib = new File(homeDir, "lib"); if (!findbugsLib.exists() && "lib".equals(homeDir.getName())) { findbugsLib = homeDir; // depends on control dependency: [if], data = [none] homeDir = homeDir.getParentFile(); // depends on control dependency: [if], data = [none] } File findbugsLibFindBugs = new File(findbugsLib, "spotbugs.jar"); // log("executing using home dir [" + homeDir + "]"); if (findbugsLibFindBugs.exists()) { findbugsEngine.setClasspath(new Path(getProject(), findbugsLibFindBugs.getPath())); } else { throw new IllegalArgumentException("Can't find spotbugs.jar in " + findbugsLib); } findbugsEngine.createJvmarg().setValue("-Dspotbugs.home=" + homeDir.getPath()); } else { // Use an explicitly specified classpath and list of plugin Jars // to initialize. This is useful for other tools which may have // FindBugs installed using a non-standard directory layout. findbugsEngine.setClasspath(classpath); } if (pluginList != null) { addArg("-pluginList"); addArg(pluginList.toString()); } // Set the main class to be whatever the subclass's constructor // specified. findbugsEngine.setClassname(mainClass); } }
public class class_name { private void drawDayNames() { int firstDayOfWeek = calendar.getFirstDayOfWeek(); DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(locale); dayNames = dateFormatSymbols.getShortWeekdays(); int day = firstDayOfWeek; for (int i = 0; i < 7; i++) { if (maxDayCharacters > 0 && maxDayCharacters < 5) { if (dayNames[day].length() >= maxDayCharacters) { dayNames[day] = dayNames[day] .substring(0, maxDayCharacters); } } days[i].setText(dayNames[day]); if (day == 1) { days[i].setForeground(sundayForeground); } else { days[i].setForeground(weekdayForeground); } if (day < 7) { day++; } else { day -= 6; } } } }
public class class_name { private void drawDayNames() { int firstDayOfWeek = calendar.getFirstDayOfWeek(); DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(locale); dayNames = dateFormatSymbols.getShortWeekdays(); int day = firstDayOfWeek; for (int i = 0; i < 7; i++) { if (maxDayCharacters > 0 && maxDayCharacters < 5) { if (dayNames[day].length() >= maxDayCharacters) { dayNames[day] = dayNames[day] .substring(0, maxDayCharacters); // depends on control dependency: [if], data = [none] } } days[i].setText(dayNames[day]); // depends on control dependency: [for], data = [i] if (day == 1) { days[i].setForeground(sundayForeground); // depends on control dependency: [if], data = [none] } else { days[i].setForeground(weekdayForeground); // depends on control dependency: [if], data = [none] } if (day < 7) { day++; // depends on control dependency: [if], data = [none] } else { day -= 6; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public List<InitMethodType<SessionBeanType<T>>> getAllInitMethod() { List<InitMethodType<SessionBeanType<T>>> list = new ArrayList<InitMethodType<SessionBeanType<T>>>(); List<Node> nodeList = childNode.get("init-method"); for(Node node: nodeList) { InitMethodType<SessionBeanType<T>> type = new InitMethodTypeImpl<SessionBeanType<T>>(this, "init-method", childNode, node); list.add(type); } return list; } }
public class class_name { public List<InitMethodType<SessionBeanType<T>>> getAllInitMethod() { List<InitMethodType<SessionBeanType<T>>> list = new ArrayList<InitMethodType<SessionBeanType<T>>>(); List<Node> nodeList = childNode.get("init-method"); for(Node node: nodeList) { InitMethodType<SessionBeanType<T>> type = new InitMethodTypeImpl<SessionBeanType<T>>(this, "init-method", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { public void release(T result) { ArrayList<CompletableFuture<T>> toComplete = null; synchronized (lock) { if (!waitingFutures.isEmpty()) { toComplete = new ArrayList<>(waitingFutures); waitingFutures.clear(); } e = null; this.result = result; released = true; } if (toComplete != null) { for (CompletableFuture<T> f : toComplete) { f.complete(result); } } } }
public class class_name { public void release(T result) { ArrayList<CompletableFuture<T>> toComplete = null; synchronized (lock) { if (!waitingFutures.isEmpty()) { toComplete = new ArrayList<>(waitingFutures); // depends on control dependency: [if], data = [none] waitingFutures.clear(); // depends on control dependency: [if], data = [none] } e = null; this.result = result; released = true; } if (toComplete != null) { for (CompletableFuture<T> f : toComplete) { f.complete(result); // depends on control dependency: [for], data = [f] } } } }
public class class_name { public void sourceStatusChange(int statusCode, String statusMessage, SourcePicture sp) { //Tools.log("ScalablePicture.sourceStatusChange: status received from SourceImage: " + statusMessage); switch (statusCode) { case SourcePicture.UNINITIALISED: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: UNINITIALISED message: " + statusMessage); setStatus(UNINITIALISED, statusMessage); break; case SourcePicture.ERROR: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: ERROR message: " + statusMessage); setStatus(ERROR, statusMessage); sourcePicture.removeListener(this); break; case SourcePicture.LOADING: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: LOADING message: " + statusMessage); setStatus(LOADING, statusMessage); break; case SourcePicture.ROTATING: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: ROTATING message: " + statusMessage); setStatus(LOADING, statusMessage); break; case SourcePicture.READY: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: READY message: " + statusMessage); setStatus(LOADED, statusMessage); sourcePicture.removeListener(this); if (scaleAfterLoad) { createScaledPictureInThread(Thread.MAX_PRIORITY); scaleAfterLoad = false; } break; default: Tools.log("ScalablePicture.sourceStatusChange: Don't recognize this status: " + statusMessage); break; } } }
public class class_name { public void sourceStatusChange(int statusCode, String statusMessage, SourcePicture sp) { //Tools.log("ScalablePicture.sourceStatusChange: status received from SourceImage: " + statusMessage); switch (statusCode) { case SourcePicture.UNINITIALISED: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: UNINITIALISED message: " + statusMessage); setStatus(UNINITIALISED, statusMessage); break; case SourcePicture.ERROR: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: ERROR message: " + statusMessage); setStatus(ERROR, statusMessage); sourcePicture.removeListener(this); break; case SourcePicture.LOADING: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: LOADING message: " + statusMessage); setStatus(LOADING, statusMessage); break; case SourcePicture.ROTATING: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: ROTATING message: " + statusMessage); setStatus(LOADING, statusMessage); break; case SourcePicture.READY: Tools.log("ScalablePicture.sourceStatusChange: pictureStatus was: READY message: " + statusMessage); setStatus(LOADED, statusMessage); sourcePicture.removeListener(this); if (scaleAfterLoad) { createScaledPictureInThread(Thread.MAX_PRIORITY); // depends on control dependency: [if], data = [none] scaleAfterLoad = false; // depends on control dependency: [if], data = [none] } break; default: Tools.log("ScalablePicture.sourceStatusChange: Don't recognize this status: " + statusMessage); break; } } }
public class class_name { public void runWith(T value, Runnable doRun) { WeakReference<Holder> ref = local.get(); Holder holder = ref != null ? ref.get() : createHolder(); Object oldValue = holder.value; holder.value = value; try { doRun.run(); } finally { holder.value = oldValue; } } }
public class class_name { public void runWith(T value, Runnable doRun) { WeakReference<Holder> ref = local.get(); Holder holder = ref != null ? ref.get() : createHolder(); Object oldValue = holder.value; holder.value = value; try { doRun.run(); // depends on control dependency: [try], data = [none] } finally { holder.value = oldValue; } } }
public class class_name { public int getPort() { try { return appContext.getServerPort(getConfigurePrefix() + "port"); } catch (NoSuchMethodError e) { log.info("Please remove 'nutzboot-starter' dependency from pom.xml. https://github.com/nutzam/nutzboot/issues/93"); return conf.getInt(getConfigurePrefix() + "port", 8080); } } }
public class class_name { public int getPort() { try { return appContext.getServerPort(getConfigurePrefix() + "port"); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodError e) { log.info("Please remove 'nutzboot-starter' dependency from pom.xml. https://github.com/nutzam/nutzboot/issues/93"); return conf.getInt(getConfigurePrefix() + "port", 8080); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void validateOrderList(SqlSelect select) { // ORDER BY is validated in a scope where aliases in the SELECT clause // are visible. For example, "SELECT empno AS x FROM emp ORDER BY x" // is valid. SqlNodeList orderList = select.getOrderList(); if (orderList == null) { return; } if (!shouldAllowIntermediateOrderBy()) { if (!cursorSet.contains(select)) { throw newValidationError(select, RESOURCE.invalidOrderByPos()); } } final SqlValidatorScope orderScope = getOrderScope(select); Objects.requireNonNull(orderScope); List<SqlNode> expandList = new ArrayList<>(); for (SqlNode orderItem : orderList) { SqlNode expandedOrderItem = expand(orderItem, orderScope); expandList.add(expandedOrderItem); } SqlNodeList expandedOrderList = new SqlNodeList( expandList, orderList.getParserPosition()); select.setOrderBy(expandedOrderList); for (SqlNode orderItem : expandedOrderList) { validateOrderItem(select, orderItem); } } }
public class class_name { protected void validateOrderList(SqlSelect select) { // ORDER BY is validated in a scope where aliases in the SELECT clause // are visible. For example, "SELECT empno AS x FROM emp ORDER BY x" // is valid. SqlNodeList orderList = select.getOrderList(); if (orderList == null) { return; // depends on control dependency: [if], data = [none] } if (!shouldAllowIntermediateOrderBy()) { if (!cursorSet.contains(select)) { throw newValidationError(select, RESOURCE.invalidOrderByPos()); } } final SqlValidatorScope orderScope = getOrderScope(select); Objects.requireNonNull(orderScope); List<SqlNode> expandList = new ArrayList<>(); for (SqlNode orderItem : orderList) { SqlNode expandedOrderItem = expand(orderItem, orderScope); expandList.add(expandedOrderItem); // depends on control dependency: [for], data = [none] } SqlNodeList expandedOrderList = new SqlNodeList( expandList, orderList.getParserPosition()); select.setOrderBy(expandedOrderList); for (SqlNode orderItem : expandedOrderList) { validateOrderItem(select, orderItem); // depends on control dependency: [for], data = [orderItem] } } }
public class class_name { public void marshall(ContainerOverrides containerOverrides, ProtocolMarshaller protocolMarshaller) { if (containerOverrides == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(containerOverrides.getVcpus(), VCPUS_BINDING); protocolMarshaller.marshall(containerOverrides.getMemory(), MEMORY_BINDING); protocolMarshaller.marshall(containerOverrides.getCommand(), COMMAND_BINDING); protocolMarshaller.marshall(containerOverrides.getInstanceType(), INSTANCETYPE_BINDING); protocolMarshaller.marshall(containerOverrides.getEnvironment(), ENVIRONMENT_BINDING); protocolMarshaller.marshall(containerOverrides.getResourceRequirements(), RESOURCEREQUIREMENTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ContainerOverrides containerOverrides, ProtocolMarshaller protocolMarshaller) { if (containerOverrides == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(containerOverrides.getVcpus(), VCPUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(containerOverrides.getMemory(), MEMORY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(containerOverrides.getCommand(), COMMAND_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(containerOverrides.getInstanceType(), INSTANCETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(containerOverrides.getEnvironment(), ENVIRONMENT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(containerOverrides.getResourceRequirements(), RESOURCEREQUIREMENTS_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 Map<I_CmsResourceType, I_CmsResourceType> cloneResourceTypes( CmsModule sourceModule, CmsModule targetModule, String sourcePathPart, String targetPathPart, Map<String, String> keys) { Map<I_CmsResourceType, I_CmsResourceType> resourceTypeMapping = new HashMap<I_CmsResourceType, I_CmsResourceType>(); List<I_CmsResourceType> targetResourceTypes = new ArrayList<I_CmsResourceType>(); for (I_CmsResourceType sourceResType : targetModule.getResourceTypes()) { // get the class name attribute String className = sourceResType.getClassName(); // create the class instance I_CmsResourceType targetResType; try { if (className != null) { className = className.trim(); } int newId = -1; boolean exists = true; do { newId = new Random().nextInt((99999)) + 10000; try { OpenCms.getResourceManager().getResourceType(newId); } catch (CmsLoaderException e) { exists = false; } } while (exists); targetResType = (I_CmsResourceType)Class.forName(className).newInstance(); for (String mapping : sourceResType.getConfiguredMappings()) { targetResType.addMappingType(mapping); } targetResType.setAdjustLinksFolder(sourceResType.getAdjustLinksFolder()); if (targetResType instanceof A_CmsResourceType) { A_CmsResourceType concreteTargetResType = (A_CmsResourceType)targetResType; for (CmsProperty prop : sourceResType.getConfiguredDefaultProperties()) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(prop.getValue())) { prop.setStructureValue( prop.getStructureValue().replaceAll( sourceModule.getName(), targetModule.getName()).replaceAll(sourcePathPart, targetPathPart)); prop.setResourceValue( prop.getResourceValue().replaceAll( sourceModule.getName(), targetModule.getName()).replaceAll(sourcePathPart, targetPathPart)); } concreteTargetResType.addDefaultProperty(prop); } for (CmsConfigurationCopyResource conres : sourceResType.getConfiguredCopyResources()) { concreteTargetResType.addCopyResource( conres.getSource(), conres.getTarget(), conres.getTypeString()); } } for (Map.Entry<String, String> entry : sourceResType.getConfiguration().entrySet()) { targetResType.addConfigurationParameter( entry.getKey(), entry.getValue().replaceAll(sourceModule.getName(), targetModule.getName())); } targetResType.setAdditionalModuleResourceType(true); targetResType.initConfiguration( alterPrefix( sourceResType.getTypeName(), m_cloneInfo.getSourceNamePrefix(), m_cloneInfo.getTargetNamePrefix()), newId + "", sourceResType.getClassName()); keys.put(sourceResType.getTypeName(), targetResType.getTypeName()); targetResourceTypes.add(targetResType); resourceTypeMapping.put(sourceResType, targetResType); } catch (Exception e) { // resource type is unknown, use dummy class to import the module resources targetResType = new CmsResourceTypeUnknown(); // write an error to the log LOG.error( org.opencms.configuration.Messages.get().getBundle().key( org.opencms.configuration.Messages.ERR_UNKNOWN_RESTYPE_CLASS_2, className, targetResType.getClass().getName()), e); } } targetModule.setResourceTypes(targetResourceTypes); return resourceTypeMapping; } }
public class class_name { private Map<I_CmsResourceType, I_CmsResourceType> cloneResourceTypes( CmsModule sourceModule, CmsModule targetModule, String sourcePathPart, String targetPathPart, Map<String, String> keys) { Map<I_CmsResourceType, I_CmsResourceType> resourceTypeMapping = new HashMap<I_CmsResourceType, I_CmsResourceType>(); List<I_CmsResourceType> targetResourceTypes = new ArrayList<I_CmsResourceType>(); for (I_CmsResourceType sourceResType : targetModule.getResourceTypes()) { // get the class name attribute String className = sourceResType.getClassName(); // create the class instance I_CmsResourceType targetResType; try { if (className != null) { className = className.trim(); // depends on control dependency: [if], data = [none] } int newId = -1; boolean exists = true; do { newId = new Random().nextInt((99999)) + 10000; try { OpenCms.getResourceManager().getResourceType(newId); // depends on control dependency: [try], data = [none] } catch (CmsLoaderException e) { exists = false; } // depends on control dependency: [catch], data = [none] } while (exists); targetResType = (I_CmsResourceType)Class.forName(className).newInstance(); // depends on control dependency: [try], data = [none] for (String mapping : sourceResType.getConfiguredMappings()) { targetResType.addMappingType(mapping); // depends on control dependency: [for], data = [mapping] } targetResType.setAdjustLinksFolder(sourceResType.getAdjustLinksFolder()); // depends on control dependency: [try], data = [none] if (targetResType instanceof A_CmsResourceType) { A_CmsResourceType concreteTargetResType = (A_CmsResourceType)targetResType; for (CmsProperty prop : sourceResType.getConfiguredDefaultProperties()) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(prop.getValue())) { prop.setStructureValue( prop.getStructureValue().replaceAll( sourceModule.getName(), targetModule.getName()).replaceAll(sourcePathPart, targetPathPart)); // depends on control dependency: [if], data = [none] prop.setResourceValue( prop.getResourceValue().replaceAll( sourceModule.getName(), targetModule.getName()).replaceAll(sourcePathPart, targetPathPart)); // depends on control dependency: [if], data = [none] } concreteTargetResType.addDefaultProperty(prop); // depends on control dependency: [for], data = [prop] } for (CmsConfigurationCopyResource conres : sourceResType.getConfiguredCopyResources()) { concreteTargetResType.addCopyResource( conres.getSource(), conres.getTarget(), conres.getTypeString()); // depends on control dependency: [for], data = [none] } } for (Map.Entry<String, String> entry : sourceResType.getConfiguration().entrySet()) { targetResType.addConfigurationParameter( entry.getKey(), entry.getValue().replaceAll(sourceModule.getName(), targetModule.getName())); // depends on control dependency: [for], data = [none] } targetResType.setAdditionalModuleResourceType(true); // depends on control dependency: [try], data = [none] targetResType.initConfiguration( alterPrefix( sourceResType.getTypeName(), m_cloneInfo.getSourceNamePrefix(), m_cloneInfo.getTargetNamePrefix()), newId + "", sourceResType.getClassName()); // depends on control dependency: [try], data = [none] keys.put(sourceResType.getTypeName(), targetResType.getTypeName()); // depends on control dependency: [try], data = [none] targetResourceTypes.add(targetResType); // depends on control dependency: [try], data = [none] resourceTypeMapping.put(sourceResType, targetResType); // depends on control dependency: [try], data = [none] } catch (Exception e) { // resource type is unknown, use dummy class to import the module resources targetResType = new CmsResourceTypeUnknown(); // write an error to the log LOG.error( org.opencms.configuration.Messages.get().getBundle().key( org.opencms.configuration.Messages.ERR_UNKNOWN_RESTYPE_CLASS_2, className, targetResType.getClass().getName()), e); } // depends on control dependency: [catch], data = [none] } targetModule.setResourceTypes(targetResourceTypes); return resourceTypeMapping; } }
public class class_name { public static int searchLast(double[] doubleArray, double value, int occurrence) { if(occurrence <= 0 || occurrence > doubleArray.length) { throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than " + "the array length: " + occurrence); } int valuesSeen = 0; for(int i = doubleArray.length-1; i >=0; i--) { if(doubleArray[i] == value) { valuesSeen++; if(valuesSeen == occurrence) { return i; } } } return -1; } }
public class class_name { public static int searchLast(double[] doubleArray, double value, int occurrence) { if(occurrence <= 0 || occurrence > doubleArray.length) { throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than " + "the array length: " + occurrence); } int valuesSeen = 0; for(int i = doubleArray.length-1; i >=0; i--) { if(doubleArray[i] == value) { valuesSeen++; // depends on control dependency: [if], data = [none] if(valuesSeen == occurrence) { return i; // depends on control dependency: [if], data = [none] } } } return -1; } }
public class class_name { private void parse(DerValue val) throws IOException, CertificateException { if (val.tag != DerValue.tag_Sequence) { throw new IOException ("Sequence tag missing for X509CertificatePair"); } while (val.data != null && val.data.available() != 0) { DerValue opt = val.data.getDerValue(); short tag = (byte) (opt.tag & 0x01f); switch (tag) { case TAG_FORWARD: if (opt.isContextSpecific() && opt.isConstructed()) { if (forward != null) { throw new IOException("Duplicate forward " + "certificate in X509CertificatePair"); } opt = opt.data.getDerValue(); forward = X509Factory.intern (new X509CertImpl(opt.toByteArray())); } break; case TAG_REVERSE: if (opt.isContextSpecific() && opt.isConstructed()) { if (reverse != null) { throw new IOException("Duplicate reverse " + "certificate in X509CertificatePair"); } opt = opt.data.getDerValue(); reverse = X509Factory.intern (new X509CertImpl(opt.toByteArray())); } break; default: throw new IOException("Invalid encoding of " + "X509CertificatePair"); } } if (forward == null && reverse == null) { throw new CertificateException("at least one of certificate pair " + "must be non-null"); } } }
public class class_name { private void parse(DerValue val) throws IOException, CertificateException { if (val.tag != DerValue.tag_Sequence) { throw new IOException ("Sequence tag missing for X509CertificatePair"); } while (val.data != null && val.data.available() != 0) { DerValue opt = val.data.getDerValue(); short tag = (byte) (opt.tag & 0x01f); switch (tag) { case TAG_FORWARD: if (opt.isContextSpecific() && opt.isConstructed()) { if (forward != null) { throw new IOException("Duplicate forward " + "certificate in X509CertificatePair"); } opt = opt.data.getDerValue(); // depends on control dependency: [if], data = [none] forward = X509Factory.intern (new X509CertImpl(opt.toByteArray())); // depends on control dependency: [if], data = [none] } break; case TAG_REVERSE: if (opt.isContextSpecific() && opt.isConstructed()) { if (reverse != null) { throw new IOException("Duplicate reverse " + "certificate in X509CertificatePair"); } opt = opt.data.getDerValue(); // depends on control dependency: [if], data = [none] reverse = X509Factory.intern (new X509CertImpl(opt.toByteArray())); // depends on control dependency: [if], data = [none] } break; default: throw new IOException("Invalid encoding of " + "X509CertificatePair"); } } if (forward == null && reverse == null) { throw new CertificateException("at least one of certificate pair " + "must be non-null"); } } }
public class class_name { public FastSet<ChannelSelectionKey> selectNow() throws IOException { FastSet<ChannelSelectionKey> selectedKey = new FastSet<ChannelSelectionKey>(); selector.selectNow(); Set<SelectionKey> selection = selector.selectedKeys(); for (SelectionKey key : selection) { ChannelSelectionKey k = (ChannelSelectionKey) key.attachment(); try { if (key.isValid()) { if (key.isValid() && key.isAcceptable()) { selectedKey.add(k); } else { if (key.isValid() && key.isReadable()) { ((ShellChannel) k.channel()).doRead(); if (k.isValid() && k.isReadable()) { selectedKey.add(k); } } if (key.isValid() && key.isWritable()) { ((ShellChannel) k.channel()).doWrite(); if (k.isValid() && k.isWritable()) { selectedKey.add(k); } } } } else { // adding invalid channel to allow its removal selectedKey.add(k); } } catch (IOException ioe) { throw new ChannelException(k, ioe.getMessage()); } } // for selection.clear(); return selectedKey; } }
public class class_name { public FastSet<ChannelSelectionKey> selectNow() throws IOException { FastSet<ChannelSelectionKey> selectedKey = new FastSet<ChannelSelectionKey>(); selector.selectNow(); Set<SelectionKey> selection = selector.selectedKeys(); for (SelectionKey key : selection) { ChannelSelectionKey k = (ChannelSelectionKey) key.attachment(); try { if (key.isValid()) { if (key.isValid() && key.isAcceptable()) { selectedKey.add(k); // depends on control dependency: [if], data = [none] } else { if (key.isValid() && key.isReadable()) { ((ShellChannel) k.channel()).doRead(); // depends on control dependency: [if], data = [none] if (k.isValid() && k.isReadable()) { selectedKey.add(k); // depends on control dependency: [if], data = [none] } } if (key.isValid() && key.isWritable()) { ((ShellChannel) k.channel()).doWrite(); // depends on control dependency: [if], data = [none] if (k.isValid() && k.isWritable()) { selectedKey.add(k); // depends on control dependency: [if], data = [none] } } } } else { // adding invalid channel to allow its removal selectedKey.add(k); // depends on control dependency: [if], data = [none] } } catch (IOException ioe) { throw new ChannelException(k, ioe.getMessage()); } // depends on control dependency: [catch], data = [none] } // for selection.clear(); return selectedKey; } }
public class class_name { public void marshall(MarkerRecordedEventAttributes markerRecordedEventAttributes, ProtocolMarshaller protocolMarshaller) { if (markerRecordedEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(markerRecordedEventAttributes.getMarkerName(), MARKERNAME_BINDING); protocolMarshaller.marshall(markerRecordedEventAttributes.getDetails(), DETAILS_BINDING); protocolMarshaller.marshall(markerRecordedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(MarkerRecordedEventAttributes markerRecordedEventAttributes, ProtocolMarshaller protocolMarshaller) { if (markerRecordedEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(markerRecordedEventAttributes.getMarkerName(), MARKERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(markerRecordedEventAttributes.getDetails(), DETAILS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(markerRecordedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_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 { static final CouponHashSet heapifySet(final Memory mem) { final int lgConfigK = extractLgK(mem); final TgtHllType tgtHllType = extractTgtHllType(mem); final CurMode curMode = extractCurMode(mem); final int memArrStart = (curMode == CurMode.LIST) ? LIST_INT_ARR_START : HASH_SET_INT_ARR_START; final CouponHashSet set = new CouponHashSet(lgConfigK, tgtHllType); set.putOutOfOrderFlag(true); final boolean memIsCompact = extractCompactFlag(mem); final int couponCount = extractHashSetCount(mem); int lgCouponArrInts = extractLgArr(mem); if (lgCouponArrInts < LG_INIT_SET_SIZE) { lgCouponArrInts = computeLgArr(mem, couponCount, lgConfigK); } if (memIsCompact) { for (int i = 0; i < couponCount; i++) { set.couponUpdate(extractInt(mem, memArrStart + (i << 2))); } } else { //updatable set.couponCount = couponCount; set.lgCouponArrInts = lgCouponArrInts; final int couponArrInts = 1 << lgCouponArrInts; set.couponIntArr = new int[couponArrInts]; mem.getIntArray(HASH_SET_INT_ARR_START, set.couponIntArr, 0, couponArrInts); } return set; } }
public class class_name { static final CouponHashSet heapifySet(final Memory mem) { final int lgConfigK = extractLgK(mem); final TgtHllType tgtHllType = extractTgtHllType(mem); final CurMode curMode = extractCurMode(mem); final int memArrStart = (curMode == CurMode.LIST) ? LIST_INT_ARR_START : HASH_SET_INT_ARR_START; final CouponHashSet set = new CouponHashSet(lgConfigK, tgtHllType); set.putOutOfOrderFlag(true); final boolean memIsCompact = extractCompactFlag(mem); final int couponCount = extractHashSetCount(mem); int lgCouponArrInts = extractLgArr(mem); if (lgCouponArrInts < LG_INIT_SET_SIZE) { lgCouponArrInts = computeLgArr(mem, couponCount, lgConfigK); // depends on control dependency: [if], data = [none] } if (memIsCompact) { for (int i = 0; i < couponCount; i++) { set.couponUpdate(extractInt(mem, memArrStart + (i << 2))); // depends on control dependency: [for], data = [i] } } else { //updatable set.couponCount = couponCount; // depends on control dependency: [if], data = [none] set.lgCouponArrInts = lgCouponArrInts; // depends on control dependency: [if], data = [none] final int couponArrInts = 1 << lgCouponArrInts; set.couponIntArr = new int[couponArrInts]; // depends on control dependency: [if], data = [none] mem.getIntArray(HASH_SET_INT_ARR_START, set.couponIntArr, 0, couponArrInts); // depends on control dependency: [if], data = [none] } return set; } }
public class class_name { public static Driver loadDriver(final File jar) { try { return loadDriver(jar.toURI().toURL()); } catch (java.net.MalformedURLException e) { throw new RuntimeException(e); } // end of catch } }
public class class_name { public static Driver loadDriver(final File jar) { try { return loadDriver(jar.toURI().toURL()); // depends on control dependency: [try], data = [none] } catch (java.net.MalformedURLException e) { throw new RuntimeException(e); } // end of catch // depends on control dependency: [catch], data = [none] } }
public class class_name { public static List<IRExpressionBuilder> passArgs( IJavaClassMethod m ) { List<IRExpressionBuilder> args = new ArrayList<IRExpressionBuilder>(); IJavaClassInfo[] paramTypes = m.getParameterTypes(); for (int i = 0; i < paramTypes.length; i++) { args.add(var("arg" + i)); } return args; } }
public class class_name { public static List<IRExpressionBuilder> passArgs( IJavaClassMethod m ) { List<IRExpressionBuilder> args = new ArrayList<IRExpressionBuilder>(); IJavaClassInfo[] paramTypes = m.getParameterTypes(); for (int i = 0; i < paramTypes.length; i++) { args.add(var("arg" + i)); // depends on control dependency: [for], data = [i] } return args; } }
public class class_name { protected Connection getConnectionAndInitInvokeContext(Url url, InvokeContext invokeContext) throws RemotingException, InterruptedException { long start = System.currentTimeMillis(); Connection conn; try { conn = this.connectionManager.getAndCreateIfAbsent(url); } finally { if (null != invokeContext) { invokeContext.putIfAbsent(InvokeContext.CLIENT_CONN_CREATETIME, (System.currentTimeMillis() - start)); } } return conn; } }
public class class_name { protected Connection getConnectionAndInitInvokeContext(Url url, InvokeContext invokeContext) throws RemotingException, InterruptedException { long start = System.currentTimeMillis(); Connection conn; try { conn = this.connectionManager.getAndCreateIfAbsent(url); } finally { if (null != invokeContext) { invokeContext.putIfAbsent(InvokeContext.CLIENT_CONN_CREATETIME, (System.currentTimeMillis() - start)); // depends on control dependency: [if], data = [none] } } return conn; } }
public class class_name { public DescribeConfigurationAggregatorSourcesStatusRequest withUpdateStatus(AggregatedSourceStatusType... updateStatus) { com.amazonaws.internal.SdkInternalList<String> updateStatusCopy = new com.amazonaws.internal.SdkInternalList<String>(updateStatus.length); for (AggregatedSourceStatusType value : updateStatus) { updateStatusCopy.add(value.toString()); } if (getUpdateStatus() == null) { setUpdateStatus(updateStatusCopy); } else { getUpdateStatus().addAll(updateStatusCopy); } return this; } }
public class class_name { public DescribeConfigurationAggregatorSourcesStatusRequest withUpdateStatus(AggregatedSourceStatusType... updateStatus) { com.amazonaws.internal.SdkInternalList<String> updateStatusCopy = new com.amazonaws.internal.SdkInternalList<String>(updateStatus.length); for (AggregatedSourceStatusType value : updateStatus) { updateStatusCopy.add(value.toString()); // depends on control dependency: [for], data = [value] } if (getUpdateStatus() == null) { setUpdateStatus(updateStatusCopy); // depends on control dependency: [if], data = [none] } else { getUpdateStatus().addAll(updateStatusCopy); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public void setPrivateKeyValid(Date privateKeyValid) { if (privateKeyValid == null) { this.privateKeyValid = null; } else { this.privateKeyValid = (Date)privateKeyValid.clone(); } } }
public class class_name { public void setPrivateKeyValid(Date privateKeyValid) { if (privateKeyValid == null) { this.privateKeyValid = null; // depends on control dependency: [if], data = [none] } else { this.privateKeyValid = (Date)privateKeyValid.clone(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String getItemIndexViewURL(String reposBaseURL, String fedoraContext, String PID, Date versDateTime) { String itemIndexURL = null; try { if (versDateTime == null) { itemIndexURL = reposBaseURL + "/" + fedoraContext + "/objects/" + URLEncoder.encode(PID, "UTF-8") + "/methods/" + URLEncoder.encode("fedora-system:3", "UTF-8") + "/viewItemIndex"; } else { itemIndexURL = reposBaseURL + "/" + fedoraContext + "/objects/" + URLEncoder.encode(PID, "UTF-8") + "/methods/" + URLEncoder.encode("fedora-system:3", "UTF-8") + "/viewItemIndex?asOfDateTime=" + DateUtility.convertDateToString(versDateTime); } } catch (UnsupportedEncodingException e) { // should never happen... throw new RuntimeException(e); } return itemIndexURL; } }
public class class_name { private String getItemIndexViewURL(String reposBaseURL, String fedoraContext, String PID, Date versDateTime) { String itemIndexURL = null; try { if (versDateTime == null) { itemIndexURL = reposBaseURL + "/" + fedoraContext + "/objects/" + URLEncoder.encode(PID, "UTF-8") + "/methods/" + URLEncoder.encode("fedora-system:3", "UTF-8") + "/viewItemIndex"; // depends on control dependency: [if], data = [none] } else { itemIndexURL = reposBaseURL + "/" + fedoraContext + "/objects/" + URLEncoder.encode(PID, "UTF-8") + "/methods/" + URLEncoder.encode("fedora-system:3", "UTF-8") + "/viewItemIndex?asOfDateTime=" + DateUtility.convertDateToString(versDateTime); // depends on control dependency: [if], data = [none] } } catch (UnsupportedEncodingException e) { // should never happen... throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] return itemIndexURL; } }
public class class_name { public GetConnectionsResult withConnectionList(Connection... connectionList) { if (this.connectionList == null) { setConnectionList(new java.util.ArrayList<Connection>(connectionList.length)); } for (Connection ele : connectionList) { this.connectionList.add(ele); } return this; } }
public class class_name { public GetConnectionsResult withConnectionList(Connection... connectionList) { if (this.connectionList == null) { setConnectionList(new java.util.ArrayList<Connection>(connectionList.length)); // depends on control dependency: [if], data = [none] } for (Connection ele : connectionList) { this.connectionList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static Collector<CharSequence, ?, String> commonPrefix() { final Supplier<Pair<CharSequence, Integer>> supplier = new Supplier<Pair<CharSequence, Integer>>() { @Override public Pair<CharSequence, Integer> get() { return Pair.of(null, -1); } }; final BiConsumer<Pair<CharSequence, Integer>, CharSequence> accumulator = new BiConsumer<Pair<CharSequence, Integer>, CharSequence>() { @Override public void accept(Pair<CharSequence, Integer> a, CharSequence t) { if (a.right == -1) { a.left = t; a.right = t.length(); } else if (a.right > 0) { if (t.length() < a.right) { a.right = t.length(); } for (int i = 0, to = a.right; i < to; i++) { if (a.left.charAt(i) != t.charAt(i)) { if (i > 0 && Character.isHighSurrogate(t.charAt(i - 1)) && (Character.isLowSurrogate(t.charAt(i)) || Character.isLowSurrogate(a.left.charAt(i)))) { i--; } a.right = i; break; } } } } }; final BinaryOperator<Pair<CharSequence, Integer>> combiner = new BinaryOperator<Pair<CharSequence, Integer>>() { @Override public Pair<CharSequence, Integer> apply(Pair<CharSequence, Integer> a, Pair<CharSequence, Integer> b) { if (a.right == -1) { return b; } if (b.right != -1) { accumulator.accept(a, b.left.subSequence(0, b.right)); } return a; } }; final Function<Pair<CharSequence, Integer>, String> finisher = new Function<Pair<CharSequence, Integer>, String>() { @Override public String apply(Pair<CharSequence, Integer> a) { return a.left == null ? "" : a.left.subSequence(0, a.right).toString(); } }; return new CollectorImpl<>(supplier, accumulator, combiner, finisher, CH_UNORDERED_NOID); } }
public class class_name { public static Collector<CharSequence, ?, String> commonPrefix() { final Supplier<Pair<CharSequence, Integer>> supplier = new Supplier<Pair<CharSequence, Integer>>() { @Override public Pair<CharSequence, Integer> get() { return Pair.of(null, -1); } }; final BiConsumer<Pair<CharSequence, Integer>, CharSequence> accumulator = new BiConsumer<Pair<CharSequence, Integer>, CharSequence>() { @Override public void accept(Pair<CharSequence, Integer> a, CharSequence t) { if (a.right == -1) { a.left = t; // depends on control dependency: [if], data = [none] a.right = t.length(); // depends on control dependency: [if], data = [none] } else if (a.right > 0) { if (t.length() < a.right) { a.right = t.length(); // depends on control dependency: [if], data = [none] } for (int i = 0, to = a.right; i < to; i++) { if (a.left.charAt(i) != t.charAt(i)) { if (i > 0 && Character.isHighSurrogate(t.charAt(i - 1)) && (Character.isLowSurrogate(t.charAt(i)) || Character.isLowSurrogate(a.left.charAt(i)))) { i--; // depends on control dependency: [if], data = [none] } a.right = i; // depends on control dependency: [if], data = [none] break; } } } } }; final BinaryOperator<Pair<CharSequence, Integer>> combiner = new BinaryOperator<Pair<CharSequence, Integer>>() { @Override public Pair<CharSequence, Integer> apply(Pair<CharSequence, Integer> a, Pair<CharSequence, Integer> b) { if (a.right == -1) { return b; // depends on control dependency: [if], data = [none] } if (b.right != -1) { accumulator.accept(a, b.left.subSequence(0, b.right)); // depends on control dependency: [if], data = [none] } return a; } }; final Function<Pair<CharSequence, Integer>, String> finisher = new Function<Pair<CharSequence, Integer>, String>() { @Override public String apply(Pair<CharSequence, Integer> a) { return a.left == null ? "" : a.left.subSequence(0, a.right).toString(); } }; return new CollectorImpl<>(supplier, accumulator, combiner, finisher, CH_UNORDERED_NOID); } }
public class class_name { public static DirectoryRosterStore init(final File baseDir) { DirectoryRosterStore store = new DirectoryRosterStore(baseDir); if (store.setRosterVersion("")) { return store; } else { return null; } } }
public class class_name { public static DirectoryRosterStore init(final File baseDir) { DirectoryRosterStore store = new DirectoryRosterStore(baseDir); if (store.setRosterVersion("")) { return store; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public int getCount() { Lock lock = this.lock.readLock(); lock.lock(); try { return this.count; } finally { lock.unlock(); } } }
public class class_name { public int getCount() { Lock lock = this.lock.readLock(); lock.lock(); try { return this.count; // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } }
public class class_name { public double getBearing(LatLong end) { if (this.equals(end)) { return 0; } double lat1 = latToRadians(); double lon1 = longToRadians(); double lat2 = end.latToRadians(); double lon2 = end.longToRadians(); double angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2)); if (angle < 0.0) { angle += Math.PI * 2.0; } if (angle > Math.PI) { angle -= Math.PI * 2.0; } return Math.toDegrees(angle); } }
public class class_name { public double getBearing(LatLong end) { if (this.equals(end)) { return 0; // depends on control dependency: [if], data = [none] } double lat1 = latToRadians(); double lon1 = longToRadians(); double lat2 = end.latToRadians(); double lon2 = end.longToRadians(); double angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2)); if (angle < 0.0) { angle += Math.PI * 2.0; // depends on control dependency: [if], data = [none] } if (angle > Math.PI) { angle -= Math.PI * 2.0; // depends on control dependency: [if], data = [none] } return Math.toDegrees(angle); } }
public class class_name { private boolean upHeap() { int currIdx = size - 1; E elem = storage.array[currIdx]; int steps = 0; while (currIdx > 0) { int parentIdx = currIdx / 2; E parent = storage.array[parentIdx]; int cmp = comparator.compare(elem, parent); if (cmp == 0) { storage.array[parentIdx] = mergeOp.merge(parent, elem); return false; } else if (cmp > 0) { break; } currIdx = parentIdx; steps++; } currIdx = size - 1; for (int i = 0; i < steps; i++) { int parentIdx = currIdx / 2; storage.array[currIdx] = storage.array[parentIdx]; currIdx = parentIdx; } storage.array[currIdx] = elem; return true; } }
public class class_name { private boolean upHeap() { int currIdx = size - 1; E elem = storage.array[currIdx]; int steps = 0; while (currIdx > 0) { int parentIdx = currIdx / 2; E parent = storage.array[parentIdx]; int cmp = comparator.compare(elem, parent); if (cmp == 0) { storage.array[parentIdx] = mergeOp.merge(parent, elem); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } else if (cmp > 0) { break; } currIdx = parentIdx; // depends on control dependency: [while], data = [none] steps++; // depends on control dependency: [while], data = [none] } currIdx = size - 1; for (int i = 0; i < steps; i++) { int parentIdx = currIdx / 2; storage.array[currIdx] = storage.array[parentIdx]; // depends on control dependency: [for], data = [none] currIdx = parentIdx; // depends on control dependency: [for], data = [none] } storage.array[currIdx] = elem; return true; } }
public class class_name { private void removeDeletable() { String fileName = "deletable"; try { if (indexDir.fileExists(fileName)) { indexDir.deleteFile(fileName); } } catch (IOException e) { LOG.warn("Unable to remove file 'deletable'.", e); } } }
public class class_name { private void removeDeletable() { String fileName = "deletable"; try { if (indexDir.fileExists(fileName)) { indexDir.deleteFile(fileName); // depends on control dependency: [if], data = [none] } } catch (IOException e) { LOG.warn("Unable to remove file 'deletable'.", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public <T extends AbstractCalculator> T bind(Class<T> clazz) { T childCalc = null; try { childCalc = clazz.newInstance(); } catch (Exception e) { throw new CalculatorException(e); } if (childCalc instanceof AbstractCalculator) { // find last child from root AbstractCalculator<CALC> bParent = this; while (bParent != null) { if (bParent.childCalculator != null) bParent = bParent.childCalculator; else break; } ((AbstractCalculator) childCalc).parentCalculator = bParent; ((AbstractCalculator) childCalc).isBind = true; bParent.childCalculator = childCalc; } else { throw new CalculatorException("Use calculator which is type of AbstractCalculator", new IllegalArgumentException()); } return childCalc; } }
public class class_name { public <T extends AbstractCalculator> T bind(Class<T> clazz) { T childCalc = null; try { childCalc = clazz.newInstance(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new CalculatorException(e); } // depends on control dependency: [catch], data = [none] if (childCalc instanceof AbstractCalculator) { // find last child from root AbstractCalculator<CALC> bParent = this; while (bParent != null) { if (bParent.childCalculator != null) bParent = bParent.childCalculator; else break; } ((AbstractCalculator) childCalc).parentCalculator = bParent; // depends on control dependency: [if], data = [none] ((AbstractCalculator) childCalc).isBind = true; // depends on control dependency: [if], data = [none] bParent.childCalculator = childCalc; // depends on control dependency: [if], data = [none] } else { throw new CalculatorException("Use calculator which is type of AbstractCalculator", new IllegalArgumentException()); } return childCalc; } }
public class class_name { public LogicalTimestamp incrementAndUpdate(LogicalTimestamp timestamp) { long nextValue = currentTimestamp.value() + 1; if (timestamp.value() > nextValue) { return update(timestamp); } return increment(); } }
public class class_name { public LogicalTimestamp incrementAndUpdate(LogicalTimestamp timestamp) { long nextValue = currentTimestamp.value() + 1; if (timestamp.value() > nextValue) { return update(timestamp); // depends on control dependency: [if], data = [none] } return increment(); } }
public class class_name { public static String toStringBinary(final byte [] b, int off, int len) { StringBuilder result = new StringBuilder(); try { String first = new String(b, off, len, "ISO-8859-1"); for (int i = 0; i < first.length(); ++i) { int ch = first.charAt(i) & 0xFF; if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || " `~!@#$%^&*()-_=+[]{}\\|;:'\",.<>/?".indexOf(ch) >= 0) { result.append(first.charAt(i)); } else { result.append(String.format("\\x%02X", ch)); } } } catch (UnsupportedEncodingException e) { } return result.toString(); } }
public class class_name { public static String toStringBinary(final byte [] b, int off, int len) { StringBuilder result = new StringBuilder(); try { String first = new String(b, off, len, "ISO-8859-1"); for (int i = 0; i < first.length(); ++i) { int ch = first.charAt(i) & 0xFF; if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || " `~!@#$%^&*()-_=+[]{}\\|;:'\",.<>/?".indexOf(ch) >= 0) { result.append(first.charAt(i)); // depends on control dependency: [if], data = [none] } else { result.append(String.format("\\x%02X", ch)); // depends on control dependency: [if], data = [none] } } } catch (UnsupportedEncodingException e) { } // depends on control dependency: [catch], data = [none] return result.toString(); } }
public class class_name { private void appendJoin(StringBuffer where, StringBuffer buf, Join join) { buf.append(","); appendTableWithJoins(join.right, where, buf); if (where.length() > 0) { where.append(" AND "); } join.appendJoinEqualities(where); } }
public class class_name { private void appendJoin(StringBuffer where, StringBuffer buf, Join join) { buf.append(","); appendTableWithJoins(join.right, where, buf); if (where.length() > 0) { where.append(" AND "); // depends on control dependency: [if], data = [none] } join.appendJoinEqualities(where); } }
public class class_name { public static Point getCoord(Feature obj) { if (obj.geometry() instanceof Point) { return (Point) obj.geometry(); } throw new TurfException("A Feature with a Point geometry is required."); } }
public class class_name { public static Point getCoord(Feature obj) { if (obj.geometry() instanceof Point) { return (Point) obj.geometry(); // depends on control dependency: [if], data = [none] } throw new TurfException("A Feature with a Point geometry is required."); } }
public class class_name { public static boolean voltMutateToBigintType(Expression maybeConstantNode, Expression parent, int childIndex) { if (maybeConstantNode.opType == OpTypes.VALUE && maybeConstantNode.dataType != null && maybeConstantNode.dataType.isBinaryType()) { ExpressionValue exprVal = (ExpressionValue)maybeConstantNode; if (exprVal.valueData == null) { return false; } BinaryData data = (BinaryData)exprVal.valueData; parent.nodes[childIndex] = new ExpressionValue(data.toLong(), Type.SQL_BIGINT); return true; } return false; } }
public class class_name { public static boolean voltMutateToBigintType(Expression maybeConstantNode, Expression parent, int childIndex) { if (maybeConstantNode.opType == OpTypes.VALUE && maybeConstantNode.dataType != null && maybeConstantNode.dataType.isBinaryType()) { ExpressionValue exprVal = (ExpressionValue)maybeConstantNode; if (exprVal.valueData == null) { return false; // depends on control dependency: [if], data = [none] } BinaryData data = (BinaryData)exprVal.valueData; parent.nodes[childIndex] = new ExpressionValue(data.toLong(), Type.SQL_BIGINT); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static base_responses update(nitro_service client, nspbr resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nspbr updateresources[] = new nspbr[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nspbr(); updateresources[i].name = resources[i].name; updateresources[i].action = resources[i].action; updateresources[i].srcip = resources[i].srcip; updateresources[i].srcipop = resources[i].srcipop; updateresources[i].srcipval = resources[i].srcipval; updateresources[i].srcport = resources[i].srcport; updateresources[i].srcportop = resources[i].srcportop; updateresources[i].srcportval = resources[i].srcportval; updateresources[i].destip = resources[i].destip; updateresources[i].destipop = resources[i].destipop; updateresources[i].destipval = resources[i].destipval; updateresources[i].destport = resources[i].destport; updateresources[i].destportop = resources[i].destportop; updateresources[i].destportval = resources[i].destportval; updateresources[i].nexthop = resources[i].nexthop; updateresources[i].nexthopval = resources[i].nexthopval; updateresources[i].iptunnel = resources[i].iptunnel; updateresources[i].iptunnelname = resources[i].iptunnelname; updateresources[i].srcmac = resources[i].srcmac; updateresources[i].protocol = resources[i].protocol; updateresources[i].protocolnumber = resources[i].protocolnumber; updateresources[i].vlan = resources[i].vlan; updateresources[i].Interface = resources[i].Interface; updateresources[i].priority = resources[i].priority; updateresources[i].msr = resources[i].msr; updateresources[i].monitor = resources[i].monitor; } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { public static base_responses update(nitro_service client, nspbr resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nspbr updateresources[] = new nspbr[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nspbr(); // depends on control dependency: [for], data = [i] updateresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i] updateresources[i].action = resources[i].action; // depends on control dependency: [for], data = [i] updateresources[i].srcip = resources[i].srcip; // depends on control dependency: [for], data = [i] updateresources[i].srcipop = resources[i].srcipop; // depends on control dependency: [for], data = [i] updateresources[i].srcipval = resources[i].srcipval; // depends on control dependency: [for], data = [i] updateresources[i].srcport = resources[i].srcport; // depends on control dependency: [for], data = [i] updateresources[i].srcportop = resources[i].srcportop; // depends on control dependency: [for], data = [i] updateresources[i].srcportval = resources[i].srcportval; // depends on control dependency: [for], data = [i] updateresources[i].destip = resources[i].destip; // depends on control dependency: [for], data = [i] updateresources[i].destipop = resources[i].destipop; // depends on control dependency: [for], data = [i] updateresources[i].destipval = resources[i].destipval; // depends on control dependency: [for], data = [i] updateresources[i].destport = resources[i].destport; // depends on control dependency: [for], data = [i] updateresources[i].destportop = resources[i].destportop; // depends on control dependency: [for], data = [i] updateresources[i].destportval = resources[i].destportval; // depends on control dependency: [for], data = [i] updateresources[i].nexthop = resources[i].nexthop; // depends on control dependency: [for], data = [i] updateresources[i].nexthopval = resources[i].nexthopval; // depends on control dependency: [for], data = [i] updateresources[i].iptunnel = resources[i].iptunnel; // depends on control dependency: [for], data = [i] updateresources[i].iptunnelname = resources[i].iptunnelname; // depends on control dependency: [for], data = [i] updateresources[i].srcmac = resources[i].srcmac; // depends on control dependency: [for], data = [i] updateresources[i].protocol = resources[i].protocol; // depends on control dependency: [for], data = [i] updateresources[i].protocolnumber = resources[i].protocolnumber; // depends on control dependency: [for], data = [i] updateresources[i].vlan = resources[i].vlan; // depends on control dependency: [for], data = [i] updateresources[i].Interface = resources[i].Interface; // depends on control dependency: [for], data = [i] updateresources[i].priority = resources[i].priority; // depends on control dependency: [for], data = [i] updateresources[i].msr = resources[i].msr; // depends on control dependency: [for], data = [i] updateresources[i].monitor = resources[i].monitor; // depends on control dependency: [for], data = [i] } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { public UaTcpStackServer getServer(String endpointUrl) { String path = pathOrUrl(endpointUrl); UaTcpStackServer server = servers.get(path); if (server == null && servers.size() == 1 && !strictEndpointUrlsEnabled) { Iterator<UaTcpStackServer> iterator = servers.values().iterator(); if (iterator.hasNext()) { server = iterator.next(); } } return server; } }
public class class_name { public UaTcpStackServer getServer(String endpointUrl) { String path = pathOrUrl(endpointUrl); UaTcpStackServer server = servers.get(path); if (server == null && servers.size() == 1 && !strictEndpointUrlsEnabled) { Iterator<UaTcpStackServer> iterator = servers.values().iterator(); if (iterator.hasNext()) { server = iterator.next(); // depends on control dependency: [if], data = [none] } } return server; } }
public class class_name { private void getAllDependents(Set<PathEntry> result, String name) { Set<String> depNames = dependenctRelativePaths.get(name); if (depNames == null) { return; } for (String dep : depNames) { PathEntry entry = pathEntries.get(dep); if (entry != null) { result.add(entry); getAllDependents(result, dep); } } } }
public class class_name { private void getAllDependents(Set<PathEntry> result, String name) { Set<String> depNames = dependenctRelativePaths.get(name); if (depNames == null) { return; // depends on control dependency: [if], data = [none] } for (String dep : depNames) { PathEntry entry = pathEntries.get(dep); if (entry != null) { result.add(entry); // depends on control dependency: [if], data = [(entry] getAllDependents(result, dep); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected void setDefaultEncoding(String encoding) { m_defaultEncoding = encoding.intern(); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_SET_DEFAULT_ENCODING_1, m_defaultEncoding)); } } }
public class class_name { protected void setDefaultEncoding(String encoding) { m_defaultEncoding = encoding.intern(); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_SET_DEFAULT_ENCODING_1, m_defaultEncoding)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void start() { // Construct the URLClassLoader which will be used to load // classes within the modules. URL[] urls = new URL[modules.size()]; for(int i=0;i!=modules.size();++i) { urls[i] = modules.get(i).getLocation(); } URLClassLoader loader = new URLClassLoader(urls); // Third, active the modules. This will give them the opportunity to // register whatever extensions they like. activateModules(loader); } }
public class class_name { public void start() { // Construct the URLClassLoader which will be used to load // classes within the modules. URL[] urls = new URL[modules.size()]; for(int i=0;i!=modules.size();++i) { urls[i] = modules.get(i).getLocation(); // depends on control dependency: [for], data = [i] } URLClassLoader loader = new URLClassLoader(urls); // Third, active the modules. This will give them the opportunity to // register whatever extensions they like. activateModules(loader); } }
public class class_name { public final EObject entryRuleJvmFormalParameter() throws RecognitionException { EObject current = null; EObject iv_ruleJvmFormalParameter = null; try { // InternalSARL.g:8171:59: (iv_ruleJvmFormalParameter= ruleJvmFormalParameter EOF ) // InternalSARL.g:8172:2: iv_ruleJvmFormalParameter= ruleJvmFormalParameter EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getJvmFormalParameterRule()); } pushFollow(FOLLOW_1); iv_ruleJvmFormalParameter=ruleJvmFormalParameter(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleJvmFormalParameter; } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject entryRuleJvmFormalParameter() throws RecognitionException { EObject current = null; EObject iv_ruleJvmFormalParameter = null; try { // InternalSARL.g:8171:59: (iv_ruleJvmFormalParameter= ruleJvmFormalParameter EOF ) // InternalSARL.g:8172:2: iv_ruleJvmFormalParameter= ruleJvmFormalParameter EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getJvmFormalParameterRule()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_1); iv_ruleJvmFormalParameter=ruleJvmFormalParameter(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleJvmFormalParameter; // depends on control dependency: [if], data = [none] } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public static double maxLambdaLogisticL1(ClassificationDataSet cds) { /** * This code was ripped out/modified from NewGLMNET. It follows the * strategy laid out in Schmidt, M., Fung, G.,&amp;Rosaless, R. (2009). * Optimization Methods for L1-Regularization. Retrieved from * http://www.cs.ubc.ca/cgi-bin/tr/2009/TR-2009-19.pdf , where we use * the coordinate with the largest magnitude of the gradient */ /** * if w=0, then D_part[i] = 0.5 for all i */ final double D_part_i = 0.5; final int n = cds.getNumNumericalVars(); Vec delta_L = new DenseVector(n); if(cds.rowMajor()) { List<Vec> X = cds.getDataVectors(); for (int i = 0; i < X.size(); i++) { double y_i = cds.getDataPointCategory(i) * 2 - 1; Vec x = X.get(i); delta_L.mutableAdd(D_part_i * y_i, x); } } else { for(int j = 0; j < cds.getNumNumericalVars(); j++) { Vec X_j = cds.getNumericColumn(j); for(IndexValue iv : X_j) { int i = iv.getIndex(); double y_i = cds.getDataPointCategory(i) * 2 - 1; delta_L.increment(j, D_part_i*y_i*iv.getValue()); } } } return max(abs(delta_L.max()), abs(delta_L.min())) / (cds.size()); } }
public class class_name { public static double maxLambdaLogisticL1(ClassificationDataSet cds) { /** * This code was ripped out/modified from NewGLMNET. It follows the * strategy laid out in Schmidt, M., Fung, G.,&amp;Rosaless, R. (2009). * Optimization Methods for L1-Regularization. Retrieved from * http://www.cs.ubc.ca/cgi-bin/tr/2009/TR-2009-19.pdf , where we use * the coordinate with the largest magnitude of the gradient */ /** * if w=0, then D_part[i] = 0.5 for all i */ final double D_part_i = 0.5; final int n = cds.getNumNumericalVars(); Vec delta_L = new DenseVector(n); if(cds.rowMajor()) { List<Vec> X = cds.getDataVectors(); for (int i = 0; i < X.size(); i++) { double y_i = cds.getDataPointCategory(i) * 2 - 1; Vec x = X.get(i); delta_L.mutableAdd(D_part_i * y_i, x); // depends on control dependency: [for], data = [none] } } else { for(int j = 0; j < cds.getNumNumericalVars(); j++) { Vec X_j = cds.getNumericColumn(j); for(IndexValue iv : X_j) { int i = iv.getIndex(); double y_i = cds.getDataPointCategory(i) * 2 - 1; delta_L.increment(j, D_part_i*y_i*iv.getValue()); // depends on control dependency: [for], data = [iv] } } } return max(abs(delta_L.max()), abs(delta_L.min())) / (cds.size()); } }
public class class_name { public void dumpLogBuffer(String identifier) { final ArrayList<LogRecord> logBufferCopy; final PrintWriter logDumper; final OutputStream outStream; Formatter formatter = this.getFormatter(); // Check if compression of dump file is enabled boolean disableCompression = System.getProperty(DISABLE_DUMP_COMPR_PROP) != null; // If no identifying factor (eg, an incident id) was provided, get one if (identifier == null) { identifier = EventUtil.getDumpFileId(); } // Do some sanity checking to make sure we're not flooding the user's // disk with dump files cleanupSfDumps(true); String logDumpPath = logDumpPathPrefix + "/" + LOG_DUMP_FILE_NAME + identifier + LOG_DUMP_FILE_EXT; if (!disableCompression) { logDumpPath += LOG_DUMP_COMP_EXT; } logger.debug("EventHandler dumping log buffer to {}", logDumpPath); // Copy logBuffer because this is potentially long running. synchronized (this) { logBufferCopy = new ArrayList<>(logBuffer); logBuffer.clear(); } File outputFile = new File(logDumpPath); /** * Because log files could potentially be very large, we should never open * them in append mode. It's rare that this should happen anyways... */ try { // If the dump path doesn't already exist, create it. if (outputFile.getParentFile() != null) { outputFile.getParentFile().mkdirs(); } outStream = disableCompression ? new FileOutputStream(logDumpPath, false) : new GZIPOutputStream(new FileOutputStream(logDumpPath, false)); logDumper = new PrintWriter(outStream, true); } catch (IOException exc) { // Not much to do here, can't dump logs so exit out. logger.debug("Log dump failed, exception: {}", exc.getMessage()); return; } // Iterate over log entries, format them, then dump them. for (LogRecord entry : logBufferCopy) { logDumper.write(formatter != null ? formatter.format(entry) : entry.getMessage()); } // Clean up logDumper.flush(); logDumper.close(); } }
public class class_name { public void dumpLogBuffer(String identifier) { final ArrayList<LogRecord> logBufferCopy; final PrintWriter logDumper; final OutputStream outStream; Formatter formatter = this.getFormatter(); // Check if compression of dump file is enabled boolean disableCompression = System.getProperty(DISABLE_DUMP_COMPR_PROP) != null; // If no identifying factor (eg, an incident id) was provided, get one if (identifier == null) { identifier = EventUtil.getDumpFileId(); // depends on control dependency: [if], data = [none] } // Do some sanity checking to make sure we're not flooding the user's // disk with dump files cleanupSfDumps(true); String logDumpPath = logDumpPathPrefix + "/" + LOG_DUMP_FILE_NAME + identifier + LOG_DUMP_FILE_EXT; if (!disableCompression) { logDumpPath += LOG_DUMP_COMP_EXT; // depends on control dependency: [if], data = [none] } logger.debug("EventHandler dumping log buffer to {}", logDumpPath); // Copy logBuffer because this is potentially long running. synchronized (this) { logBufferCopy = new ArrayList<>(logBuffer); logBuffer.clear(); } File outputFile = new File(logDumpPath); /** * Because log files could potentially be very large, we should never open * them in append mode. It's rare that this should happen anyways... */ try { // If the dump path doesn't already exist, create it. if (outputFile.getParentFile() != null) { outputFile.getParentFile().mkdirs(); // depends on control dependency: [if], data = [none] } outStream = disableCompression ? new FileOutputStream(logDumpPath, false) : new GZIPOutputStream(new FileOutputStream(logDumpPath, false)); // depends on control dependency: [try], data = [none] logDumper = new PrintWriter(outStream, true); // depends on control dependency: [try], data = [none] } catch (IOException exc) { // Not much to do here, can't dump logs so exit out. logger.debug("Log dump failed, exception: {}", exc.getMessage()); return; } // depends on control dependency: [catch], data = [none] // Iterate over log entries, format them, then dump them. for (LogRecord entry : logBufferCopy) { logDumper.write(formatter != null ? formatter.format(entry) : entry.getMessage()); // depends on control dependency: [for], data = [none] } // Clean up logDumper.flush(); logDumper.close(); } }
public class class_name { public static boolean isSocketAlive(String host, int port) { boolean socketAlive = false; Socket socket = null; try { socket = new Socket(host, port); socketAlive = socket.isConnected(); } catch (Throwable t) { // do nothing } finally { if (socket != null) { try { socket.close(); } catch (IOException e) { // do nothing } } } return socketAlive; } }
public class class_name { public static boolean isSocketAlive(String host, int port) { boolean socketAlive = false; Socket socket = null; try { socket = new Socket(host, port); // depends on control dependency: [try], data = [none] socketAlive = socket.isConnected(); // depends on control dependency: [try], data = [none] } catch (Throwable t) { // do nothing } finally { // depends on control dependency: [catch], data = [none] if (socket != null) { try { socket.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { // do nothing } // depends on control dependency: [catch], data = [none] } } return socketAlive; } }
public class class_name { public void marshall(RetryStrategy retryStrategy, ProtocolMarshaller protocolMarshaller) { if (retryStrategy == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(retryStrategy.getAttempts(), ATTEMPTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RetryStrategy retryStrategy, ProtocolMarshaller protocolMarshaller) { if (retryStrategy == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(retryStrategy.getAttempts(), ATTEMPTS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void deletePropertiesExtension(GeoPackageCore geoPackage) { ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); if (geoPackage.isTable(PropertiesCoreExtension.TABLE_NAME)) { ContentsDao contentsDao = geoPackage.getContentsDao(); contentsDao.deleteTable(PropertiesCoreExtension.TABLE_NAME); } try { if (extensionsDao.isTableExists()) { extensionsDao.deleteByExtension( PropertiesCoreExtension.EXTENSION_NAME, PropertiesCoreExtension.TABLE_NAME); } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Properties extension. GeoPackage: " + geoPackage.getName(), e); } } }
public class class_name { public static void deletePropertiesExtension(GeoPackageCore geoPackage) { ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); if (geoPackage.isTable(PropertiesCoreExtension.TABLE_NAME)) { ContentsDao contentsDao = geoPackage.getContentsDao(); contentsDao.deleteTable(PropertiesCoreExtension.TABLE_NAME); // depends on control dependency: [if], data = [none] } try { if (extensionsDao.isTableExists()) { extensionsDao.deleteByExtension( PropertiesCoreExtension.EXTENSION_NAME, PropertiesCoreExtension.TABLE_NAME); // depends on control dependency: [if], data = [none] } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Properties extension. GeoPackage: " + geoPackage.getName(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final hqlParser.likeEscape_return likeEscape() throws RecognitionException { hqlParser.likeEscape_return retval = new hqlParser.likeEscape_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token ESCAPE178=null; ParserRuleReturnScope concatenation179 =null; CommonTree ESCAPE178_tree=null; try { // hql.g:483:2: ( ( ESCAPE ^ concatenation )? ) // hql.g:483:4: ( ESCAPE ^ concatenation )? { root_0 = (CommonTree)adaptor.nil(); // hql.g:483:4: ( ESCAPE ^ concatenation )? int alt63=2; int LA63_0 = input.LA(1); if ( (LA63_0==ESCAPE) ) { alt63=1; } switch (alt63) { case 1 : // hql.g:483:5: ESCAPE ^ concatenation { ESCAPE178=(Token)match(input,ESCAPE,FOLLOW_ESCAPE_in_likeEscape2228); ESCAPE178_tree = (CommonTree)adaptor.create(ESCAPE178); root_0 = (CommonTree)adaptor.becomeRoot(ESCAPE178_tree, root_0); pushFollow(FOLLOW_concatenation_in_likeEscape2231); concatenation179=concatenation(); state._fsp--; adaptor.addChild(root_0, concatenation179.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.likeEscape_return likeEscape() throws RecognitionException { hqlParser.likeEscape_return retval = new hqlParser.likeEscape_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token ESCAPE178=null; ParserRuleReturnScope concatenation179 =null; CommonTree ESCAPE178_tree=null; try { // hql.g:483:2: ( ( ESCAPE ^ concatenation )? ) // hql.g:483:4: ( ESCAPE ^ concatenation )? { root_0 = (CommonTree)adaptor.nil(); // hql.g:483:4: ( ESCAPE ^ concatenation )? int alt63=2; int LA63_0 = input.LA(1); if ( (LA63_0==ESCAPE) ) { alt63=1; // depends on control dependency: [if], data = [none] } switch (alt63) { case 1 : // hql.g:483:5: ESCAPE ^ concatenation { ESCAPE178=(Token)match(input,ESCAPE,FOLLOW_ESCAPE_in_likeEscape2228); ESCAPE178_tree = (CommonTree)adaptor.create(ESCAPE178); root_0 = (CommonTree)adaptor.becomeRoot(ESCAPE178_tree, root_0); pushFollow(FOLLOW_concatenation_in_likeEscape2231); concatenation179=concatenation(); state._fsp--; adaptor.addChild(root_0, concatenation179.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 { protected CBConnection resetSomeState() { url = null; followRedirects = CBDefaultConfig.FOLLOW_REDIRECTS; header.clear(); data = null; if (!keepMethod) { method = CBDefaultConfig.METHOD; } if (!keepCharset) { charset = CBDefaultConfig.CHARSET; } return this; } }
public class class_name { protected CBConnection resetSomeState() { url = null; followRedirects = CBDefaultConfig.FOLLOW_REDIRECTS; header.clear(); data = null; if (!keepMethod) { method = CBDefaultConfig.METHOD; // depends on control dependency: [if], data = [none] } if (!keepCharset) { charset = CBDefaultConfig.CHARSET; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { @Deprecated private String extractElements(I_CmsXmlDocument xmlDoc) { StringBuffer result = new StringBuffer(); if (xmlDoc instanceof CmsXmlPage) { List<?> locales = xmlDoc.getLocales(); Iterator<?> i = locales.iterator(); boolean firstIter = true; while (i.hasNext()) { if (!firstIter) { result.append("\n\n-----"); } Locale locale = (Locale)i.next(); result.append("\n\n[").append(locale.toString()).append(']'); List<?> elements = xmlDoc.getValues(locale); Iterator<?> j = elements.iterator(); while (j.hasNext()) { I_CmsXmlContentValue value = (I_CmsXmlContentValue)j.next(); result.append("\n\n["); // output value of name attribute result.append(value.getElement().attribute(0).getValue()); result.append("]\n\n"); I_CmsWidget widget = CmsWidgetUtil.collectWidgetInfo(value).getWidget(); result.append( widget.getWidgetStringValue( getCms(), new CmsResourceInfoDialog(getJsp()), (I_CmsWidgetParameter)value)); } firstIter = false; } } else if (xmlDoc instanceof CmsXmlContent) { CmsXmlContentTextExtractor visitor = new CmsXmlContentTextExtractor(result); ((CmsXmlContent)xmlDoc).visitAllValuesWith(visitor); } return result.toString(); } }
public class class_name { @Deprecated private String extractElements(I_CmsXmlDocument xmlDoc) { StringBuffer result = new StringBuffer(); if (xmlDoc instanceof CmsXmlPage) { List<?> locales = xmlDoc.getLocales(); Iterator<?> i = locales.iterator(); boolean firstIter = true; while (i.hasNext()) { if (!firstIter) { result.append("\n\n-----"); // depends on control dependency: [if], data = [none] } Locale locale = (Locale)i.next(); result.append("\n\n[").append(locale.toString()).append(']'); // depends on control dependency: [while], data = [none] List<?> elements = xmlDoc.getValues(locale); Iterator<?> j = elements.iterator(); while (j.hasNext()) { I_CmsXmlContentValue value = (I_CmsXmlContentValue)j.next(); result.append("\n\n["); // depends on control dependency: [while], data = [none] // output value of name attribute result.append(value.getElement().attribute(0).getValue()); // depends on control dependency: [while], data = [none] result.append("]\n\n"); // depends on control dependency: [while], data = [none] I_CmsWidget widget = CmsWidgetUtil.collectWidgetInfo(value).getWidget(); result.append( widget.getWidgetStringValue( getCms(), new CmsResourceInfoDialog(getJsp()), (I_CmsWidgetParameter)value)); // depends on control dependency: [while], data = [none] } firstIter = false; // depends on control dependency: [while], data = [none] } } else if (xmlDoc instanceof CmsXmlContent) { CmsXmlContentTextExtractor visitor = new CmsXmlContentTextExtractor(result); ((CmsXmlContent)xmlDoc).visitAllValuesWith(visitor); // depends on control dependency: [if], data = [none] } return result.toString(); } }
public class class_name { public void configure(Object configuration) { if (!(configuration instanceof Properties) && !(configuration.toString() instanceof String)) throw new IllegalArgumentException("Configuration for DAR must be of type Properties or String; " + configuration.getClass().getName() + " was received"); Properties properties = new Properties(); if (configuration instanceof String) { try { properties.load(new StringReader((String) configuration)); } catch (IOException e) { throw new IllegalArgumentException(e); } } else if (configuration instanceof Properties) { properties = (Properties) configuration; } try { defaultSipApplicationRouterInfos = this.defaultApplicationRouterParser.parse(properties); } catch (ParseException e1) { throw new IllegalArgumentException("Failed to parse the new DAR properties", e1); } String configFileLocation = defaultApplicationRouterParser.getDarConfigurationFileLocation(); if (configFileLocation.startsWith("file:/")) { int i = 5; while (configFileLocation.charAt(i) == '/') i++; configFileLocation = configFileLocation.substring(i - 1); } else { log.warn("Can not write persist DAR configuration to " + configFileLocation + ". Make sure you have write permissions and make sure it's a local file. NOTE THAT THE NEW DAR CONFIGURATION IS LOADED AND EFFECTIVE."); return; } if (configFileLocation == null || configFileLocation.length() < 1) throw new IllegalStateException("Configuration file name is empty."); File configFile = new File(configFileLocation); FileOutputStream fis = null; try { fis = new FileOutputStream(configFile); properties.store(fis, "Application Router Configuration"); } catch (Exception e) { throw new IllegalStateException("Failed to store configuration file.", e); } finally { if (fis != null) { try { fis.close(); } catch (IOException e) { log.error("fail to close the following file " + configFile.getAbsolutePath(), e); } } } log.info("Stored DAR configuration in " + configFile.getAbsolutePath()); } }
public class class_name { public void configure(Object configuration) { if (!(configuration instanceof Properties) && !(configuration.toString() instanceof String)) throw new IllegalArgumentException("Configuration for DAR must be of type Properties or String; " + configuration.getClass().getName() + " was received"); Properties properties = new Properties(); if (configuration instanceof String) { try { properties.load(new StringReader((String) configuration)); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IllegalArgumentException(e); } // depends on control dependency: [catch], data = [none] } else if (configuration instanceof Properties) { properties = (Properties) configuration; // depends on control dependency: [if], data = [none] } try { defaultSipApplicationRouterInfos = this.defaultApplicationRouterParser.parse(properties); // depends on control dependency: [try], data = [none] } catch (ParseException e1) { throw new IllegalArgumentException("Failed to parse the new DAR properties", e1); } // depends on control dependency: [catch], data = [none] String configFileLocation = defaultApplicationRouterParser.getDarConfigurationFileLocation(); if (configFileLocation.startsWith("file:/")) { int i = 5; while (configFileLocation.charAt(i) == '/') i++; configFileLocation = configFileLocation.substring(i - 1); } else { log.warn("Can not write persist DAR configuration to " + configFileLocation + ". Make sure you have write permissions and make sure it's a local file. NOTE THAT THE NEW DAR CONFIGURATION IS LOADED AND EFFECTIVE."); return; } if (configFileLocation == null || configFileLocation.length() < 1) throw new IllegalStateException("Configuration file name is empty."); File configFile = new File(configFileLocation); FileOutputStream fis = null; try { fis = new FileOutputStream(configFile); properties.store(fis, "Application Router Configuration"); } catch (Exception e) { throw new IllegalStateException("Failed to store configuration file.", e); } finally { if (fis != null) { try { fis.close(); } catch (IOException e) { log.error("fail to close the following file " + configFile.getAbsolutePath(), e); } } } log.info("Stored DAR configuration in " + configFile.getAbsolutePath()); } }
public class class_name { public void addStep(Diagram diagram) { if (diagram.getFigureCount() != figures.size()) { throw new RuntimeException("Mismatched diagrams, missing ids"); } for (int i=0;i<diagram.getFigureCount();i++) { Figure figure = diagram.getFigure(i); String id = figure.getData().getMetaData(); for (int j=0;j<figures.size();j++) { Figure existing = (Figure) figures.get(j); if (existing.getData().getMetaData().equals(id)) { MorphShape morph = (MorphShape) existing.getShape(); morph.addShape(figure.getShape()); break; } } } } }
public class class_name { public void addStep(Diagram diagram) { if (diagram.getFigureCount() != figures.size()) { throw new RuntimeException("Mismatched diagrams, missing ids"); } for (int i=0;i<diagram.getFigureCount();i++) { Figure figure = diagram.getFigure(i); String id = figure.getData().getMetaData(); for (int j=0;j<figures.size();j++) { Figure existing = (Figure) figures.get(j); if (existing.getData().getMetaData().equals(id)) { MorphShape morph = (MorphShape) existing.getShape(); morph.addShape(figure.getShape()); // depends on control dependency: [if], data = [none] break; } } } } }
public class class_name { public final boolean makesDicts() { if (!isConstructor()) { return false; } if (propAccess == PropAccess.DICT) { return true; } FunctionType superc = getSuperClassConstructor(); if (superc != null && superc.makesDicts()) { setDict(); return true; } return false; } }
public class class_name { public final boolean makesDicts() { if (!isConstructor()) { return false; // depends on control dependency: [if], data = [none] } if (propAccess == PropAccess.DICT) { return true; // depends on control dependency: [if], data = [none] } FunctionType superc = getSuperClassConstructor(); if (superc != null && superc.makesDicts()) { setDict(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { @SuppressWarnings("unchecked") public static void registerTopologyTimerEvents(Map<String, Object> conf, String name, Duration interval, Runnable task) { if (interval.isZero() || interval.isNegative()) { throw new IllegalArgumentException("Timer duration needs to be positive"); } if (!conf.containsKey(Config.TOPOLOGY_TIMER_EVENTS)) { conf.put(Config.TOPOLOGY_TIMER_EVENTS, new HashMap<String, Pair<Duration, Runnable>>()); } Map<String, Pair<Duration, Runnable>> timers = (Map<String, Pair<Duration, Runnable>>) conf.get(Config.TOPOLOGY_TIMER_EVENTS); if (timers.containsKey(name)) { throw new IllegalArgumentException("Timer with name " + name + " already exists"); } timers.put(name, Pair.of(interval, task)); } }
public class class_name { @SuppressWarnings("unchecked") public static void registerTopologyTimerEvents(Map<String, Object> conf, String name, Duration interval, Runnable task) { if (interval.isZero() || interval.isNegative()) { throw new IllegalArgumentException("Timer duration needs to be positive"); } if (!conf.containsKey(Config.TOPOLOGY_TIMER_EVENTS)) { conf.put(Config.TOPOLOGY_TIMER_EVENTS, new HashMap<String, Pair<Duration, Runnable>>()); // depends on control dependency: [if], data = [none] } Map<String, Pair<Duration, Runnable>> timers = (Map<String, Pair<Duration, Runnable>>) conf.get(Config.TOPOLOGY_TIMER_EVENTS); if (timers.containsKey(name)) { throw new IllegalArgumentException("Timer with name " + name + " already exists"); } timers.put(name, Pair.of(interval, task)); } }
public class class_name { public void openSubView(String state, boolean updateState) { if (updateState) { CmsAppWorkplaceUi.get().changeCurrentAppState(state); } Component comp = getComponentForState(state); if (comp != null) { comp.setSizeFull(); m_rootLayout.setMainContent(comp); } else { m_rootLayout.setMainContent(new Label("Malformed path, tool not available for path: " + state)); } updateSubNav(getSubNavEntries(state)); updateBreadCrumb(getBreadCrumbForState(state)); } }
public class class_name { public void openSubView(String state, boolean updateState) { if (updateState) { CmsAppWorkplaceUi.get().changeCurrentAppState(state); // depends on control dependency: [if], data = [none] } Component comp = getComponentForState(state); if (comp != null) { comp.setSizeFull(); // depends on control dependency: [if], data = [none] m_rootLayout.setMainContent(comp); // depends on control dependency: [if], data = [(comp] } else { m_rootLayout.setMainContent(new Label("Malformed path, tool not available for path: " + state)); // depends on control dependency: [if], data = [none] } updateSubNav(getSubNavEntries(state)); updateBreadCrumb(getBreadCrumbForState(state)); } }
public class class_name { static private ClientAuthnDTO.AuthenticatorType getAuthenticator( LoginInput loginInput) { if (loginInput.getAuthenticator() != null) { if (loginInput.getAuthenticator().equalsIgnoreCase( ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name())) { // SAML 2.0 compliant service/application return ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER; } else if (loginInput.getAuthenticator().equalsIgnoreCase( ClientAuthnDTO.AuthenticatorType.OAUTH.name())) { // OAuth Authentication return ClientAuthnDTO.AuthenticatorType.OAUTH; } else if (loginInput.getAuthenticator().equalsIgnoreCase( ClientAuthnDTO.AuthenticatorType.SNOWFLAKE_JWT.name())) { return ClientAuthnDTO.AuthenticatorType.SNOWFLAKE_JWT; } else if (!loginInput.getAuthenticator().equalsIgnoreCase( ClientAuthnDTO.AuthenticatorType.SNOWFLAKE.name())) { // OKTA authenticator v1. This will be deprecated once externalbrowser // is in production. return ClientAuthnDTO.AuthenticatorType.OKTA; } } // authenticator is null, then jdbc will decide authenticator depends on // if privateKey is specified or not. If yes, authenticator type will be // SNOWFLAKE_JWT, otherwise it will use SNOWFLAKE. return loginInput.getPrivateKey() != null ? ClientAuthnDTO.AuthenticatorType.SNOWFLAKE_JWT : ClientAuthnDTO.AuthenticatorType.SNOWFLAKE; } }
public class class_name { static private ClientAuthnDTO.AuthenticatorType getAuthenticator( LoginInput loginInput) { if (loginInput.getAuthenticator() != null) { if (loginInput.getAuthenticator().equalsIgnoreCase( ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name())) { // SAML 2.0 compliant service/application return ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER; // depends on control dependency: [if], data = [none] } else if (loginInput.getAuthenticator().equalsIgnoreCase( ClientAuthnDTO.AuthenticatorType.OAUTH.name())) { // OAuth Authentication return ClientAuthnDTO.AuthenticatorType.OAUTH; // depends on control dependency: [if], data = [none] } else if (loginInput.getAuthenticator().equalsIgnoreCase( ClientAuthnDTO.AuthenticatorType.SNOWFLAKE_JWT.name())) { return ClientAuthnDTO.AuthenticatorType.SNOWFLAKE_JWT; // depends on control dependency: [if], data = [none] } else if (!loginInput.getAuthenticator().equalsIgnoreCase( ClientAuthnDTO.AuthenticatorType.SNOWFLAKE.name())) { // OKTA authenticator v1. This will be deprecated once externalbrowser // is in production. return ClientAuthnDTO.AuthenticatorType.OKTA; // depends on control dependency: [if], data = [none] } } // authenticator is null, then jdbc will decide authenticator depends on // if privateKey is specified or not. If yes, authenticator type will be // SNOWFLAKE_JWT, otherwise it will use SNOWFLAKE. return loginInput.getPrivateKey() != null ? ClientAuthnDTO.AuthenticatorType.SNOWFLAKE_JWT : ClientAuthnDTO.AuthenticatorType.SNOWFLAKE; } }
public class class_name { public static String makeBytesUrlSafe(byte[] bytes) { byte[] encoded = Base64.encode(bytes); for (int i=0; i < encoded.length; i++) { switch(encoded[i]) { case '+': encoded[i] = '-'; continue; case '=': encoded[i] = '_'; continue; case '/': encoded[i] = '~'; continue; default: continue; } } return new String(encoded, UTF8); } }
public class class_name { public static String makeBytesUrlSafe(byte[] bytes) { byte[] encoded = Base64.encode(bytes); for (int i=0; i < encoded.length; i++) { switch(encoded[i]) { // depends on control dependency: [for], data = [i] case '+': encoded[i] = '-'; continue; case '=': encoded[i] = '_'; continue; case '/': encoded[i] = '~'; continue; default: continue; } } return new String(encoded, UTF8); } }
public class class_name { public static <E extends Comparable<E>> void quickSort(InplaceList<E> array) { if (array.isEmpty()) { return; } recursiveQuickSort(array, 0, array.size() - 1); } }
public class class_name { public static <E extends Comparable<E>> void quickSort(InplaceList<E> array) { if (array.isEmpty()) { return; // depends on control dependency: [if], data = [none] } recursiveQuickSort(array, 0, array.size() - 1); } }
public class class_name { public static String getEventTypeDescription(final XMLStreamReader reader) { final int eventType = reader.getEventType(); if (eventType == XMLStreamConstants.START_ELEMENT) { final String namespace = reader.getNamespaceURI(); return "<" + reader.getLocalName() + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">"; } if (eventType == XMLStreamConstants.END_ELEMENT) { final String namespace = reader.getNamespaceURI(); return "</" + reader.getLocalName() + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">"; } return NAMES_OF_EVENTS[reader.getEventType()]; } }
public class class_name { public static String getEventTypeDescription(final XMLStreamReader reader) { final int eventType = reader.getEventType(); if (eventType == XMLStreamConstants.START_ELEMENT) { final String namespace = reader.getNamespaceURI(); return "<" + reader.getLocalName() + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">"; } if (eventType == XMLStreamConstants.END_ELEMENT) { // depends on control dependency: [if], data = [none] final String namespace = reader.getNamespaceURI(); return "</" + reader.getLocalName() + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">"; } return NAMES_OF_EVENTS[reader.getEventType()]; } }
public class class_name { private static boolean maybeInitMetaDataFromHelpVar(Builder builder, @Nullable Node sibling) throws MalformedException { if ((sibling != null) && (sibling.isVar())) { Node nameNode = sibling.getFirstChild(); String name = nameNode.getString(); if (name.equals(builder.getKey() + DESC_SUFFIX)) { Node valueNode = nameNode.getFirstChild(); String desc = extractStringFromStringExprNode(valueNode); if (desc.startsWith(HIDDEN_DESC_PREFIX)) { builder.setDesc(desc.substring(HIDDEN_DESC_PREFIX.length()).trim()); builder.setIsHidden(true); } else { builder.setDesc(desc); } return true; } } return false; } }
public class class_name { private static boolean maybeInitMetaDataFromHelpVar(Builder builder, @Nullable Node sibling) throws MalformedException { if ((sibling != null) && (sibling.isVar())) { Node nameNode = sibling.getFirstChild(); String name = nameNode.getString(); if (name.equals(builder.getKey() + DESC_SUFFIX)) { Node valueNode = nameNode.getFirstChild(); String desc = extractStringFromStringExprNode(valueNode); if (desc.startsWith(HIDDEN_DESC_PREFIX)) { builder.setDesc(desc.substring(HIDDEN_DESC_PREFIX.length()).trim()); // depends on control dependency: [if], data = [none] builder.setIsHidden(true); // depends on control dependency: [if], data = [none] } else { builder.setDesc(desc); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public ListUpdatesResult withUpdateIds(String... updateIds) { if (this.updateIds == null) { setUpdateIds(new java.util.ArrayList<String>(updateIds.length)); } for (String ele : updateIds) { this.updateIds.add(ele); } return this; } }
public class class_name { public ListUpdatesResult withUpdateIds(String... updateIds) { if (this.updateIds == null) { setUpdateIds(new java.util.ArrayList<String>(updateIds.length)); // depends on control dependency: [if], data = [none] } for (String ele : updateIds) { this.updateIds.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void marshall(ListProjectsRequest listProjectsRequest, ProtocolMarshaller protocolMarshaller) { if (listProjectsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listProjectsRequest.getArn(), ARN_BINDING); protocolMarshaller.marshall(listProjectsRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListProjectsRequest listProjectsRequest, ProtocolMarshaller protocolMarshaller) { if (listProjectsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listProjectsRequest.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listProjectsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void clearAsync() { post(new Runnable() { @Override public void run() { for (T object: getObjects()) { removeObjectSync(object); } } }); } }
public class class_name { public void clearAsync() { post(new Runnable() { @Override public void run() { for (T object: getObjects()) { removeObjectSync(object); // depends on control dependency: [for], data = [object] } } }); } }
public class class_name { public String[] getRuleSetDisplayNames(ULocale loc) { String[] names = getNameListForLocale(loc); if (names != null) { return names.clone(); } names = getRuleSetNames(); for (int i = 0; i < names.length; ++i) { names[i] = names[i].substring(1); } return names; } }
public class class_name { public String[] getRuleSetDisplayNames(ULocale loc) { String[] names = getNameListForLocale(loc); if (names != null) { return names.clone(); // depends on control dependency: [if], data = [none] } names = getRuleSetNames(); for (int i = 0; i < names.length; ++i) { names[i] = names[i].substring(1); // depends on control dependency: [for], data = [i] } return names; } }
public class class_name { @Deprecated public static void ensureCorrectGroovyMetaClass(Object target, Class<?> persistentClass) { if (target instanceof GroovyObject) { GroovyObject go = ((GroovyObject)target); if (!go.getMetaClass().getTheClass().equals(persistentClass)) { go.setMetaClass(GroovySystem.getMetaClassRegistry().getMetaClass(persistentClass)); } } } }
public class class_name { @Deprecated public static void ensureCorrectGroovyMetaClass(Object target, Class<?> persistentClass) { if (target instanceof GroovyObject) { GroovyObject go = ((GroovyObject)target); if (!go.getMetaClass().getTheClass().equals(persistentClass)) { go.setMetaClass(GroovySystem.getMetaClassRegistry().getMetaClass(persistentClass)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected void setKey(String uri, String sub, int line, int col) { if (srcId == null) { srcId = split.getPath().toString(); } // apply prefix and suffix for URI uri = URIUtil.applyUriReplace(uri, conf); uri = URIUtil.applyPrefixSuffix(uri, conf); if (key == null) { key = new DocumentURIWithSourceInfo(uri, srcId, sub, line, col); } else { key.setSkipReason(""); key.setUri(uri); key.setSrcId(srcId); key.setSubId(sub); key.setColNumber(col); key.setLineNumber(line); } } }
public class class_name { protected void setKey(String uri, String sub, int line, int col) { if (srcId == null) { srcId = split.getPath().toString(); // depends on control dependency: [if], data = [none] } // apply prefix and suffix for URI uri = URIUtil.applyUriReplace(uri, conf); uri = URIUtil.applyPrefixSuffix(uri, conf); if (key == null) { key = new DocumentURIWithSourceInfo(uri, srcId, sub, line, col); // depends on control dependency: [if], data = [none] } else { key.setSkipReason(""); // depends on control dependency: [if], data = [none] key.setUri(uri); // depends on control dependency: [if], data = [none] key.setSrcId(srcId); // depends on control dependency: [if], data = [none] key.setSubId(sub); // depends on control dependency: [if], data = [none] key.setColNumber(col); // depends on control dependency: [if], data = [none] key.setLineNumber(line); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static IBond.Stereo convertStereo(int stereoValue) { IBond.Stereo stereo = IBond.Stereo.NONE; if (stereoValue == 1) { // up bond stereo = IBond.Stereo.UP; } else if (stereoValue == 6) { // down bond stereo = IBond.Stereo.DOWN; } else if (stereoValue == 0) { // bond has no stereochemistry stereo = IBond.Stereo.NONE; } else if (stereoValue == 4) { //up or down bond stereo = IBond.Stereo.UP_OR_DOWN; } else if (stereoValue == 3) { //e or z undefined stereo = IBond.Stereo.E_OR_Z; } return stereo; } }
public class class_name { public static IBond.Stereo convertStereo(int stereoValue) { IBond.Stereo stereo = IBond.Stereo.NONE; if (stereoValue == 1) { // up bond stereo = IBond.Stereo.UP; // depends on control dependency: [if], data = [none] } else if (stereoValue == 6) { // down bond stereo = IBond.Stereo.DOWN; // depends on control dependency: [if], data = [none] } else if (stereoValue == 0) { // bond has no stereochemistry stereo = IBond.Stereo.NONE; // depends on control dependency: [if], data = [none] } else if (stereoValue == 4) { //up or down bond stereo = IBond.Stereo.UP_OR_DOWN; // depends on control dependency: [if], data = [none] } else if (stereoValue == 3) { //e or z undefined stereo = IBond.Stereo.E_OR_Z; // depends on control dependency: [if], data = [none] } return stereo; } }
public class class_name { private void sync(Collection<FileDescriptor> target, Map<String, FileDescriptor> after) { Map<String, FileDescriptor> before = getCache(target); Map<String, FileDescriptor> all = new HashMap<>(); all.putAll(before); all.putAll(after); for (Map.Entry<String, FileDescriptor> entry : all.entrySet()) { String key = entry.getKey(); FileDescriptor fileDescriptor = entry.getValue(); boolean hasBefore = before.containsKey(key); boolean hasAfter = after.containsKey(key); if (hasBefore && !hasAfter) { target.remove(fileDescriptor); } else if (!hasBefore && hasAfter) { target.add(fileDescriptor); } } } }
public class class_name { private void sync(Collection<FileDescriptor> target, Map<String, FileDescriptor> after) { Map<String, FileDescriptor> before = getCache(target); Map<String, FileDescriptor> all = new HashMap<>(); all.putAll(before); all.putAll(after); for (Map.Entry<String, FileDescriptor> entry : all.entrySet()) { String key = entry.getKey(); FileDescriptor fileDescriptor = entry.getValue(); boolean hasBefore = before.containsKey(key); boolean hasAfter = after.containsKey(key); if (hasBefore && !hasAfter) { target.remove(fileDescriptor); // depends on control dependency: [if], data = [none] } else if (!hasBefore && hasAfter) { target.add(fileDescriptor); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void updateNavigationPreferences() { List<NavigationPreference> oldNavigationPreferences = new ArrayList<>(navigationPreferences); navigationPreferences.clear(); boolean selectedNavigationPreferenceFound = selectedNavigationPreference == null; for (int i = 0; i < getItemCount(); i++) { Preference item = getItem(i); if (item instanceof NavigationPreference) { NavigationPreference navigationPreference = (NavigationPreference) item; navigationPreferences.add(navigationPreference); if (selectedNavigationPreference == navigationPreference) { selectedNavigationPreferenceFound = true; } if (!oldNavigationPreferences.contains(navigationPreference)) { notifyOnNavigationPreferenceAdded(navigationPreference); oldNavigationPreferences.remove(navigationPreference); } } } for (NavigationPreference removedNavigationPreference : oldNavigationPreferences) { notifyOnNavigationPreferenceRemoved(removedNavigationPreference); } if (!selectedNavigationPreferenceFound) { if (getNavigationPreferenceCount() > 0) { selectNavigationPreference(Math.min(selectedNavigationPreferenceIndex, getNavigationPreferenceCount() - 1), null); } else { selectNavigationPreference(null, null); } } } }
public class class_name { private void updateNavigationPreferences() { List<NavigationPreference> oldNavigationPreferences = new ArrayList<>(navigationPreferences); navigationPreferences.clear(); boolean selectedNavigationPreferenceFound = selectedNavigationPreference == null; for (int i = 0; i < getItemCount(); i++) { Preference item = getItem(i); if (item instanceof NavigationPreference) { NavigationPreference navigationPreference = (NavigationPreference) item; navigationPreferences.add(navigationPreference); // depends on control dependency: [if], data = [none] if (selectedNavigationPreference == navigationPreference) { selectedNavigationPreferenceFound = true; // depends on control dependency: [if], data = [none] } if (!oldNavigationPreferences.contains(navigationPreference)) { notifyOnNavigationPreferenceAdded(navigationPreference); // depends on control dependency: [if], data = [none] oldNavigationPreferences.remove(navigationPreference); // depends on control dependency: [if], data = [none] } } } for (NavigationPreference removedNavigationPreference : oldNavigationPreferences) { notifyOnNavigationPreferenceRemoved(removedNavigationPreference); // depends on control dependency: [for], data = [removedNavigationPreference] } if (!selectedNavigationPreferenceFound) { if (getNavigationPreferenceCount() > 0) { selectNavigationPreference(Math.min(selectedNavigationPreferenceIndex, getNavigationPreferenceCount() - 1), null); // depends on control dependency: [if], data = [none] } else { selectNavigationPreference(null, null); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setHistoryRecords(java.util.Collection<HistoryRecordEntry> historyRecords) { if (historyRecords == null) { this.historyRecords = null; return; } this.historyRecords = new com.amazonaws.internal.SdkInternalList<HistoryRecordEntry>(historyRecords); } }
public class class_name { public void setHistoryRecords(java.util.Collection<HistoryRecordEntry> historyRecords) { if (historyRecords == null) { this.historyRecords = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.historyRecords = new com.amazonaws.internal.SdkInternalList<HistoryRecordEntry>(historyRecords); } }
public class class_name { public static Object[] deepBox(Class<?> resultType, final Object src) { Class<?> compType = resultType.getComponentType(); if (compType.isArray()) { final Object[] src2 = (Object[]) src; final Object[] result = (Object[]) newArray(compType, src2.length); for (int i = 0; i < src2.length; i++) { result[i] = deepBox(compType, src2[i]); } return result; } else { return boxAll(compType, src, 0, -1); } } }
public class class_name { public static Object[] deepBox(Class<?> resultType, final Object src) { Class<?> compType = resultType.getComponentType(); if (compType.isArray()) { final Object[] src2 = (Object[]) src; final Object[] result = (Object[]) newArray(compType, src2.length); for (int i = 0; i < src2.length; i++) { result[i] = deepBox(compType, src2[i]); // depends on control dependency: [for], data = [i] } return result; // depends on control dependency: [if], data = [none] } else { return boxAll(compType, src, 0, -1); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String formatBearing(List<Double[]> bearings) { if (bearings.isEmpty()) { return null; } String[] bearingFormatted = new String[bearings.size()]; for (int i = 0; i < bearings.size(); i++) { if (bearings.get(i).length == 0) { bearingFormatted[i] = ""; } else { bearingFormatted[i] = String.format(Locale.US, "%s,%s", TextUtils.formatCoordinate(bearings.get(i)[0]), TextUtils.formatCoordinate(bearings.get(i)[1])); } } return TextUtils.join(";", bearingFormatted); } }
public class class_name { public static String formatBearing(List<Double[]> bearings) { if (bearings.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } String[] bearingFormatted = new String[bearings.size()]; for (int i = 0; i < bearings.size(); i++) { if (bearings.get(i).length == 0) { bearingFormatted[i] = ""; // depends on control dependency: [if], data = [none] } else { bearingFormatted[i] = String.format(Locale.US, "%s,%s", TextUtils.formatCoordinate(bearings.get(i)[0]), TextUtils.formatCoordinate(bearings.get(i)[1])); // depends on control dependency: [if], data = [none] } } return TextUtils.join(";", bearingFormatted); } }
public class class_name { private Glyph createControlStructure(Control ctrl) { Glyph cg; Set<PhysicalEntity> controllers = getControllers(ctrl); // If no representable controller found, skip this control if (controllers.isEmpty()) { cg = null; } else if (controllers.size() == 1 && getControllerSize(ctrl.getControlledOf()) == 0) { // If there is only one controller with no modulator, put an arc for controller cg = getGlyphToLink(controllers.iterator().next(), convertID(ctrl.getUri())); } else { // This list will contain handles for each participant of the AND structure List<Glyph> toConnect = new ArrayList<Glyph>(); // Bundle controllers if necessary Glyph gg = handlePEGroup(controllers, convertID(ctrl.getUri())); if(gg != null) toConnect.add(gg); // Handle co-factors of catalysis if (ctrl instanceof Catalysis) { Set<PhysicalEntity> cofs = ((Catalysis) ctrl).getCofactor(); Glyph g = handlePEGroup(cofs, convertID(ctrl.getUri())); if (g != null) toConnect.add(g); } if (toConnect.isEmpty()) { return null; } else if (toConnect.size() == 1) { cg = toConnect.iterator().next(); } else { cg = connectWithAND(toConnect); } } return cg; } }
public class class_name { private Glyph createControlStructure(Control ctrl) { Glyph cg; Set<PhysicalEntity> controllers = getControllers(ctrl); // If no representable controller found, skip this control if (controllers.isEmpty()) { cg = null; // depends on control dependency: [if], data = [none] } else if (controllers.size() == 1 && getControllerSize(ctrl.getControlledOf()) == 0) { // If there is only one controller with no modulator, put an arc for controller cg = getGlyphToLink(controllers.iterator().next(), convertID(ctrl.getUri())); // depends on control dependency: [if], data = [none] } else { // This list will contain handles for each participant of the AND structure List<Glyph> toConnect = new ArrayList<Glyph>(); // Bundle controllers if necessary Glyph gg = handlePEGroup(controllers, convertID(ctrl.getUri())); if(gg != null) toConnect.add(gg); // Handle co-factors of catalysis if (ctrl instanceof Catalysis) { Set<PhysicalEntity> cofs = ((Catalysis) ctrl).getCofactor(); Glyph g = handlePEGroup(cofs, convertID(ctrl.getUri())); if (g != null) toConnect.add(g); } if (toConnect.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } else if (toConnect.size() == 1) { cg = toConnect.iterator().next(); // depends on control dependency: [if], data = [none] } else { cg = connectWithAND(toConnect); // depends on control dependency: [if], data = [none] } } return cg; } }
public class class_name { public final void ruleXCatchClause() throws RecognitionException { int stackSize = keepStackSize(); try { // InternalXbase.g:1521:2: ( ( ( rule__XCatchClause__Group__0 ) ) ) // InternalXbase.g:1522:2: ( ( rule__XCatchClause__Group__0 ) ) { // InternalXbase.g:1522:2: ( ( rule__XCatchClause__Group__0 ) ) // InternalXbase.g:1523:3: ( rule__XCatchClause__Group__0 ) { if ( state.backtracking==0 ) { before(grammarAccess.getXCatchClauseAccess().getGroup()); } // InternalXbase.g:1524:3: ( rule__XCatchClause__Group__0 ) // InternalXbase.g:1524:4: rule__XCatchClause__Group__0 { pushFollow(FOLLOW_2); rule__XCatchClause__Group__0(); state._fsp--; if (state.failed) return ; } if ( state.backtracking==0 ) { after(grammarAccess.getXCatchClauseAccess().getGroup()); } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { restoreStackSize(stackSize); } return ; } }
public class class_name { public final void ruleXCatchClause() throws RecognitionException { int stackSize = keepStackSize(); try { // InternalXbase.g:1521:2: ( ( ( rule__XCatchClause__Group__0 ) ) ) // InternalXbase.g:1522:2: ( ( rule__XCatchClause__Group__0 ) ) { // InternalXbase.g:1522:2: ( ( rule__XCatchClause__Group__0 ) ) // InternalXbase.g:1523:3: ( rule__XCatchClause__Group__0 ) { if ( state.backtracking==0 ) { before(grammarAccess.getXCatchClauseAccess().getGroup()); // depends on control dependency: [if], data = [none] } // InternalXbase.g:1524:3: ( rule__XCatchClause__Group__0 ) // InternalXbase.g:1524:4: rule__XCatchClause__Group__0 { pushFollow(FOLLOW_2); rule__XCatchClause__Group__0(); state._fsp--; if (state.failed) return ; } if ( state.backtracking==0 ) { after(grammarAccess.getXCatchClauseAccess().getGroup()); // depends on control dependency: [if], data = [none] } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { restoreStackSize(stackSize); } return ; } }
public class class_name { @XmlTransient public Number getFieldValueAsNumber() { Object obj = this.getFieldValue(); if(obj == null) { return null; } if(obj instanceof Number) { return (Number)obj; } return null; } }
public class class_name { @XmlTransient public Number getFieldValueAsNumber() { Object obj = this.getFieldValue(); if(obj == null) { return null; // depends on control dependency: [if], data = [none] } if(obj instanceof Number) { return (Number)obj; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public final Set<IDialect> getDialects() { if (this.initialized) { return this.configuration.getDialects(); } final Set<IDialect> dialects = new LinkedHashSet<IDialect>(this.dialectConfigurations.size()); for (final DialectConfiguration dialectConfiguration : this.dialectConfigurations) { dialects.add(dialectConfiguration.getDialect()); } return Collections.unmodifiableSet(dialects); } }
public class class_name { public final Set<IDialect> getDialects() { if (this.initialized) { return this.configuration.getDialects(); // depends on control dependency: [if], data = [none] } final Set<IDialect> dialects = new LinkedHashSet<IDialect>(this.dialectConfigurations.size()); for (final DialectConfiguration dialectConfiguration : this.dialectConfigurations) { dialects.add(dialectConfiguration.getDialect()); // depends on control dependency: [for], data = [dialectConfiguration] } return Collections.unmodifiableSet(dialects); } }
public class class_name { protected <T> CharSequence createSQLExpress(final EntityInfo<T> info, final Map<Class, String> joinTabalis) { CharSequence sb0 = this.column == null || this.column.isEmpty() || this.column.charAt(0) == '#' || info == null ? null : createElementSQLExpress(info, joinTabalis == null ? null : joinTabalis.get(info.getType())); if (this.nodes == null) return sb0; final StringBuilder rs = new StringBuilder(); rs.append('('); boolean more = false; if (sb0 != null && sb0.length() > 2) { more = true; rs.append(sb0); } for (FilterNode node : this.nodes) { CharSequence f = node.createSQLExpress(info, joinTabalis); if (f == null || f.length() < 3) continue; if (more) rs.append(or ? " OR " : " AND "); rs.append(f); more = true; } rs.append(')'); if (rs.length() < 5) return null; return rs; } }
public class class_name { protected <T> CharSequence createSQLExpress(final EntityInfo<T> info, final Map<Class, String> joinTabalis) { CharSequence sb0 = this.column == null || this.column.isEmpty() || this.column.charAt(0) == '#' || info == null ? null : createElementSQLExpress(info, joinTabalis == null ? null : joinTabalis.get(info.getType())); if (this.nodes == null) return sb0; final StringBuilder rs = new StringBuilder(); rs.append('('); boolean more = false; if (sb0 != null && sb0.length() > 2) { more = true; // depends on control dependency: [if], data = [none] rs.append(sb0); // depends on control dependency: [if], data = [(sb0] } for (FilterNode node : this.nodes) { CharSequence f = node.createSQLExpress(info, joinTabalis); if (f == null || f.length() < 3) continue; if (more) rs.append(or ? " OR " : " AND "); rs.append(f); // depends on control dependency: [for], data = [none] more = true; // depends on control dependency: [for], data = [none] } rs.append(')'); if (rs.length() < 5) return null; return rs; } }
public class class_name { private Drawable tileifyIndeterminate(Drawable drawable) { if (drawable instanceof AnimationDrawable) { AnimationDrawable background = (AnimationDrawable) drawable; final int N = background.getNumberOfFrames(); AnimationDrawable newBg = new AnimationDrawable(); newBg.setOneShot(background.isOneShot()); for (int i = 0; i < N; i++) { Drawable frame = tileify(background.getFrame(i), true); frame.setLevel(10000); newBg.addFrame(frame, background.getDuration(i)); } newBg.setLevel(10000); drawable = newBg; } return drawable; } }
public class class_name { private Drawable tileifyIndeterminate(Drawable drawable) { if (drawable instanceof AnimationDrawable) { AnimationDrawable background = (AnimationDrawable) drawable; final int N = background.getNumberOfFrames(); AnimationDrawable newBg = new AnimationDrawable(); newBg.setOneShot(background.isOneShot()); // depends on control dependency: [if], data = [none] for (int i = 0; i < N; i++) { Drawable frame = tileify(background.getFrame(i), true); frame.setLevel(10000); // depends on control dependency: [for], data = [none] newBg.addFrame(frame, background.getDuration(i)); // depends on control dependency: [for], data = [i] } newBg.setLevel(10000); // depends on control dependency: [if], data = [none] drawable = newBg; // depends on control dependency: [if], data = [none] } return drawable; } }
public class class_name { private void parseqatom(int stopper, int type, State lp, State rp, Subre top) throws RegexException { State s; /* temporaries for new states */ State s2; int m; int n; Subre atom; /* atom's subtree */ Subre t; boolean cap; /* capturing parens? */ int pos; /* positive lookahead? */ int subno; /* capturing-parens or backref number */ int atomtype; int qprefer; /* quantifier short/long preference */ int f; AtomSetter atomp; /* initial bookkeeping */ atom = null; assert lp.nouts == 0; /* must string new code */ assert rp.nins == 0; /* between lp and rp */ subno = 0; /* just to shut lint up */ /* an atom or constraint... */ atomtype = nexttype; switch (atomtype) { /* first, constraints, which end by returning */ case '^': nfa.newarc('^', (short)1, lp, rp); if (0 != (cflags & Flags.REG_NLANCH)) { nfa.newarc(BEHIND, nlcolor, lp, rp); } lex.next(); return; case '$': nfa.newarc('$', (short)1, lp, rp); if (0 != (cflags & Flags.REG_NLANCH)) { nfa.newarc(AHEAD, nlcolor, lp, rp); } lex.next(); return; case SBEGIN: nfa.newarc('^', (short)1, lp, rp); /* BOL */ nfa.newarc('^', (short)0, lp, rp); /* or BOS */ lex.next(); return; case SEND: nfa.newarc('$', (short)1, lp, rp); /* EOL */ nfa.newarc('$', (short)0, lp, rp); /* or EOS */ lex.next(); return; case '<': wordchrs(); /* does next() */ s = nfa.newstate(); nonword(BEHIND, lp, s); word(AHEAD, s, rp); return; case '>': wordchrs(); /* does next() */ s = nfa.newstate(); word(BEHIND, lp, s); nonword(AHEAD, s, rp); return; case WBDRY: wordchrs(); /* does next() */ s = nfa.newstate(); nonword(BEHIND, lp, s); word(AHEAD, s, rp); s = nfa.newstate(); word(BEHIND, lp, s); nonword(AHEAD, s, rp); return; case NWBDRY: wordchrs(); /* does next() */ s = nfa.newstate(); word(BEHIND, lp, s); word(AHEAD, s, rp); s = nfa.newstate(); nonword(BEHIND, lp, s); nonword(AHEAD, s, rp); return; case LACON: /* lookahead constraint */ pos = nextvalue; lex.next(); s = nfa.newstate(); s2 = nfa.newstate(); parse(')', LACON, s, s2); // parse for side-effect. assert see(')'); lex.next(); n = newlacon(s, s2, pos); nfa.newarc(LACON, (short)n, lp, rp); return; /* then errors, to get them out of the way */ case '*': case '+': case '?': case '{': throw new RegexException("Pattern syntax error (*+?} misplaced)."); /* then plain characters, and minor variants on that theme */ case ')': /* unbalanced paren */ if ((cflags & Flags.REG_ADVANCED) != Flags.REG_EXTENDED) { throw new RegexException("Unbalanced parenthesis."); } /* legal in EREs due to specification botch */ note(Flags.REG_UPBOTCH); /* fallthrough into case PLAIN */ case PLAIN: // look out for surrogates as ordinary chars. if (nextvalue < Character.MAX_VALUE && Character.isHighSurrogate((char)nextvalue)) { char high = (char)nextvalue; lex.next(); char low = (char)nextvalue; int codepoint = Character.toCodePoint(high, low); onechr(codepoint, lp, rp); } else { onechr(nextvalue, lp, rp); } cm.okcolors(nfa); lex.next(); break; case '[': if (nextvalue == 1) { bracket(lp, rp); } else { cbracket(lp, rp); } assert see(']'); lex.next(); break; case '.': cm.rainbow(nfa, PLAIN, (0 != (cflags & Flags.REG_NLSTOP)) ? nlcolor : Constants.COLORLESS, lp, rp); lex.next(); break; /* and finally the ugly stuff */ case '(': /* value flags as capturing or non */ if (type == LACON) { cap = false; } else { cap = nextvalue != 0; } if (cap) { subno = subs.size() + 1; // first subno is 1. /* * This recurses via a call to parse just below. * So, the size() just above has to reflect this new sub, * even though we won't create the object until a little further * down. */ subs.add(null); } else { atomtype = PLAIN; /* something that's not '(' */ } lex.next(); /* need new endpoints because tree will contain pointers */ s = nfa.newstate(); s2 = nfa.newstate(); nfa.emptyarc(lp, s); nfa.emptyarc(s2, rp); atom = parse(')', PLAIN, s, s2); assert see(')'); lex.next(); if (cap) { // we can't assert anything about the size of 'subs', recursion may have added to it. // but we can check that nothing has used our slot. assert subs.get(subno - 1) == null; subs.set(subno - 1, atom); t = new Subre('(', atom.flags | Subre.CAP, lp, rp); t.subno = subno; t.left = atom; atom = t; } /* postpone everything else pending possible {0} */ break; case BACKREF: /* the Feature From The Black Lagoon */ if (type == LACON) { throw new RegexException("REG_ESUBREG"); } if (nextvalue > subs.size()) { throw new RegexException(String.format("Backreference to %d out of range of defined subexpressions (%d)", nextvalue, subs .size())); } if (subs.get(nextvalue - 1) == null) { // \1 is first backref, living in slot 0. throw new RegexException(String.format("Backreference to %d refers to non-capturing group.", nextvalue)); } assert nextvalue > 0; atom = new Subre('b', Subre.BACKR, lp, rp); subno = nextvalue ; atom.subno = subno; nfa.emptyarc(lp, rp); /* temporarily, so there's something */ lex.next(); break; default: throw new RuntimeException("Impossible type in lex"); } /* ...and an atom may be followed by a quantifier */ switch (nexttype) { case '*': m = 0; n = INFINITY; qprefer = (nextvalue != 0) ? Subre.LONGER : Subre.SHORTER; lex.next(); break; case '+': m = 1; n = INFINITY; qprefer = (nextvalue != 0) ? Subre.LONGER : Subre.SHORTER; lex.next(); break; case '?': m = 0; n = 1; qprefer = (nextvalue != 0) ? Subre.LONGER : Subre.SHORTER; lex.next(); break; case '{': lex.next(); m = scannum(); if (eat(',')) { if (see(DIGIT)) { n = scannum(); } else { n = INFINITY; } if (m > n) { throw new RegexException("First quantity is larger than second quantity in {m,n} quantifier."); } /* {m,n} exercises preference, even if it's {m,m} */ qprefer = (nextvalue != 0) ? Subre.LONGER : Subre.SHORTER; } else { n = m; /* {m} passes operand's preference through */ qprefer = 0; } if (!see('}')) { /* catches errors too */ throw new RegexException("Invalid syntax for {m,n} quantifier."); } lex.next(); break; default: /* no quantifier */ m = 1; n = 1; qprefer = 0; break; } /* annoying special case: {0} or {0,0} cancels everything */ if (m == 0 && n == 0) { if (atomtype == '(') { assert subno == subs.size() - 1; subs.remove(subs.size() - 1); } delsub(nfa, lp, rp); nfa.emptyarc(lp, rp); return; } /* if not a messy case, avoid hard part */ assert !messy(top.flags); f = top.flags | qprefer | ((atom != null) ? atom.flags : 0); if (atomtype != '(' && atomtype != BACKREF && !messy(up(f))) { if (!(m == 1 && n == 1)) { repeat(lp, rp, m, n); } top.flags = f; return; } /* * hard part: something messy * That is, capturing parens, back reference, short/long clash, or * an atom with substructure containing one of those. */ /* now we'll need a subre for the contents even if they're boring */ if (atom == null) { atom = new Subre('=', 0, lp, rp); } /* * prepare a general-purpose state skeleton * * --. [s] ---prefix--. [begin] ---atom--. [end] ----rest--. [rp] * / / * [lp] ---. [s2] ----bypass--------------------- * * where bypass is an empty, and prefix is some repetitions of atom */ s = nfa.newstate(); /* first, new endpoints for the atom */ s2 = nfa.newstate(); nfa.moveouts(lp, s); nfa.moveins(rp, s2); atom.begin = s; atom.end = s2; s = nfa.newstate(); /* and spots for prefix and bypass */ s2 = nfa.newstate(); nfa.emptyarc(lp, s); nfa.emptyarc(lp, s2); /* break remaining subRE into x{...} and what follows */ t = new Subre('.', Subre.combine(qprefer, atom.flags), lp, rp); t.left = atom; final Subre target = t; atomp = new AtomSetter() { @Override public void set(Subre s) { target.left = s; } }; /* here we should recurse... but we must postpone that to the end */ /* split top into prefix and remaining */ assert top.op == '=' && top.left == null && top.right == null; top.left = new Subre('=', top.flags, top.begin, lp); top.op = '.'; top.right = t; /* if it's a backref, now is the time to replicate the subNFA */ if (atomtype == BACKREF) { assert atom.begin.nouts == 1; /* just the EMPTY */ delsub(nfa, atom.begin, atom.end); assert subs.get(subno - 1) != null; /* and here's why the recursion got postponed: it must */ /* wait until the skeleton is filled in, because it may */ /* hit a backref that wants to copy the filled-in skeleton */ nfa.dupnfa(subs.get(subno - 1).begin, subs.get(subno - 1).end, atom.begin, atom.end); } /* it's quantifier time; first, turn x{0,...} into x{1,...}|empty */ if (m == 0) { nfa.emptyarc(s2, atom.end); /* the bypass */ assert Subre.pref(qprefer) != 0; f = Subre.combine(qprefer, atom.flags); t = new Subre('|', f, lp, atom.end); t.left = atom; t.right = new Subre('|', Subre.pref(f), s2, atom.end); t.right.left = new Subre('=', 0, s2, atom.end); atomp.set(t); final Subre target2 = t; atomp = new AtomSetter() { @Override public void set(Subre s) { target2.left = s; } }; m = 1; } /* deal with the rest of the quantifier */ if (atomtype == BACKREF) { /* special case: backrefs have internal quantifiers */ nfa.emptyarc(s, atom.begin); /* empty prefix */ /* just stuff everything into atom */ repeat(atom.begin, atom.end, m, n); atom.min = (short)m; atom.max = (short)n; atom.flags |= Subre.combine(qprefer, atom.flags); } else if (m == 1 && n == 1) { /* no/vacuous quantifier: done */ nfa.emptyarc(s, atom.begin); /* empty prefix */ } else { /* turn x{m,n} into x{m-1,n-1}x, with capturing */ /* parens in only second x */ nfa.dupnfa(atom.begin, atom.end, s, atom.begin); assert m >= 1 && m != INFINITY && n >= 1; repeat(s, atom.begin, m - 1, (n == INFINITY) ? n : n - 1); f = Subre.combine(qprefer, atom.flags); t = new Subre('.', f, s, atom.end); /* prefix and atom */ t.left = new Subre('=', Subre.pref(f), s, atom.begin); t.right = atom; atomp.set(t); } /* and finally, look after that postponed recursion */ t = top.right; if (!(see('|') || see(stopper) || see(EOS))) { t.right = parsebranch(stopper, type, atom.end, rp, true); } else { nfa.emptyarc(atom.end, rp); t.right = new Subre('=', 0, atom.end, rp); } assert see('|') || see(stopper) || see(EOS); t.flags |= Subre.combine(t.flags, t.right.flags); top.flags |= Subre.combine(top.flags, t.flags); } }
public class class_name { private void parseqatom(int stopper, int type, State lp, State rp, Subre top) throws RegexException { State s; /* temporaries for new states */ State s2; int m; int n; Subre atom; /* atom's subtree */ Subre t; boolean cap; /* capturing parens? */ int pos; /* positive lookahead? */ int subno; /* capturing-parens or backref number */ int atomtype; int qprefer; /* quantifier short/long preference */ int f; AtomSetter atomp; /* initial bookkeeping */ atom = null; assert lp.nouts == 0; /* must string new code */ assert rp.nins == 0; /* between lp and rp */ subno = 0; /* just to shut lint up */ /* an atom or constraint... */ atomtype = nexttype; switch (atomtype) { /* first, constraints, which end by returning */ case '^': nfa.newarc('^', (short)1, lp, rp); if (0 != (cflags & Flags.REG_NLANCH)) { nfa.newarc(BEHIND, nlcolor, lp, rp); // depends on control dependency: [if], data = [none] } lex.next(); return; case '$': nfa.newarc('$', (short)1, lp, rp); if (0 != (cflags & Flags.REG_NLANCH)) { nfa.newarc(AHEAD, nlcolor, lp, rp); // depends on control dependency: [if], data = [none] } lex.next(); return; case SBEGIN: nfa.newarc('^', (short)1, lp, rp); /* BOL */ nfa.newarc('^', (short)0, lp, rp); /* or BOS */ lex.next(); return; case SEND: nfa.newarc('$', (short)1, lp, rp); /* EOL */ nfa.newarc('$', (short)0, lp, rp); /* or EOS */ lex.next(); return; case '<': wordchrs(); /* does next() */ s = nfa.newstate(); nonword(BEHIND, lp, s); word(AHEAD, s, rp); return; case '>': wordchrs(); /* does next() */ s = nfa.newstate(); word(BEHIND, lp, s); nonword(AHEAD, s, rp); return; case WBDRY: wordchrs(); /* does next() */ s = nfa.newstate(); nonword(BEHIND, lp, s); word(AHEAD, s, rp); s = nfa.newstate(); word(BEHIND, lp, s); nonword(AHEAD, s, rp); return; case NWBDRY: wordchrs(); /* does next() */ s = nfa.newstate(); word(BEHIND, lp, s); word(AHEAD, s, rp); s = nfa.newstate(); nonword(BEHIND, lp, s); nonword(AHEAD, s, rp); return; case LACON: /* lookahead constraint */ pos = nextvalue; lex.next(); s = nfa.newstate(); s2 = nfa.newstate(); parse(')', LACON, s, s2); // parse for side-effect. assert see(')'); lex.next(); n = newlacon(s, s2, pos); nfa.newarc(LACON, (short)n, lp, rp); return; /* then errors, to get them out of the way */ case '*': case '+': case '?': case '{': throw new RegexException("Pattern syntax error (*+?} misplaced)."); /* then plain characters, and minor variants on that theme */ case ')': /* unbalanced paren */ if ((cflags & Flags.REG_ADVANCED) != Flags.REG_EXTENDED) { throw new RegexException("Unbalanced parenthesis."); } /* legal in EREs due to specification botch */ note(Flags.REG_UPBOTCH); /* fallthrough into case PLAIN */ case PLAIN: // look out for surrogates as ordinary chars. if (nextvalue < Character.MAX_VALUE && Character.isHighSurrogate((char)nextvalue)) { char high = (char)nextvalue; lex.next(); // depends on control dependency: [if], data = [none] char low = (char)nextvalue; int codepoint = Character.toCodePoint(high, low); onechr(codepoint, lp, rp); // depends on control dependency: [if], data = [none] } else { onechr(nextvalue, lp, rp); // depends on control dependency: [if], data = [(nextvalue] } cm.okcolors(nfa); lex.next(); break; case '[': if (nextvalue == 1) { bracket(lp, rp); // depends on control dependency: [if], data = [none] } else { cbracket(lp, rp); // depends on control dependency: [if], data = [none] } assert see(']'); lex.next(); break; case '.': cm.rainbow(nfa, PLAIN, (0 != (cflags & Flags.REG_NLSTOP)) ? nlcolor : Constants.COLORLESS, lp, rp); lex.next(); break; /* and finally the ugly stuff */ case '(': /* value flags as capturing or non */ if (type == LACON) { cap = false; // depends on control dependency: [if], data = [none] } else { cap = nextvalue != 0; // depends on control dependency: [if], data = [none] } if (cap) { subno = subs.size() + 1; // first subno is 1. // depends on control dependency: [if], data = [none] /* * This recurses via a call to parse just below. * So, the size() just above has to reflect this new sub, * even though we won't create the object until a little further * down. */ subs.add(null); // depends on control dependency: [if], data = [none] } else { atomtype = PLAIN; /* something that's not '(' */ // depends on control dependency: [if], data = [none] } lex.next(); /* need new endpoints because tree will contain pointers */ s = nfa.newstate(); s2 = nfa.newstate(); nfa.emptyarc(lp, s); nfa.emptyarc(s2, rp); atom = parse(')', PLAIN, s, s2); assert see(')'); lex.next(); if (cap) { // we can't assert anything about the size of 'subs', recursion may have added to it. // but we can check that nothing has used our slot. assert subs.get(subno - 1) == null; // depends on control dependency: [if], data = [none] subs.set(subno - 1, atom); // depends on control dependency: [if], data = [none] t = new Subre('(', atom.flags | Subre.CAP, lp, rp); // depends on control dependency: [if], data = [none] t.subno = subno; // depends on control dependency: [if], data = [none] t.left = atom; // depends on control dependency: [if], data = [none] atom = t; // depends on control dependency: [if], data = [none] } /* postpone everything else pending possible {0} */ break; case BACKREF: /* the Feature From The Black Lagoon */ if (type == LACON) { throw new RegexException("REG_ESUBREG"); } if (nextvalue > subs.size()) { throw new RegexException(String.format("Backreference to %d out of range of defined subexpressions (%d)", nextvalue, subs .size())); } if (subs.get(nextvalue - 1) == null) { // \1 is first backref, living in slot 0. throw new RegexException(String.format("Backreference to %d refers to non-capturing group.", nextvalue)); } assert nextvalue > 0; atom = new Subre('b', Subre.BACKR, lp, rp); subno = nextvalue ; atom.subno = subno; nfa.emptyarc(lp, rp); /* temporarily, so there's something */ lex.next(); break; default: throw new RuntimeException("Impossible type in lex"); } /* ...and an atom may be followed by a quantifier */ switch (nexttype) { case '*': m = 0; n = INFINITY; qprefer = (nextvalue != 0) ? Subre.LONGER : Subre.SHORTER; lex.next(); break; case '+': m = 1; n = INFINITY; qprefer = (nextvalue != 0) ? Subre.LONGER : Subre.SHORTER; lex.next(); break; case '?': m = 0; n = 1; qprefer = (nextvalue != 0) ? Subre.LONGER : Subre.SHORTER; lex.next(); break; case '{': lex.next(); m = scannum(); if (eat(',')) { if (see(DIGIT)) { n = scannum(); // depends on control dependency: [if], data = [none] } else { n = INFINITY; // depends on control dependency: [if], data = [none] } if (m > n) { throw new RegexException("First quantity is larger than second quantity in {m,n} quantifier."); } /* {m,n} exercises preference, even if it's {m,m} */ qprefer = (nextvalue != 0) ? Subre.LONGER : Subre.SHORTER; // depends on control dependency: [if], data = [none] } else { n = m; // depends on control dependency: [if], data = [none] /* {m} passes operand's preference through */ qprefer = 0; // depends on control dependency: [if], data = [none] } if (!see('}')) { /* catches errors too */ throw new RegexException("Invalid syntax for {m,n} quantifier."); // depends on control dependency: [if], data = [none] } lex.next(); break; default: /* no quantifier */ m = 1; n = 1; qprefer = 0; break; } /* annoying special case: {0} or {0,0} cancels everything */ if (m == 0 && n == 0) { if (atomtype == '(') { assert subno == subs.size() - 1; // depends on control dependency: [if], data = [none] subs.remove(subs.size() - 1); // depends on control dependency: [if], data = [none] } delsub(nfa, lp, rp); nfa.emptyarc(lp, rp); return; } /* if not a messy case, avoid hard part */ assert !messy(top.flags); f = top.flags | qprefer | ((atom != null) ? atom.flags : 0); if (atomtype != '(' && atomtype != BACKREF && !messy(up(f))) { if (!(m == 1 && n == 1)) { repeat(lp, rp, m, n); // depends on control dependency: [if], data = [none] } top.flags = f; return; } /* * hard part: something messy * That is, capturing parens, back reference, short/long clash, or * an atom with substructure containing one of those. */ /* now we'll need a subre for the contents even if they're boring */ if (atom == null) { atom = new Subre('=', 0, lp, rp); } /* * prepare a general-purpose state skeleton * * --. [s] ---prefix--. [begin] ---atom--. [end] ----rest--. [rp] * / / * [lp] ---. [s2] ----bypass--------------------- * * where bypass is an empty, and prefix is some repetitions of atom */ s = nfa.newstate(); /* first, new endpoints for the atom */ s2 = nfa.newstate(); nfa.moveouts(lp, s); nfa.moveins(rp, s2); atom.begin = s; atom.end = s2; s = nfa.newstate(); /* and spots for prefix and bypass */ s2 = nfa.newstate(); nfa.emptyarc(lp, s); nfa.emptyarc(lp, s2); /* break remaining subRE into x{...} and what follows */ t = new Subre('.', Subre.combine(qprefer, atom.flags), lp, rp); t.left = atom; final Subre target = t; atomp = new AtomSetter() { @Override public void set(Subre s) { target.left = s; } }; /* here we should recurse... but we must postpone that to the end */ /* split top into prefix and remaining */ assert top.op == '=' && top.left == null && top.right == null; top.left = new Subre('=', top.flags, top.begin, lp); top.op = '.'; top.right = t; /* if it's a backref, now is the time to replicate the subNFA */ if (atomtype == BACKREF) { assert atom.begin.nouts == 1; /* just the EMPTY */ delsub(nfa, atom.begin, atom.end); assert subs.get(subno - 1) != null; /* and here's why the recursion got postponed: it must */ /* wait until the skeleton is filled in, because it may */ /* hit a backref that wants to copy the filled-in skeleton */ nfa.dupnfa(subs.get(subno - 1).begin, subs.get(subno - 1).end, atom.begin, atom.end); } /* it's quantifier time; first, turn x{0,...} into x{1,...}|empty */ if (m == 0) { nfa.emptyarc(s2, atom.end); /* the bypass */ assert Subre.pref(qprefer) != 0; f = Subre.combine(qprefer, atom.flags); t = new Subre('|', f, lp, atom.end); t.left = atom; t.right = new Subre('|', Subre.pref(f), s2, atom.end); t.right.left = new Subre('=', 0, s2, atom.end); atomp.set(t); final Subre target2 = t; atomp = new AtomSetter() { @Override public void set(Subre s) { target2.left = s; } }; m = 1; } /* deal with the rest of the quantifier */ if (atomtype == BACKREF) { /* special case: backrefs have internal quantifiers */ nfa.emptyarc(s, atom.begin); /* empty prefix */ /* just stuff everything into atom */ repeat(atom.begin, atom.end, m, n); atom.min = (short)m; atom.max = (short)n; atom.flags |= Subre.combine(qprefer, atom.flags); } else if (m == 1 && n == 1) { /* no/vacuous quantifier: done */ nfa.emptyarc(s, atom.begin); /* empty prefix */ } else { /* turn x{m,n} into x{m-1,n-1}x, with capturing */ /* parens in only second x */ nfa.dupnfa(atom.begin, atom.end, s, atom.begin); assert m >= 1 && m != INFINITY && n >= 1; repeat(s, atom.begin, m - 1, (n == INFINITY) ? n : n - 1); f = Subre.combine(qprefer, atom.flags); t = new Subre('.', f, s, atom.end); /* prefix and atom */ t.left = new Subre('=', Subre.pref(f), s, atom.begin); t.right = atom; atomp.set(t); } /* and finally, look after that postponed recursion */ t = top.right; if (!(see('|') || see(stopper) || see(EOS))) { t.right = parsebranch(stopper, type, atom.end, rp, true); } else { nfa.emptyarc(atom.end, rp); t.right = new Subre('=', 0, atom.end, rp); } assert see('|') || see(stopper) || see(EOS); t.flags |= Subre.combine(t.flags, t.right.flags); top.flags |= Subre.combine(top.flags, t.flags); } }
public class class_name { public static PrefsTransform lookup(TypeName typeName) { PrefsTransform transform = cache.get(typeName); if (transform != null) { return transform; } transform = getTransform(typeName); AssertKripton.assertNotNull(transform, new UnsupportedFieldTypeException(typeName)); cache.put(typeName, transform); return transform; } }
public class class_name { public static PrefsTransform lookup(TypeName typeName) { PrefsTransform transform = cache.get(typeName); if (transform != null) { return transform; // depends on control dependency: [if], data = [none] } transform = getTransform(typeName); AssertKripton.assertNotNull(transform, new UnsupportedFieldTypeException(typeName)); cache.put(typeName, transform); return transform; } }
public class class_name { private byte[] encodeParameters(Map<String, String> params, String paramsEncoding) { StringBuilder encodedParams = new StringBuilder(); try { for (Map.Entry<String, String> entry : params.entrySet()) { encodedParams.append(URLEncoder.encode(entry.getKey(), paramsEncoding)); encodedParams.append('='); encodedParams.append(URLEncoder.encode(entry.getValue(), paramsEncoding)); encodedParams.append('&'); } return encodedParams.toString().getBytes(paramsEncoding); } catch (UnsupportedEncodingException uee) { throw new RuntimeException("Encoding not supported: " + paramsEncoding, uee); } } }
public class class_name { private byte[] encodeParameters(Map<String, String> params, String paramsEncoding) { StringBuilder encodedParams = new StringBuilder(); try { for (Map.Entry<String, String> entry : params.entrySet()) { encodedParams.append(URLEncoder.encode(entry.getKey(), paramsEncoding)); // depends on control dependency: [for], data = [entry] encodedParams.append('='); // depends on control dependency: [for], data = [none] encodedParams.append(URLEncoder.encode(entry.getValue(), paramsEncoding)); // depends on control dependency: [for], data = [entry] encodedParams.append('&'); // depends on control dependency: [for], data = [none] } return encodedParams.toString().getBytes(paramsEncoding); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException uee) { throw new RuntimeException("Encoding not supported: " + paramsEncoding, uee); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void info(Object... message) { StringBuilder builder = new StringBuilder(APP_INFO); for (Object object : message) { builder.append(object.toString()); } infoStream.println(builder.toString()); } }
public class class_name { public static void info(Object... message) { StringBuilder builder = new StringBuilder(APP_INFO); for (Object object : message) { builder.append(object.toString()); // depends on control dependency: [for], data = [object] } infoStream.println(builder.toString()); } }
public class class_name { private void initWrite(List<T> datas) { if (null == this.datas) { this.datas = new ArrayList<T>(); } if (null != datas) { this.datas.addAll(datas); } } }
public class class_name { private void initWrite(List<T> datas) { if (null == this.datas) { this.datas = new ArrayList<T>(); // depends on control dependency: [if], data = [none] } if (null != datas) { this.datas.addAll(datas); // depends on control dependency: [if], data = [datas)] } } }
public class class_name { protected void extractBeanDescriptor() { Object defaultInstance = null; try { defaultInstance = getBeanClass().newInstance(); } catch (Exception e) { LOGGER.debug("Failed to create a new default instance for class " + this.beanClass + ". The BeanDescriptor will not contains any default value information.", e); } try { // Get public fields for (Class<?> currentClass = this.beanClass; currentClass != null; currentClass = currentClass.getSuperclass()) { Field[] fields = currentClass.getFields(); for (Field field : fields) { if (!Modifier.isStatic(field.getModifiers())) { extractPropertyDescriptor(field, defaultInstance); } } } // Get getter/setter based properties BeanInfo beanInfo = Introspector.getBeanInfo(this.beanClass); java.beans.PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); if (propertyDescriptors != null) { for (java.beans.PropertyDescriptor propertyDescriptor : propertyDescriptors) { if (propertyDescriptor != null) { extractPropertyDescriptor(propertyDescriptor, defaultInstance); } } } } catch (Exception e) { LOGGER.error("Failed to load bean descriptor for class " + this.beanClass, e); } } }
public class class_name { protected void extractBeanDescriptor() { Object defaultInstance = null; try { defaultInstance = getBeanClass().newInstance(); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOGGER.debug("Failed to create a new default instance for class " + this.beanClass + ". The BeanDescriptor will not contains any default value information.", e); } // depends on control dependency: [catch], data = [none] try { // Get public fields for (Class<?> currentClass = this.beanClass; currentClass != null; currentClass = currentClass.getSuperclass()) { Field[] fields = currentClass.getFields(); for (Field field : fields) { if (!Modifier.isStatic(field.getModifiers())) { extractPropertyDescriptor(field, defaultInstance); // depends on control dependency: [if], data = [none] } } } // Get getter/setter based properties BeanInfo beanInfo = Introspector.getBeanInfo(this.beanClass); java.beans.PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); if (propertyDescriptors != null) { for (java.beans.PropertyDescriptor propertyDescriptor : propertyDescriptors) { if (propertyDescriptor != null) { extractPropertyDescriptor(propertyDescriptor, defaultInstance); // depends on control dependency: [if], data = [(propertyDescriptor] } } } } catch (Exception e) { LOGGER.error("Failed to load bean descriptor for class " + this.beanClass, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public PersistenceUnitTransactionType getTransactionType() { if (persistenceUnitXml.getTransactionType() == org.wisdom.framework.jpa.model.PersistenceUnitTransactionType .RESOURCE_LOCAL) { return PersistenceUnitTransactionType.RESOURCE_LOCAL; } else { return PersistenceUnitTransactionType.JTA; } } }
public class class_name { @Override public PersistenceUnitTransactionType getTransactionType() { if (persistenceUnitXml.getTransactionType() == org.wisdom.framework.jpa.model.PersistenceUnitTransactionType .RESOURCE_LOCAL) { return PersistenceUnitTransactionType.RESOURCE_LOCAL; // depends on control dependency: [if], data = [none] } else { return PersistenceUnitTransactionType.JTA; // depends on control dependency: [if], data = [none] } } }
public class class_name { public LifecycleState getState(Object obj) { LifecycleStateWrapper lifecycleState = objectStates.get(obj); if ( lifecycleState == null ) { return hasStarted() ? LifecycleState.ACTIVE : LifecycleState.LATENT; } else { synchronized(lifecycleState) { return lifecycleState.get(); } } } }
public class class_name { public LifecycleState getState(Object obj) { LifecycleStateWrapper lifecycleState = objectStates.get(obj); if ( lifecycleState == null ) { return hasStarted() ? LifecycleState.ACTIVE : LifecycleState.LATENT; // depends on control dependency: [if], data = [none] } else { synchronized(lifecycleState) { // depends on control dependency: [if], data = [none] return lifecycleState.get(); } } } }