code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @GET @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.LOCALE_READ) public Response getAvailableLocales() { List<LocaleRepresentation> availableLocales = localeFinder.findAvailableLocales(); if (!availableLocales.isEmpty()) { return Response.ok(availableLocales).build(); } return Response.noContent().build(); } }
public class class_name { @GET @Produces(MediaType.APPLICATION_JSON) @RequiresPermissions(I18nPermissions.LOCALE_READ) public Response getAvailableLocales() { List<LocaleRepresentation> availableLocales = localeFinder.findAvailableLocales(); if (!availableLocales.isEmpty()) { return Response.ok(availableLocales).build(); // depends on control dependency: [if], data = [none] } return Response.noContent().build(); } }
public class class_name { public void writeCharacters(Characters ch) throws XMLStreamException { // Need to finish an open start element? if (mStartElementOpen) { closeStartElement(mEmptyElement); } /* Not legal outside main element tree, except if it's all * white space */ if (mCheckStructure) { if (inPrologOrEpilog()) { if (!ch.isIgnorableWhiteSpace() && !ch.isWhiteSpace()) { reportNwfStructure(ErrorConsts.WERR_PROLOG_NONWS_TEXT); } } } if (mVldContent <= XMLValidator.CONTENT_ALLOW_WS) { if (mVldContent == XMLValidator.CONTENT_ALLOW_NONE) { // never ok reportInvalidContent(CHARACTERS); } else { // all-ws is ok... if (!ch.isIgnorableWhiteSpace() && !ch.isWhiteSpace()) { reportInvalidContent(CHARACTERS); } } } else if (mVldContent == XMLValidator.CONTENT_ALLOW_VALIDATABLE_TEXT) { if (mValidator != null) { /* Last arg is false, since we do not know if more text * may be added with additional calls */ mValidator.validateText(ch.getData(), false); } } // Ok, let's just write it out: try { mWriter.writeCharacters(ch.getData()); } catch (IOException ioe) { throw new WstxIOException(ioe); } } }
public class class_name { public void writeCharacters(Characters ch) throws XMLStreamException { // Need to finish an open start element? if (mStartElementOpen) { closeStartElement(mEmptyElement); } /* Not legal outside main element tree, except if it's all * white space */ if (mCheckStructure) { if (inPrologOrEpilog()) { if (!ch.isIgnorableWhiteSpace() && !ch.isWhiteSpace()) { reportNwfStructure(ErrorConsts.WERR_PROLOG_NONWS_TEXT); // depends on control dependency: [if], data = [none] } } } if (mVldContent <= XMLValidator.CONTENT_ALLOW_WS) { if (mVldContent == XMLValidator.CONTENT_ALLOW_NONE) { // never ok reportInvalidContent(CHARACTERS); } else { // all-ws is ok... if (!ch.isIgnorableWhiteSpace() && !ch.isWhiteSpace()) { reportInvalidContent(CHARACTERS); } } } else if (mVldContent == XMLValidator.CONTENT_ALLOW_VALIDATABLE_TEXT) { if (mValidator != null) { /* Last arg is false, since we do not know if more text * may be added with additional calls */ mValidator.validateText(ch.getData(), false); } } // Ok, let's just write it out: try { mWriter.writeCharacters(ch.getData()); } catch (IOException ioe) { throw new WstxIOException(ioe); } } }
public class class_name { public String toHumanString() { final StringBuilder output = new StringBuilder(); output.append(scheme).append(':'); if (isHierarchical) { output.append("//"); final String userInfo = userInfo(); if (!userInfo.isEmpty()) { output.append(URLUtils.percentDecode(userInfo)).append('@'); } if (host != null) { if (host instanceof IPv6Address) { output.append(host.toHostString()); } else { output.append(host.toHumanString()); } } if (port != -1) { output.append(':').append(port); } if (path != null) { output.append(URLUtils.percentDecode(path)); } } else { output.append(URLUtils.percentDecode(schemeData)); } if (query != null) { output.append('?').append(URLUtils.percentDecode(query)); } if (fragment != null) { output.append('#').append(URLUtils.percentDecode(fragment)); } return output.toString(); } }
public class class_name { public String toHumanString() { final StringBuilder output = new StringBuilder(); output.append(scheme).append(':'); if (isHierarchical) { output.append("//"); final String userInfo = userInfo(); if (!userInfo.isEmpty()) { output.append(URLUtils.percentDecode(userInfo)).append('@'); // depends on control dependency: [if], data = [none] } if (host != null) { if (host instanceof IPv6Address) { output.append(host.toHostString()); // depends on control dependency: [if], data = [none] } else { output.append(host.toHumanString()); // depends on control dependency: [if], data = [none] } } if (port != -1) { output.append(':').append(port); // depends on control dependency: [if], data = [(port] } if (path != null) { output.append(URLUtils.percentDecode(path)); // depends on control dependency: [if], data = [(path] } } else { output.append(URLUtils.percentDecode(schemeData)); // depends on control dependency: [if], data = [none] } if (query != null) { output.append('?').append(URLUtils.percentDecode(query)); // depends on control dependency: [if], data = [(query] } if (fragment != null) { output.append('#').append(URLUtils.percentDecode(fragment)); // depends on control dependency: [if], data = [(fragment] } return output.toString(); } }
public class class_name { public Page getRelativePage(String relativePath) { String path = getRootPath(); if (path == null) { return null; } StringBuilder sb = new StringBuilder(path); if (!relativePath.startsWith("/")) { sb.append("/"); } sb.append(relativePath); return pageManager.getPage(sb.toString()); } }
public class class_name { public Page getRelativePage(String relativePath) { String path = getRootPath(); if (path == null) { return null; // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(path); if (!relativePath.startsWith("/")) { sb.append("/"); // depends on control dependency: [if], data = [none] } sb.append(relativePath); return pageManager.getPage(sb.toString()); } }
public class class_name { private Set<URL> filterURLs(final Set<URL> urls) { final Set<URL> results = new HashSet<URL>(urls.size()); for (final URL url : urls) { String cleanURL = url.toString(); // Fix JBoss URLs if (url.getProtocol().startsWith("vfszip:")) { cleanURL = cleanURL.replaceFirst("vfszip:", "file:"); } else if (url.getProtocol().startsWith("vfsfile:")) { cleanURL = cleanURL.replaceFirst("vfsfile:", "file:"); } cleanURL = cleanURL.replaceFirst("\\.jar/", ".jar!/"); try { results.add(new URL(cleanURL)); } catch (final MalformedURLException ex) { // Shouldn't happen, but we can't do more to fix this URL. } } return results; } }
public class class_name { private Set<URL> filterURLs(final Set<URL> urls) { final Set<URL> results = new HashSet<URL>(urls.size()); for (final URL url : urls) { String cleanURL = url.toString(); // Fix JBoss URLs if (url.getProtocol().startsWith("vfszip:")) { cleanURL = cleanURL.replaceFirst("vfszip:", "file:"); // depends on control dependency: [if], data = [none] } else if (url.getProtocol().startsWith("vfsfile:")) { cleanURL = cleanURL.replaceFirst("vfsfile:", "file:"); // depends on control dependency: [if], data = [none] } cleanURL = cleanURL.replaceFirst("\\.jar/", ".jar!/"); // depends on control dependency: [for], data = [none] try { results.add(new URL(cleanURL)); // depends on control dependency: [try], data = [none] } catch (final MalformedURLException ex) { // Shouldn't happen, but we can't do more to fix this URL. } // depends on control dependency: [catch], data = [none] } return results; } }
public class class_name { private void closeConnection( IConnection conn ) { try { if( conn != null && conn.isOpen() ) conn.close(); } catch ( OdaException e ) { // ignore e.printStackTrace(); } } }
public class class_name { private void closeConnection( IConnection conn ) { try { if( conn != null && conn.isOpen() ) conn.close(); } catch ( OdaException e ) { // ignore e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected static Map<String, String> convertProperties( CmsObject cms, Map<String, String> props, Map<String, CmsXmlContentProperty> propConfig, boolean toClient) { Map<String, String> result = new HashMap<String, String>(); for (Map.Entry<String, String> entry : props.entrySet()) { String propName = entry.getKey(); String propValue = entry.getValue(); String type = "string"; CmsXmlContentProperty configEntry = getPropertyConfig(propConfig, propName); if (configEntry != null) { type = configEntry.getType(); } String newValue = convertStringPropertyValue(cms, propValue, type, toClient); result.put(propName, newValue); } return result; } }
public class class_name { protected static Map<String, String> convertProperties( CmsObject cms, Map<String, String> props, Map<String, CmsXmlContentProperty> propConfig, boolean toClient) { Map<String, String> result = new HashMap<String, String>(); for (Map.Entry<String, String> entry : props.entrySet()) { String propName = entry.getKey(); String propValue = entry.getValue(); String type = "string"; CmsXmlContentProperty configEntry = getPropertyConfig(propConfig, propName); if (configEntry != null) { type = configEntry.getType(); // depends on control dependency: [if], data = [none] } String newValue = convertStringPropertyValue(cms, propValue, type, toClient); result.put(propName, newValue); // depends on control dependency: [for], data = [none] } return result; } }
public class class_name { public PeriodicEvent runEvery(Runnable task, float delay, float period, int repetitions) { if (repetitions < 1) { return null; } else if (repetitions == 1) { // Better to burn a handful of CPU cycles than to churn memory by // creating a new callback return runAfter(task, delay); } else { return runEvery(task, delay, period, new RunFor(repetitions)); } } }
public class class_name { public PeriodicEvent runEvery(Runnable task, float delay, float period, int repetitions) { if (repetitions < 1) { return null; // depends on control dependency: [if], data = [none] } else if (repetitions == 1) { // Better to burn a handful of CPU cycles than to churn memory by // creating a new callback return runAfter(task, delay); // depends on control dependency: [if], data = [none] } else { return runEvery(task, delay, period, new RunFor(repetitions)); // depends on control dependency: [if], data = [(repetitions] } } }
public class class_name { private static byte[] toBytes(JsonNode content) { try { return Jackson.writeValueAsBytes(content); } catch (JsonProcessingException e) { // Should never reach here. throw new Error(e); } } }
public class class_name { private static byte[] toBytes(JsonNode content) { try { return Jackson.writeValueAsBytes(content); // depends on control dependency: [try], data = [none] } catch (JsonProcessingException e) { // Should never reach here. throw new Error(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean hasCloseHeader(List<String> connectionValues) { if (connectionValues == null) { return false; } return connectionValues.stream().anyMatch(v -> v.equalsIgnoreCase("close")); } }
public class class_name { public static boolean hasCloseHeader(List<String> connectionValues) { if (connectionValues == null) { return false; // depends on control dependency: [if], data = [none] } return connectionValues.stream().anyMatch(v -> v.equalsIgnoreCase("close")); } }
public class class_name { public static void searchByCriterion(final Criterion criterion, final MapWidget mapWidget, final DataCallback<Map<VectorLayer, List<Feature>>> onFinished, final Runnable onError) { FeatureSearchRequest request = new FeatureSearchRequest(); request.setMapCrs(mapWidget.getMapModel().getCrs()); request.setCriterion(criterion); request.setLayerFilters(getLayerFiltersForCriterion(criterion, mapWidget.getMapModel())); request.setFeatureIncludes(featureIncludes); request.setMax(searchResultSize); GwtCommand commandRequest = new GwtCommand(FeatureSearchRequest.COMMAND); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<FeatureSearchResponse>() { public void execute(FeatureSearchResponse response) { onFinished.execute(convertFromDto(response.getFeatureMap(), mapWidget.getMapModel())); } @Override public void onCommunicationException(Throwable error) { if (null != onError) { onError.run(); } else { super.onCommunicationException(error); } } }); } }
public class class_name { public static void searchByCriterion(final Criterion criterion, final MapWidget mapWidget, final DataCallback<Map<VectorLayer, List<Feature>>> onFinished, final Runnable onError) { FeatureSearchRequest request = new FeatureSearchRequest(); request.setMapCrs(mapWidget.getMapModel().getCrs()); request.setCriterion(criterion); request.setLayerFilters(getLayerFiltersForCriterion(criterion, mapWidget.getMapModel())); request.setFeatureIncludes(featureIncludes); request.setMax(searchResultSize); GwtCommand commandRequest = new GwtCommand(FeatureSearchRequest.COMMAND); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<FeatureSearchResponse>() { public void execute(FeatureSearchResponse response) { onFinished.execute(convertFromDto(response.getFeatureMap(), mapWidget.getMapModel())); } @Override public void onCommunicationException(Throwable error) { if (null != onError) { onError.run(); // depends on control dependency: [if], data = [none] } else { super.onCommunicationException(error); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { public int typeExchange(Element element) { TypeMirror typeMirror = element.asType(); // Primitive if (typeMirror.getKind().isPrimitive()) { return element.asType().getKind().ordinal(); } switch (typeMirror.toString()) { case BYTE: return TypeKind.BYTE.ordinal(); case SHORT: return TypeKind.SHORT.ordinal(); case INTEGER: return TypeKind.INT.ordinal(); case LONG: return TypeKind.LONG.ordinal(); case FLOAT: return TypeKind.FLOAT.ordinal(); case DOUBEL: return TypeKind.DOUBLE.ordinal(); case BOOLEAN: return TypeKind.BOOLEAN.ordinal(); case CHAR: return TypeKind.CHAR.ordinal(); case STRING: return TypeKind.STRING.ordinal(); default: // Other side, maybe the PARCELABLE or SERIALIZABLE or OBJECT. if (types.isSubtype(typeMirror, parcelableType)) { // PARCELABLE return TypeKind.PARCELABLE.ordinal(); } else if (types.isSubtype(typeMirror, serializableType)) { // SERIALIZABLE return TypeKind.SERIALIZABLE.ordinal(); } else { return TypeKind.OBJECT.ordinal(); } } } }
public class class_name { public int typeExchange(Element element) { TypeMirror typeMirror = element.asType(); // Primitive if (typeMirror.getKind().isPrimitive()) { return element.asType().getKind().ordinal(); // depends on control dependency: [if], data = [none] } switch (typeMirror.toString()) { case BYTE: return TypeKind.BYTE.ordinal(); case SHORT: return TypeKind.SHORT.ordinal(); case INTEGER: return TypeKind.INT.ordinal(); case LONG: return TypeKind.LONG.ordinal(); case FLOAT: return TypeKind.FLOAT.ordinal(); case DOUBEL: return TypeKind.DOUBLE.ordinal(); case BOOLEAN: return TypeKind.BOOLEAN.ordinal(); case CHAR: return TypeKind.CHAR.ordinal(); case STRING: return TypeKind.STRING.ordinal(); default: // Other side, maybe the PARCELABLE or SERIALIZABLE or OBJECT. if (types.isSubtype(typeMirror, parcelableType)) { // PARCELABLE return TypeKind.PARCELABLE.ordinal(); // depends on control dependency: [if], data = [none] } else if (types.isSubtype(typeMirror, serializableType)) { // SERIALIZABLE return TypeKind.SERIALIZABLE.ordinal(); // depends on control dependency: [if], data = [none] } else { return TypeKind.OBJECT.ordinal(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public final void invokeQuery(InboxAmp inbox, StubAmp actorDeliver) { try { MethodAmp method = method(); StubAmp actorMessage = serviceRef().stub(); StubStateAmp load = actorDeliver.load(actorMessage, this); load.inPipe(actorDeliver, actorMessage, method, getHeaders(), this, _args); } catch (Throwable e) { fail(e); } } }
public class class_name { @Override public final void invokeQuery(InboxAmp inbox, StubAmp actorDeliver) { try { MethodAmp method = method(); StubAmp actorMessage = serviceRef().stub(); StubStateAmp load = actorDeliver.load(actorMessage, this); load.inPipe(actorDeliver, actorMessage, method, getHeaders(), this, _args); // depends on control dependency: [try], data = [none] } catch (Throwable e) { fail(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final void whileStatement() throws RecognitionException { int whileStatement_StartIndex = input.index(); Token s=null; ParserRuleReturnScope bs =null; JavaWhileBlockDescr wd = null; try { if ( state.backtracking>0 && alreadyParsedRule(input, 87) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:863:5: (s= 'while' parExpression bs= statement ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:865:5: s= 'while' parExpression bs= statement { s=(Token)match(input,120,FOLLOW_120_in_whileStatement3700); if (state.failed) return; pushFollow(FOLLOW_parExpression_in_whileStatement3702); parExpression(); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { wd = new JavaWhileBlockDescr( ); wd.setStart( ((CommonToken)s).getStartIndex() ); pushContainerBlockDescr(wd, true); } pushFollow(FOLLOW_statement_in_whileStatement3719); bs=statement(); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { wd.setTextStart(((CommonToken)(bs!=null?(bs.start):null)).getStartIndex() ); wd.setEnd(((CommonToken)(bs!=null?(bs.stop):null)).getStopIndex() ); popContainerBlockDescr(); } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 87, whileStatement_StartIndex); } } } }
public class class_name { public final void whileStatement() throws RecognitionException { int whileStatement_StartIndex = input.index(); Token s=null; ParserRuleReturnScope bs =null; JavaWhileBlockDescr wd = null; try { if ( state.backtracking>0 && alreadyParsedRule(input, 87) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:863:5: (s= 'while' parExpression bs= statement ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:865:5: s= 'while' parExpression bs= statement { s=(Token)match(input,120,FOLLOW_120_in_whileStatement3700); if (state.failed) return; pushFollow(FOLLOW_parExpression_in_whileStatement3702); parExpression(); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { wd = new JavaWhileBlockDescr( ); wd.setStart( ((CommonToken)s).getStartIndex() ); pushContainerBlockDescr(wd, true); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_statement_in_whileStatement3719); bs=statement(); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { wd.setTextStart(((CommonToken)(bs!=null?(bs.start):null)).getStartIndex() ); // depends on control dependency: [if], data = [none] wd.setEnd(((CommonToken)(bs!=null?(bs.stop):null)).getStopIndex() ); popContainerBlockDescr(); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 87, whileStatement_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<T> fetchList() throws SQLException, InstantiationException, IllegalAccessException { ArrayList<T> result = new ArrayList<T>(); if (primitive) { while (!finished) { result.add(fetchSinglePrimitiveInternal()); next(); } } else { while (!finished) { result.add(fetchSingleInternal()); next(); } } return result; } }
public class class_name { public List<T> fetchList() throws SQLException, InstantiationException, IllegalAccessException { ArrayList<T> result = new ArrayList<T>(); if (primitive) { while (!finished) { result.add(fetchSinglePrimitiveInternal()); // depends on control dependency: [while], data = [none] next(); // depends on control dependency: [while], data = [none] } } else { while (!finished) { result.add(fetchSingleInternal()); // depends on control dependency: [while], data = [none] next(); // depends on control dependency: [while], data = [none] } } return result; } }
public class class_name { public final void error(String message, Throwable throwable) { if (isErrorEnabled()) { out.print( "[ maven embedder ERROR] " ); out.println( message ); if (null != throwable) { throwable.printStackTrace( out ); } } } }
public class class_name { public final void error(String message, Throwable throwable) { if (isErrorEnabled()) { out.print( "[ maven embedder ERROR] " ); // depends on control dependency: [if], data = [none] out.println( message ); // depends on control dependency: [if], data = [none] if (null != throwable) { throwable.printStackTrace( out ); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public String[] getParams(String word) { for (Forest forest : forests) { if (forest == null) { continue; } SmartForest<String[]> sf = forest; for (int i = 0; i < word.length(); i++) { sf = sf.get(word.charAt(i)); if (sf == null) { return null; } } if (sf.getStatus() > 1) { return sf.getParam(); } else { return null; } } return null; } }
public class class_name { public String[] getParams(String word) { for (Forest forest : forests) { if (forest == null) { continue; } SmartForest<String[]> sf = forest; for (int i = 0; i < word.length(); i++) { sf = sf.get(word.charAt(i)); // depends on control dependency: [for], data = [i] if (sf == null) { return null; // depends on control dependency: [if], data = [none] } } if (sf.getStatus() > 1) { return sf.getParam(); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { protected Map getAllVariables(){ try{ Iterator names = FreeMarkerTL.getEnvironment().getKnownVariableNames().iterator(); Map vars = new HashMap(); while (names.hasNext()) { Object name =names.next(); vars.put(name, get(name.toString())); } return vars; }catch(Exception e){ throw new ViewException(e); } } }
public class class_name { protected Map getAllVariables(){ try{ Iterator names = FreeMarkerTL.getEnvironment().getKnownVariableNames().iterator(); Map vars = new HashMap(); while (names.hasNext()) { Object name =names.next(); vars.put(name, get(name.toString())); // depends on control dependency: [while], data = [none] } return vars; // depends on control dependency: [try], data = [none] }catch(Exception e){ throw new ViewException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Cron map(final Cron cron) { Preconditions.checkNotNull(cron, "Cron must not be null"); final List<CronField> fields = new ArrayList<>(); for (final CronFieldName name : CronFieldName.values()) { if (mappings.containsKey(name)) { fields.add(mappings.get(name).apply(cron.retrieve(name))); } } return cronRules.apply(new SingleCron(to, fields)).validate(); } }
public class class_name { public Cron map(final Cron cron) { Preconditions.checkNotNull(cron, "Cron must not be null"); final List<CronField> fields = new ArrayList<>(); for (final CronFieldName name : CronFieldName.values()) { if (mappings.containsKey(name)) { fields.add(mappings.get(name).apply(cron.retrieve(name))); // depends on control dependency: [if], data = [none] } } return cronRules.apply(new SingleCron(to, fields)).validate(); } }
public class class_name { @Override protected void _fit(Dataframe trainingData) { knowledgeBase.getTrainingParameters().getSvmParameter().probability=1; //probabilities are required from the algorithm ModelParameters modelParameters = knowledgeBase.getModelParameters(); Map<Object, Integer> featureIds = modelParameters.getFeatureIds(); Map<Object, Integer> classIds = modelParameters.getClassIds(); Set<Object> classesSet = modelParameters.getClasses(); //we need to maintain this because inherited code relies on it //build the classIds and featureIds maps int classId = 0; int featureId = 0; for(Record r : trainingData) { Object theClass=r.getY(); if(classesSet.add(theClass)) { classIds.put(theClass, classId++); } for(Map.Entry<Object, Object> entry : r.getX().entrySet()) { Object feature = entry.getKey(); if(featureIds.putIfAbsent(feature, featureId) == null) { featureId++; } } } //calling the method that handles the training with LibSVM library libSVMTrainer(trainingData); } }
public class class_name { @Override protected void _fit(Dataframe trainingData) { knowledgeBase.getTrainingParameters().getSvmParameter().probability=1; //probabilities are required from the algorithm ModelParameters modelParameters = knowledgeBase.getModelParameters(); Map<Object, Integer> featureIds = modelParameters.getFeatureIds(); Map<Object, Integer> classIds = modelParameters.getClassIds(); Set<Object> classesSet = modelParameters.getClasses(); //we need to maintain this because inherited code relies on it //build the classIds and featureIds maps int classId = 0; int featureId = 0; for(Record r : trainingData) { Object theClass=r.getY(); if(classesSet.add(theClass)) { classIds.put(theClass, classId++); // depends on control dependency: [if], data = [none] } for(Map.Entry<Object, Object> entry : r.getX().entrySet()) { Object feature = entry.getKey(); if(featureIds.putIfAbsent(feature, featureId) == null) { featureId++; // depends on control dependency: [if], data = [none] } } } //calling the method that handles the training with LibSVM library libSVMTrainer(trainingData); } }
public class class_name { public static void process(GrayU8 orig, GrayS16 derivXX, GrayS16 derivYY, GrayS16 derivXY , ImageBorder_S32 border ) { InputSanityCheck.reshapeOneIn(orig, derivXX, derivYY, derivXY); HessianThree_Standard.process(orig, derivXX, derivYY,derivXY); if( border != null ) { DerivativeHelperFunctions.processBorderHorizontal(orig, derivXX ,kernelXXYY_I32, border ); DerivativeHelperFunctions.processBorderVertical(orig, derivYY ,kernelXXYY_I32, border ); ConvolveJustBorder_General_SB.convolve(kernelCross_I32, border,derivXY); } } }
public class class_name { public static void process(GrayU8 orig, GrayS16 derivXX, GrayS16 derivYY, GrayS16 derivXY , ImageBorder_S32 border ) { InputSanityCheck.reshapeOneIn(orig, derivXX, derivYY, derivXY); HessianThree_Standard.process(orig, derivXX, derivYY,derivXY); if( border != null ) { DerivativeHelperFunctions.processBorderHorizontal(orig, derivXX ,kernelXXYY_I32, border ); // depends on control dependency: [if], data = [none] DerivativeHelperFunctions.processBorderVertical(orig, derivYY ,kernelXXYY_I32, border ); // depends on control dependency: [if], data = [none] ConvolveJustBorder_General_SB.convolve(kernelCross_I32, border,derivXY); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected int marshalMessagesToSameDestination(Address dest, Message[] buf, int start_index, final int end_index, int max_bundle_size) throws Exception { int num_msgs=0, bytes=0; for(;;) { Message msg=buf[start_index]; if(msg != null && Objects.equals(dest, msg.dest())) { long size=msg.size(); if(bytes + size > max_bundle_size) break; bytes+=size; num_msgs++; buf[start_index]=null; msg.writeToNoAddrs(msg.src(), output, transport.getId()); } if(start_index == end_index) break; start_index=advance(start_index); } return num_msgs; } }
public class class_name { protected int marshalMessagesToSameDestination(Address dest, Message[] buf, int start_index, final int end_index, int max_bundle_size) throws Exception { int num_msgs=0, bytes=0; for(;;) { Message msg=buf[start_index]; if(msg != null && Objects.equals(dest, msg.dest())) { long size=msg.size(); if(bytes + size > max_bundle_size) break; bytes+=size; // depends on control dependency: [if], data = [none] num_msgs++; // depends on control dependency: [if], data = [none] buf[start_index]=null; // depends on control dependency: [if], data = [none] msg.writeToNoAddrs(msg.src(), output, transport.getId()); // depends on control dependency: [if], data = [(msg] } if(start_index == end_index) break; start_index=advance(start_index); } return num_msgs; } }
public class class_name { public void marshall(ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes, ProtocolMarshaller protocolMarshaller) { if (activityTaskFailedEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(activityTaskFailedEventAttributes.getReason(), REASON_BINDING); protocolMarshaller.marshall(activityTaskFailedEventAttributes.getDetails(), DETAILS_BINDING); protocolMarshaller.marshall(activityTaskFailedEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_BINDING); protocolMarshaller.marshall(activityTaskFailedEventAttributes.getStartedEventId(), STARTEDEVENTID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes, ProtocolMarshaller protocolMarshaller) { if (activityTaskFailedEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(activityTaskFailedEventAttributes.getReason(), REASON_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(activityTaskFailedEventAttributes.getDetails(), DETAILS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(activityTaskFailedEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(activityTaskFailedEventAttributes.getStartedEventId(), STARTEDEVENTID_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 void updateHubHeartbeatSelf() { _isHubHeartbeatSelf = true; if (_hubHeartbeatCount < 2) { for (Result<Boolean> result : _hubHeartbeatList) { result.ok(true); } _hubHeartbeatList.clear(); } } }
public class class_name { private void updateHubHeartbeatSelf() { _isHubHeartbeatSelf = true; if (_hubHeartbeatCount < 2) { for (Result<Boolean> result : _hubHeartbeatList) { result.ok(true); // depends on control dependency: [for], data = [result] } _hubHeartbeatList.clear(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public EClass getIfcElementarySurface() { if (ifcElementarySurfaceEClass == null) { ifcElementarySurfaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(228); } return ifcElementarySurfaceEClass; } }
public class class_name { @Override public EClass getIfcElementarySurface() { if (ifcElementarySurfaceEClass == null) { ifcElementarySurfaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(228); // depends on control dependency: [if], data = [none] } return ifcElementarySurfaceEClass; } }
public class class_name { private void releaseAllBlocks() throws IOException { synchronized (m_accessLock) { Set<Map.Entry<BlockId, Path>> entries = m_blockPathMap.entrySet(); while (! entries.isEmpty()) { Map.Entry<BlockId, Path> entry = entries.iterator().next(); Files.delete(entry.getValue()); m_blockPathMap.remove(entry.getKey()); entries = m_blockPathMap.entrySet(); } } } }
public class class_name { private void releaseAllBlocks() throws IOException { synchronized (m_accessLock) { Set<Map.Entry<BlockId, Path>> entries = m_blockPathMap.entrySet(); while (! entries.isEmpty()) { Map.Entry<BlockId, Path> entry = entries.iterator().next(); Files.delete(entry.getValue()); // depends on control dependency: [while], data = [none] m_blockPathMap.remove(entry.getKey()); // depends on control dependency: [while], data = [none] entries = m_blockPathMap.entrySet(); // depends on control dependency: [while], data = [none] } } } }
public class class_name { public Observable<ServiceResponse<ApplicationGatewaySslPredefinedPolicyInner>> getSslPredefinedPolicyWithServiceResponseAsync(String predefinedPolicyName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (predefinedPolicyName == null) { throw new IllegalArgumentException("Parameter predefinedPolicyName is required and cannot be null."); } final String apiVersion = "2018-07-01"; return service.getSslPredefinedPolicy(this.client.subscriptionId(), predefinedPolicyName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ApplicationGatewaySslPredefinedPolicyInner>>>() { @Override public Observable<ServiceResponse<ApplicationGatewaySslPredefinedPolicyInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ApplicationGatewaySslPredefinedPolicyInner> clientResponse = getSslPredefinedPolicyDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<ApplicationGatewaySslPredefinedPolicyInner>> getSslPredefinedPolicyWithServiceResponseAsync(String predefinedPolicyName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (predefinedPolicyName == null) { throw new IllegalArgumentException("Parameter predefinedPolicyName is required and cannot be null."); } final String apiVersion = "2018-07-01"; return service.getSslPredefinedPolicy(this.client.subscriptionId(), predefinedPolicyName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ApplicationGatewaySslPredefinedPolicyInner>>>() { @Override public Observable<ServiceResponse<ApplicationGatewaySslPredefinedPolicyInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ApplicationGatewaySslPredefinedPolicyInner> clientResponse = getSslPredefinedPolicyDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public String cluster() { if (d1 == 0) { // Application portion is empty return null; } else { return (dN > 0 && dN == asg.length()) ? asg() : substr(asg, 0, dN); } } }
public class class_name { public String cluster() { if (d1 == 0) { // Application portion is empty return null; // depends on control dependency: [if], data = [none] } else { return (dN > 0 && dN == asg.length()) ? asg() : substr(asg, 0, dN); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<T> getChildren(T payload) { List<T> children = new ArrayList<>(); if (!mIndex.containsKey(payload)) { return children; } DirectedAcyclicGraphNode<T> node = mIndex.get(payload); for (DirectedAcyclicGraphNode<T> child : node.getChildren()) { children.add(child.getPayload()); } return children; } }
public class class_name { public List<T> getChildren(T payload) { List<T> children = new ArrayList<>(); if (!mIndex.containsKey(payload)) { return children; // depends on control dependency: [if], data = [none] } DirectedAcyclicGraphNode<T> node = mIndex.get(payload); for (DirectedAcyclicGraphNode<T> child : node.getChildren()) { children.add(child.getPayload()); // depends on control dependency: [for], data = [child] } return children; } }
public class class_name { public void marshall(ReportDefinition reportDefinition, ProtocolMarshaller protocolMarshaller) { if (reportDefinition == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(reportDefinition.getReportName(), REPORTNAME_BINDING); protocolMarshaller.marshall(reportDefinition.getTimeUnit(), TIMEUNIT_BINDING); protocolMarshaller.marshall(reportDefinition.getFormat(), FORMAT_BINDING); protocolMarshaller.marshall(reportDefinition.getCompression(), COMPRESSION_BINDING); protocolMarshaller.marshall(reportDefinition.getAdditionalSchemaElements(), ADDITIONALSCHEMAELEMENTS_BINDING); protocolMarshaller.marshall(reportDefinition.getS3Bucket(), S3BUCKET_BINDING); protocolMarshaller.marshall(reportDefinition.getS3Prefix(), S3PREFIX_BINDING); protocolMarshaller.marshall(reportDefinition.getS3Region(), S3REGION_BINDING); protocolMarshaller.marshall(reportDefinition.getAdditionalArtifacts(), ADDITIONALARTIFACTS_BINDING); protocolMarshaller.marshall(reportDefinition.getRefreshClosedReports(), REFRESHCLOSEDREPORTS_BINDING); protocolMarshaller.marshall(reportDefinition.getReportVersioning(), REPORTVERSIONING_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ReportDefinition reportDefinition, ProtocolMarshaller protocolMarshaller) { if (reportDefinition == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(reportDefinition.getReportName(), REPORTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getTimeUnit(), TIMEUNIT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getFormat(), FORMAT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getCompression(), COMPRESSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getAdditionalSchemaElements(), ADDITIONALSCHEMAELEMENTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getS3Bucket(), S3BUCKET_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getS3Prefix(), S3PREFIX_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getS3Region(), S3REGION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getAdditionalArtifacts(), ADDITIONALARTIFACTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getRefreshClosedReports(), REFRESHCLOSEDREPORTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reportDefinition.getReportVersioning(), REPORTVERSIONING_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 { @JsonIgnore @SuppressWarnings("unchecked") public Map<String, Object> getDataMap() { if (data instanceof Map) { return (Map<String, Object>) data; } return Collections.emptyMap(); } }
public class class_name { @JsonIgnore @SuppressWarnings("unchecked") public Map<String, Object> getDataMap() { if (data instanceof Map) { return (Map<String, Object>) data; // depends on control dependency: [if], data = [none] } return Collections.emptyMap(); } }
public class class_name { public void actionDeleteResource() throws JspException { if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) { // only delete resource if dialog mode is a wizard mode try { getCms().deleteResource(getParamResource(), CmsResource.DELETE_PRESERVE_SIBLINGS); } catch (Throwable e) { // error deleting the resource, show error dialog includeErrorpage(this, e); } } } }
public class class_name { public void actionDeleteResource() throws JspException { if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) { // only delete resource if dialog mode is a wizard mode try { getCms().deleteResource(getParamResource(), CmsResource.DELETE_PRESERVE_SIBLINGS); // depends on control dependency: [try], data = [none] } catch (Throwable e) { // error deleting the resource, show error dialog includeErrorpage(this, e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public final Span[] multiWordsToSpans(final String[] tokens) { final List<Span> multiWordsFound = new LinkedList<Span>(); for (int offsetFrom = 0; offsetFrom < tokens.length; offsetFrom++) { Span multiwordFound = null; String tokensSearching[] = new String[] {}; for (int offsetTo = offsetFrom; offsetTo < tokens.length; offsetTo++) { final int lengthSearching = offsetTo - offsetFrom + 1; if (lengthSearching > getMaxTokenCount()) { break; } else { tokensSearching = new String[lengthSearching]; System.arraycopy(tokens, offsetFrom, tokensSearching, 0, lengthSearching); final String entryForSearch = StringUtils .getStringFromTokens(tokensSearching); final String entryValue = dictionary .get(entryForSearch.toLowerCase()); if (entryValue != null) { multiwordFound = new Span(offsetFrom, offsetTo + 1, entryValue); } } } if (multiwordFound != null) { multiWordsFound.add(multiwordFound); offsetFrom += multiwordFound.length() - 1; } } return multiWordsFound.toArray(new Span[multiWordsFound.size()]); } }
public class class_name { public final Span[] multiWordsToSpans(final String[] tokens) { final List<Span> multiWordsFound = new LinkedList<Span>(); for (int offsetFrom = 0; offsetFrom < tokens.length; offsetFrom++) { Span multiwordFound = null; String tokensSearching[] = new String[] {}; for (int offsetTo = offsetFrom; offsetTo < tokens.length; offsetTo++) { final int lengthSearching = offsetTo - offsetFrom + 1; if (lengthSearching > getMaxTokenCount()) { break; } else { tokensSearching = new String[lengthSearching]; // depends on control dependency: [if], data = [none] System.arraycopy(tokens, offsetFrom, tokensSearching, 0, lengthSearching); // depends on control dependency: [if], data = [none] final String entryForSearch = StringUtils .getStringFromTokens(tokensSearching); final String entryValue = dictionary .get(entryForSearch.toLowerCase()); if (entryValue != null) { multiwordFound = new Span(offsetFrom, offsetTo + 1, entryValue); // depends on control dependency: [if], data = [none] } } } if (multiwordFound != null) { multiWordsFound.add(multiwordFound); // depends on control dependency: [if], data = [(multiwordFound] offsetFrom += multiwordFound.length() - 1; // depends on control dependency: [if], data = [none] } } return multiWordsFound.toArray(new Span[multiWordsFound.size()]); } }
public class class_name { private void processIntegerReturn() { if ((sawConstant == null) && (stack.getStackDepth() == 0)) { throw new StopOpcodeParsingException(); } Integer returnValue = null; if (sawConstant == null) { OpcodeStack.Item item = stack.getStackItem(0); returnValue = (Integer) item.getConstant(); } else { returnValue = sawConstant; } if (returnValue == null) { throw new StopOpcodeParsingException(); } int v = returnValue.intValue(); if (v < 0) { seenNegative = true; if (getPC() > furthestBranchTarget) { seenUnconditionalNonZero = true; } } else if (v > 0) { seenPositive = true; if (getPC() > furthestBranchTarget) { seenUnconditionalNonZero = true; } } else { seenZero = true; } sawConstant = null; } }
public class class_name { private void processIntegerReturn() { if ((sawConstant == null) && (stack.getStackDepth() == 0)) { throw new StopOpcodeParsingException(); } Integer returnValue = null; if (sawConstant == null) { OpcodeStack.Item item = stack.getStackItem(0); returnValue = (Integer) item.getConstant(); // depends on control dependency: [if], data = [none] } else { returnValue = sawConstant; // depends on control dependency: [if], data = [none] } if (returnValue == null) { throw new StopOpcodeParsingException(); } int v = returnValue.intValue(); if (v < 0) { seenNegative = true; // depends on control dependency: [if], data = [none] if (getPC() > furthestBranchTarget) { seenUnconditionalNonZero = true; // depends on control dependency: [if], data = [none] } } else if (v > 0) { seenPositive = true; // depends on control dependency: [if], data = [none] if (getPC() > furthestBranchTarget) { seenUnconditionalNonZero = true; // depends on control dependency: [if], data = [none] } } else { seenZero = true; // depends on control dependency: [if], data = [none] } sawConstant = null; } }
public class class_name { private static String generateKey(int num) { Random random = new Random(); String key = ""; for (int x = 0; x < num; x++) { key += CHARACTERS[random.nextInt(CHARACTERS.length)]; } return key; } }
public class class_name { private static String generateKey(int num) { Random random = new Random(); String key = ""; for (int x = 0; x < num; x++) { key += CHARACTERS[random.nextInt(CHARACTERS.length)]; // depends on control dependency: [for], data = [none] } return key; } }
public class class_name { public void updateIndices(ApiType oldObj, ApiType newObj, String key) { // if we got an old object, we need to remove it before we can add // it again. if (oldObj != null) { deleteFromIndices(oldObj, key); } for (Map.Entry<String, Function<ApiType, List<String>>> indexEntry : indexers.entrySet()) { String indexName = indexEntry.getKey(); Function<ApiType, List<String>> indexFunc = indexEntry.getValue(); List<String> indexValues = indexFunc.apply(newObj); if (io.kubernetes.client.util.common.Collections.isEmptyCollection(indexValues)) { continue; } Map<String, Set<String>> index = this.indices.computeIfAbsent(indexName, k -> new HashMap<>()); for (String indexValue : indexValues) { Set<String> indexSet = index.computeIfAbsent(indexValue, k -> new HashSet<>()); indexSet.add(key); } } } }
public class class_name { public void updateIndices(ApiType oldObj, ApiType newObj, String key) { // if we got an old object, we need to remove it before we can add // it again. if (oldObj != null) { deleteFromIndices(oldObj, key); // depends on control dependency: [if], data = [(oldObj] } for (Map.Entry<String, Function<ApiType, List<String>>> indexEntry : indexers.entrySet()) { String indexName = indexEntry.getKey(); Function<ApiType, List<String>> indexFunc = indexEntry.getValue(); List<String> indexValues = indexFunc.apply(newObj); if (io.kubernetes.client.util.common.Collections.isEmptyCollection(indexValues)) { continue; } Map<String, Set<String>> index = this.indices.computeIfAbsent(indexName, k -> new HashMap<>()); for (String indexValue : indexValues) { Set<String> indexSet = index.computeIfAbsent(indexValue, k -> new HashSet<>()); indexSet.add(key); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public static <E extends Enum<? extends Style.HasCssName>> void removeEnumStyleNames(final UIObject uiObject, final Class<E> enumClass) { for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) { final String cssClass = ((Style.HasCssName) constant).getCssName(); if (cssClass != null && !cssClass.isEmpty()) { uiObject.removeStyleName(cssClass); } } } }
public class class_name { public static <E extends Enum<? extends Style.HasCssName>> void removeEnumStyleNames(final UIObject uiObject, final Class<E> enumClass) { for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) { final String cssClass = ((Style.HasCssName) constant).getCssName(); if (cssClass != null && !cssClass.isEmpty()) { uiObject.removeStyleName(cssClass); // depends on control dependency: [if], data = [(cssClass] } } } }
public class class_name { protected Mono<ServerResponse> renderDefaultErrorView( ServerResponse.BodyBuilder responseBody, Map<String, Object> error) { StringBuilder builder = new StringBuilder(); Date timestamp = (Date) error.get("timestamp"); Object message = error.get("message"); Object trace = error.get("trace"); Object requestId = error.get("requestId"); builder.append("<html><body><h1>Whitelabel Error Page</h1>").append( "<p>This application has no configured error view, so you are seeing this as a fallback.</p>") .append("<div id='created'>").append(timestamp).append("</div>") .append("<div>[").append(requestId) .append("] There was an unexpected error (type=") .append(htmlEscape(error.get("error"))).append(", status=") .append(htmlEscape(error.get("status"))).append(").</div>"); if (message != null) { builder.append("<div>").append(htmlEscape(message)).append("</div>"); } if (trace != null) { builder.append("<div style='white-space:pre-wrap;'>") .append(htmlEscape(trace)).append("</div>"); } builder.append("</body></html>"); return responseBody.syncBody(builder.toString()); } }
public class class_name { protected Mono<ServerResponse> renderDefaultErrorView( ServerResponse.BodyBuilder responseBody, Map<String, Object> error) { StringBuilder builder = new StringBuilder(); Date timestamp = (Date) error.get("timestamp"); Object message = error.get("message"); Object trace = error.get("trace"); Object requestId = error.get("requestId"); builder.append("<html><body><h1>Whitelabel Error Page</h1>").append( "<p>This application has no configured error view, so you are seeing this as a fallback.</p>") .append("<div id='created'>").append(timestamp).append("</div>") .append("<div>[").append(requestId) .append("] There was an unexpected error (type=") .append(htmlEscape(error.get("error"))).append(", status=") .append(htmlEscape(error.get("status"))).append(").</div>"); if (message != null) { builder.append("<div>").append(htmlEscape(message)).append("</div>"); // depends on control dependency: [if], data = [(message] } if (trace != null) { builder.append("<div style='white-space:pre-wrap;'>") .append(htmlEscape(trace)).append("</div>"); // depends on control dependency: [if], data = [none] } builder.append("</body></html>"); return responseBody.syncBody(builder.toString()); } }
public class class_name { protected Actor prepareActor() { final LmlActorBuilder builder = getNewInstanceOfBuilder(); final ObjectSet<String> processedAttributes = GdxSets.newSet(); addDefaultAttributes(); processBuildingAttributes(builder, processedAttributes); final Actor actor; try { actor = getNewInstanceOfActor(builder); } catch (final Exception exception) { getParser().throwError("Unable to create a new instance of actor with tag: " + getTagName(), exception); return null; } builder.finishBuilding(actor); processTagAttributes(processedAttributes, actor, getManagedObject()); invokeOnCreateActions(actor); return actor; } }
public class class_name { protected Actor prepareActor() { final LmlActorBuilder builder = getNewInstanceOfBuilder(); final ObjectSet<String> processedAttributes = GdxSets.newSet(); addDefaultAttributes(); processBuildingAttributes(builder, processedAttributes); final Actor actor; try { actor = getNewInstanceOfActor(builder); // depends on control dependency: [try], data = [none] } catch (final Exception exception) { getParser().throwError("Unable to create a new instance of actor with tag: " + getTagName(), exception); return null; } // depends on control dependency: [catch], data = [none] builder.finishBuilding(actor); processTagAttributes(processedAttributes, actor, getManagedObject()); invokeOnCreateActions(actor); return actor; } }
public class class_name { public JStormCache putMetricData(String topologyId, TopologyMetric tpMetric) { // map<key, [ts, metric_info]> Map<String, Object> batchData = new HashMap<>(); long ts = System.currentTimeMillis(); int tp = 0, comp = 0, compStream = 0, task = 0, stream = 0, worker = 0, netty = 0; if (tpMetric.get_componentMetric().get_metrics_size() > 0) { batchData.put(METRIC_DATA_30M_COMPONENT + topologyId, new Object[]{ts, tpMetric.get_componentMetric()}); comp += tpMetric.get_componentMetric().get_metrics_size(); } if (tpMetric.is_set_compStreamMetric() && tpMetric.get_compStreamMetric().get_metrics_size() > 0) { batchData.put(METRIC_DATA_30M_COMP_STREAM + topologyId, new Object[]{ts, tpMetric.get_compStreamMetric()}); compStream += tpMetric.get_compStreamMetric().get_metrics_size(); } if (tpMetric.get_taskMetric().get_metrics_size() > 0) { tryCombineMetricInfo(METRIC_DATA_30M_TASK + topologyId, tpMetric.get_taskMetric(), MetaType.TASK, ts); task += tpMetric.get_taskMetric().get_metrics_size(); } if (tpMetric.get_streamMetric().get_metrics_size() > 0) { tryCombineMetricInfo(METRIC_DATA_30M_STREAM + topologyId, tpMetric.get_streamMetric(), MetaType.STREAM, ts); stream += tpMetric.get_streamMetric().get_metrics_size(); } if (tpMetric.get_workerMetric().get_metrics_size() > 0) { tryCombineMetricInfo(METRIC_DATA_30M_WORKER + topologyId, tpMetric.get_workerMetric(), MetaType.WORKER, ts); worker += tpMetric.get_workerMetric().get_metrics_size(); } if (tpMetric.get_nettyMetric().get_metrics_size() > 0) { tryCombineMetricInfo(METRIC_DATA_30M_NETTY + topologyId, tpMetric.get_nettyMetric(), MetaType.NETTY, ts); netty += tpMetric.get_nettyMetric().get_metrics_size(); } // store 30 snapshots of topology metrics if (tpMetric.get_topologyMetric().get_metrics_size() > 0) { String keyPrefix = METRIC_DATA_30M_TOPOLOGY + topologyId + "-"; int page = getRingAvailableIndex(keyPrefix); batchData.put(keyPrefix + page, new Object[]{ts, tpMetric.get_topologyMetric()}); tp += tpMetric.get_topologyMetric().get_metrics_size(); } LOG.info("caching metric data for topology:{},tp:{},comp:{},comp_stream:{},task:{},stream:{},worker:{},netty:{},cost:{}", topologyId, tp, comp, compStream, task, stream, worker, netty, System.currentTimeMillis() - ts); return putBatch(batchData); } }
public class class_name { public JStormCache putMetricData(String topologyId, TopologyMetric tpMetric) { // map<key, [ts, metric_info]> Map<String, Object> batchData = new HashMap<>(); long ts = System.currentTimeMillis(); int tp = 0, comp = 0, compStream = 0, task = 0, stream = 0, worker = 0, netty = 0; if (tpMetric.get_componentMetric().get_metrics_size() > 0) { batchData.put(METRIC_DATA_30M_COMPONENT + topologyId, new Object[]{ts, tpMetric.get_componentMetric()}); // depends on control dependency: [if], data = [none] comp += tpMetric.get_componentMetric().get_metrics_size(); // depends on control dependency: [if], data = [none] } if (tpMetric.is_set_compStreamMetric() && tpMetric.get_compStreamMetric().get_metrics_size() > 0) { batchData.put(METRIC_DATA_30M_COMP_STREAM + topologyId, new Object[]{ts, tpMetric.get_compStreamMetric()}); // depends on control dependency: [if], data = [none] compStream += tpMetric.get_compStreamMetric().get_metrics_size(); // depends on control dependency: [if], data = [none] } if (tpMetric.get_taskMetric().get_metrics_size() > 0) { tryCombineMetricInfo(METRIC_DATA_30M_TASK + topologyId, tpMetric.get_taskMetric(), MetaType.TASK, ts); // depends on control dependency: [if], data = [none] task += tpMetric.get_taskMetric().get_metrics_size(); // depends on control dependency: [if], data = [none] } if (tpMetric.get_streamMetric().get_metrics_size() > 0) { tryCombineMetricInfo(METRIC_DATA_30M_STREAM + topologyId, tpMetric.get_streamMetric(), MetaType.STREAM, ts); // depends on control dependency: [if], data = [none] stream += tpMetric.get_streamMetric().get_metrics_size(); // depends on control dependency: [if], data = [none] } if (tpMetric.get_workerMetric().get_metrics_size() > 0) { tryCombineMetricInfo(METRIC_DATA_30M_WORKER + topologyId, tpMetric.get_workerMetric(), MetaType.WORKER, ts); // depends on control dependency: [if], data = [none] worker += tpMetric.get_workerMetric().get_metrics_size(); // depends on control dependency: [if], data = [none] } if (tpMetric.get_nettyMetric().get_metrics_size() > 0) { tryCombineMetricInfo(METRIC_DATA_30M_NETTY + topologyId, tpMetric.get_nettyMetric(), MetaType.NETTY, ts); // depends on control dependency: [if], data = [none] netty += tpMetric.get_nettyMetric().get_metrics_size(); // depends on control dependency: [if], data = [none] } // store 30 snapshots of topology metrics if (tpMetric.get_topologyMetric().get_metrics_size() > 0) { String keyPrefix = METRIC_DATA_30M_TOPOLOGY + topologyId + "-"; int page = getRingAvailableIndex(keyPrefix); batchData.put(keyPrefix + page, new Object[]{ts, tpMetric.get_topologyMetric()}); // depends on control dependency: [if], data = [none] tp += tpMetric.get_topologyMetric().get_metrics_size(); // depends on control dependency: [if], data = [none] } LOG.info("caching metric data for topology:{},tp:{},comp:{},comp_stream:{},task:{},stream:{},worker:{},netty:{},cost:{}", topologyId, tp, comp, compStream, task, stream, worker, netty, System.currentTimeMillis() - ts); return putBatch(batchData); } }
public class class_name { private void closeMappedEntity(final MappedEntity mappedEntity) { try { // Flush first final PreparedStatement insert = mappedEntity.getInsert(); final PreparedStatement insertReturning = mappedEntity.getInsertReturning(); final PreparedStatement insertWithAutoInc = mappedEntity.getInsertWithAutoInc(); insert.executeBatch(); if (insertReturning != null) { insertReturning.executeBatch(); } if (insertWithAutoInc != null) { insertWithAutoInc.executeBatch(); } } catch (final SQLException e) { logger.debug(String.format("Failed to flush before closing mapped entity '%s'", mappedEntity.getEntity().getName()), e); } finally { try { mappedEntity.close(); } catch (final Exception e) { logger.warn("Could not close insert statements from mapped entity.", e); } } } }
public class class_name { private void closeMappedEntity(final MappedEntity mappedEntity) { try { // Flush first final PreparedStatement insert = mappedEntity.getInsert(); final PreparedStatement insertReturning = mappedEntity.getInsertReturning(); final PreparedStatement insertWithAutoInc = mappedEntity.getInsertWithAutoInc(); insert.executeBatch(); // depends on control dependency: [try], data = [none] if (insertReturning != null) { insertReturning.executeBatch(); // depends on control dependency: [if], data = [none] } if (insertWithAutoInc != null) { insertWithAutoInc.executeBatch(); // depends on control dependency: [if], data = [none] } } catch (final SQLException e) { logger.debug(String.format("Failed to flush before closing mapped entity '%s'", mappedEntity.getEntity().getName()), e); } finally { // depends on control dependency: [catch], data = [none] try { mappedEntity.close(); // depends on control dependency: [try], data = [none] } catch (final Exception e) { logger.warn("Could not close insert statements from mapped entity.", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void addListeners(PropertyChangeListener listener, Object newObject, Set updateSet) { removeListeners(); if (newObject != null) { // check for local synthetics TriggerBinding syntheticTrigger = getSyntheticTriggerBinding(newObject); MetaClass mc = InvokerHelper.getMetaClass(newObject); if (syntheticTrigger != null) { PropertyBinding psb = new PropertyBinding(newObject, propertyName); PropertyChangeProxyTargetBinding proxytb = new PropertyChangeProxyTargetBinding(newObject, propertyName, listener); syntheticFullBinding = syntheticTrigger.createBinding(psb, proxytb); syntheticFullBinding.bind(); updateSet.add(newObject); } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", NAME_PARAMS).isEmpty()) { InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", new Object[] {propertyName, listener}); localListener = listener; updateSet.add(newObject); } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", GLOBAL_PARAMS).isEmpty()) { InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", listener); globalListener = listener; updateSet.add(newObject); } } currentObject = newObject; } }
public class class_name { public void addListeners(PropertyChangeListener listener, Object newObject, Set updateSet) { removeListeners(); if (newObject != null) { // check for local synthetics TriggerBinding syntheticTrigger = getSyntheticTriggerBinding(newObject); MetaClass mc = InvokerHelper.getMetaClass(newObject); if (syntheticTrigger != null) { PropertyBinding psb = new PropertyBinding(newObject, propertyName); PropertyChangeProxyTargetBinding proxytb = new PropertyChangeProxyTargetBinding(newObject, propertyName, listener); syntheticFullBinding = syntheticTrigger.createBinding(psb, proxytb); // depends on control dependency: [if], data = [none] syntheticFullBinding.bind(); // depends on control dependency: [if], data = [none] updateSet.add(newObject); // depends on control dependency: [if], data = [none] } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", NAME_PARAMS).isEmpty()) { InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", new Object[] {propertyName, listener}); // depends on control dependency: [if], data = [none] localListener = listener; // depends on control dependency: [if], data = [none] updateSet.add(newObject); // depends on control dependency: [if], data = [none] } else if (!mc.respondsTo(newObject, "addPropertyChangeListener", GLOBAL_PARAMS).isEmpty()) { InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", listener); // depends on control dependency: [if], data = [none] globalListener = listener; // depends on control dependency: [if], data = [none] updateSet.add(newObject); // depends on control dependency: [if], data = [none] } } currentObject = newObject; } }
public class class_name { private Project.Tasks.Task writeTask(Task mpx) { Project.Tasks.Task xml = m_factory.createProjectTasksTask(); xml.setActive(Boolean.valueOf(mpx.getActive())); xml.setActualCost(DatatypeConverter.printCurrency(mpx.getActualCost())); xml.setActualDuration(DatatypeConverter.printDuration(this, mpx.getActualDuration())); xml.setActualFinish(mpx.getActualFinish()); xml.setActualOvertimeCost(DatatypeConverter.printCurrency(mpx.getActualOvertimeCost())); xml.setActualOvertimeWork(DatatypeConverter.printDuration(this, mpx.getActualOvertimeWork())); xml.setActualOvertimeWorkProtected(DatatypeConverter.printDuration(this, mpx.getActualOvertimeWorkProtected())); xml.setActualStart(mpx.getActualStart()); xml.setActualWork(DatatypeConverter.printDuration(this, mpx.getActualWork())); xml.setActualWorkProtected(DatatypeConverter.printDuration(this, mpx.getActualWorkProtected())); xml.setACWP(DatatypeConverter.printCurrency(mpx.getACWP())); xml.setBCWP(DatatypeConverter.printCurrency(mpx.getBCWP())); xml.setBCWS(DatatypeConverter.printCurrency(mpx.getBCWS())); xml.setCalendarUID(getTaskCalendarID(mpx)); xml.setConstraintDate(mpx.getConstraintDate()); xml.setConstraintType(DatatypeConverter.printConstraintType(mpx.getConstraintType())); xml.setContact(mpx.getContact()); xml.setCost(DatatypeConverter.printCurrency(mpx.getCost())); xml.setCreateDate(mpx.getCreateDate()); xml.setCritical(Boolean.valueOf(mpx.getCritical())); xml.setCV(DatatypeConverter.printCurrency(mpx.getCV())); xml.setDeadline(mpx.getDeadline()); xml.setDuration(DatatypeConverter.printDurationMandatory(this, mpx.getDuration())); xml.setDurationText(mpx.getDurationText()); xml.setDurationFormat(DatatypeConverter.printDurationTimeUnits(mpx.getDuration(), mpx.getEstimated())); xml.setEarlyFinish(mpx.getEarlyFinish()); xml.setEarlyStart(mpx.getEarlyStart()); xml.setEarnedValueMethod(DatatypeConverter.printEarnedValueMethod(mpx.getEarnedValueMethod())); xml.setEffortDriven(Boolean.valueOf(mpx.getEffortDriven())); xml.setEstimated(Boolean.valueOf(mpx.getEstimated())); xml.setExternalTask(Boolean.valueOf(mpx.getExternalTask())); xml.setExternalTaskProject(mpx.getProject()); xml.setFinish(mpx.getFinish()); xml.setFinishSlack(DatatypeConverter.printDurationInIntegerTenthsOfMinutes(mpx.getFinishSlack())); xml.setFinishText(mpx.getFinishText()); xml.setFinishVariance(DatatypeConverter.printDurationInIntegerThousandthsOfMinutes(mpx.getFinishVariance())); xml.setFixedCost(DatatypeConverter.printCurrency(mpx.getFixedCost())); AccrueType fixedCostAccrual = mpx.getFixedCostAccrual(); if (fixedCostAccrual == null) { fixedCostAccrual = AccrueType.PRORATED; } xml.setFixedCostAccrual(fixedCostAccrual); xml.setFreeSlack(DatatypeConverter.printDurationInIntegerTenthsOfMinutes(mpx.getFreeSlack())); xml.setGUID(mpx.getGUID()); xml.setHideBar(Boolean.valueOf(mpx.getHideBar())); xml.setIsNull(Boolean.valueOf(mpx.getNull())); xml.setIsSubproject(Boolean.valueOf(mpx.getSubProject() != null)); xml.setIsSubprojectReadOnly(Boolean.valueOf(mpx.getSubprojectReadOnly())); xml.setHyperlink(mpx.getHyperlink()); xml.setHyperlinkAddress(mpx.getHyperlinkAddress()); xml.setHyperlinkSubAddress(mpx.getHyperlinkSubAddress()); xml.setID(NumberHelper.getBigInteger(mpx.getID())); xml.setIgnoreResourceCalendar(Boolean.valueOf(mpx.getIgnoreResourceCalendar())); xml.setLateFinish(mpx.getLateFinish()); xml.setLateStart(mpx.getLateStart()); xml.setLevelAssignments(Boolean.valueOf(mpx.getLevelAssignments())); xml.setLevelingCanSplit(Boolean.valueOf(mpx.getLevelingCanSplit())); if (mpx.getLevelingDelay() != null) { Duration levelingDelay = mpx.getLevelingDelay(); double tenthMinutes = 10.0 * Duration.convertUnits(levelingDelay.getDuration(), levelingDelay.getUnits(), TimeUnit.MINUTES, m_projectFile.getProjectProperties()).getDuration(); xml.setLevelingDelay(BigInteger.valueOf((long) tenthMinutes)); xml.setLevelingDelayFormat(DatatypeConverter.printDurationTimeUnits(levelingDelay, false)); } xml.setManual(Boolean.valueOf(mpx.getTaskMode() == TaskMode.MANUALLY_SCHEDULED)); if (mpx.getTaskMode() == TaskMode.MANUALLY_SCHEDULED) { xml.setManualDuration(DatatypeConverter.printDuration(this, mpx.getDuration())); xml.setManualFinish(mpx.getFinish()); xml.setManualStart(mpx.getStart()); } xml.setMilestone(Boolean.valueOf(mpx.getMilestone())); xml.setName(mpx.getName()); if (!mpx.getNotes().isEmpty()) { xml.setNotes(mpx.getNotes()); } xml.setOutlineLevel(NumberHelper.getBigInteger(mpx.getOutlineLevel())); xml.setOutlineNumber(mpx.getOutlineNumber()); xml.setOverAllocated(Boolean.valueOf(mpx.getOverAllocated())); xml.setOvertimeCost(DatatypeConverter.printCurrency(mpx.getOvertimeCost())); xml.setOvertimeWork(DatatypeConverter.printDuration(this, mpx.getOvertimeWork())); xml.setPercentComplete(NumberHelper.getBigInteger(mpx.getPercentageComplete())); xml.setPercentWorkComplete(NumberHelper.getBigInteger(mpx.getPercentageWorkComplete())); xml.setPhysicalPercentComplete(NumberHelper.getBigInteger(mpx.getPhysicalPercentComplete())); xml.setPriority(DatatypeConverter.printPriority(mpx.getPriority())); xml.setRecurring(Boolean.valueOf(mpx.getRecurring())); xml.setRegularWork(DatatypeConverter.printDuration(this, mpx.getRegularWork())); xml.setRemainingCost(DatatypeConverter.printCurrency(mpx.getRemainingCost())); if (mpx.getRemainingDuration() == null) { Duration duration = mpx.getDuration(); if (duration != null) { double amount = duration.getDuration(); amount -= ((amount * NumberHelper.getDouble(mpx.getPercentageComplete())) / 100); xml.setRemainingDuration(DatatypeConverter.printDuration(this, Duration.getInstance(amount, duration.getUnits()))); } } else { xml.setRemainingDuration(DatatypeConverter.printDuration(this, mpx.getRemainingDuration())); } xml.setRemainingOvertimeCost(DatatypeConverter.printCurrency(mpx.getRemainingOvertimeCost())); xml.setRemainingOvertimeWork(DatatypeConverter.printDuration(this, mpx.getRemainingOvertimeWork())); xml.setRemainingWork(DatatypeConverter.printDuration(this, mpx.getRemainingWork())); xml.setResume(mpx.getResume()); xml.setResumeValid(Boolean.valueOf(mpx.getResumeValid())); xml.setRollup(Boolean.valueOf(mpx.getRollup())); xml.setStart(mpx.getStart()); xml.setStartSlack(DatatypeConverter.printDurationInIntegerTenthsOfMinutes(mpx.getStartSlack())); xml.setStartText(mpx.getStartText()); xml.setStartVariance(DatatypeConverter.printDurationInIntegerThousandthsOfMinutes(mpx.getStartVariance())); xml.setStop(mpx.getStop()); xml.setSubprojectName(mpx.getSubprojectName()); xml.setSummary(Boolean.valueOf(mpx.hasChildTasks())); xml.setTotalSlack(DatatypeConverter.printDurationInIntegerTenthsOfMinutes(mpx.getTotalSlack())); xml.setType(mpx.getType()); xml.setUID(mpx.getUniqueID()); xml.setWBS(mpx.getWBS()); xml.setWBSLevel(mpx.getWBSLevel()); xml.setWork(DatatypeConverter.printDuration(this, mpx.getWork())); xml.setWorkVariance(DatatypeConverter.printDurationInDecimalThousandthsOfMinutes(mpx.getWorkVariance())); if (mpx.getTaskMode() == TaskMode.MANUALLY_SCHEDULED) { xml.setManualDuration(DatatypeConverter.printDuration(this, mpx.getManualDuration())); } writePredecessors(xml, mpx); writeTaskExtendedAttributes(xml, mpx); writeTaskBaselines(xml, mpx); return (xml); } }
public class class_name { private Project.Tasks.Task writeTask(Task mpx) { Project.Tasks.Task xml = m_factory.createProjectTasksTask(); xml.setActive(Boolean.valueOf(mpx.getActive())); xml.setActualCost(DatatypeConverter.printCurrency(mpx.getActualCost())); xml.setActualDuration(DatatypeConverter.printDuration(this, mpx.getActualDuration())); xml.setActualFinish(mpx.getActualFinish()); xml.setActualOvertimeCost(DatatypeConverter.printCurrency(mpx.getActualOvertimeCost())); xml.setActualOvertimeWork(DatatypeConverter.printDuration(this, mpx.getActualOvertimeWork())); xml.setActualOvertimeWorkProtected(DatatypeConverter.printDuration(this, mpx.getActualOvertimeWorkProtected())); xml.setActualStart(mpx.getActualStart()); xml.setActualWork(DatatypeConverter.printDuration(this, mpx.getActualWork())); xml.setActualWorkProtected(DatatypeConverter.printDuration(this, mpx.getActualWorkProtected())); xml.setACWP(DatatypeConverter.printCurrency(mpx.getACWP())); xml.setBCWP(DatatypeConverter.printCurrency(mpx.getBCWP())); xml.setBCWS(DatatypeConverter.printCurrency(mpx.getBCWS())); xml.setCalendarUID(getTaskCalendarID(mpx)); xml.setConstraintDate(mpx.getConstraintDate()); xml.setConstraintType(DatatypeConverter.printConstraintType(mpx.getConstraintType())); xml.setContact(mpx.getContact()); xml.setCost(DatatypeConverter.printCurrency(mpx.getCost())); xml.setCreateDate(mpx.getCreateDate()); xml.setCritical(Boolean.valueOf(mpx.getCritical())); xml.setCV(DatatypeConverter.printCurrency(mpx.getCV())); xml.setDeadline(mpx.getDeadline()); xml.setDuration(DatatypeConverter.printDurationMandatory(this, mpx.getDuration())); xml.setDurationText(mpx.getDurationText()); xml.setDurationFormat(DatatypeConverter.printDurationTimeUnits(mpx.getDuration(), mpx.getEstimated())); xml.setEarlyFinish(mpx.getEarlyFinish()); xml.setEarlyStart(mpx.getEarlyStart()); xml.setEarnedValueMethod(DatatypeConverter.printEarnedValueMethod(mpx.getEarnedValueMethod())); xml.setEffortDriven(Boolean.valueOf(mpx.getEffortDriven())); xml.setEstimated(Boolean.valueOf(mpx.getEstimated())); xml.setExternalTask(Boolean.valueOf(mpx.getExternalTask())); xml.setExternalTaskProject(mpx.getProject()); xml.setFinish(mpx.getFinish()); xml.setFinishSlack(DatatypeConverter.printDurationInIntegerTenthsOfMinutes(mpx.getFinishSlack())); xml.setFinishText(mpx.getFinishText()); xml.setFinishVariance(DatatypeConverter.printDurationInIntegerThousandthsOfMinutes(mpx.getFinishVariance())); xml.setFixedCost(DatatypeConverter.printCurrency(mpx.getFixedCost())); AccrueType fixedCostAccrual = mpx.getFixedCostAccrual(); if (fixedCostAccrual == null) { fixedCostAccrual = AccrueType.PRORATED; // depends on control dependency: [if], data = [none] } xml.setFixedCostAccrual(fixedCostAccrual); xml.setFreeSlack(DatatypeConverter.printDurationInIntegerTenthsOfMinutes(mpx.getFreeSlack())); xml.setGUID(mpx.getGUID()); xml.setHideBar(Boolean.valueOf(mpx.getHideBar())); xml.setIsNull(Boolean.valueOf(mpx.getNull())); xml.setIsSubproject(Boolean.valueOf(mpx.getSubProject() != null)); xml.setIsSubprojectReadOnly(Boolean.valueOf(mpx.getSubprojectReadOnly())); xml.setHyperlink(mpx.getHyperlink()); xml.setHyperlinkAddress(mpx.getHyperlinkAddress()); xml.setHyperlinkSubAddress(mpx.getHyperlinkSubAddress()); xml.setID(NumberHelper.getBigInteger(mpx.getID())); xml.setIgnoreResourceCalendar(Boolean.valueOf(mpx.getIgnoreResourceCalendar())); xml.setLateFinish(mpx.getLateFinish()); xml.setLateStart(mpx.getLateStart()); xml.setLevelAssignments(Boolean.valueOf(mpx.getLevelAssignments())); xml.setLevelingCanSplit(Boolean.valueOf(mpx.getLevelingCanSplit())); if (mpx.getLevelingDelay() != null) { Duration levelingDelay = mpx.getLevelingDelay(); double tenthMinutes = 10.0 * Duration.convertUnits(levelingDelay.getDuration(), levelingDelay.getUnits(), TimeUnit.MINUTES, m_projectFile.getProjectProperties()).getDuration(); xml.setLevelingDelay(BigInteger.valueOf((long) tenthMinutes)); // depends on control dependency: [if], data = [none] xml.setLevelingDelayFormat(DatatypeConverter.printDurationTimeUnits(levelingDelay, false)); // depends on control dependency: [if], data = [none] } xml.setManual(Boolean.valueOf(mpx.getTaskMode() == TaskMode.MANUALLY_SCHEDULED)); if (mpx.getTaskMode() == TaskMode.MANUALLY_SCHEDULED) { xml.setManualDuration(DatatypeConverter.printDuration(this, mpx.getDuration())); // depends on control dependency: [if], data = [none] xml.setManualFinish(mpx.getFinish()); // depends on control dependency: [if], data = [none] xml.setManualStart(mpx.getStart()); // depends on control dependency: [if], data = [none] } xml.setMilestone(Boolean.valueOf(mpx.getMilestone())); xml.setName(mpx.getName()); if (!mpx.getNotes().isEmpty()) { xml.setNotes(mpx.getNotes()); // depends on control dependency: [if], data = [none] } xml.setOutlineLevel(NumberHelper.getBigInteger(mpx.getOutlineLevel())); xml.setOutlineNumber(mpx.getOutlineNumber()); xml.setOverAllocated(Boolean.valueOf(mpx.getOverAllocated())); xml.setOvertimeCost(DatatypeConverter.printCurrency(mpx.getOvertimeCost())); xml.setOvertimeWork(DatatypeConverter.printDuration(this, mpx.getOvertimeWork())); xml.setPercentComplete(NumberHelper.getBigInteger(mpx.getPercentageComplete())); xml.setPercentWorkComplete(NumberHelper.getBigInteger(mpx.getPercentageWorkComplete())); xml.setPhysicalPercentComplete(NumberHelper.getBigInteger(mpx.getPhysicalPercentComplete())); xml.setPriority(DatatypeConverter.printPriority(mpx.getPriority())); xml.setRecurring(Boolean.valueOf(mpx.getRecurring())); xml.setRegularWork(DatatypeConverter.printDuration(this, mpx.getRegularWork())); xml.setRemainingCost(DatatypeConverter.printCurrency(mpx.getRemainingCost())); if (mpx.getRemainingDuration() == null) { Duration duration = mpx.getDuration(); if (duration != null) { double amount = duration.getDuration(); amount -= ((amount * NumberHelper.getDouble(mpx.getPercentageComplete())) / 100); // depends on control dependency: [if], data = [none] xml.setRemainingDuration(DatatypeConverter.printDuration(this, Duration.getInstance(amount, duration.getUnits()))); // depends on control dependency: [if], data = [none] } } else { xml.setRemainingDuration(DatatypeConverter.printDuration(this, mpx.getRemainingDuration())); // depends on control dependency: [if], data = [none] } xml.setRemainingOvertimeCost(DatatypeConverter.printCurrency(mpx.getRemainingOvertimeCost())); xml.setRemainingOvertimeWork(DatatypeConverter.printDuration(this, mpx.getRemainingOvertimeWork())); xml.setRemainingWork(DatatypeConverter.printDuration(this, mpx.getRemainingWork())); xml.setResume(mpx.getResume()); xml.setResumeValid(Boolean.valueOf(mpx.getResumeValid())); xml.setRollup(Boolean.valueOf(mpx.getRollup())); xml.setStart(mpx.getStart()); xml.setStartSlack(DatatypeConverter.printDurationInIntegerTenthsOfMinutes(mpx.getStartSlack())); xml.setStartText(mpx.getStartText()); xml.setStartVariance(DatatypeConverter.printDurationInIntegerThousandthsOfMinutes(mpx.getStartVariance())); xml.setStop(mpx.getStop()); xml.setSubprojectName(mpx.getSubprojectName()); xml.setSummary(Boolean.valueOf(mpx.hasChildTasks())); xml.setTotalSlack(DatatypeConverter.printDurationInIntegerTenthsOfMinutes(mpx.getTotalSlack())); xml.setType(mpx.getType()); xml.setUID(mpx.getUniqueID()); xml.setWBS(mpx.getWBS()); xml.setWBSLevel(mpx.getWBSLevel()); xml.setWork(DatatypeConverter.printDuration(this, mpx.getWork())); xml.setWorkVariance(DatatypeConverter.printDurationInDecimalThousandthsOfMinutes(mpx.getWorkVariance())); if (mpx.getTaskMode() == TaskMode.MANUALLY_SCHEDULED) { xml.setManualDuration(DatatypeConverter.printDuration(this, mpx.getManualDuration())); // depends on control dependency: [if], data = [none] } writePredecessors(xml, mpx); writeTaskExtendedAttributes(xml, mpx); writeTaskBaselines(xml, mpx); return (xml); } }
public class class_name { public void marshall(Listener listener, ProtocolMarshaller protocolMarshaller) { if (listener == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listener.getListenerArn(), LISTENERARN_BINDING); protocolMarshaller.marshall(listener.getPortRanges(), PORTRANGES_BINDING); protocolMarshaller.marshall(listener.getProtocol(), PROTOCOL_BINDING); protocolMarshaller.marshall(listener.getClientAffinity(), CLIENTAFFINITY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Listener listener, ProtocolMarshaller protocolMarshaller) { if (listener == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listener.getListenerArn(), LISTENERARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listener.getPortRanges(), PORTRANGES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listener.getProtocol(), PROTOCOL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listener.getClientAffinity(), CLIENTAFFINITY_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 AbstractReportGenerator generateHtml5Report() { AbstractReportGenerator report; try { Class<?> aClass = new ReportGenerator().getClass().getClassLoader() .loadClass( "com.tngtech.jgiven.report.html5.Html5ReportGenerator" ); report = (AbstractReportGenerator) aClass.newInstance(); } catch( ClassNotFoundException e ) { throw new JGivenInstallationException( "The JGiven HTML5 Report Generator seems not to be on the classpath.\n" + "Ensure that you have a dependency to jgiven-html5-report." ); } catch( Exception e ) { throw new JGivenInternalDefectException( "The HTML5 Report Generator could not be instantiated.", e ); } return report; } }
public class class_name { public static AbstractReportGenerator generateHtml5Report() { AbstractReportGenerator report; try { Class<?> aClass = new ReportGenerator().getClass().getClassLoader() .loadClass( "com.tngtech.jgiven.report.html5.Html5ReportGenerator" ); report = (AbstractReportGenerator) aClass.newInstance(); } catch( ClassNotFoundException e ) { throw new JGivenInstallationException( "The JGiven HTML5 Report Generator seems not to be on the classpath.\n" + "Ensure that you have a dependency to jgiven-html5-report." ); } catch( Exception e ) { // depends on control dependency: [catch], data = [none] throw new JGivenInternalDefectException( "The HTML5 Report Generator could not be instantiated.", e ); } // depends on control dependency: [catch], data = [none] return report; } }
public class class_name { private void addMessage(final WMessageBox box, final Message message, final boolean encode) { String code = message.getMessage(); if (!Util.empty(code)) { box.addMessage(encode, code, message.getArgs()); } } }
public class class_name { private void addMessage(final WMessageBox box, final Message message, final boolean encode) { String code = message.getMessage(); if (!Util.empty(code)) { box.addMessage(encode, code, message.getArgs()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String asString(final HttpResponse response, final String encoding) { if (response == null) { throw new NullPointerException(); } final HttpEntity entity = response.getEntity(); if (entity == null) { return null; } try { return EntityUtils.toString(entity, encoding); } catch (final Exception e) { return null; } } }
public class class_name { public static String asString(final HttpResponse response, final String encoding) { if (response == null) { throw new NullPointerException(); } final HttpEntity entity = response.getEntity(); if (entity == null) { return null; // depends on control dependency: [if], data = [none] } try { return EntityUtils.toString(entity, encoding); // depends on control dependency: [try], data = [none] } catch (final Exception e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected int countEntireIndexRange(int indexOffset) { // Go to the beginning of the index seek(indexOffset); // Read the count field int count = getCard16(); // If count==0 -> size=2 if (count==0) return 2; else { // Read the offsize field int indexOffSize = getCard8(); // Go to the last element of the offset array seek(indexOffset+2+1+count*indexOffSize); // The size of the object array is the value of the last element-1 int size = getOffset(indexOffSize)-1; // Return the size of the entire index return 2+1+(count+1)*indexOffSize+size; } } }
public class class_name { protected int countEntireIndexRange(int indexOffset) { // Go to the beginning of the index seek(indexOffset); // Read the count field int count = getCard16(); // If count==0 -> size=2 if (count==0) return 2; else { // Read the offsize field int indexOffSize = getCard8(); // Go to the last element of the offset array seek(indexOffset+2+1+count*indexOffSize); // depends on control dependency: [if], data = [none] // The size of the object array is the value of the last element-1 int size = getOffset(indexOffSize)-1; // Return the size of the entire index return 2+1+(count+1)*indexOffSize+size; // depends on control dependency: [if], data = [(count] } } }
public class class_name { @SuppressWarnings("unchecked") public static Object convertArg(ContextAware ca, String val, Class<?> type) { if (val == null) { return null; } String v = val.trim(); if (String.class.isAssignableFrom(type)) { return v; } else if (Integer.TYPE.isAssignableFrom(type)) { return Integer.valueOf(v); } else if (Long.TYPE.isAssignableFrom(type)) { return Long.valueOf(v); } else if (Float.TYPE.isAssignableFrom(type)) { return Float.valueOf(v); } else if (Double.TYPE.isAssignableFrom(type)) { return Double.valueOf(v); } else if (Boolean.TYPE.isAssignableFrom(type)) { if ("true".equalsIgnoreCase(v)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(v)) { return Boolean.FALSE; } } else if (type.isEnum()) { return convertToEnum(ca, v, (Class<? extends Enum<?>>) type); } else if (StringToObjectConverter.followsTheValueOfConvention(type)) { return convertByValueOfMethod(ca, type, v); } else if (isOfTypeCharset(type)) { return convertToCharset(ca, val); } return null; } }
public class class_name { @SuppressWarnings("unchecked") public static Object convertArg(ContextAware ca, String val, Class<?> type) { if (val == null) { return null; // depends on control dependency: [if], data = [none] } String v = val.trim(); if (String.class.isAssignableFrom(type)) { return v; // depends on control dependency: [if], data = [none] } else if (Integer.TYPE.isAssignableFrom(type)) { return Integer.valueOf(v); // depends on control dependency: [if], data = [none] } else if (Long.TYPE.isAssignableFrom(type)) { return Long.valueOf(v); // depends on control dependency: [if], data = [none] } else if (Float.TYPE.isAssignableFrom(type)) { return Float.valueOf(v); // depends on control dependency: [if], data = [none] } else if (Double.TYPE.isAssignableFrom(type)) { return Double.valueOf(v); // depends on control dependency: [if], data = [none] } else if (Boolean.TYPE.isAssignableFrom(type)) { if ("true".equalsIgnoreCase(v)) { return Boolean.TRUE; // depends on control dependency: [if], data = [none] } else if ("false".equalsIgnoreCase(v)) { return Boolean.FALSE; // depends on control dependency: [if], data = [none] } } else if (type.isEnum()) { return convertToEnum(ca, v, (Class<? extends Enum<?>>) type); } else if (StringToObjectConverter.followsTheValueOfConvention(type)) { return convertByValueOfMethod(ca, type, v); } else if (isOfTypeCharset(type)) { return convertToCharset(ca, val); } return null; // depends on control dependency: [if], data = [none] } }
public class class_name { public String render(String templateName, EmailModel emailModel, Map<String, Object> model, Locale locale) { if (logger.isDebugEnabled()) { logger.debug("Rendering template [{}] for recipient [{}]", templateName, emailModel.getTo()); } final IEngineConfiguration engineConfiguration = templateEngineFactory.getTemplateEngine().getConfiguration(); final ExpressionContext context = new ExpressionContext(engineConfiguration, locale); context.setVariable(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME, new ThymeleafEvaluationContext(applicationContext, null)); context.setVariables(model); context.setVariable(THYMELEAF_EMAIL_MODEL_NAME, emailModel); return templateEngineFactory.getTemplateEngine().process(templateName, context); } }
public class class_name { public String render(String templateName, EmailModel emailModel, Map<String, Object> model, Locale locale) { if (logger.isDebugEnabled()) { logger.debug("Rendering template [{}] for recipient [{}]", templateName, emailModel.getTo()); // depends on control dependency: [if], data = [none] } final IEngineConfiguration engineConfiguration = templateEngineFactory.getTemplateEngine().getConfiguration(); final ExpressionContext context = new ExpressionContext(engineConfiguration, locale); context.setVariable(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME, new ThymeleafEvaluationContext(applicationContext, null)); context.setVariables(model); context.setVariable(THYMELEAF_EMAIL_MODEL_NAME, emailModel); return templateEngineFactory.getTemplateEngine().process(templateName, context); } }
public class class_name { public static Node[] toNodeArray(Document doc, Object o) throws PageException { if (o instanceof Node) return new Node[] { (Node) o }; // Node[] if (o instanceof Node[]) { return (Node[]) o; } // Collection else if (o instanceof Collection) { Collection coll = (Collection) o; Iterator<Object> it = coll.valueIterator(); List<Node> nodes = new ArrayList<Node>(); while (it.hasNext()) { nodes.add(toNode(doc, it.next(), false)); } return nodes.toArray(new Node[nodes.size()]); } // Node Map and List Node[] nodes = _toNodeArray(doc, o); if (nodes != null) return nodes; // Single Text Node try { return new Node[] { toNode(doc, o, false) }; } catch (ExpressionException e) { throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Node Array"); } } }
public class class_name { public static Node[] toNodeArray(Document doc, Object o) throws PageException { if (o instanceof Node) return new Node[] { (Node) o }; // Node[] if (o instanceof Node[]) { return (Node[]) o; } // Collection else if (o instanceof Collection) { Collection coll = (Collection) o; Iterator<Object> it = coll.valueIterator(); List<Node> nodes = new ArrayList<Node>(); while (it.hasNext()) { nodes.add(toNode(doc, it.next(), false)); // depends on control dependency: [while], data = [none] } return nodes.toArray(new Node[nodes.size()]); } // Node Map and List Node[] nodes = _toNodeArray(doc, o); if (nodes != null) return nodes; // Single Text Node try { return new Node[] { toNode(doc, o, false) }; } catch (ExpressionException e) { throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Node Array"); } } }
public class class_name { public void marshall(CreateFunctionDefinitionRequest createFunctionDefinitionRequest, ProtocolMarshaller protocolMarshaller) { if (createFunctionDefinitionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createFunctionDefinitionRequest.getAmznClientToken(), AMZNCLIENTTOKEN_BINDING); protocolMarshaller.marshall(createFunctionDefinitionRequest.getInitialVersion(), INITIALVERSION_BINDING); protocolMarshaller.marshall(createFunctionDefinitionRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(createFunctionDefinitionRequest.getTags(), TAGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateFunctionDefinitionRequest createFunctionDefinitionRequest, ProtocolMarshaller protocolMarshaller) { if (createFunctionDefinitionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createFunctionDefinitionRequest.getAmznClientToken(), AMZNCLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createFunctionDefinitionRequest.getInitialVersion(), INITIALVERSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createFunctionDefinitionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createFunctionDefinitionRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(DiscoverInputSchemaRequest discoverInputSchemaRequest, ProtocolMarshaller protocolMarshaller) { if (discoverInputSchemaRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(discoverInputSchemaRequest.getResourceARN(), RESOURCEARN_BINDING); protocolMarshaller.marshall(discoverInputSchemaRequest.getServiceExecutionRole(), SERVICEEXECUTIONROLE_BINDING); protocolMarshaller.marshall(discoverInputSchemaRequest.getInputStartingPositionConfiguration(), INPUTSTARTINGPOSITIONCONFIGURATION_BINDING); protocolMarshaller.marshall(discoverInputSchemaRequest.getS3Configuration(), S3CONFIGURATION_BINDING); protocolMarshaller.marshall(discoverInputSchemaRequest.getInputProcessingConfiguration(), INPUTPROCESSINGCONFIGURATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DiscoverInputSchemaRequest discoverInputSchemaRequest, ProtocolMarshaller protocolMarshaller) { if (discoverInputSchemaRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(discoverInputSchemaRequest.getResourceARN(), RESOURCEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(discoverInputSchemaRequest.getServiceExecutionRole(), SERVICEEXECUTIONROLE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(discoverInputSchemaRequest.getInputStartingPositionConfiguration(), INPUTSTARTINGPOSITIONCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(discoverInputSchemaRequest.getS3Configuration(), S3CONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(discoverInputSchemaRequest.getInputProcessingConfiguration(), INPUTPROCESSINGCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static String getStringValue0(String appName, String key) { String ret = System.getProperty(key); if (StringUtils.isNotEmpty(ret)) { return ret; } rLock.lock(); try { for (ExternalConfigLoader configLoader : CONFIG_LOADERS) { ret = appName == null ? configLoader.getValue(key) : configLoader.getValue(appName, key); if (StringUtils.isNotEmpty(ret)) { return ret; } } } finally { rLock.unlock(); } return getConfig().getProperty(key); } }
public class class_name { private static String getStringValue0(String appName, String key) { String ret = System.getProperty(key); if (StringUtils.isNotEmpty(ret)) { return ret; // depends on control dependency: [if], data = [none] } rLock.lock(); try { for (ExternalConfigLoader configLoader : CONFIG_LOADERS) { ret = appName == null ? configLoader.getValue(key) : configLoader.getValue(appName, key); // depends on control dependency: [for], data = [configLoader] if (StringUtils.isNotEmpty(ret)) { return ret; // depends on control dependency: [if], data = [none] } } } finally { rLock.unlock(); } return getConfig().getProperty(key); } }
public class class_name { private JsDocToken parseIdGeneratorTag(JsDocToken token) { String idgenKind = "unique"; if (token == JsDocToken.LEFT_CURLY) { if (match(JsDocToken.STRING)) { String name = stream.getString(); if (!idGeneratorAnnotationKeywords.contains(name) && !jsdocBuilder.hasParameter(name)) { addParserWarning("msg.jsdoc.idgen.unknown", name); } idgenKind = name; token = next(); } else { addParserWarning("msg.jsdoc.idgen.bad"); return token; } if (!match(JsDocToken.RIGHT_CURLY)) { addParserWarning("msg.jsdoc.idgen.bad"); } else { token = next(); } } switch (idgenKind) { case "unique": if (!jsdocBuilder.recordIdGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); } break; case "consistent": if (!jsdocBuilder.recordConsistentIdGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); } break; case "stable": if (!jsdocBuilder.recordStableIdGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); } break; case "xid": if (!jsdocBuilder.recordXidGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); } break; case "mapped": if (!jsdocBuilder.recordMappedIdGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); } break; } return token; } }
public class class_name { private JsDocToken parseIdGeneratorTag(JsDocToken token) { String idgenKind = "unique"; if (token == JsDocToken.LEFT_CURLY) { if (match(JsDocToken.STRING)) { String name = stream.getString(); if (!idGeneratorAnnotationKeywords.contains(name) && !jsdocBuilder.hasParameter(name)) { addParserWarning("msg.jsdoc.idgen.unknown", name); // depends on control dependency: [if], data = [none] } idgenKind = name; // depends on control dependency: [if], data = [none] token = next(); // depends on control dependency: [if], data = [none] } else { addParserWarning("msg.jsdoc.idgen.bad"); // depends on control dependency: [if], data = [none] return token; // depends on control dependency: [if], data = [none] } if (!match(JsDocToken.RIGHT_CURLY)) { addParserWarning("msg.jsdoc.idgen.bad"); // depends on control dependency: [if], data = [none] } else { token = next(); // depends on control dependency: [if], data = [none] } } switch (idgenKind) { case "unique": if (!jsdocBuilder.recordIdGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); // depends on control dependency: [if], data = [none] } break; case "consistent": if (!jsdocBuilder.recordConsistentIdGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); // depends on control dependency: [if], data = [none] } break; case "stable": if (!jsdocBuilder.recordStableIdGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); // depends on control dependency: [if], data = [none] } break; case "xid": if (!jsdocBuilder.recordXidGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); // depends on control dependency: [if], data = [none] } break; case "mapped": if (!jsdocBuilder.recordMappedIdGenerator()) { addParserWarning("msg.jsdoc.idgen.duplicate"); // depends on control dependency: [if], data = [none] } break; } return token; } }
public class class_name { public void marshall(DeleteBackupSelectionRequest deleteBackupSelectionRequest, ProtocolMarshaller protocolMarshaller) { if (deleteBackupSelectionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteBackupSelectionRequest.getBackupPlanId(), BACKUPPLANID_BINDING); protocolMarshaller.marshall(deleteBackupSelectionRequest.getSelectionId(), SELECTIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteBackupSelectionRequest deleteBackupSelectionRequest, ProtocolMarshaller protocolMarshaller) { if (deleteBackupSelectionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteBackupSelectionRequest.getBackupPlanId(), BACKUPPLANID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteBackupSelectionRequest.getSelectionId(), SELECTIONID_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 synchronized Rect getFramingRect() { if (framingRect == null) { if (camera == null) { return null; } Point screenResolution = configManager.getScreenResolution(); if (screenResolution == null) { // Called early, before init even finished return null; } int width = findDesiredDimensionInRange(screenResolution.x, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH); int height = findDesiredDimensionInRange(screenResolution.y, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT); int leftOffset = (screenResolution.x - width) / 2; int topOffset = (screenResolution.y - height) / 2; framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height); Log.d(TAG, "Calculated framing rect: " + framingRect); } return framingRect; } }
public class class_name { public synchronized Rect getFramingRect() { if (framingRect == null) { if (camera == null) { return null; // depends on control dependency: [if], data = [none] } Point screenResolution = configManager.getScreenResolution(); if (screenResolution == null) { // Called early, before init even finished return null; // depends on control dependency: [if], data = [none] } int width = findDesiredDimensionInRange(screenResolution.x, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH); int height = findDesiredDimensionInRange(screenResolution.y, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT); int leftOffset = (screenResolution.x - width) / 2; int topOffset = (screenResolution.y - height) / 2; framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height); // depends on control dependency: [if], data = [none] Log.d(TAG, "Calculated framing rect: " + framingRect); // depends on control dependency: [if], data = [none] } return framingRect; } }
public class class_name { public int installFunction(String name, Class func) { int funcIndex; Object funcIndexObj = getFunctionID(name); if (null != funcIndexObj) { funcIndex = ((Integer) funcIndexObj).intValue(); if (funcIndex < NUM_BUILT_IN_FUNCS){ funcIndex = m_funcNextFreeIndex++; m_functionID_customer.put(name, new Integer(funcIndex)); } m_functions_customer[funcIndex - NUM_BUILT_IN_FUNCS] = func; } else { funcIndex = m_funcNextFreeIndex++; m_functions_customer[funcIndex-NUM_BUILT_IN_FUNCS] = func; m_functionID_customer.put(name, new Integer(funcIndex)); } return funcIndex; } }
public class class_name { public int installFunction(String name, Class func) { int funcIndex; Object funcIndexObj = getFunctionID(name); if (null != funcIndexObj) { funcIndex = ((Integer) funcIndexObj).intValue(); // depends on control dependency: [if], data = [funcIndexObj)] if (funcIndex < NUM_BUILT_IN_FUNCS){ funcIndex = m_funcNextFreeIndex++; // depends on control dependency: [if], data = [none] m_functionID_customer.put(name, new Integer(funcIndex)); // depends on control dependency: [if], data = [(funcIndex] } m_functions_customer[funcIndex - NUM_BUILT_IN_FUNCS] = func; // depends on control dependency: [if], data = [none] } else { funcIndex = m_funcNextFreeIndex++; // depends on control dependency: [if], data = [none] m_functions_customer[funcIndex-NUM_BUILT_IN_FUNCS] = func; // depends on control dependency: [if], data = [none] m_functionID_customer.put(name, new Integer(funcIndex)); // depends on control dependency: [if], data = [none] } return funcIndex; } }
public class class_name { public static <T, R> Stream<R> zip(final Collection<? extends Stream<? extends T>> c, final List<? extends T> valuesForNone, final Function<? super List<? extends T>, R> zipFunction) { if (N.isNullOrEmpty(c)) { return Stream.empty(); } final int len = c.size(); if (len != valuesForNone.size()) { throw new IllegalArgumentException("The size of 'valuesForNone' must be same as the size of the collection of iterators"); } final Stream<? extends T>[] ss = c.toArray(new Stream[len]); final ObjIterator<? extends T>[] iters = new ObjIterator[len]; for (int i = 0; i < len; i++) { iters[i] = ss[i].iteratorEx(); } return new IteratorStream<>(new ObjIteratorEx<R>() { @Override public boolean hasNext() { for (int i = 0; i < len; i++) { if (iters[i] != null) { if (iters[i].hasNext()) { return true; } else if (iters[i] != null) { iters[i] = null; ss[i].close(); } } } return false; } @Override public R next() { final Object[] args = new Object[len]; boolean hasNext = false; for (int i = 0; i < len; i++) { if (iters[i] != null && iters[i].hasNext()) { hasNext = true; args[i] = iters[i].next(); } else { args[i] = valuesForNone.get(i); } } if (hasNext == false) { throw new NoSuchElementException(); } return zipFunction.apply(Arrays.asList((T[]) args)); } }); } }
public class class_name { public static <T, R> Stream<R> zip(final Collection<? extends Stream<? extends T>> c, final List<? extends T> valuesForNone, final Function<? super List<? extends T>, R> zipFunction) { if (N.isNullOrEmpty(c)) { return Stream.empty(); // depends on control dependency: [if], data = [none] } final int len = c.size(); if (len != valuesForNone.size()) { throw new IllegalArgumentException("The size of 'valuesForNone' must be same as the size of the collection of iterators"); } final Stream<? extends T>[] ss = c.toArray(new Stream[len]); final ObjIterator<? extends T>[] iters = new ObjIterator[len]; for (int i = 0; i < len; i++) { iters[i] = ss[i].iteratorEx(); // depends on control dependency: [for], data = [i] } return new IteratorStream<>(new ObjIteratorEx<R>() { @Override public boolean hasNext() { for (int i = 0; i < len; i++) { if (iters[i] != null) { if (iters[i].hasNext()) { return true; // depends on control dependency: [if], data = [none] } else if (iters[i] != null) { iters[i] = null; // depends on control dependency: [if], data = [none] ss[i].close(); // depends on control dependency: [if], data = [none] } } } return false; } @Override public R next() { final Object[] args = new Object[len]; boolean hasNext = false; for (int i = 0; i < len; i++) { if (iters[i] != null && iters[i].hasNext()) { hasNext = true; // depends on control dependency: [if], data = [none] args[i] = iters[i].next(); // depends on control dependency: [if], data = [none] } else { args[i] = valuesForNone.get(i); // depends on control dependency: [if], data = [none] } } if (hasNext == false) { throw new NoSuchElementException(); } return zipFunction.apply(Arrays.asList((T[]) args)); } }); } }
public class class_name { public void setExtendedKeyUsages(java.util.Collection<ExtendedKeyUsage> extendedKeyUsages) { if (extendedKeyUsages == null) { this.extendedKeyUsages = null; return; } this.extendedKeyUsages = new java.util.ArrayList<ExtendedKeyUsage>(extendedKeyUsages); } }
public class class_name { public void setExtendedKeyUsages(java.util.Collection<ExtendedKeyUsage> extendedKeyUsages) { if (extendedKeyUsages == null) { this.extendedKeyUsages = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.extendedKeyUsages = new java.util.ArrayList<ExtendedKeyUsage>(extendedKeyUsages); } }
public class class_name { @SuppressWarnings("unchecked") public <P extends ParaObject> List<P> getLinkedObjects(ParaObject obj, String type2, Pager... pager) { if (obj == null || obj.getId() == null || type2 == null) { return Collections.emptyList(); } String url = Utils.formatMessage("{0}/links/{1}", obj.getObjectURI(), type2); return getItems((Map<String, Object>) getEntity(invokeGet(url, pagerToParams(pager)), Map.class), pager); } }
public class class_name { @SuppressWarnings("unchecked") public <P extends ParaObject> List<P> getLinkedObjects(ParaObject obj, String type2, Pager... pager) { if (obj == null || obj.getId() == null || type2 == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } String url = Utils.formatMessage("{0}/links/{1}", obj.getObjectURI(), type2); return getItems((Map<String, Object>) getEntity(invokeGet(url, pagerToParams(pager)), Map.class), pager); } }
public class class_name { private TreeRule parseRule(HttpQuery query) { final TreeRule rule = new TreeRule(parseTreeId(query, true)); if (query.hasQueryStringParam("type")) { try { rule.setType(TreeRule.stringToType(query.getQueryStringParam("type"))); } catch (IllegalArgumentException e) { throw new BadRequestException("Unable to parse the 'type' parameter", e); } } if (query.hasQueryStringParam("field")) { rule.setField(query.getQueryStringParam("field")); } if (query.hasQueryStringParam("custom_field")) { rule.setCustomField(query.getQueryStringParam("custom_field")); } if (query.hasQueryStringParam("regex")) { try { rule.setRegex(query.getQueryStringParam("regex")); } catch (PatternSyntaxException e) { throw new BadRequestException( "Unable to parse the 'regex' parameter", e); } } if (query.hasQueryStringParam("separator")) { rule.setSeparator(query.getQueryStringParam("separator")); } if (query.hasQueryStringParam("description")) { rule.setDescription(query.getQueryStringParam("description")); } if (query.hasQueryStringParam("notes")) { rule.setNotes(query.getQueryStringParam("notes")); } if (query.hasQueryStringParam("regex_group_idx")) { try { rule.setRegexGroupIdx(Integer.parseInt( query.getQueryStringParam("regex_group_idx"))); } catch (NumberFormatException e) { throw new BadRequestException( "Unable to parse the 'regex_group_idx' parameter", e); } } if (query.hasQueryStringParam("display_format")) { rule.setDisplayFormat(query.getQueryStringParam("display_format")); } //if (query.hasQueryStringParam("level")) { try { rule.setLevel(Integer.parseInt( query.getRequiredQueryStringParam("level"))); } catch (NumberFormatException e) { throw new BadRequestException( "Unable to parse the 'level' parameter", e); } //} //if (query.hasQueryStringParam("order")) { try { rule.setOrder(Integer.parseInt( query.getRequiredQueryStringParam("order"))); } catch (NumberFormatException e) { throw new BadRequestException( "Unable to parse the 'order' parameter", e); } //} return rule; } }
public class class_name { private TreeRule parseRule(HttpQuery query) { final TreeRule rule = new TreeRule(parseTreeId(query, true)); if (query.hasQueryStringParam("type")) { try { rule.setType(TreeRule.stringToType(query.getQueryStringParam("type"))); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { throw new BadRequestException("Unable to parse the 'type' parameter", e); } // depends on control dependency: [catch], data = [none] } if (query.hasQueryStringParam("field")) { rule.setField(query.getQueryStringParam("field")); // depends on control dependency: [if], data = [none] } if (query.hasQueryStringParam("custom_field")) { rule.setCustomField(query.getQueryStringParam("custom_field")); // depends on control dependency: [if], data = [none] } if (query.hasQueryStringParam("regex")) { try { rule.setRegex(query.getQueryStringParam("regex")); // depends on control dependency: [try], data = [none] } catch (PatternSyntaxException e) { throw new BadRequestException( "Unable to parse the 'regex' parameter", e); } // depends on control dependency: [catch], data = [none] } if (query.hasQueryStringParam("separator")) { rule.setSeparator(query.getQueryStringParam("separator")); // depends on control dependency: [if], data = [none] } if (query.hasQueryStringParam("description")) { rule.setDescription(query.getQueryStringParam("description")); // depends on control dependency: [if], data = [none] } if (query.hasQueryStringParam("notes")) { rule.setNotes(query.getQueryStringParam("notes")); // depends on control dependency: [if], data = [none] } if (query.hasQueryStringParam("regex_group_idx")) { try { rule.setRegexGroupIdx(Integer.parseInt( query.getQueryStringParam("regex_group_idx"))); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new BadRequestException( "Unable to parse the 'regex_group_idx' parameter", e); } // depends on control dependency: [catch], data = [none] } if (query.hasQueryStringParam("display_format")) { rule.setDisplayFormat(query.getQueryStringParam("display_format")); // depends on control dependency: [if], data = [none] } //if (query.hasQueryStringParam("level")) { try { rule.setLevel(Integer.parseInt( query.getRequiredQueryStringParam("level"))); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new BadRequestException( "Unable to parse the 'level' parameter", e); } // depends on control dependency: [catch], data = [none] //} //if (query.hasQueryStringParam("order")) { try { rule.setOrder(Integer.parseInt( query.getRequiredQueryStringParam("order"))); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new BadRequestException( "Unable to parse the 'order' parameter", e); } // depends on control dependency: [catch], data = [none] //} return rule; } }
public class class_name { Optional<PointForecast> getPointForecast(ZonedDateTime dateTime) { for (Forecast forecast : forecasts) { if (forecast instanceof PointForecast) { PointForecast pointForecast = (PointForecast) forecast; if (createHourIndexKey(dateTime) .equals(createHourIndexKey(cloneZonedDateTime(pointForecast.getFrom())))) { return Optional.of(pointForecast); } } } return Optional.empty(); } }
public class class_name { Optional<PointForecast> getPointForecast(ZonedDateTime dateTime) { for (Forecast forecast : forecasts) { if (forecast instanceof PointForecast) { PointForecast pointForecast = (PointForecast) forecast; if (createHourIndexKey(dateTime) .equals(createHourIndexKey(cloneZonedDateTime(pointForecast.getFrom())))) { return Optional.of(pointForecast); // depends on control dependency: [if], data = [none] } } } return Optional.empty(); } }
public class class_name { protected void executeTree(final Map<Instance, Boolean> _map, final boolean _expand) { try { final List<Instance> instances = new ArrayList<>(); for (final Instance inst : _map.keySet()) { instances.add(inst); } final ValueParser parser = new ValueParser(new StringReader(this.valueLabel)); final ValueList valuelist = parser.ExpressionString(); final MultiPrintQuery print = new MultiPrintQuery(instances); valuelist.makeSelect(print); print.execute(); while (print.next()) { Object value = null; final Instance instance = print.getCurrentInstance(); value = valuelist.makeString(getInstance(), print, getMode()); final UIStructurBrowser child = getNewStructurBrowser(instance, this); this.children.add(child); child.setDirection(_map.get(instance)); child.setLabel(value.toString()); child.setAllowChildren(checkForAllowChildren(instance)); if (isAllowChildren()) { child.setParent(checkForChildren(instance)); } child.setImage(Image.getTypeIcon(instance.getType()) != null ? Image.getTypeIcon(instance.getType()) .getName() : null); } } catch (final EFapsException e) { throw new RestartResponseException(new ErrorPage(e)); } catch (final ParseException e) { throw new RestartResponseException(new ErrorPage(e)); } sortModel(); expand(_expand); super.setInitialized(true); } }
public class class_name { protected void executeTree(final Map<Instance, Boolean> _map, final boolean _expand) { try { final List<Instance> instances = new ArrayList<>(); for (final Instance inst : _map.keySet()) { instances.add(inst); // depends on control dependency: [for], data = [inst] } final ValueParser parser = new ValueParser(new StringReader(this.valueLabel)); final ValueList valuelist = parser.ExpressionString(); final MultiPrintQuery print = new MultiPrintQuery(instances); valuelist.makeSelect(print); // depends on control dependency: [try], data = [none] print.execute(); // depends on control dependency: [try], data = [none] while (print.next()) { Object value = null; final Instance instance = print.getCurrentInstance(); value = valuelist.makeString(getInstance(), print, getMode()); // depends on control dependency: [while], data = [none] final UIStructurBrowser child = getNewStructurBrowser(instance, this); this.children.add(child); // depends on control dependency: [while], data = [none] child.setDirection(_map.get(instance)); // depends on control dependency: [while], data = [none] child.setLabel(value.toString()); // depends on control dependency: [while], data = [none] child.setAllowChildren(checkForAllowChildren(instance)); // depends on control dependency: [while], data = [none] if (isAllowChildren()) { child.setParent(checkForChildren(instance)); // depends on control dependency: [if], data = [none] } child.setImage(Image.getTypeIcon(instance.getType()) != null ? Image.getTypeIcon(instance.getType()) .getName() : null); // depends on control dependency: [while], data = [none] } } catch (final EFapsException e) { throw new RestartResponseException(new ErrorPage(e)); } catch (final ParseException e) { // depends on control dependency: [catch], data = [none] throw new RestartResponseException(new ErrorPage(e)); } // depends on control dependency: [catch], data = [none] sortModel(); expand(_expand); super.setInitialized(true); } }
public class class_name { private InputStream getResourceInputStream(String path) { InputStream is = config.getContext().getResourceAsStream(path); if (is == null) { try { is = ClassLoaderResourceUtils.getResourceAsStream(path, this); } catch (FileNotFoundException e) { throw new BundlingProcessException(e); } } return is; } }
public class class_name { private InputStream getResourceInputStream(String path) { InputStream is = config.getContext().getResourceAsStream(path); if (is == null) { try { is = ClassLoaderResourceUtils.getResourceAsStream(path, this); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException e) { throw new BundlingProcessException(e); } // depends on control dependency: [catch], data = [none] } return is; } }
public class class_name { public void marshall(UpdateTagsForDomainRequest updateTagsForDomainRequest, ProtocolMarshaller protocolMarshaller) { if (updateTagsForDomainRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateTagsForDomainRequest.getDomainName(), DOMAINNAME_BINDING); protocolMarshaller.marshall(updateTagsForDomainRequest.getTagsToUpdate(), TAGSTOUPDATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateTagsForDomainRequest updateTagsForDomainRequest, ProtocolMarshaller protocolMarshaller) { if (updateTagsForDomainRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateTagsForDomainRequest.getDomainName(), DOMAINNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateTagsForDomainRequest.getTagsToUpdate(), TAGSTOUPDATE_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 { @ConditionalOnClass(name = {"io.grpc.netty.shaded.io.netty.channel.Channel", "io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder"}) @Bean public ShadedNettyGrpcServerFactory shadedNettyGrpcServerFactory(final GrpcServerProperties properties, final GrpcServiceDiscoverer serviceDiscoverer, final List<GrpcServerConfigurer> serverConfigurers) { final ShadedNettyGrpcServerFactory factory = new ShadedNettyGrpcServerFactory(properties, serverConfigurers); for (final GrpcServiceDefinition service : serviceDiscoverer.findGrpcServices()) { factory.addService(service); } return factory; } }
public class class_name { @ConditionalOnClass(name = {"io.grpc.netty.shaded.io.netty.channel.Channel", "io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder"}) @Bean public ShadedNettyGrpcServerFactory shadedNettyGrpcServerFactory(final GrpcServerProperties properties, final GrpcServiceDiscoverer serviceDiscoverer, final List<GrpcServerConfigurer> serverConfigurers) { final ShadedNettyGrpcServerFactory factory = new ShadedNettyGrpcServerFactory(properties, serverConfigurers); for (final GrpcServiceDefinition service : serviceDiscoverer.findGrpcServices()) { factory.addService(service); // depends on control dependency: [for], data = [service] } return factory; } }
public class class_name { public OExecutionStepInternal executeUntilReturn() { if (steps.size() > 0) { lastStep = steps.get(steps.size() - 1); } for (int i = 0; i < steps.size() - 1; i++) { ScriptLineStep step = steps.get(i); if (step.containsReturn()) { OExecutionStepInternal returnStep = step.executeUntilReturn(ctx); if (returnStep != null) { lastStep = returnStep; return lastStep; } } OResultSet lastResult = step.syncPull(ctx, 100); while (lastResult.hasNext()) { while (lastResult.hasNext()) { lastResult.next(); } lastResult = step.syncPull(ctx, 100); } } this.lastStep = steps.get(steps.size() - 1); return lastStep; } }
public class class_name { public OExecutionStepInternal executeUntilReturn() { if (steps.size() > 0) { lastStep = steps.get(steps.size() - 1); // depends on control dependency: [if], data = [(steps.size()] } for (int i = 0; i < steps.size() - 1; i++) { ScriptLineStep step = steps.get(i); if (step.containsReturn()) { OExecutionStepInternal returnStep = step.executeUntilReturn(ctx); if (returnStep != null) { lastStep = returnStep; // depends on control dependency: [if], data = [none] return lastStep; // depends on control dependency: [if], data = [none] } } OResultSet lastResult = step.syncPull(ctx, 100); while (lastResult.hasNext()) { while (lastResult.hasNext()) { lastResult.next(); // depends on control dependency: [while], data = [none] } lastResult = step.syncPull(ctx, 100); // depends on control dependency: [while], data = [none] } } this.lastStep = steps.get(steps.size() - 1); return lastStep; } }
public class class_name { public InsertStrategy getOverridenStrategy(AbstractEntityProperty<?> property) { final InsertStrategy insertStrategy = OverridingOptional .from(this.insertStrategy) .defaultValue(property.insertStrategy()) .get(); if (LOGGER.isTraceEnabled()) { LOGGER.trace(format("Get runtime insert strategy for entity %s : %s", property.entityClass.getCanonicalName(), insertStrategy.name())); } return insertStrategy; } }
public class class_name { public InsertStrategy getOverridenStrategy(AbstractEntityProperty<?> property) { final InsertStrategy insertStrategy = OverridingOptional .from(this.insertStrategy) .defaultValue(property.insertStrategy()) .get(); if (LOGGER.isTraceEnabled()) { LOGGER.trace(format("Get runtime insert strategy for entity %s : %s", property.entityClass.getCanonicalName(), insertStrategy.name())); // depends on control dependency: [if], data = [none] } return insertStrategy; } }
public class class_name { public static void tryUnlock(CmsObject cms, CmsResource resource) { try { cms.unlockResource(resource); } catch (CmsException e) { LOG.debug("Unable to unlock " + resource.getRootPath(), e); } } }
public class class_name { public static void tryUnlock(CmsObject cms, CmsResource resource) { try { cms.unlockResource(resource); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.debug("Unable to unlock " + resource.getRootPath(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <T> List<T> makeSureInit(List<T> ts) { if (ts == null) { ts = new ArrayList<T>(); } return ts; } }
public class class_name { public static <T> List<T> makeSureInit(List<T> ts) { if (ts == null) { ts = new ArrayList<T>(); // depends on control dependency: [if], data = [none] } return ts; } }
public class class_name { public void put(K key,V value){ List<V> list; if (map.containsKey(key)){ list=(List<V>)map.get(key); } else { list=new Vector<V>(); map.put(key,list); } list.add(value); } }
public class class_name { public void put(K key,V value){ List<V> list; if (map.containsKey(key)){ list=(List<V>)map.get(key); // depends on control dependency: [if], data = [none] } else { list=new Vector<V>(); // depends on control dependency: [if], data = [none] map.put(key,list); // depends on control dependency: [if], data = [none] } list.add(value); } }
public class class_name { public static String isbn() { StringBuffer stringBuffer = new StringBuffer("09"); stringBuffer.append(String.format("%06d", JDefaultNumber.randomIntBetweenTwoNumbers(0, 49999))); stringBuffer.append(String.format("%02d", JDefaultNumber.randomIntBetweenTwoNumbers(0, 99))); String numberString = stringBuffer.toString(); int number = Integer.parseInt(numberString); int sum = 0; for (int i = 2; i <= 10; i++) { int digit = number % 10; // rightmost digit sum = sum + i * digit; number = number / 10; } // Determine check digit, use X for 10 String checkDigit = null; if (sum % 11 == 1) { checkDigit = "X"; } else if (sum % 11 == 0) { checkDigit = "0"; } else { checkDigit = (11 - (sum % 11)) + ""; } // System.out.println("The full ISBN number is " + numberString+checkDigit); String returnString = stringBuffer.toString(); returnString = returnString.substring(0, 1) + "-" + returnString.substring(1, 7) + "-" + returnString.substring(7, 9) + "-" + checkDigit; return returnString; } }
public class class_name { public static String isbn() { StringBuffer stringBuffer = new StringBuffer("09"); stringBuffer.append(String.format("%06d", JDefaultNumber.randomIntBetweenTwoNumbers(0, 49999))); stringBuffer.append(String.format("%02d", JDefaultNumber.randomIntBetweenTwoNumbers(0, 99))); String numberString = stringBuffer.toString(); int number = Integer.parseInt(numberString); int sum = 0; for (int i = 2; i <= 10; i++) { int digit = number % 10; // rightmost digit sum = sum + i * digit; // depends on control dependency: [for], data = [i] number = number / 10; // depends on control dependency: [for], data = [none] } // Determine check digit, use X for 10 String checkDigit = null; if (sum % 11 == 1) { checkDigit = "X"; // depends on control dependency: [if], data = [none] } else if (sum % 11 == 0) { checkDigit = "0"; // depends on control dependency: [if], data = [none] } else { checkDigit = (11 - (sum % 11)) + ""; // depends on control dependency: [if], data = [(sum % 11] } // System.out.println("The full ISBN number is " + numberString+checkDigit); String returnString = stringBuffer.toString(); returnString = returnString.substring(0, 1) + "-" + returnString.substring(1, 7) + "-" + returnString.substring(7, 9) + "-" + checkDigit; return returnString; } }
public class class_name { public void setAttributes(java.util.Collection<Attribute> attributes) { if (attributes == null) { this.attributes = null; return; } this.attributes = new java.util.ArrayList<Attribute>(attributes); } }
public class class_name { public void setAttributes(java.util.Collection<Attribute> attributes) { if (attributes == null) { this.attributes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.attributes = new java.util.ArrayList<Attribute>(attributes); } }
public class class_name { @Override protected void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException { if (!snapshot.getSnapshotControl().shouldInclude(ForeignKey.class)) { return; } if (foundObject instanceof Table) { Table table = (Table) foundObject; Database database = snapshot.getDatabase(); Schema schema; schema = table.getSchema(); Set<String> seenFks = new HashSet<>(); List<CachedRow> importedKeyMetadataResultSet; try { importedKeyMetadataResultSet = ((JdbcDatabaseSnapshot) snapshot).getMetaDataFromCache().getForeignKeys(((AbstractJdbcDatabase) database) .getJdbcCatalogName(schema), ((AbstractJdbcDatabase) database).getJdbcSchemaName(schema), database.correctObjectName(table.getName(), Table.class), null); for (CachedRow row : importedKeyMetadataResultSet) { ForeignKey fk = new ForeignKey().setName(row.getString("FK_NAME")).setForeignKeyTable(table); if (seenFks.add(fk.getName())) { table.getOutgoingForeignKeys().add(fk); } } } catch (Exception e) { throw new DatabaseException(e); } } } }
public class class_name { @Override protected void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException { if (!snapshot.getSnapshotControl().shouldInclude(ForeignKey.class)) { return; } if (foundObject instanceof Table) { Table table = (Table) foundObject; Database database = snapshot.getDatabase(); Schema schema; schema = table.getSchema(); Set<String> seenFks = new HashSet<>(); List<CachedRow> importedKeyMetadataResultSet; try { importedKeyMetadataResultSet = ((JdbcDatabaseSnapshot) snapshot).getMetaDataFromCache().getForeignKeys(((AbstractJdbcDatabase) database) .getJdbcCatalogName(schema), ((AbstractJdbcDatabase) database).getJdbcSchemaName(schema), database.correctObjectName(table.getName(), Table.class), null); // depends on control dependency: [try], data = [none] for (CachedRow row : importedKeyMetadataResultSet) { ForeignKey fk = new ForeignKey().setName(row.getString("FK_NAME")).setForeignKeyTable(table); if (seenFks.add(fk.getName())) { table.getOutgoingForeignKeys().add(fk); // depends on control dependency: [if], data = [none] } } } catch (Exception e) { throw new DatabaseException(e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static String getRemoteInterfaceName(String stubClassName) { if (stubClassName != null && stubClassName.endsWith("_Stub") && !stubClassName.endsWith("._Stub")) // PM25511 { StringBuilder nameBuilder = new StringBuilder(stubClassName); nameBuilder.setLength(nameBuilder.length() - 5); int packageOffset = nameBuilder.lastIndexOf(".") + 1; if (nameBuilder.charAt(packageOffset) == '_') nameBuilder.deleteCharAt(packageOffset); else return null; return nameBuilder.toString(); } return null; } }
public class class_name { public static String getRemoteInterfaceName(String stubClassName) { if (stubClassName != null && stubClassName.endsWith("_Stub") && !stubClassName.endsWith("._Stub")) // PM25511 { StringBuilder nameBuilder = new StringBuilder(stubClassName); nameBuilder.setLength(nameBuilder.length() - 5); // depends on control dependency: [if], data = [none] int packageOffset = nameBuilder.lastIndexOf(".") + 1; if (nameBuilder.charAt(packageOffset) == '_') nameBuilder.deleteCharAt(packageOffset); else return null; return nameBuilder.toString(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private static double thresholdLength(double[][] matrix, int[] edges) { double[] lengths = new double[edges.length >> 1]; for(int i = 0, e = edges.length - 1; i < e; i += 2) { lengths[i >> 1] = matrix[edges[i]][edges[i + 1]]; } Arrays.sort(lengths); final int pos = (lengths.length >> 1); // 50% return lengths[pos]; } }
public class class_name { private static double thresholdLength(double[][] matrix, int[] edges) { double[] lengths = new double[edges.length >> 1]; for(int i = 0, e = edges.length - 1; i < e; i += 2) { lengths[i >> 1] = matrix[edges[i]][edges[i + 1]]; // depends on control dependency: [for], data = [i] } Arrays.sort(lengths); final int pos = (lengths.length >> 1); // 50% return lengths[pos]; } }
public class class_name { @Override public byte[] getBuffer () { synchronized ( this.cache ) { byte[] buf; if ( this.freeBuffers > 0 ) { for ( int i = 0; i < this.cache.length; i++ ) { if ( this.cache[ i ] != null ) { buf = (byte[]) this.cache[ i ]; this.cache[ i ] = null; this.freeBuffers--; return buf; } } } return new byte[this.bufferSize]; } } }
public class class_name { @Override public byte[] getBuffer () { synchronized ( this.cache ) { byte[] buf; if ( this.freeBuffers > 0 ) { for ( int i = 0; i < this.cache.length; i++ ) { if ( this.cache[ i ] != null ) { buf = (byte[]) this.cache[ i ]; // depends on control dependency: [if], data = [none] this.cache[ i ] = null; // depends on control dependency: [if], data = [none] this.freeBuffers--; // depends on control dependency: [if], data = [none] return buf; // depends on control dependency: [if], data = [none] } } } return new byte[this.bufferSize]; } } }
public class class_name { public static <T> T findOneByField(Iterable<T> collection, final String fieldName, final Object fieldValue) { return findOne(collection, new Filter<T>() { @Override public boolean accept(T t) { if (t instanceof Map) { final Map<?, ?> map = (Map<?, ?>) t; final Object value = map.get(fieldName); return ObjectUtil.equal(value, fieldValue); } // 普通Bean final Object value = ReflectUtil.getFieldValue(t, fieldName); return ObjectUtil.equal(value, fieldValue); } }); } }
public class class_name { public static <T> T findOneByField(Iterable<T> collection, final String fieldName, final Object fieldValue) { return findOne(collection, new Filter<T>() { @Override public boolean accept(T t) { if (t instanceof Map) { final Map<?, ?> map = (Map<?, ?>) t; final Object value = map.get(fieldName); return ObjectUtil.equal(value, fieldValue); // depends on control dependency: [if], data = [none] } // 普通Bean final Object value = ReflectUtil.getFieldValue(t, fieldName); return ObjectUtil.equal(value, fieldValue); } }); } }
public class class_name { public ContainerInstance withRemainingResources(Resource... remainingResources) { if (this.remainingResources == null) { setRemainingResources(new com.amazonaws.internal.SdkInternalList<Resource>(remainingResources.length)); } for (Resource ele : remainingResources) { this.remainingResources.add(ele); } return this; } }
public class class_name { public ContainerInstance withRemainingResources(Resource... remainingResources) { if (this.remainingResources == null) { setRemainingResources(new com.amazonaws.internal.SdkInternalList<Resource>(remainingResources.length)); // depends on control dependency: [if], data = [none] } for (Resource ele : remainingResources) { this.remainingResources.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected void finishToken(boolean deferErrors) throws XMLStreamException { switch (mCurrToken) { case CDATA: if (mCfgCoalesceText) { readCoalescedText(mCurrToken, deferErrors); } else { if (readCDataSecondary(Integer.MAX_VALUE)) { mTokenState = TOKEN_FULL_SINGLE; } else { // can this ever happen? mTokenState = TOKEN_PARTIAL_SINGLE; } } return; case CHARACTERS: if (mCfgCoalesceText) { /* 21-Sep-2005, TSa: It is often possible to optimize * here: if we get '<' NOT followed by '!', it can not * be CDATA, and thus we are done. */ if (mTokenState == TOKEN_FULL_SINGLE && (mInputPtr + 1) < mInputEnd && mInputBuffer[mInputPtr+1] != '!') { mTokenState = TOKEN_FULL_COALESCED; return; } readCoalescedText(mCurrToken, deferErrors); } else { if (readTextSecondary(mShortestTextSegment, deferErrors)) { mTokenState = TOKEN_FULL_SINGLE; } else { mTokenState = TOKEN_PARTIAL_SINGLE; } } return; case SPACE: { /* Only need to ensure there's no non-whitespace text * when parsing 'real' ignorable white space (in validating * mode, but that's implicit here) */ boolean prolog = (mParseState != STATE_TREE); readSpaceSecondary(prolog); mTokenState = TOKEN_FULL_COALESCED; } return; case COMMENT: readComment(); mTokenState = TOKEN_FULL_COALESCED; return; case DTD: /* 05-Jan-2006, TSa: Although we shouldn't have to use finally * here, it's probably better to do that for robustness * (specifically, in case of a parsing problem, we don't want * to remain in 'DTD partially read' case -- it's better * to get in panic mode and skip the rest) */ try { finishDTD(true); } finally { mTokenState = TOKEN_FULL_COALESCED; } return; case PROCESSING_INSTRUCTION: readPI(); mTokenState = TOKEN_FULL_COALESCED; return; case START_ELEMENT: case END_ELEMENT: // these 2 should never end up in here... case ENTITY_REFERENCE: case ENTITY_DECLARATION: case NOTATION_DECLARATION: case START_DOCUMENT: case END_DOCUMENT: throw new IllegalStateException("finishToken() called when current token is "+tokenTypeDesc(mCurrToken)); case ATTRIBUTE: case NAMESPACE: // These two are never returned by this class default: } throw new IllegalStateException("Internal error: unexpected token "+tokenTypeDesc(mCurrToken)); } }
public class class_name { protected void finishToken(boolean deferErrors) throws XMLStreamException { switch (mCurrToken) { case CDATA: if (mCfgCoalesceText) { readCoalescedText(mCurrToken, deferErrors); // depends on control dependency: [if], data = [none] } else { if (readCDataSecondary(Integer.MAX_VALUE)) { mTokenState = TOKEN_FULL_SINGLE; // depends on control dependency: [if], data = [none] } else { // can this ever happen? mTokenState = TOKEN_PARTIAL_SINGLE; // depends on control dependency: [if], data = [none] } } return; case CHARACTERS: if (mCfgCoalesceText) { /* 21-Sep-2005, TSa: It is often possible to optimize * here: if we get '<' NOT followed by '!', it can not * be CDATA, and thus we are done. */ if (mTokenState == TOKEN_FULL_SINGLE && (mInputPtr + 1) < mInputEnd && mInputBuffer[mInputPtr+1] != '!') { mTokenState = TOKEN_FULL_COALESCED; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } readCoalescedText(mCurrToken, deferErrors); // depends on control dependency: [if], data = [none] } else { if (readTextSecondary(mShortestTextSegment, deferErrors)) { mTokenState = TOKEN_FULL_SINGLE; // depends on control dependency: [if], data = [none] } else { mTokenState = TOKEN_PARTIAL_SINGLE; // depends on control dependency: [if], data = [none] } } return; case SPACE: { /* Only need to ensure there's no non-whitespace text * when parsing 'real' ignorable white space (in validating * mode, but that's implicit here) */ boolean prolog = (mParseState != STATE_TREE); readSpaceSecondary(prolog); mTokenState = TOKEN_FULL_COALESCED; } return; case COMMENT: readComment(); mTokenState = TOKEN_FULL_COALESCED; return; case DTD: /* 05-Jan-2006, TSa: Although we shouldn't have to use finally * here, it's probably better to do that for robustness * (specifically, in case of a parsing problem, we don't want * to remain in 'DTD partially read' case -- it's better * to get in panic mode and skip the rest) */ try { finishDTD(true); } finally { mTokenState = TOKEN_FULL_COALESCED; } return; case PROCESSING_INSTRUCTION: readPI(); mTokenState = TOKEN_FULL_COALESCED; return; case START_ELEMENT: case END_ELEMENT: // these 2 should never end up in here... case ENTITY_REFERENCE: case ENTITY_DECLARATION: case NOTATION_DECLARATION: case START_DOCUMENT: case END_DOCUMENT: throw new IllegalStateException("finishToken() called when current token is "+tokenTypeDesc(mCurrToken)); case ATTRIBUTE: case NAMESPACE: // These two are never returned by this class default: } throw new IllegalStateException("Internal error: unexpected token "+tokenTypeDesc(mCurrToken)); } }
public class class_name { protected void updateTables() { byte[] data = m_model.getData(); int columns = m_model.getColumns(); int rows = (data.length / columns) + 1; int offset = m_model.getOffset(); String[][] hexData = new String[rows][columns]; String[][] asciiData = new String[rows][columns]; int row = 0; int column = 0; StringBuilder hexValue = new StringBuilder(); for (int index = offset; index < data.length; index++) { int value = data[index]; hexValue.setLength(0); hexValue.append(HEX_DIGITS[(value & 0xF0) >> 4]); hexValue.append(HEX_DIGITS[value & 0x0F]); char c = (char) value; if ((c > 200) || (c < 27)) { c = ' '; } hexData[row][column] = hexValue.toString(); asciiData[row][column] = Character.toString(c); ++column; if (column == columns) { column = 0; ++row; } } String[] columnHeadings = new String[columns]; TableModel hexTableModel = new DefaultTableModel(hexData, columnHeadings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; TableModel asciiTableModel = new DefaultTableModel(asciiData, columnHeadings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; m_model.setSizeValueLabel(Integer.toString(data.length)); m_model.setHexTableModel(hexTableModel); m_model.setAsciiTableModel(asciiTableModel); m_model.setCurrentSelectionIndex(0); m_model.setPreviousSelectionIndex(0); } }
public class class_name { protected void updateTables() { byte[] data = m_model.getData(); int columns = m_model.getColumns(); int rows = (data.length / columns) + 1; int offset = m_model.getOffset(); String[][] hexData = new String[rows][columns]; String[][] asciiData = new String[rows][columns]; int row = 0; int column = 0; StringBuilder hexValue = new StringBuilder(); for (int index = offset; index < data.length; index++) { int value = data[index]; hexValue.setLength(0); // depends on control dependency: [for], data = [none] hexValue.append(HEX_DIGITS[(value & 0xF0) >> 4]); // depends on control dependency: [for], data = [none] hexValue.append(HEX_DIGITS[value & 0x0F]); // depends on control dependency: [for], data = [none] char c = (char) value; if ((c > 200) || (c < 27)) { c = ' '; // depends on control dependency: [if], data = [none] } hexData[row][column] = hexValue.toString(); // depends on control dependency: [for], data = [none] asciiData[row][column] = Character.toString(c); // depends on control dependency: [for], data = [none] ++column; // depends on control dependency: [for], data = [none] if (column == columns) { column = 0; // depends on control dependency: [if], data = [none] ++row; // depends on control dependency: [if], data = [none] } } String[] columnHeadings = new String[columns]; TableModel hexTableModel = new DefaultTableModel(hexData, columnHeadings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; TableModel asciiTableModel = new DefaultTableModel(asciiData, columnHeadings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; m_model.setSizeValueLabel(Integer.toString(data.length)); m_model.setHexTableModel(hexTableModel); m_model.setAsciiTableModel(asciiTableModel); m_model.setCurrentSelectionIndex(0); m_model.setPreviousSelectionIndex(0); } }
public class class_name { public Properties getProperties(String sslAliasName, Map<String, Object> connectionInfo, SSLConfigChangeListener listener, boolean tryDefault) throws SSLException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "getProperties", new Object[] { sslAliasName, connectionInfo, listener }); SecurityManager sm = System.getSecurityManager(); if (sm != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Performing Java 2 Security Permission Check ..."); Tr.debug(tc, "Expecting : " + GET_SSLCONFIG.toString()); } sm.checkPermission(GET_SSLCONFIG); } boolean isOutbound = true; if (SSLConfigManager.getInstance().isTransportSecurityEnabled()) { if (connectionInfo != null) { String direction = (String) connectionInfo.get(Constants.CONNECTION_INFO_DIRECTION); if (direction != null && direction.equals(Constants.DIRECTION_INBOUND)) isOutbound = false; } } try { // programmatic selection Properties programmaticProperties = getSSLPropertiesOnThread(); if (programmaticProperties != null) { // convert to SSLConfig for validation of customer properties SSLConfig programmaticConfig = new SSLConfig(programmaticProperties); if (listener != null) { String alias = programmaticConfig.getProperty(Constants.SSLPROP_ALIAS); if (alias == null) alias = sslAliasName; registerEvent(listener, alias, programmaticConfig, Constants.SELECTION_TYPE_THREAD, connectionInfo); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "getProperties -> programmatic"); return programmaticConfig; } // direct selection if (sslAliasName != null && sslAliasName.length() > 0) { Properties directSelectionProperties = SSLConfigManager.getInstance().getProperties(sslAliasName); if (directSelectionProperties == null) { // added for issue 876 String origAliasName = SSLConfigManager.getInstance().getPossibleActualID(sslAliasName); if (origAliasName != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "could not find properties with " + sslAliasName + " trying properties with " + origAliasName); directSelectionProperties = SSLConfigManager.getInstance().getProperties(origAliasName); } } if (directSelectionProperties != null) { directSelectionProperties = SSLConfigManager.getInstance().determineIfCSIv2SettingsApply(directSelectionProperties, connectionInfo); if (listener != null) registerEvent(listener, sslAliasName, directSelectionProperties, Constants.SELECTION_TYPE_DIRECT, connectionInfo); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "getProperties -> direct"); return directSelectionProperties; } } // dynamic selection if (SSLConfigManager.getInstance().isTransportSecurityEnabled() && isOutbound) { SSLConfig dynamicSelectionConfig = (SSLConfig) SSLConfigManager.getInstance().getPropertiesFromDynamicSelectionInfo(connectionInfo); if (dynamicSelectionConfig != null) { if (listener != null) { String alias = dynamicSelectionConfig.getProperty(Constants.SSLPROP_ALIAS); if (alias == null) alias = sslAliasName; registerEvent(listener, alias, dynamicSelectionConfig, Constants.SELECTION_TYPE_DYNAMIC, connectionInfo); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "getProperties -> dynamic"); return dynamicSelectionConfig; } } if (tryDefault) { if (SSLConfigManager.getInstance().isTransportSecurityEnabled() && isOutbound) { Properties props = SSLConfigManager.getInstance().getOutboundDefaultSSLConfig(); if (props != null && !props.isEmpty()) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getProperties -> outbound default"); } return props; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getProperties -> default"); } return SSLConfigManager.getInstance().getDefaultSSLConfig(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getProperties -> null"); } return null; } } catch (Exception e) { FFDCFilter.processException(e, getClass().getName(), "getProperties (2)", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "The following exception occurred in getProperties().", new Object[] { e }); throw asSSLException(e); } } }
public class class_name { public Properties getProperties(String sslAliasName, Map<String, Object> connectionInfo, SSLConfigChangeListener listener, boolean tryDefault) throws SSLException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "getProperties", new Object[] { sslAliasName, connectionInfo, listener }); SecurityManager sm = System.getSecurityManager(); if (sm != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Performing Java 2 Security Permission Check ..."); // depends on control dependency: [if], data = [none] Tr.debug(tc, "Expecting : " + GET_SSLCONFIG.toString()); // depends on control dependency: [if], data = [none] } sm.checkPermission(GET_SSLCONFIG); // depends on control dependency: [if], data = [none] } boolean isOutbound = true; if (SSLConfigManager.getInstance().isTransportSecurityEnabled()) { if (connectionInfo != null) { String direction = (String) connectionInfo.get(Constants.CONNECTION_INFO_DIRECTION); if (direction != null && direction.equals(Constants.DIRECTION_INBOUND)) isOutbound = false; } } try { // programmatic selection Properties programmaticProperties = getSSLPropertiesOnThread(); if (programmaticProperties != null) { // convert to SSLConfig for validation of customer properties SSLConfig programmaticConfig = new SSLConfig(programmaticProperties); if (listener != null) { String alias = programmaticConfig.getProperty(Constants.SSLPROP_ALIAS); if (alias == null) alias = sslAliasName; registerEvent(listener, alias, programmaticConfig, Constants.SELECTION_TYPE_THREAD, connectionInfo); // depends on control dependency: [if], data = [(listener] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "getProperties -> programmatic"); return programmaticConfig; // depends on control dependency: [if], data = [none] } // direct selection if (sslAliasName != null && sslAliasName.length() > 0) { Properties directSelectionProperties = SSLConfigManager.getInstance().getProperties(sslAliasName); if (directSelectionProperties == null) { // added for issue 876 String origAliasName = SSLConfigManager.getInstance().getPossibleActualID(sslAliasName); if (origAliasName != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "could not find properties with " + sslAliasName + " trying properties with " + origAliasName); directSelectionProperties = SSLConfigManager.getInstance().getProperties(origAliasName); // depends on control dependency: [if], data = [(origAliasName] } } if (directSelectionProperties != null) { directSelectionProperties = SSLConfigManager.getInstance().determineIfCSIv2SettingsApply(directSelectionProperties, connectionInfo); // depends on control dependency: [if], data = [(directSelectionProperties] if (listener != null) registerEvent(listener, sslAliasName, directSelectionProperties, Constants.SELECTION_TYPE_DIRECT, connectionInfo); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "getProperties -> direct"); return directSelectionProperties; // depends on control dependency: [if], data = [none] } } // dynamic selection if (SSLConfigManager.getInstance().isTransportSecurityEnabled() && isOutbound) { SSLConfig dynamicSelectionConfig = (SSLConfig) SSLConfigManager.getInstance().getPropertiesFromDynamicSelectionInfo(connectionInfo); if (dynamicSelectionConfig != null) { if (listener != null) { String alias = dynamicSelectionConfig.getProperty(Constants.SSLPROP_ALIAS); if (alias == null) alias = sslAliasName; registerEvent(listener, alias, dynamicSelectionConfig, Constants.SELECTION_TYPE_DYNAMIC, connectionInfo); // depends on control dependency: [if], data = [(listener] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "getProperties -> dynamic"); return dynamicSelectionConfig; // depends on control dependency: [if], data = [none] } } if (tryDefault) { if (SSLConfigManager.getInstance().isTransportSecurityEnabled() && isOutbound) { Properties props = SSLConfigManager.getInstance().getOutboundDefaultSSLConfig(); if (props != null && !props.isEmpty()) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getProperties -> outbound default"); // depends on control dependency: [if], data = [none] } return props; // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getProperties -> default"); // depends on control dependency: [if], data = [none] } return SSLConfigManager.getInstance().getDefaultSSLConfig(); // depends on control dependency: [if], data = [none] } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getProperties -> null"); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } } catch (Exception e) { FFDCFilter.processException(e, getClass().getName(), "getProperties (2)", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "The following exception occurred in getProperties().", new Object[] { e }); throw asSSLException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public AbstractExpression replaceWithTVE( Map<AbstractExpression, Integer> aggTableIndexMap, Map<Integer, ParsedColInfo> indexToColumnMap) { Integer ii = aggTableIndexMap.get(this); if (ii != null) { ParsedColInfo col = indexToColumnMap.get(ii); TupleValueExpression tve = new TupleValueExpression( col.m_tableName, col.m_tableAlias, col.m_columnName, col.m_alias, this, ii); if (this instanceof TupleValueExpression) { tve.setOrigStmtId(((TupleValueExpression)this).getOrigStmtId()); } // To prevent pushdown of LIMIT when ORDER BY references an agg. ENG-3487. if (hasAnySubexpressionOfClass(AggregateExpression.class)) { tve.setHasAggregate(true); } return tve; } AbstractExpression lnode = null; AbstractExpression rnode = null; if (m_left != null) { lnode = m_left.replaceWithTVE(aggTableIndexMap, indexToColumnMap); } if (m_right != null) { rnode = m_right.replaceWithTVE(aggTableIndexMap, indexToColumnMap); } ArrayList<AbstractExpression> newArgs = null; boolean changed = false; if (m_args != null) { newArgs = new ArrayList<>(); for (AbstractExpression expr: m_args) { AbstractExpression ex = expr.replaceWithTVE(aggTableIndexMap, indexToColumnMap); newArgs.add(ex); if (ex != expr) { changed = true; } } } if (m_left != lnode || m_right != rnode || changed) { AbstractExpression resExpr = clone(); resExpr.setLeft(lnode); resExpr.setRight(rnode); resExpr.setArgs(newArgs); return resExpr; } return this; } }
public class class_name { public AbstractExpression replaceWithTVE( Map<AbstractExpression, Integer> aggTableIndexMap, Map<Integer, ParsedColInfo> indexToColumnMap) { Integer ii = aggTableIndexMap.get(this); if (ii != null) { ParsedColInfo col = indexToColumnMap.get(ii); TupleValueExpression tve = new TupleValueExpression( col.m_tableName, col.m_tableAlias, col.m_columnName, col.m_alias, this, ii); if (this instanceof TupleValueExpression) { tve.setOrigStmtId(((TupleValueExpression)this).getOrigStmtId()); // depends on control dependency: [if], data = [none] } // To prevent pushdown of LIMIT when ORDER BY references an agg. ENG-3487. if (hasAnySubexpressionOfClass(AggregateExpression.class)) { tve.setHasAggregate(true); // depends on control dependency: [if], data = [none] } return tve; // depends on control dependency: [if], data = [none] } AbstractExpression lnode = null; AbstractExpression rnode = null; if (m_left != null) { lnode = m_left.replaceWithTVE(aggTableIndexMap, indexToColumnMap); // depends on control dependency: [if], data = [none] } if (m_right != null) { rnode = m_right.replaceWithTVE(aggTableIndexMap, indexToColumnMap); // depends on control dependency: [if], data = [none] } ArrayList<AbstractExpression> newArgs = null; boolean changed = false; if (m_args != null) { newArgs = new ArrayList<>(); // depends on control dependency: [if], data = [none] for (AbstractExpression expr: m_args) { AbstractExpression ex = expr.replaceWithTVE(aggTableIndexMap, indexToColumnMap); newArgs.add(ex); // depends on control dependency: [for], data = [none] if (ex != expr) { changed = true; // depends on control dependency: [if], data = [none] } } } if (m_left != lnode || m_right != rnode || changed) { AbstractExpression resExpr = clone(); resExpr.setLeft(lnode); // depends on control dependency: [if], data = [none] resExpr.setRight(rnode); // depends on control dependency: [if], data = [none] resExpr.setArgs(newArgs); // depends on control dependency: [if], data = [none] return resExpr; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { int getTabIndex(Component component) { List<Component> tabs = Lists.newArrayList(m_tabs.iterator()); while (component != null) { int pos = tabs.indexOf(component); if (pos >= 0) { return pos; } component = component.getParent(); } return -1; } }
public class class_name { int getTabIndex(Component component) { List<Component> tabs = Lists.newArrayList(m_tabs.iterator()); while (component != null) { int pos = tabs.indexOf(component); if (pos >= 0) { return pos; // depends on control dependency: [if], data = [none] } component = component.getParent(); // depends on control dependency: [while], data = [none] } return -1; } }
public class class_name { protected void calibrate () { long currentTimer = current(); long currentMillis = System.currentTimeMillis(); long elapsedTimer = currentTimer - _driftTimerStamp; float elapsedMillis = currentMillis - _driftMilliStamp; float drift = elapsedMillis / (elapsedTimer / _milliDivider); if (_debugCalibrate.getValue()) { log.warning("Calibrating", "timer", elapsedTimer, "millis", elapsedMillis, "drift", drift, "timerstamp", _driftTimerStamp, "millistamp", _driftMilliStamp, "current", currentTimer); } if (elapsedTimer < 0) { log.warning("The timer has decided to live in the past, resetting drift" , "previousTimer", _driftTimerStamp, "currentTimer", currentTimer, "previousMillis", _driftMilliStamp, "currentMillis", currentMillis); _driftRatio = 1.0F; } else if (drift > MAX_ALLOWED_DRIFT_RATIO || drift < MIN_ALLOWED_DRIFT_RATIO) { log.warning("Calibrating", "drift", drift); // Ignore the drift if it's hugely out of range. That indicates general clock insanity, // and we just want to stay out of the way. if (drift < 100 * MAX_ALLOWED_DRIFT_RATIO && drift > MIN_ALLOWED_DRIFT_RATIO / 100) { _driftRatio = drift; } else { _driftRatio = 1.0F; } if (Math.abs(drift - 1.0) > Math.abs(_maxDriftRatio - 1.0)) { _maxDriftRatio = drift; } } else if (_driftRatio != 1.0) { log.warning("Calibrating", "drift", drift); // If we're within bounds now but we weren't before, reset _driftFactor and log it _driftRatio = 1.0F; } _driftMilliStamp = currentMillis; _driftTimerStamp = currentTimer; } }
public class class_name { protected void calibrate () { long currentTimer = current(); long currentMillis = System.currentTimeMillis(); long elapsedTimer = currentTimer - _driftTimerStamp; float elapsedMillis = currentMillis - _driftMilliStamp; float drift = elapsedMillis / (elapsedTimer / _milliDivider); if (_debugCalibrate.getValue()) { log.warning("Calibrating", "timer", elapsedTimer, "millis", elapsedMillis, "drift", drift, "timerstamp", _driftTimerStamp, "millistamp", _driftMilliStamp, "current", currentTimer); // depends on control dependency: [if], data = [none] } if (elapsedTimer < 0) { log.warning("The timer has decided to live in the past, resetting drift" , "previousTimer", _driftTimerStamp, "currentTimer", currentTimer, "previousMillis", _driftMilliStamp, "currentMillis", currentMillis); // depends on control dependency: [if], data = [none] _driftRatio = 1.0F; // depends on control dependency: [if], data = [none] } else if (drift > MAX_ALLOWED_DRIFT_RATIO || drift < MIN_ALLOWED_DRIFT_RATIO) { log.warning("Calibrating", "drift", drift); // depends on control dependency: [if], data = [none] // Ignore the drift if it's hugely out of range. That indicates general clock insanity, // and we just want to stay out of the way. if (drift < 100 * MAX_ALLOWED_DRIFT_RATIO && drift > MIN_ALLOWED_DRIFT_RATIO / 100) { _driftRatio = drift; // depends on control dependency: [if], data = [none] } else { _driftRatio = 1.0F; // depends on control dependency: [if], data = [none] } if (Math.abs(drift - 1.0) > Math.abs(_maxDriftRatio - 1.0)) { _maxDriftRatio = drift; // depends on control dependency: [if], data = [none] } } else if (_driftRatio != 1.0) { log.warning("Calibrating", "drift", drift); // depends on control dependency: [if], data = [none] // If we're within bounds now but we weren't before, reset _driftFactor and log it _driftRatio = 1.0F; // depends on control dependency: [if], data = [none] } _driftMilliStamp = currentMillis; _driftTimerStamp = currentTimer; } }
public class class_name { public void error(Throwable throwable) { if (consumerError == null) { consumerError = throwable; controlChannel.consumerError(throwable); } } }
public class class_name { public void error(Throwable throwable) { if (consumerError == null) { consumerError = throwable; // depends on control dependency: [if], data = [none] controlChannel.consumerError(throwable); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void processChildren( List<RemovrSpec> children, Object subInput ) { if (subInput != null ) { if( subInput instanceof List ) { List<Object> subList = (List<Object>) subInput; Set<Integer> indiciesToRemove = new HashSet<>(); // build a list of all indicies to remove for(RemovrSpec childSpec : children) { indiciesToRemove.addAll( childSpec.applyToList( subList ) ); } List<Integer> uniqueIndiciesToRemove = new ArrayList<>( indiciesToRemove ); // Sort the list from Biggest to Smallest, so that when we remove items from the input // list we don't muck up the order. // Aka removing 0 _then_ 3 would be bad, because we would have actually removed // 0 and 4 from the "original" list. Collections.sort( uniqueIndiciesToRemove, new Comparator<Integer>() { @Override public int compare( Integer o1, Integer o2 ) { return o2.compareTo( o1 ); } } ); for ( int index : uniqueIndiciesToRemove ) { subList.remove( index ); } } else if (subInput instanceof Map ) { Map<String,Object> subInputMap = (Map<String,Object>) subInput; List<String> keysToRemove = new LinkedList<>(); for(RemovrSpec childSpec : children) { keysToRemove.addAll( childSpec.applyToMap( subInputMap ) ); } subInputMap.keySet().removeAll( keysToRemove ); } } } }
public class class_name { private void processChildren( List<RemovrSpec> children, Object subInput ) { if (subInput != null ) { if( subInput instanceof List ) { List<Object> subList = (List<Object>) subInput; Set<Integer> indiciesToRemove = new HashSet<>(); // build a list of all indicies to remove for(RemovrSpec childSpec : children) { indiciesToRemove.addAll( childSpec.applyToList( subList ) ); // depends on control dependency: [for], data = [childSpec] } List<Integer> uniqueIndiciesToRemove = new ArrayList<>( indiciesToRemove ); // Sort the list from Biggest to Smallest, so that when we remove items from the input // list we don't muck up the order. // Aka removing 0 _then_ 3 would be bad, because we would have actually removed // 0 and 4 from the "original" list. Collections.sort( uniqueIndiciesToRemove, new Comparator<Integer>() { @Override public int compare( Integer o1, Integer o2 ) { return o2.compareTo( o1 ); } } ); // depends on control dependency: [if], data = [none] for ( int index : uniqueIndiciesToRemove ) { subList.remove( index ); // depends on control dependency: [for], data = [index] } } else if (subInput instanceof Map ) { Map<String,Object> subInputMap = (Map<String,Object>) subInput; List<String> keysToRemove = new LinkedList<>(); for(RemovrSpec childSpec : children) { keysToRemove.addAll( childSpec.applyToMap( subInputMap ) ); // depends on control dependency: [for], data = [childSpec] } subInputMap.keySet().removeAll( keysToRemove ); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private T nextUncheck() { if (0 != this.index || false == this.includeStart) { // 非第一个元素或不包含第一个元素增加步进 this.current = this.next; if (null != this.current) { this.next = safeStep(this.next); } } index++; return this.current; } }
public class class_name { private T nextUncheck() { if (0 != this.index || false == this.includeStart) { // 非第一个元素或不包含第一个元素增加步进 this.current = this.next; // depends on control dependency: [if], data = [none] if (null != this.current) { this.next = safeStep(this.next); // depends on control dependency: [if], data = [none] } } index++; return this.current; } }
public class class_name { public <DatabaseObjectType extends DatabaseObject> DatabaseObjectType get(DatabaseObjectType example, CompareControl.SchemaComparison[] schemaComparisons) { Map<String, Set<DatabaseObject>> databaseObjectsByHash = cache.get(example.getClass()); if (databaseObjectsByHash == null) { return null; } String[] hashes = DatabaseObjectComparatorFactory.getInstance().hash(example, null, database); SortedSet<Set<DatabaseObject>> objectSets = new TreeSet<>(new Comparator<Set<DatabaseObject>>() { @Override public int compare(Set<DatabaseObject> o1, Set<DatabaseObject> o2) { int sizeComparison = Integer.valueOf(o1.size()).compareTo(o2.size()); if (sizeComparison == 0) { return o1.toString().compareTo(o2.toString()); } return sizeComparison; } }); for (String hash : hashes) { Set<DatabaseObject> databaseObjects = databaseObjectsByHash.get(hash); if (databaseObjects != null) { objectSets.add(databaseObjects); } } for (Set<DatabaseObject> databaseObjects : objectSets) { for (DatabaseObject obj : databaseObjects) { if (DatabaseObjectComparatorFactory.getInstance().isSameObject(obj, example, schemaComparisons, database)) { //noinspection unchecked return (DatabaseObjectType) obj; } } } return null; } }
public class class_name { public <DatabaseObjectType extends DatabaseObject> DatabaseObjectType get(DatabaseObjectType example, CompareControl.SchemaComparison[] schemaComparisons) { Map<String, Set<DatabaseObject>> databaseObjectsByHash = cache.get(example.getClass()); if (databaseObjectsByHash == null) { return null; // depends on control dependency: [if], data = [none] } String[] hashes = DatabaseObjectComparatorFactory.getInstance().hash(example, null, database); SortedSet<Set<DatabaseObject>> objectSets = new TreeSet<>(new Comparator<Set<DatabaseObject>>() { @Override public int compare(Set<DatabaseObject> o1, Set<DatabaseObject> o2) { int sizeComparison = Integer.valueOf(o1.size()).compareTo(o2.size()); if (sizeComparison == 0) { return o1.toString().compareTo(o2.toString()); // depends on control dependency: [if], data = [none] } return sizeComparison; } }); for (String hash : hashes) { Set<DatabaseObject> databaseObjects = databaseObjectsByHash.get(hash); if (databaseObjects != null) { objectSets.add(databaseObjects); // depends on control dependency: [if], data = [(databaseObjects] } } for (Set<DatabaseObject> databaseObjects : objectSets) { for (DatabaseObject obj : databaseObjects) { if (DatabaseObjectComparatorFactory.getInstance().isSameObject(obj, example, schemaComparisons, database)) { //noinspection unchecked return (DatabaseObjectType) obj; // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { private int computeSimpleCredsHashCode( SimpleCredentials c ) { String userID = c.getUserID(); char[] password = c.getPassword(); Map<String, Object> m = getAttributeMap(c); final int prime = 31; int result = 1; result = prime * result + ((userID == null) ? 0 : userID.hashCode()); for (int i = 0; i < password.length; i++) { result = prime * result + password[i]; } result = prime * result + ((m == null) ? 0 : m.hashCode()); return result; } }
public class class_name { private int computeSimpleCredsHashCode( SimpleCredentials c ) { String userID = c.getUserID(); char[] password = c.getPassword(); Map<String, Object> m = getAttributeMap(c); final int prime = 31; int result = 1; result = prime * result + ((userID == null) ? 0 : userID.hashCode()); for (int i = 0; i < password.length; i++) { result = prime * result + password[i]; // depends on control dependency: [for], data = [i] } result = prime * result + ((m == null) ? 0 : m.hashCode()); return result; } }
public class class_name { public void waitUntilComplete(long timeout) { long base=System.currentTimeMillis(); long now=0; lock.lock(); try { while(processing || count.get() > 0) { long delay=timeout-now; if(delay <= 0) break; try { processing_done.await(delay, TimeUnit.MILLISECONDS); now=System.currentTimeMillis()-base; } catch(InterruptedException e) { } } } finally { lock.unlock(); } } }
public class class_name { public void waitUntilComplete(long timeout) { long base=System.currentTimeMillis(); long now=0; lock.lock(); try { while(processing || count.get() > 0) { long delay=timeout-now; if(delay <= 0) break; try { processing_done.await(delay, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none] now=System.currentTimeMillis()-base; // depends on control dependency: [try], data = [none] } catch(InterruptedException e) { } // depends on control dependency: [catch], data = [none] } } finally { lock.unlock(); } } }
public class class_name { public String next() { seq++; String text = pattern; for (final Integer paramLevel : params) { text = Strings.replace(text, "{" + paramLevel + "}", generator.getSytle(paramLevel.intValue()) .curSeqText()); } return Strings.replace(text, "{" + level + "}", seqNumStyle.build(seq)); } }
public class class_name { public String next() { seq++; String text = pattern; for (final Integer paramLevel : params) { text = Strings.replace(text, "{" + paramLevel + "}", generator.getSytle(paramLevel.intValue()) .curSeqText()); // depends on control dependency: [for], data = [none] } return Strings.replace(text, "{" + level + "}", seqNumStyle.build(seq)); } }
public class class_name { private void printConfig() { logger.debug("-----Configuration parameters:"); for (String paramName : m_params.keySet()) { Object paramValue = m_params.get(paramName); printParam(paramName, paramValue, ""); } } }
public class class_name { private void printConfig() { logger.debug("-----Configuration parameters:"); for (String paramName : m_params.keySet()) { Object paramValue = m_params.get(paramName); printParam(paramName, paramValue, ""); // depends on control dependency: [for], data = [paramName] } } }
public class class_name { public boolean remove( C consumer ) { if (consumer != null) { // Iterate through the map to find the runner that owns this consumer ... ConsumerRunner match = null; for (ConsumerRunner runner : consumers) { if (runner.getConsumer().equals(consumer)) { match = runner; break; } } // Try to remove the matching runner (if we found one) from our list ... if (match != null) { // Tell the thread to stop and wait for it, after which it will have been removed from our map ... match.close(); return true; } } // We either didn't find it, or we found it but something else remove it while we searched ... return false; } }
public class class_name { public boolean remove( C consumer ) { if (consumer != null) { // Iterate through the map to find the runner that owns this consumer ... ConsumerRunner match = null; for (ConsumerRunner runner : consumers) { if (runner.getConsumer().equals(consumer)) { match = runner; // depends on control dependency: [if], data = [none] break; } } // Try to remove the matching runner (if we found one) from our list ... if (match != null) { // Tell the thread to stop and wait for it, after which it will have been removed from our map ... match.close(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } // We either didn't find it, or we found it but something else remove it while we searched ... return false; } }
public class class_name { public void setDuration(final LocalTime DURATION) { if (null == duration) { _duration = DURATION; fireTileEvent(REDRAW_EVENT); } else { duration.set(DURATION); } } }
public class class_name { public void setDuration(final LocalTime DURATION) { if (null == duration) { _duration = DURATION; // depends on control dependency: [if], data = [none] fireTileEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none] } else { duration.set(DURATION); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Trivial private String toIntervalData(double throughput, double forecast, double shrinkScore, double growScore, int poolSize, int poolAdjustment) { final int RANGE = 25; StringBuilder sb = new StringBuilder(); sb.append("\nThroughput:"); sb.append(String.format(" previous = %.6f", Double.valueOf(previousThroughput))); sb.append(String.format(" current = %.6f", Double.valueOf(throughput))); sb.append(String.format(" forecast = %.6f", Double.valueOf(forecast))); sb.append("\nHeuristics:"); sb.append(String.format(" queueDepth = %8d", Integer.valueOf(queueDepth))); sb.append(String.format(" consecutiveQueueEmptyCount = %2d", Integer.valueOf(consecutiveQueueEmptyCount))); sb.append(String.format(" consecutiveNoAdjustment = %2d", Integer.valueOf(consecutiveNoAdjustment))); sb.append("\nOutliers: "); sb.append(String.format(" consecutiveOutlierAfterAdjustment = %2d", Integer.valueOf(consecutiveOutlierAfterAdjustment))); sb.append(String.format(" hangResolutionPoolSize = %2d", Integer.valueOf(hangBufferPoolSize))); sb.append("\nAttraction:"); sb.append(String.format(" shrinkScore = %.6f", Double.valueOf(shrinkScore))); sb.append(String.format(" growScore = %.6f", Double.valueOf(growScore))); sb.append(String.format(" lastAction = %s", lastAction)); sb.append("\nCPU:"); sb.append(String.format(" cpuUtil = %.2f", Double.valueOf(cpuUtil))); sb.append(String.format(" processCpuUtil = %.2f", Double.valueOf(processCpuUtil))); sb.append(String.format(" systemCpuUtil = %.2f", Double.valueOf(systemCpuUtil))); sb.append("\nIncrement:"); sb.append(String.format(" poolSize = %2d", Integer.valueOf(poolSize))); sb.append(String.format(" poolIncrement = %2d", Integer.valueOf(poolIncrement))); sb.append(String.format(" poolDecrement = %2d", Integer.valueOf(poolDecrement))); sb.append(String.format(" compareRange = %2d", Integer.valueOf(compareRange))); sb.append("\nConfig:"); sb.append(String.format(" coreThreads = %2d", Integer.valueOf(coreThreads))); sb.append(String.format(" maxThreads = %2d", Integer.valueOf(maxThreads))); sb.append("\nStatistics:\n"); Integer[] poolSizes = new Integer[2 * RANGE + 1]; ThroughputDistribution[] tputDistros = new ThroughputDistribution[2 * RANGE + 1]; Integer poolSizeInteger = Integer.valueOf(poolSize); int start = RANGE; int end = RANGE; poolSizes[RANGE] = poolSizeInteger; tputDistros[RANGE] = getThroughputDistribution(poolSize, false); Integer prior = threadStats.lowerKey(poolSizeInteger); Integer next = threadStats.higherKey(poolSizeInteger); for (int i = 1; i <= RANGE; i++) { if (prior != null) { start--; poolSizes[start] = prior; tputDistros[start] = getThroughputDistribution(prior, false); prior = threadStats.lowerKey(prior); } if (next != null) { end++; poolSizes[end] = next; tputDistros[end] = getThroughputDistribution(next, false); next = threadStats.higherKey(next); } } for (int i = start; i <= end; i++) { sb.append(String.format("%s%3d threads: %s%n", (poolSizes[i] == poolSizeInteger) ? "-->" : " ", poolSizes[i], String.valueOf(tputDistros[i]))); } if (poolAdjustment == 0) { sb.append("### No pool adjustment ###"); } else if (poolAdjustment < 0) { sb.append("--- Shrinking to " + (poolSize + poolAdjustment) + " ---"); } else { sb.append("+++ Growing to " + (poolSize + poolAdjustment) + " +++"); } return sb.toString(); } }
public class class_name { @Trivial private String toIntervalData(double throughput, double forecast, double shrinkScore, double growScore, int poolSize, int poolAdjustment) { final int RANGE = 25; StringBuilder sb = new StringBuilder(); sb.append("\nThroughput:"); sb.append(String.format(" previous = %.6f", Double.valueOf(previousThroughput))); sb.append(String.format(" current = %.6f", Double.valueOf(throughput))); sb.append(String.format(" forecast = %.6f", Double.valueOf(forecast))); sb.append("\nHeuristics:"); sb.append(String.format(" queueDepth = %8d", Integer.valueOf(queueDepth))); sb.append(String.format(" consecutiveQueueEmptyCount = %2d", Integer.valueOf(consecutiveQueueEmptyCount))); sb.append(String.format(" consecutiveNoAdjustment = %2d", Integer.valueOf(consecutiveNoAdjustment))); sb.append("\nOutliers: "); sb.append(String.format(" consecutiveOutlierAfterAdjustment = %2d", Integer.valueOf(consecutiveOutlierAfterAdjustment))); sb.append(String.format(" hangResolutionPoolSize = %2d", Integer.valueOf(hangBufferPoolSize))); sb.append("\nAttraction:"); sb.append(String.format(" shrinkScore = %.6f", Double.valueOf(shrinkScore))); sb.append(String.format(" growScore = %.6f", Double.valueOf(growScore))); sb.append(String.format(" lastAction = %s", lastAction)); sb.append("\nCPU:"); sb.append(String.format(" cpuUtil = %.2f", Double.valueOf(cpuUtil))); sb.append(String.format(" processCpuUtil = %.2f", Double.valueOf(processCpuUtil))); sb.append(String.format(" systemCpuUtil = %.2f", Double.valueOf(systemCpuUtil))); sb.append("\nIncrement:"); sb.append(String.format(" poolSize = %2d", Integer.valueOf(poolSize))); sb.append(String.format(" poolIncrement = %2d", Integer.valueOf(poolIncrement))); sb.append(String.format(" poolDecrement = %2d", Integer.valueOf(poolDecrement))); sb.append(String.format(" compareRange = %2d", Integer.valueOf(compareRange))); sb.append("\nConfig:"); sb.append(String.format(" coreThreads = %2d", Integer.valueOf(coreThreads))); sb.append(String.format(" maxThreads = %2d", Integer.valueOf(maxThreads))); sb.append("\nStatistics:\n"); Integer[] poolSizes = new Integer[2 * RANGE + 1]; ThroughputDistribution[] tputDistros = new ThroughputDistribution[2 * RANGE + 1]; Integer poolSizeInteger = Integer.valueOf(poolSize); int start = RANGE; int end = RANGE; poolSizes[RANGE] = poolSizeInteger; tputDistros[RANGE] = getThroughputDistribution(poolSize, false); Integer prior = threadStats.lowerKey(poolSizeInteger); Integer next = threadStats.higherKey(poolSizeInteger); for (int i = 1; i <= RANGE; i++) { if (prior != null) { start--; // depends on control dependency: [if], data = [none] poolSizes[start] = prior; // depends on control dependency: [if], data = [none] tputDistros[start] = getThroughputDistribution(prior, false); // depends on control dependency: [if], data = [(prior] prior = threadStats.lowerKey(prior); // depends on control dependency: [if], data = [(prior] } if (next != null) { end++; // depends on control dependency: [if], data = [none] poolSizes[end] = next; // depends on control dependency: [if], data = [none] tputDistros[end] = getThroughputDistribution(next, false); // depends on control dependency: [if], data = [(next] next = threadStats.higherKey(next); // depends on control dependency: [if], data = [(next] } } for (int i = start; i <= end; i++) { sb.append(String.format("%s%3d threads: %s%n", (poolSizes[i] == poolSizeInteger) ? "-->" : " ", poolSizes[i], String.valueOf(tputDistros[i]))); // depends on control dependency: [for], data = [i] } if (poolAdjustment == 0) { sb.append("### No pool adjustment ###"); // depends on control dependency: [if], data = [none] } else if (poolAdjustment < 0) { sb.append("--- Shrinking to " + (poolSize + poolAdjustment) + " ---"); // depends on control dependency: [if], data = [none] } else { sb.append("+++ Growing to " + (poolSize + poolAdjustment) + " +++"); // depends on control dependency: [if], data = [none] } return sb.toString(); } }
public class class_name { private Map<File, File[]> getDataMap_1_1(String[] dataDirs) { Map<File, File[]> map = new HashMap<File, File[]>(); boolean doLog = false; if(!lockedMessages.contains("getDataMap")) { lockedMessages.add("getDataMap"); doLog = true; } for (int i = 0; i < dataDirs.length; i++) { File dir = new File(dataDirs[i]); if (!dir.canRead()) { if(doLog) { logger.warn("Can't read: " + dir); } continue; } File[] ksList = dir.listFiles(); for (int j = 0; j < ksList.length; j++) { if (ksList[j].isDirectory()) { File[] familyList = ksList[j].listFiles(); for(int n = 0; n < familyList.length; n++) { if(familyList[n].isDirectory()) { ArrayList<File> snapshots = new ArrayList<File>(); File snDir = new File(familyList[n], SNAPSHOTS_DIR_NAME); if (snDir.isDirectory()) { File[] snList = snDir.listFiles(); for (int k = 0; k < snList.length; k++) { if (snList[k].isDirectory()) { snapshots.add(snList[k]); } } } map.put(familyList[n], snapshots.toArray(new File[snapshots.size()])); } } } } } // if(doLog) { // logger.debug("familiesCount=" + map.size()); // // for(File f : map.keySet()) { // File[] snaps = map.get(f); // logger.debug("family: " + f.getAbsolutePath() + ", snapshotsCount=" + snaps.length); // // for(int i = 0; i < snaps.length; i++) { // logger.debug("snaps[" + i + "]: " + snaps[i]); // } // } // } return map; } }
public class class_name { private Map<File, File[]> getDataMap_1_1(String[] dataDirs) { Map<File, File[]> map = new HashMap<File, File[]>(); boolean doLog = false; if(!lockedMessages.contains("getDataMap")) { lockedMessages.add("getDataMap"); // depends on control dependency: [if], data = [none] doLog = true; // depends on control dependency: [if], data = [none] } for (int i = 0; i < dataDirs.length; i++) { File dir = new File(dataDirs[i]); if (!dir.canRead()) { if(doLog) { logger.warn("Can't read: " + dir); // depends on control dependency: [if], data = [none] } continue; } File[] ksList = dir.listFiles(); for (int j = 0; j < ksList.length; j++) { if (ksList[j].isDirectory()) { File[] familyList = ksList[j].listFiles(); for(int n = 0; n < familyList.length; n++) { if(familyList[n].isDirectory()) { ArrayList<File> snapshots = new ArrayList<File>(); File snDir = new File(familyList[n], SNAPSHOTS_DIR_NAME); if (snDir.isDirectory()) { File[] snList = snDir.listFiles(); for (int k = 0; k < snList.length; k++) { if (snList[k].isDirectory()) { snapshots.add(snList[k]); // depends on control dependency: [if], data = [none] } } } map.put(familyList[n], snapshots.toArray(new File[snapshots.size()])); // depends on control dependency: [if], data = [none] } } } } } // if(doLog) { // logger.debug("familiesCount=" + map.size()); // // for(File f : map.keySet()) { // File[] snaps = map.get(f); // logger.debug("family: " + f.getAbsolutePath() + ", snapshotsCount=" + snaps.length); // // for(int i = 0; i < snaps.length; i++) { // logger.debug("snaps[" + i + "]: " + snaps[i]); // } // } // } return map; } }
public class class_name { public void marshall(AccountQuota accountQuota, ProtocolMarshaller protocolMarshaller) { if (accountQuota == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(accountQuota.getAccountQuotaName(), ACCOUNTQUOTANAME_BINDING); protocolMarshaller.marshall(accountQuota.getUsed(), USED_BINDING); protocolMarshaller.marshall(accountQuota.getMax(), MAX_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AccountQuota accountQuota, ProtocolMarshaller protocolMarshaller) { if (accountQuota == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(accountQuota.getAccountQuotaName(), ACCOUNTQUOTANAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(accountQuota.getUsed(), USED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(accountQuota.getMax(), MAX_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 addSarlRequiredCapacity(String... name) { if (name != null && name.length > 0) { SarlRequiredCapacity member = SarlFactory.eINSTANCE.createSarlRequiredCapacity(); this.sarlBehavior.getMembers().add(member); member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities(); for (final String aname : name) { if (!Strings.isEmpty(aname)) { thecollection.add(newTypeRef(this.sarlBehavior, aname)); } } } } }
public class class_name { public void addSarlRequiredCapacity(String... name) { if (name != null && name.length > 0) { SarlRequiredCapacity member = SarlFactory.eINSTANCE.createSarlRequiredCapacity(); this.sarlBehavior.getMembers().add(member); // depends on control dependency: [if], data = [none] member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); // depends on control dependency: [if], data = [none] Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities(); for (final String aname : name) { if (!Strings.isEmpty(aname)) { thecollection.add(newTypeRef(this.sarlBehavior, aname)); // depends on control dependency: [if], data = [none] } } } } }