code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected Deque<XMLEvent> getAdditionalEvents(XMLEvent event) { final XMLEvent additionalEvent = this.getAdditionalEvent(event); if (additionalEvent == null) { return null; } final Deque<XMLEvent> additionalEvents = new LinkedList<XMLEvent>(); additionalEvents.push(additionalEvent); return additionalEvents; } }
public class class_name { protected Deque<XMLEvent> getAdditionalEvents(XMLEvent event) { final XMLEvent additionalEvent = this.getAdditionalEvent(event); if (additionalEvent == null) { return null; // depends on control dependency: [if], data = [none] } final Deque<XMLEvent> additionalEvents = new LinkedList<XMLEvent>(); additionalEvents.push(additionalEvent); return additionalEvents; } }
public class class_name { @VisibleForTesting void partitionFirstSharedQueueItemIfNeeded() { final TableRuntimeContext headPartition = getOwnedTablesQueue().peek(); if (headPartition != null) { synchronized (partitionStateLock) { keepPartitioningIfNeeded(headPartition); } } else if (LOG.isTraceEnabled()) { LOG.trace("No item at head of shared partition queue"); } } }
public class class_name { @VisibleForTesting void partitionFirstSharedQueueItemIfNeeded() { final TableRuntimeContext headPartition = getOwnedTablesQueue().peek(); if (headPartition != null) { synchronized (partitionStateLock) { // depends on control dependency: [if], data = [none] keepPartitioningIfNeeded(headPartition); } } else if (LOG.isTraceEnabled()) { LOG.trace("No item at head of shared partition queue"); // depends on control dependency: [if], data = [none] } } }
public class class_name { boolean takeWorkPermit(boolean takeTaskPermit) { int taskDelta = takeTaskPermit ? 1 : 0; while (true) { long current = permits.get(); int workPermits = workPermits(current); int taskPermits = taskPermits(current); if (workPermits == 0 || taskPermits == 0) return false; if (permits.compareAndSet(current, combine(taskPermits - taskDelta, workPermits - 1))) { if (takeTaskPermit && taskPermits == maxTasksQueued && hasRoom.hasWaiters()) hasRoom.signalAll(); return true; } } } }
public class class_name { boolean takeWorkPermit(boolean takeTaskPermit) { int taskDelta = takeTaskPermit ? 1 : 0; while (true) { long current = permits.get(); int workPermits = workPermits(current); int taskPermits = taskPermits(current); if (workPermits == 0 || taskPermits == 0) return false; if (permits.compareAndSet(current, combine(taskPermits - taskDelta, workPermits - 1))) { if (takeTaskPermit && taskPermits == maxTasksQueued && hasRoom.hasWaiters()) hasRoom.signalAll(); return true; // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected void setFontSizeHelper(float size, Component... comps) { for (Component comp : comps) { comp.setFont(comp.getFont().deriveFont(size)); if (comp instanceof Container) { setFontSizeHelper(size, ((Container) comp).getComponents()); } } } }
public class class_name { protected void setFontSizeHelper(float size, Component... comps) { for (Component comp : comps) { comp.setFont(comp.getFont().deriveFont(size)); // depends on control dependency: [for], data = [comp] if (comp instanceof Container) { setFontSizeHelper(size, ((Container) comp).getComponents()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public int totalIntCount(Filter<E> filter) { int total = 0; for (E key : map.keySet()) { if (filter.accept(key)) { total += getIntCount(key); } } return (total); } }
public class class_name { public int totalIntCount(Filter<E> filter) { int total = 0; for (E key : map.keySet()) { if (filter.accept(key)) { total += getIntCount(key); // depends on control dependency: [if], data = [none] } } return (total); } }
public class class_name { private Set<LineString> getSegments(Collection<LineString> lines) { Set<LineString> set = new HashSet<>(); for (LineString line : lines) { Coordinate[] cc = line.getCoordinates(); for (int i = 1; i < cc.length; i++) { if (!cc[i - 1].equals(cc[i])) { LineString segment = line.getFactory().createLineString( new Coordinate[]{new Coordinate(cc[i - 1]), new Coordinate(cc[i])}); set.add(segment); } } } return set; } }
public class class_name { private Set<LineString> getSegments(Collection<LineString> lines) { Set<LineString> set = new HashSet<>(); for (LineString line : lines) { Coordinate[] cc = line.getCoordinates(); for (int i = 1; i < cc.length; i++) { if (!cc[i - 1].equals(cc[i])) { LineString segment = line.getFactory().createLineString( new Coordinate[]{new Coordinate(cc[i - 1]), new Coordinate(cc[i])}); set.add(segment); // depends on control dependency: [if], data = [none] } } } return set; } }
public class class_name { ManagerEvent addMember(BridgeEnterEvent event) { List<BridgeEnterEvent> remaining = null; synchronized (members) { if (members.put(event.getChannel(), event) == null && members.size() == 2) { remaining = new ArrayList<>(members.values()); } } if (remaining == null) { return null; } logger.info("Members size " + remaining.size() + " " + event); BridgeEvent bridgeEvent = buildBridgeEvent( BridgeEvent.BRIDGE_STATE_LINK, remaining); logger.info("Bridge " + bridgeEvent.getChannel1() + " " + bridgeEvent.getChannel2()); return bridgeEvent; } }
public class class_name { ManagerEvent addMember(BridgeEnterEvent event) { List<BridgeEnterEvent> remaining = null; synchronized (members) { if (members.put(event.getChannel(), event) == null && members.size() == 2) { remaining = new ArrayList<>(members.values()); // depends on control dependency: [if], data = [none] } } if (remaining == null) { return null; // depends on control dependency: [if], data = [none] } logger.info("Members size " + remaining.size() + " " + event); BridgeEvent bridgeEvent = buildBridgeEvent( BridgeEvent.BRIDGE_STATE_LINK, remaining); logger.info("Bridge " + bridgeEvent.getChannel1() + " " + bridgeEvent.getChannel2()); return bridgeEvent; } }
public class class_name { public SimpleDialog checkBoxStyle(int resId){ if(mCheckBoxStyle != resId){ mCheckBoxStyle = resId; if(mAdapter != null && mMode == MODE_MULTI_ITEMS) mAdapter.notifyDataSetChanged(); } return this; } }
public class class_name { public SimpleDialog checkBoxStyle(int resId){ if(mCheckBoxStyle != resId){ mCheckBoxStyle = resId; // depends on control dependency: [if], data = [none] if(mAdapter != null && mMode == MODE_MULTI_ITEMS) mAdapter.notifyDataSetChanged(); } return this; } }
public class class_name { public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; nextCharBuf = new char[4096]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; nextCharInd = bufpos = -1; } }
public class class_name { public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; // depends on control dependency: [if], data = [none] buffer = new char[buffersize]; // depends on control dependency: [if], data = [none] bufline = new int[buffersize]; // depends on control dependency: [if], data = [none] bufcolumn = new int[buffersize]; // depends on control dependency: [if], data = [none] nextCharBuf = new char[4096]; // depends on control dependency: [if], data = [none] } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; nextCharInd = bufpos = -1; } }
public class class_name { public static long copyLarge(Reader input, Writer output, final long inputOffset, final long length, char[] buffer) throws IOException { if (inputOffset > 0) { skipFully(input, inputOffset); } if (length == 0) { return 0; } int bytesToRead = buffer.length; if (length > 0 && length < buffer.length) { bytesToRead = (int) length; } int read; long totalRead = 0; while (bytesToRead > 0 && EOF != (read = input.read(buffer, 0, bytesToRead))) { output.write(buffer, 0, read); totalRead += read; if (length > 0) { // only adjust length if not reading to the end // Note the cast must work because buffer.length is an integer bytesToRead = (int) Math.min(length - totalRead, buffer.length); } } return totalRead; } }
public class class_name { public static long copyLarge(Reader input, Writer output, final long inputOffset, final long length, char[] buffer) throws IOException { if (inputOffset > 0) { skipFully(input, inputOffset); } if (length == 0) { return 0; } int bytesToRead = buffer.length; if (length > 0 && length < buffer.length) { bytesToRead = (int) length; } int read; long totalRead = 0; while (bytesToRead > 0 && EOF != (read = input.read(buffer, 0, bytesToRead))) { output.write(buffer, 0, read); totalRead += read; if (length > 0) { // only adjust length if not reading to the end // Note the cast must work because buffer.length is an integer bytesToRead = (int) Math.min(length - totalRead, buffer.length); // depends on control dependency: [if], data = [(length] } } return totalRead; } }
public class class_name { private T verifyNewInstance(T t) { if (t!=null && t.getDescriptor()!=this) { // TODO: should this be a fatal error? LOGGER.warning("Father of "+ t+" and its getDescriptor() points to two different instances. Probably malplaced @Extension. See http://hudson.361315.n4.nabble.com/Help-Hint-needed-Post-build-action-doesn-t-stay-activated-td2308833.html"); } return t; } }
public class class_name { private T verifyNewInstance(T t) { if (t!=null && t.getDescriptor()!=this) { // TODO: should this be a fatal error? LOGGER.warning("Father of "+ t+" and its getDescriptor() points to two different instances. Probably malplaced @Extension. See http://hudson.361315.n4.nabble.com/Help-Hint-needed-Post-build-action-doesn-t-stay-activated-td2308833.html"); } return t; // depends on control dependency: [if], data = [none] } }
public class class_name { public int getTotalDocuments() { try { final int totalDocs = _jsonObject.getJSONObject(META_OBJECT_FIELD).getInt("total_count"); return totalDocs; } catch (JSONException ex) { throw new QuandlRuntimeException("Could not find total_count field in results from Quandl", ex); } } }
public class class_name { public int getTotalDocuments() { try { final int totalDocs = _jsonObject.getJSONObject(META_OBJECT_FIELD).getInt("total_count"); return totalDocs; // depends on control dependency: [try], data = [none] } catch (JSONException ex) { throw new QuandlRuntimeException("Could not find total_count field in results from Quandl", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void connectLeftRight(GrayS32 input, GrayS32 output) { for( int y = 0; y < input.height; y++ ) { int x = input.width-1; int inputLabel = input.unsafe_get(x, y); int outputLabel = output.unsafe_get(x, y); if( outputLabel == -1 ) { // see if it needs to create a new output segment outputLabel = regionMemberCount.size; output.unsafe_set(x,y,outputLabel); regionMemberCount.add(1); mergeList.add(outputLabel); } // check right first for( int i = 0; i < edges.length; i++ ) { Point2D_I32 offset = edges[i]; // make sure it is inside the image if( !input.isInBounds(x+offset.x,y+offset.y)) continue; if( inputLabel == input.unsafe_get(x+offset.x,y+offset.y) ) { int outputAdj = output.unsafe_get(x+offset.x,y+offset.y); if( outputAdj == -1 ) { // see if not assigned regionMemberCount.data[outputLabel]++; output.unsafe_set(x+offset.x,y+offset.y, outputLabel); } else if( outputLabel != outputAdj ) { // see if assigned to different regions markMerge(outputLabel,outputAdj); } // do nothing, same input and output labels } } // skip check of left of 4-connect if( connectRule != ConnectRule.EIGHT ) continue; x = 0; inputLabel = input.unsafe_get(x, y); outputLabel = output.unsafe_get(x, y); if( outputLabel == -1 ) { // see if it needs to create a new output segment outputLabel = regionMemberCount.size; output.unsafe_set(x,y,outputLabel); regionMemberCount.add(1); mergeList.add(outputLabel); } for( int i = 0; i < edges.length; i++ ) { Point2D_I32 offset = edges[i]; // make sure it is inside the image if( !input.isInBounds(x+offset.x,y+offset.y)) continue; if( inputLabel == input.unsafe_get(x+offset.x,y+offset.y) ) { int outputAdj = output.unsafe_get(x+offset.x,y+offset.y); if( outputAdj == -1 ) { // see if not assigned regionMemberCount.data[outputLabel]++; output.unsafe_set(x+offset.x,y+offset.y, outputLabel); } else if( outputLabel != outputAdj ) { // see if assigned to different regions markMerge(outputLabel,outputAdj); } // do nothing, same input and output labels } } } } }
public class class_name { protected void connectLeftRight(GrayS32 input, GrayS32 output) { for( int y = 0; y < input.height; y++ ) { int x = input.width-1; int inputLabel = input.unsafe_get(x, y); int outputLabel = output.unsafe_get(x, y); if( outputLabel == -1 ) { // see if it needs to create a new output segment outputLabel = regionMemberCount.size; // depends on control dependency: [if], data = [none] output.unsafe_set(x,y,outputLabel); // depends on control dependency: [if], data = [none] regionMemberCount.add(1); // depends on control dependency: [if], data = [none] mergeList.add(outputLabel); // depends on control dependency: [if], data = [none] } // check right first for( int i = 0; i < edges.length; i++ ) { Point2D_I32 offset = edges[i]; // make sure it is inside the image if( !input.isInBounds(x+offset.x,y+offset.y)) continue; if( inputLabel == input.unsafe_get(x+offset.x,y+offset.y) ) { int outputAdj = output.unsafe_get(x+offset.x,y+offset.y); if( outputAdj == -1 ) { // see if not assigned regionMemberCount.data[outputLabel]++; // depends on control dependency: [if], data = [none] output.unsafe_set(x+offset.x,y+offset.y, outputLabel); // depends on control dependency: [if], data = [none] } else if( outputLabel != outputAdj ) { // see if assigned to different regions markMerge(outputLabel,outputAdj); // depends on control dependency: [if], data = [none] } // do nothing, same input and output labels } } // skip check of left of 4-connect if( connectRule != ConnectRule.EIGHT ) continue; x = 0; // depends on control dependency: [for], data = [none] inputLabel = input.unsafe_get(x, y); // depends on control dependency: [for], data = [y] outputLabel = output.unsafe_get(x, y); // depends on control dependency: [for], data = [y] if( outputLabel == -1 ) { // see if it needs to create a new output segment outputLabel = regionMemberCount.size; // depends on control dependency: [if], data = [none] output.unsafe_set(x,y,outputLabel); // depends on control dependency: [if], data = [none] regionMemberCount.add(1); // depends on control dependency: [if], data = [none] mergeList.add(outputLabel); // depends on control dependency: [if], data = [none] } for( int i = 0; i < edges.length; i++ ) { Point2D_I32 offset = edges[i]; // make sure it is inside the image if( !input.isInBounds(x+offset.x,y+offset.y)) continue; if( inputLabel == input.unsafe_get(x+offset.x,y+offset.y) ) { int outputAdj = output.unsafe_get(x+offset.x,y+offset.y); if( outputAdj == -1 ) { // see if not assigned regionMemberCount.data[outputLabel]++; // depends on control dependency: [if], data = [none] output.unsafe_set(x+offset.x,y+offset.y, outputLabel); // depends on control dependency: [if], data = [none] } else if( outputLabel != outputAdj ) { // see if assigned to different regions markMerge(outputLabel,outputAdj); // depends on control dependency: [if], data = [none] } // do nothing, same input and output labels } } } } }
public class class_name { public static byte[] decodeBase64(String base64String) { try { return BaseEncoding.base64().decode(base64String); } catch (IllegalArgumentException e) { if (e.getCause() instanceof DecodingException) { return BaseEncoding.base64Url().decode(base64String); } throw e; } } }
public class class_name { public static byte[] decodeBase64(String base64String) { try { return BaseEncoding.base64().decode(base64String); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { if (e.getCause() instanceof DecodingException) { return BaseEncoding.base64Url().decode(base64String); // depends on control dependency: [if], data = [none] } throw e; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final void moreStatementExpressions() throws RecognitionException { int moreStatementExpressions_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 99) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1037:5: ( ( ',' statementExpression )* ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1037:7: ( ',' statementExpression )* { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1037:7: ( ',' statementExpression )* loop131: while (true) { int alt131=2; int LA131_0 = input.LA(1); if ( (LA131_0==43) ) { alt131=1; } switch (alt131) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1037:8: ',' statementExpression { match(input,43,FOLLOW_43_in_moreStatementExpressions4498); if (state.failed) return; pushFollow(FOLLOW_statementExpression_in_moreStatementExpressions4500); statementExpression(); state._fsp--; if (state.failed) return; } break; default : break loop131; } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 99, moreStatementExpressions_StartIndex); } } } }
public class class_name { public final void moreStatementExpressions() throws RecognitionException { int moreStatementExpressions_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 99) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1037:5: ( ( ',' statementExpression )* ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1037:7: ( ',' statementExpression )* { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1037:7: ( ',' statementExpression )* loop131: while (true) { int alt131=2; int LA131_0 = input.LA(1); if ( (LA131_0==43) ) { alt131=1; // depends on control dependency: [if], data = [none] } switch (alt131) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1037:8: ',' statementExpression { match(input,43,FOLLOW_43_in_moreStatementExpressions4498); if (state.failed) return; pushFollow(FOLLOW_statementExpression_in_moreStatementExpressions4500); statementExpression(); state._fsp--; if (state.failed) return; } break; default : break loop131; } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 99, moreStatementExpressions_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { public EClass getIfcContextDependentUnit() { if (ifcContextDependentUnitEClass == null) { ifcContextDependentUnitEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(115); } return ifcContextDependentUnitEClass; } }
public class class_name { public EClass getIfcContextDependentUnit() { if (ifcContextDependentUnitEClass == null) { ifcContextDependentUnitEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(115); // depends on control dependency: [if], data = [none] } return ifcContextDependentUnitEClass; } }
public class class_name { @SuppressWarnings("rawtypes") @Nullable private Metric collectGauge(MetricName dropwizardMetric, Gauge gauge) { // TODO cache dropwizard MetricName -> OC MetricDescriptor, Labels conversion String metricName = DropWizardUtils.generateFullMetricName(dropwizardMetric.getKey(), "gauge"); String metricDescription = DropWizardUtils.generateFullMetricDescription(dropwizardMetric.getKey(), gauge); AbstractMap.SimpleImmutableEntry<List<LabelKey>, List<LabelValue>> labels = DropWizardUtils.generateLabels(dropwizardMetric); // Figure out which gauge instance and call the right method to get value Type type; Value value; Object obj = gauge.getValue(); if (obj instanceof Number) { type = Type.GAUGE_DOUBLE; value = Value.doubleValue(((Number) obj).doubleValue()); } else if (obj instanceof Boolean) { type = Type.GAUGE_INT64; value = Value.longValue(((Boolean) obj) ? 1 : 0); } else { // Ignoring Gauge (gauge.getKey()) with unhandled type. return null; } MetricDescriptor metricDescriptor = MetricDescriptor.create(metricName, metricDescription, DEFAULT_UNIT, type, labels.getKey()); TimeSeries timeSeries = TimeSeries.createWithOnePoint(labels.getValue(), Point.create(value, clock.now()), null); return Metric.createWithOneTimeSeries(metricDescriptor, timeSeries); } }
public class class_name { @SuppressWarnings("rawtypes") @Nullable private Metric collectGauge(MetricName dropwizardMetric, Gauge gauge) { // TODO cache dropwizard MetricName -> OC MetricDescriptor, Labels conversion String metricName = DropWizardUtils.generateFullMetricName(dropwizardMetric.getKey(), "gauge"); String metricDescription = DropWizardUtils.generateFullMetricDescription(dropwizardMetric.getKey(), gauge); AbstractMap.SimpleImmutableEntry<List<LabelKey>, List<LabelValue>> labels = DropWizardUtils.generateLabels(dropwizardMetric); // Figure out which gauge instance and call the right method to get value Type type; Value value; Object obj = gauge.getValue(); if (obj instanceof Number) { type = Type.GAUGE_DOUBLE; // depends on control dependency: [if], data = [none] value = Value.doubleValue(((Number) obj).doubleValue()); // depends on control dependency: [if], data = [none] } else if (obj instanceof Boolean) { type = Type.GAUGE_INT64; // depends on control dependency: [if], data = [none] value = Value.longValue(((Boolean) obj) ? 1 : 0); // depends on control dependency: [if], data = [none] } else { // Ignoring Gauge (gauge.getKey()) with unhandled type. return null; // depends on control dependency: [if], data = [none] } MetricDescriptor metricDescriptor = MetricDescriptor.create(metricName, metricDescription, DEFAULT_UNIT, type, labels.getKey()); TimeSeries timeSeries = TimeSeries.createWithOnePoint(labels.getValue(), Point.create(value, clock.now()), null); return Metric.createWithOneTimeSeries(metricDescriptor, timeSeries); } }
public class class_name { private void removeEntry(String key) { CacheHeader entry = mEntries.get(key); if (entry != null) { mTotalSize -= entry.size; mEntries.remove(key); } } }
public class class_name { private void removeEntry(String key) { CacheHeader entry = mEntries.get(key); if (entry != null) { mTotalSize -= entry.size; // depends on control dependency: [if], data = [none] mEntries.remove(key); // depends on control dependency: [if], data = [none] } } }
public class class_name { public GetBuiltinSlotTypesResult withSlotTypes(BuiltinSlotTypeMetadata... slotTypes) { if (this.slotTypes == null) { setSlotTypes(new java.util.ArrayList<BuiltinSlotTypeMetadata>(slotTypes.length)); } for (BuiltinSlotTypeMetadata ele : slotTypes) { this.slotTypes.add(ele); } return this; } }
public class class_name { public GetBuiltinSlotTypesResult withSlotTypes(BuiltinSlotTypeMetadata... slotTypes) { if (this.slotTypes == null) { setSlotTypes(new java.util.ArrayList<BuiltinSlotTypeMetadata>(slotTypes.length)); // depends on control dependency: [if], data = [none] } for (BuiltinSlotTypeMetadata ele : slotTypes) { this.slotTypes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected void configureImage(ImageConfigurable configurable, String objectName) { Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); Image image = loadImage(objectName, IMAGE_KEY); if (image != null) { configurable.setImage(image); } } }
public class class_name { protected void configureImage(ImageConfigurable configurable, String objectName) { Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); Image image = loadImage(objectName, IMAGE_KEY); if (image != null) { configurable.setImage(image); // depends on control dependency: [if], data = [(image] } } }
public class class_name { private void handleBindStat(long elapsedTime) { String METHODNAME = "handleBindStat(long)"; if (elapsedTime < LDAP_CONNECT_TIMEOUT_TRACE) { QUICK_LDAP_BIND.getAndIncrement(); } long now = System.currentTimeMillis(); /* * Print out at most every 30 minutes the latest number of "quick" binds */ if (now - LDAP_STATS_TIMER.get() > 1800000) { //Update the last update time, then make certain no one beat us to it long lastUpdated = LDAP_STATS_TIMER.getAndSet(now); if (now - lastUpdated > 1800000) { if (tc.isDebugEnabled()) Tr.debug(tc, METHODNAME + " **LDAPBindStat: " + QUICK_LDAP_BIND.get() + " binds took less then " + LDAP_CONNECT_TIMEOUT_TRACE + " ms"); } } } }
public class class_name { private void handleBindStat(long elapsedTime) { String METHODNAME = "handleBindStat(long)"; if (elapsedTime < LDAP_CONNECT_TIMEOUT_TRACE) { QUICK_LDAP_BIND.getAndIncrement(); // depends on control dependency: [if], data = [none] } long now = System.currentTimeMillis(); /* * Print out at most every 30 minutes the latest number of "quick" binds */ if (now - LDAP_STATS_TIMER.get() > 1800000) { //Update the last update time, then make certain no one beat us to it long lastUpdated = LDAP_STATS_TIMER.getAndSet(now); if (now - lastUpdated > 1800000) { if (tc.isDebugEnabled()) Tr.debug(tc, METHODNAME + " **LDAPBindStat: " + QUICK_LDAP_BIND.get() + " binds took less then " + LDAP_CONNECT_TIMEOUT_TRACE + " ms"); } } } }
public class class_name { private void buildAggregation(DBObject group, Expression expression, EntityMetadata metadata, EntityType entityType, boolean hasLob) { if (expression instanceof AggregateFunction) { AggregateFunction aggregateFunction = (AggregateFunction) expression; String identifier = aggregateFunction.getIdentifier().toLowerCase(); Expression child = aggregateFunction.getExpression(); if (child instanceof StateFieldPathExpression) { StateFieldPathExpression sfpExp = (StateFieldPathExpression) child; String columnName = getColumnName(metadata, entityType, sfpExp.toActualText()); String actualColumnName = columnName; if (hasLob) { actualColumnName = "metadata." + columnName; } else if (metadata.getIdAttribute().equals(entityType.getAttribute(metadata.getFieldName(columnName)))) { actualColumnName = "_id"; } BasicDBObject item = new BasicDBObject("$" + identifier, "$" + actualColumnName); group.put(identifier + "_" + columnName, item); } else if (expression instanceof CountFunction) { group.put("count", new BasicDBObject("$sum", 1)); } } else if (expression instanceof CollectionExpression) { for (Expression child : expression.children()) { buildAggregation(group, child, metadata, entityType, hasLob); } } else if (expression instanceof StateFieldPathExpression) { StateFieldPathExpression sfpExp = (StateFieldPathExpression) expression; BasicDBObject idObject; Object existing = group.get("_id"); if (existing != null) { idObject = (BasicDBObject) existing; } else { idObject = new BasicDBObject(); group.put("_id", idObject); } String columnName = getColumnName(metadata, entityType, sfpExp.toActualText()); String actualColumnName = columnName; if (hasLob) { actualColumnName = "metadata." + columnName; } idObject.put(columnName, "$" + actualColumnName); } } }
public class class_name { private void buildAggregation(DBObject group, Expression expression, EntityMetadata metadata, EntityType entityType, boolean hasLob) { if (expression instanceof AggregateFunction) { AggregateFunction aggregateFunction = (AggregateFunction) expression; String identifier = aggregateFunction.getIdentifier().toLowerCase(); Expression child = aggregateFunction.getExpression(); if (child instanceof StateFieldPathExpression) { StateFieldPathExpression sfpExp = (StateFieldPathExpression) child; String columnName = getColumnName(metadata, entityType, sfpExp.toActualText()); String actualColumnName = columnName; if (hasLob) { actualColumnName = "metadata." + columnName; // depends on control dependency: [if], data = [none] } else if (metadata.getIdAttribute().equals(entityType.getAttribute(metadata.getFieldName(columnName)))) { actualColumnName = "_id"; // depends on control dependency: [if], data = [none] } BasicDBObject item = new BasicDBObject("$" + identifier, "$" + actualColumnName); group.put(identifier + "_" + columnName, item); // depends on control dependency: [if], data = [none] } else if (expression instanceof CountFunction) { group.put("count", new BasicDBObject("$sum", 1)); // depends on control dependency: [if], data = [none] } } else if (expression instanceof CollectionExpression) { for (Expression child : expression.children()) { buildAggregation(group, child, metadata, entityType, hasLob); // depends on control dependency: [for], data = [child] } } else if (expression instanceof StateFieldPathExpression) { StateFieldPathExpression sfpExp = (StateFieldPathExpression) expression; BasicDBObject idObject; Object existing = group.get("_id"); if (existing != null) { idObject = (BasicDBObject) existing; // depends on control dependency: [if], data = [none] } else { idObject = new BasicDBObject(); // depends on control dependency: [if], data = [none] group.put("_id", idObject); // depends on control dependency: [if], data = [none] } String columnName = getColumnName(metadata, entityType, sfpExp.toActualText()); String actualColumnName = columnName; if (hasLob) { actualColumnName = "metadata." + columnName; // depends on control dependency: [if], data = [none] } idObject.put(columnName, "$" + actualColumnName); // depends on control dependency: [if], data = [none] } } }
public class class_name { static final double moonAge(long time) { double age = 0; synchronized(astro) { astro.setTime(time); age = astro.getMoonAge(); } // Convert to degrees and normalize... age = age * 180 / Math.PI; if (age > 180) { age = age - 360; } return age; } }
public class class_name { static final double moonAge(long time) { double age = 0; synchronized(astro) { astro.setTime(time); age = astro.getMoonAge(); } // Convert to degrees and normalize... age = age * 180 / Math.PI; if (age > 180) { age = age - 360; // depends on control dependency: [if], data = [none] } return age; } }
public class class_name { public String getValue(String propertyName) { Property property = super.get(propertyName); if (property == null) { return null; } return property.getValue(); } }
public class class_name { public String getValue(String propertyName) { Property property = super.get(propertyName); if (property == null) { return null; // depends on control dependency: [if], data = [none] } return property.getValue(); } }
public class class_name { private CoordTile getFreeTileAround(Pathfindable mover, int tx, int ty, int tw, int th, int radius, Integer id) { for (int ctx = tx - radius; ctx <= tx + radius; ctx++) { for (int cty = ty - radius; cty <= ty + radius; cty++) { if (isAreaAvailable(mover, ctx, cty, tw, th, id)) { return new CoordTile(ctx, cty); } } } return null; } }
public class class_name { private CoordTile getFreeTileAround(Pathfindable mover, int tx, int ty, int tw, int th, int radius, Integer id) { for (int ctx = tx - radius; ctx <= tx + radius; ctx++) { for (int cty = ty - radius; cty <= ty + radius; cty++) { if (isAreaAvailable(mover, ctx, cty, tw, th, id)) { return new CoordTile(ctx, cty); // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { private void addForwardReference( final int sourceInsnBytecodeOffset, final int referenceType, final int referenceHandle) { if (forwardReferences == null) { forwardReferences = new int[FORWARD_REFERENCES_CAPACITY_INCREMENT]; } int lastElementIndex = forwardReferences[0]; if (lastElementIndex + 2 >= forwardReferences.length) { int[] newValues = new int[forwardReferences.length + FORWARD_REFERENCES_CAPACITY_INCREMENT]; System.arraycopy(forwardReferences, 0, newValues, 0, forwardReferences.length); forwardReferences = newValues; } forwardReferences[++lastElementIndex] = sourceInsnBytecodeOffset; forwardReferences[++lastElementIndex] = referenceType | referenceHandle; forwardReferences[0] = lastElementIndex; } }
public class class_name { private void addForwardReference( final int sourceInsnBytecodeOffset, final int referenceType, final int referenceHandle) { if (forwardReferences == null) { forwardReferences = new int[FORWARD_REFERENCES_CAPACITY_INCREMENT]; // depends on control dependency: [if], data = [none] } int lastElementIndex = forwardReferences[0]; if (lastElementIndex + 2 >= forwardReferences.length) { int[] newValues = new int[forwardReferences.length + FORWARD_REFERENCES_CAPACITY_INCREMENT]; System.arraycopy(forwardReferences, 0, newValues, 0, forwardReferences.length); // depends on control dependency: [if], data = [none] forwardReferences = newValues; // depends on control dependency: [if], data = [none] } forwardReferences[++lastElementIndex] = sourceInsnBytecodeOffset; forwardReferences[++lastElementIndex] = referenceType | referenceHandle; forwardReferences[0] = lastElementIndex; } }
public class class_name { public List<String> encode(Cookie... cookies) { if (cookies == null) { throw new NullPointerException("cookies"); } if (cookies.length == 0) { return Collections.emptyList(); } List<String> encoded = new ArrayList<String>(cookies.length); for (Cookie c : cookies) { if (c == null) { break; } encoded.add(encode(c)); } return encoded; } }
public class class_name { public List<String> encode(Cookie... cookies) { if (cookies == null) { throw new NullPointerException("cookies"); } if (cookies.length == 0) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<String> encoded = new ArrayList<String>(cookies.length); for (Cookie c : cookies) { if (c == null) { break; } encoded.add(encode(c)); // depends on control dependency: [for], data = [c] } return encoded; } }
public class class_name { public static Policy createPolicy(final String resourceName) { if (StringUtils.isBlank(resourceName)) { throw new SystemException("AntiSamy Policy resourceName cannot be null "); } URL resource = HtmlSanitizerUtil.class.getClassLoader().getResource(resourceName); if (resource == null) { throw new SystemException("Could not find AntiSamy Policy XML resource."); } try { return Policy.getInstance(resource); } catch (PolicyException ex) { throw new SystemException("Could not create AntiSamy Policy" + ex.getMessage(), ex); } } }
public class class_name { public static Policy createPolicy(final String resourceName) { if (StringUtils.isBlank(resourceName)) { throw new SystemException("AntiSamy Policy resourceName cannot be null "); } URL resource = HtmlSanitizerUtil.class.getClassLoader().getResource(resourceName); if (resource == null) { throw new SystemException("Could not find AntiSamy Policy XML resource."); } try { return Policy.getInstance(resource); // depends on control dependency: [try], data = [none] } catch (PolicyException ex) { throw new SystemException("Could not create AntiSamy Policy" + ex.getMessage(), ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Number parseNumber(String value, boolean integerOnly, Locale... locales) throws NumberFormatException { value = StringUtils.trimToNull(value); if (value == null) return null; // ignore leading plus sign if (value.startsWith("+")) value = StringUtils.trimToNull(value.substring(1)); // remove any spaces value = StringUtils.replace(value, StringUtils.SPACE, StringUtils.EMPTY); if (ArrayUtils.isEmpty(locales)) locales = new Locale[]{Locale.getDefault()}; for (Locale locale : locales) { // check, if the value is completely numeric for the locale if (!isNumeric(value, locale)) continue; NumberFormat format = NumberFormat.getNumberInstance(locale); try { format.setMinimumFractionDigits(0); format.setParseIntegerOnly(integerOnly); format.setGroupingUsed(value.indexOf(DecimalFormatSymbols.getInstance(locale).getGroupingSeparator()) > -1); return format.parse(value); } catch (ParseException ex) { } } throw new NumberFormatException("The provided value '" + value + "' is not numeric!"); } }
public class class_name { public static Number parseNumber(String value, boolean integerOnly, Locale... locales) throws NumberFormatException { value = StringUtils.trimToNull(value); if (value == null) return null; // ignore leading plus sign if (value.startsWith("+")) value = StringUtils.trimToNull(value.substring(1)); // remove any spaces value = StringUtils.replace(value, StringUtils.SPACE, StringUtils.EMPTY); if (ArrayUtils.isEmpty(locales)) locales = new Locale[]{Locale.getDefault()}; for (Locale locale : locales) { // check, if the value is completely numeric for the locale if (!isNumeric(value, locale)) continue; NumberFormat format = NumberFormat.getNumberInstance(locale); try { format.setMinimumFractionDigits(0); // depends on control dependency: [try], data = [none] format.setParseIntegerOnly(integerOnly); // depends on control dependency: [try], data = [none] format.setGroupingUsed(value.indexOf(DecimalFormatSymbols.getInstance(locale).getGroupingSeparator()) > -1); // depends on control dependency: [try], data = [none] return format.parse(value); // depends on control dependency: [try], data = [none] } catch (ParseException ex) { } // depends on control dependency: [catch], data = [none] } throw new NumberFormatException("The provided value '" + value + "' is not numeric!"); } }
public class class_name { private Pair<Instance, Locality> findInstance(Iterable<TaskManagerLocation> requestedLocations, boolean localOnly) { // drain the queue of newly available instances while (this.newlyAvailableInstances.size() > 0) { Instance queuedInstance = this.newlyAvailableInstances.poll(); if (queuedInstance != null) { this.instancesWithAvailableResources.put(queuedInstance.getTaskManagerID(), queuedInstance); } } // if nothing is available at all, return null if (this.instancesWithAvailableResources.isEmpty()) { return null; } Iterator<TaskManagerLocation> locations = requestedLocations == null ? null : requestedLocations.iterator(); if (locations != null && locations.hasNext()) { // we have a locality preference while (locations.hasNext()) { TaskManagerLocation location = locations.next(); if (location != null) { Instance instance = instancesWithAvailableResources.remove(location.getResourceID()); if (instance != null) { return new ImmutablePair<Instance, Locality>(instance, Locality.LOCAL); } } } // no local instance available if (localOnly) { return null; } else { // take the first instance from the instances with resources Iterator<Instance> instances = instancesWithAvailableResources.values().iterator(); Instance instanceToUse = instances.next(); instances.remove(); return new ImmutablePair<>(instanceToUse, Locality.NON_LOCAL); } } else { // no location preference, so use some instance Iterator<Instance> instances = instancesWithAvailableResources.values().iterator(); Instance instanceToUse = instances.next(); instances.remove(); return new ImmutablePair<>(instanceToUse, Locality.UNCONSTRAINED); } } }
public class class_name { private Pair<Instance, Locality> findInstance(Iterable<TaskManagerLocation> requestedLocations, boolean localOnly) { // drain the queue of newly available instances while (this.newlyAvailableInstances.size() > 0) { Instance queuedInstance = this.newlyAvailableInstances.poll(); if (queuedInstance != null) { this.instancesWithAvailableResources.put(queuedInstance.getTaskManagerID(), queuedInstance); // depends on control dependency: [if], data = [(queuedInstance] } } // if nothing is available at all, return null if (this.instancesWithAvailableResources.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } Iterator<TaskManagerLocation> locations = requestedLocations == null ? null : requestedLocations.iterator(); if (locations != null && locations.hasNext()) { // we have a locality preference while (locations.hasNext()) { TaskManagerLocation location = locations.next(); if (location != null) { Instance instance = instancesWithAvailableResources.remove(location.getResourceID()); if (instance != null) { return new ImmutablePair<Instance, Locality>(instance, Locality.LOCAL); // depends on control dependency: [if], data = [(instance] } } } // no local instance available if (localOnly) { return null; // depends on control dependency: [if], data = [none] } else { // take the first instance from the instances with resources Iterator<Instance> instances = instancesWithAvailableResources.values().iterator(); Instance instanceToUse = instances.next(); instances.remove(); // depends on control dependency: [if], data = [none] return new ImmutablePair<>(instanceToUse, Locality.NON_LOCAL); // depends on control dependency: [if], data = [none] } } else { // no location preference, so use some instance Iterator<Instance> instances = instancesWithAvailableResources.values().iterator(); Instance instanceToUse = instances.next(); instances.remove(); // depends on control dependency: [if], data = [none] return new ImmutablePair<>(instanceToUse, Locality.UNCONSTRAINED); // depends on control dependency: [if], data = [none] } } }
public class class_name { public DescribeAvailabilityZonesRequest withZoneIds(String... zoneIds) { if (this.zoneIds == null) { setZoneIds(new com.amazonaws.internal.SdkInternalList<String>(zoneIds.length)); } for (String ele : zoneIds) { this.zoneIds.add(ele); } return this; } }
public class class_name { public DescribeAvailabilityZonesRequest withZoneIds(String... zoneIds) { if (this.zoneIds == null) { setZoneIds(new com.amazonaws.internal.SdkInternalList<String>(zoneIds.length)); // depends on control dependency: [if], data = [none] } for (String ele : zoneIds) { this.zoneIds.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static void invoke(final Object listener, final Class listenerType) { if (listenerType == Init.class) { ((Init) listener).init(); return; } if (listenerType == Start.class) { ((Start) listener).start(); return; } if (listenerType == Ready.class) { ((Ready) listener).ready(); return; } if (listenerType == Stop.class) { ((Stop) listener).stop(); return; } throw new MadvocException("Invalid listener"); } }
public class class_name { public static void invoke(final Object listener, final Class listenerType) { if (listenerType == Init.class) { ((Init) listener).init(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (listenerType == Start.class) { ((Start) listener).start(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (listenerType == Ready.class) { ((Ready) listener).ready(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (listenerType == Stop.class) { ((Stop) listener).stop(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } throw new MadvocException("Invalid listener"); } }
public class class_name { public void addFilterClause(final String property, final String condition, final Object value, final String fieldName, final boolean ignoreCase) { if (property != null && condition != null) { FilterClause filterClause = new FilterClause(property.trim(), condition.trim(), value, fieldName); filterClause.setIgnoreCase(ignoreCase); filtersQueue.add(filterClause); } else { filtersQueue.add(property); } } }
public class class_name { public void addFilterClause(final String property, final String condition, final Object value, final String fieldName, final boolean ignoreCase) { if (property != null && condition != null) { FilterClause filterClause = new FilterClause(property.trim(), condition.trim(), value, fieldName); filterClause.setIgnoreCase(ignoreCase); // depends on control dependency: [if], data = [none] filtersQueue.add(filterClause); // depends on control dependency: [if], data = [none] } else { filtersQueue.add(property); // depends on control dependency: [if], data = [(property] } } }
public class class_name { public ValueExpression resolveVariable(String variable) { ValueExpression ve = null; try { if (_vars != null) { ve = (ValueExpression) _vars.get(variable); // Is this code in a block that wants to cache // the resulting expression(s) and variable has been resolved? if (_trackResolveVariables && ve != null) { _variableResolved = true; } } if (ve == null) { return _target.resolveVariable(variable); } return ve; } catch (StackOverflowError e) { throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e); } } }
public class class_name { public ValueExpression resolveVariable(String variable) { ValueExpression ve = null; try { if (_vars != null) { ve = (ValueExpression) _vars.get(variable); // depends on control dependency: [if], data = [none] // Is this code in a block that wants to cache // the resulting expression(s) and variable has been resolved? if (_trackResolveVariables && ve != null) { _variableResolved = true; // depends on control dependency: [if], data = [none] } } if (ve == null) { return _target.resolveVariable(variable); // depends on control dependency: [if], data = [none] } return ve; // depends on control dependency: [try], data = [none] } catch (StackOverflowError e) { throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Set<File> scanAntStylePaths(List<String> antStylePaths, int symLinkDepth, String[] excludes) { final Set<File> paths = new HashSet<>(); for (String file : antStylePaths) { LOGGER.debug("Scanning {}", file); final DirectoryScanner scanner = new DirectoryScanner(); String include = file.replace('\\', '/'); final File baseDir; final int pos = getLastFileSeparator(include); final String tmpBase = include.substring(0, pos); final String tmpInclude = include.substring(pos + 1); if (tmpInclude.indexOf('*') >= 0 || tmpInclude.indexOf('?') >= 0 || new File(include).isFile()) { baseDir = new File(tmpBase); include = tmpInclude; } else { baseDir = new File(tmpBase, tmpInclude); include = "**/*"; } scanner.setBasedir(baseDir); final String[] includes = {include}; scanner.setIncludes(includes); scanner.setMaxLevelsOfSymlinks(symLinkDepth); if (symLinkDepth <= 0) { scanner.setFollowSymlinks(false); } if (excludes != null && excludes.length > 0) { scanner.addExcludes(excludes); } scanner.scan(); if (scanner.getIncludedFilesCount() > 0) { for (String s : scanner.getIncludedFiles()) { final File f = new File(baseDir, s); LOGGER.debug("Found file {}", f.toString()); paths.add(f); } } } return paths; } }
public class class_name { private Set<File> scanAntStylePaths(List<String> antStylePaths, int symLinkDepth, String[] excludes) { final Set<File> paths = new HashSet<>(); for (String file : antStylePaths) { LOGGER.debug("Scanning {}", file); final DirectoryScanner scanner = new DirectoryScanner(); String include = file.replace('\\', '/'); final File baseDir; final int pos = getLastFileSeparator(include); final String tmpBase = include.substring(0, pos); final String tmpInclude = include.substring(pos + 1); if (tmpInclude.indexOf('*') >= 0 || tmpInclude.indexOf('?') >= 0 || new File(include).isFile()) { baseDir = new File(tmpBase); // depends on control dependency: [if], data = [none] include = tmpInclude; // depends on control dependency: [if], data = [none] } else { baseDir = new File(tmpBase, tmpInclude); // depends on control dependency: [if], data = [none] include = "**/*"; // depends on control dependency: [if], data = [none] } scanner.setBasedir(baseDir); final String[] includes = {include}; scanner.setIncludes(includes); scanner.setMaxLevelsOfSymlinks(symLinkDepth); if (symLinkDepth <= 0) { scanner.setFollowSymlinks(false); // depends on control dependency: [if], data = [none] } if (excludes != null && excludes.length > 0) { scanner.addExcludes(excludes); // depends on control dependency: [if], data = [(excludes] } scanner.scan(); if (scanner.getIncludedFilesCount() > 0) { for (String s : scanner.getIncludedFiles()) { final File f = new File(baseDir, s); LOGGER.debug("Found file {}", f.toString()); paths.add(f); } } } return paths; } }
public class class_name { @Override public CloudTrailSource getSource(Message sqsMessage) throws IOException { ExceptionChain exceptionChain = new ExceptionChain(); if (lastUsedSourceSerializer != null) { CloudTrailSource source = getCloudTrailSource(sqsMessage, lastUsedSourceSerializer, exceptionChain); if (source != null) { return source; } } for (SourceSerializer serializer: sourceSerializers) { // already tried lastUsedSourceSerializer, so skip it and move on if (serializer == lastUsedSourceSerializer) { continue; } CloudTrailSource source = getCloudTrailSource(sqsMessage, serializer, exceptionChain); if (source != null) { lastUsedSourceSerializer = serializer; return source; } } throw exceptionChain.throwOut(); } }
public class class_name { @Override public CloudTrailSource getSource(Message sqsMessage) throws IOException { ExceptionChain exceptionChain = new ExceptionChain(); if (lastUsedSourceSerializer != null) { CloudTrailSource source = getCloudTrailSource(sqsMessage, lastUsedSourceSerializer, exceptionChain); if (source != null) { return source; } } for (SourceSerializer serializer: sourceSerializers) { // already tried lastUsedSourceSerializer, so skip it and move on if (serializer == lastUsedSourceSerializer) { continue; } CloudTrailSource source = getCloudTrailSource(sqsMessage, serializer, exceptionChain); if (source != null) { lastUsedSourceSerializer = serializer; // depends on control dependency: [if], data = [none] return source; // depends on control dependency: [if], data = [none] } } throw exceptionChain.throwOut(); } }
public class class_name { public static boolean canVisualize(Relation<?> rel, AbstractMTree<?, ?, ?, ?> tree) { if(!TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) { return false; } return getLPNormP(tree) > 0; } }
public class class_name { public static boolean canVisualize(Relation<?> rel, AbstractMTree<?, ?, ?, ?> tree) { if(!TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) { return false; // depends on control dependency: [if], data = [none] } return getLPNormP(tree) > 0; } }
public class class_name { public void setAttackCounters(java.util.Collection<SummarizedCounter> attackCounters) { if (attackCounters == null) { this.attackCounters = null; return; } this.attackCounters = new java.util.ArrayList<SummarizedCounter>(attackCounters); } }
public class class_name { public void setAttackCounters(java.util.Collection<SummarizedCounter> attackCounters) { if (attackCounters == null) { this.attackCounters = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.attackCounters = new java.util.ArrayList<SummarizedCounter>(attackCounters); } }
public class class_name { public static String stringFor(int m) { if (m == CUFFT_COMPATIBILITY_NATIVE) { return "CUFFT_COMPATIBILITY_NATIVE"; } if ((m & CUFFT_COMPATIBILITY_FFTW_ALL) == CUFFT_COMPATIBILITY_FFTW_ALL) { return "CUFFT_COMPATIBILITY_FFTW_ALL"; } StringBuilder sb = new StringBuilder(); if ((m & CUFFT_COMPATIBILITY_FFTW_PADDING) != 0) { sb.append("CUFFT_COMPATIBILITY_FFTW_PADDING "); } if ((m & CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC) != 0) { sb.append("CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC "); } return sb.toString(); } }
public class class_name { public static String stringFor(int m) { if (m == CUFFT_COMPATIBILITY_NATIVE) { return "CUFFT_COMPATIBILITY_NATIVE"; // depends on control dependency: [if], data = [none] } if ((m & CUFFT_COMPATIBILITY_FFTW_ALL) == CUFFT_COMPATIBILITY_FFTW_ALL) { return "CUFFT_COMPATIBILITY_FFTW_ALL"; // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(); if ((m & CUFFT_COMPATIBILITY_FFTW_PADDING) != 0) { sb.append("CUFFT_COMPATIBILITY_FFTW_PADDING "); // depends on control dependency: [if], data = [none] } if ((m & CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC) != 0) { sb.append("CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC "); // depends on control dependency: [if], data = [none] } return sb.toString(); } }
public class class_name { public static DateTime toDateTime(Locale locale, String str, TimeZone tz, DateTime defaultValue, boolean useCommomDateParserAsWell) { str = str.trim(); tz = ThreadLocalPageContext.getTimeZone(tz); DateFormat[] df; // get Calendar Calendar c = JREDateTimeUtil.getThreadCalendar(locale, tz); // datetime ParsePosition pp = new ParsePosition(0); df = FormatUtil.getDateTimeFormats(locale, tz, false);// dfc[FORMATS_DATE_TIME]; Date d; for (int i = 0; i < df.length; i++) { SimpleDateFormat sdf = (SimpleDateFormat) df[i]; // print.e(sdf.format(new Date(108,3,6,1,2,1)) + " : "+sdf.toPattern()); pp.setErrorIndex(-1); pp.setIndex(0); sdf.setTimeZone(tz); d = sdf.parse(str, pp); if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue; optimzeDate(c, tz, d); return new DateTimeImpl(c.getTime()); } // date df = FormatUtil.getDateFormats(locale, tz, false); for (int i = 0; i < df.length; i++) { SimpleDateFormat sdf = (SimpleDateFormat) df[i]; // print.e(sdf.format(new Date(108,3,6,1,2,1)) + " : "+sdf.toPattern()); pp.setErrorIndex(-1); pp.setIndex(0); sdf.setTimeZone(tz); d = sdf.parse(str, pp); if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue; optimzeDate(c, tz, d); return new DateTimeImpl(c.getTime()); } // time df = FormatUtil.getTimeFormats(locale, tz, false);// dfc[FORMATS_TIME]; for (int i = 0; i < df.length; i++) { SimpleDateFormat sdf = (SimpleDateFormat) df[i]; // print.e(sdf.format(new Date(108,3,6,1,2,1))+ " : "+sdf.toPattern()); pp.setErrorIndex(-1); pp.setIndex(0); sdf.setTimeZone(tz); d = sdf.parse(str, pp); if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue; c.setTimeZone(tz); c.setTime(d); c.set(Calendar.YEAR, 1899); c.set(Calendar.MONTH, 11); c.set(Calendar.DAY_OF_MONTH, 30); c.setTimeZone(tz); return new DateTimeImpl(c.getTime()); } if (useCommomDateParserAsWell) return DateCaster.toDateSimple(str, CONVERTING_TYPE_NONE, true, tz, defaultValue); return defaultValue; } }
public class class_name { public static DateTime toDateTime(Locale locale, String str, TimeZone tz, DateTime defaultValue, boolean useCommomDateParserAsWell) { str = str.trim(); tz = ThreadLocalPageContext.getTimeZone(tz); DateFormat[] df; // get Calendar Calendar c = JREDateTimeUtil.getThreadCalendar(locale, tz); // datetime ParsePosition pp = new ParsePosition(0); df = FormatUtil.getDateTimeFormats(locale, tz, false);// dfc[FORMATS_DATE_TIME]; Date d; for (int i = 0; i < df.length; i++) { SimpleDateFormat sdf = (SimpleDateFormat) df[i]; // print.e(sdf.format(new Date(108,3,6,1,2,1)) + " : "+sdf.toPattern()); pp.setErrorIndex(-1); // depends on control dependency: [for], data = [none] pp.setIndex(0); // depends on control dependency: [for], data = [none] sdf.setTimeZone(tz); // depends on control dependency: [for], data = [none] d = sdf.parse(str, pp); // depends on control dependency: [for], data = [none] if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue; optimzeDate(c, tz, d); // depends on control dependency: [for], data = [none] return new DateTimeImpl(c.getTime()); // depends on control dependency: [for], data = [none] } // date df = FormatUtil.getDateFormats(locale, tz, false); for (int i = 0; i < df.length; i++) { SimpleDateFormat sdf = (SimpleDateFormat) df[i]; // print.e(sdf.format(new Date(108,3,6,1,2,1)) + " : "+sdf.toPattern()); pp.setErrorIndex(-1); // depends on control dependency: [for], data = [none] pp.setIndex(0); // depends on control dependency: [for], data = [none] sdf.setTimeZone(tz); // depends on control dependency: [for], data = [none] d = sdf.parse(str, pp); // depends on control dependency: [for], data = [none] if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue; optimzeDate(c, tz, d); // depends on control dependency: [for], data = [none] return new DateTimeImpl(c.getTime()); // depends on control dependency: [for], data = [none] } // time df = FormatUtil.getTimeFormats(locale, tz, false);// dfc[FORMATS_TIME]; for (int i = 0; i < df.length; i++) { SimpleDateFormat sdf = (SimpleDateFormat) df[i]; // print.e(sdf.format(new Date(108,3,6,1,2,1))+ " : "+sdf.toPattern()); pp.setErrorIndex(-1); // depends on control dependency: [for], data = [none] pp.setIndex(0); // depends on control dependency: [for], data = [none] sdf.setTimeZone(tz); // depends on control dependency: [for], data = [none] d = sdf.parse(str, pp); // depends on control dependency: [for], data = [none] if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue; c.setTimeZone(tz); // depends on control dependency: [for], data = [none] c.setTime(d); // depends on control dependency: [for], data = [none] c.set(Calendar.YEAR, 1899); // depends on control dependency: [for], data = [none] c.set(Calendar.MONTH, 11); // depends on control dependency: [for], data = [none] c.set(Calendar.DAY_OF_MONTH, 30); // depends on control dependency: [for], data = [none] c.setTimeZone(tz); // depends on control dependency: [for], data = [none] return new DateTimeImpl(c.getTime()); // depends on control dependency: [for], data = [none] } if (useCommomDateParserAsWell) return DateCaster.toDateSimple(str, CONVERTING_TYPE_NONE, true, tz, defaultValue); return defaultValue; } }
public class class_name { public static boolean isWriteEnabled(Resource resource, String relPath) throws RepositoryException { ResourceResolver resolver = resource.getResourceResolver(); Session session = resolver.adaptTo(Session.class); AccessControlManager accessManager = AccessControlUtil.getAccessControlManager(session); String resourcePath = resource.getPath(); Privilege[] addPrivileges = new Privilege[]{ accessManager.privilegeFromName(Privilege.JCR_ADD_CHILD_NODES) }; boolean result = accessManager.hasPrivileges(resourcePath, addPrivileges); if (StringUtils.isNotBlank(relPath)) { if (!resourcePath.endsWith("/")) { resourcePath += "/"; } resourcePath += relPath; } Privilege[] changePrivileges = new Privilege[]{ accessManager.privilegeFromName(Privilege.JCR_MODIFY_PROPERTIES) }; try { result = result && accessManager.hasPrivileges(resourcePath, changePrivileges); } catch (PathNotFoundException pnfex) { // ok, let's create it } return result; } }
public class class_name { public static boolean isWriteEnabled(Resource resource, String relPath) throws RepositoryException { ResourceResolver resolver = resource.getResourceResolver(); Session session = resolver.adaptTo(Session.class); AccessControlManager accessManager = AccessControlUtil.getAccessControlManager(session); String resourcePath = resource.getPath(); Privilege[] addPrivileges = new Privilege[]{ accessManager.privilegeFromName(Privilege.JCR_ADD_CHILD_NODES) }; boolean result = accessManager.hasPrivileges(resourcePath, addPrivileges); if (StringUtils.isNotBlank(relPath)) { if (!resourcePath.endsWith("/")) { resourcePath += "/"; // depends on control dependency: [if], data = [none] } resourcePath += relPath; } Privilege[] changePrivileges = new Privilege[]{ accessManager.privilegeFromName(Privilege.JCR_MODIFY_PROPERTIES) }; try { result = result && accessManager.hasPrivileges(resourcePath, changePrivileges); } catch (PathNotFoundException pnfex) { // ok, let's create it } return result; } }
public class class_name { public boolean hasNext() { while(next == null) { try { next = (SIMPControllable) next(); } catch(NoSuchElementException e) { //No FFDC code needed break; } } boolean hasNext = (next != null); return hasNext; } }
public class class_name { public boolean hasNext() { while(next == null) { try { next = (SIMPControllable) next(); // depends on control dependency: [try], data = [none] } catch(NoSuchElementException e) { //No FFDC code needed break; } // depends on control dependency: [catch], data = [none] } boolean hasNext = (next != null); return hasNext; } }
public class class_name { protected void processCookieHeaders( final CookieSpec parser, final Header[] headers, final HttpState state, final HttpConnection conn) { LOG.trace("enter HttpMethodBase.processCookieHeaders(Header[], HttpState, " + "HttpConnection)"); String host = this.params.getVirtualHost(); if (host == null) { host = conn.getHost(); } for (int i = 0; i < headers.length; i++) { Header header = headers[i]; Cookie[] cookies = null; try { cookies = parser.parse( host, conn.getPort(), getPath(), conn.isSecure(), header); } catch (MalformedCookieException e) { if (LOG.isWarnEnabled()) { LOG.warn("Invalid cookie header: \"" + header.getValue() + "\". " + e.getMessage()); } } if (cookies != null) { for (int j = 0; j < cookies.length; j++) { Cookie cookie = cookies[j]; try { parser.validate( host, conn.getPort(), getPath(), conn.isSecure(), cookie); state.addCookie(cookie); if (LOG.isDebugEnabled()) { LOG.debug("Cookie accepted: \"" + parser.formatCookie(cookie) + "\""); } } catch (MalformedCookieException e) { if (LOG.isWarnEnabled()) { LOG.warn("Cookie rejected: \"" + parser.formatCookie(cookie) + "\". " + e.getMessage()); } } } } } } }
public class class_name { protected void processCookieHeaders( final CookieSpec parser, final Header[] headers, final HttpState state, final HttpConnection conn) { LOG.trace("enter HttpMethodBase.processCookieHeaders(Header[], HttpState, " + "HttpConnection)"); String host = this.params.getVirtualHost(); if (host == null) { host = conn.getHost(); // depends on control dependency: [if], data = [none] } for (int i = 0; i < headers.length; i++) { Header header = headers[i]; Cookie[] cookies = null; try { cookies = parser.parse( host, conn.getPort(), getPath(), conn.isSecure(), header); } catch (MalformedCookieException e) { if (LOG.isWarnEnabled()) { LOG.warn("Invalid cookie header: \"" + header.getValue() + "\". " + e.getMessage()); } } if (cookies != null) { for (int j = 0; j < cookies.length; j++) { Cookie cookie = cookies[j]; try { parser.validate( host, conn.getPort(), getPath(), conn.isSecure(), cookie); state.addCookie(cookie); if (LOG.isDebugEnabled()) { LOG.debug("Cookie accepted: \"" + parser.formatCookie(cookie) + "\""); } } catch (MalformedCookieException e) { if (LOG.isWarnEnabled()) { LOG.warn("Cookie rejected: \"" + parser.formatCookie(cookie) + "\". " + e.getMessage()); } } } } } } }
public class class_name { protected boolean nextBuffer() { if (this.buffersIndex == this.buffersEndIndex) { return false; } this.bufferStepCount++; this.buffersIndex++; if (this.buffersIndex >= this.buffers.length) { this.buffersIndex = 0; } ByteArrayBuffer buffer = this.buffers[this.buffersIndex]; this.currentBufferBytes = buffer.getBytes(); this.currentBufferIndex = buffer.getCurrentIndex(); this.currentBufferMax = buffer.getMaximumIndex(); return true; } }
public class class_name { protected boolean nextBuffer() { if (this.buffersIndex == this.buffersEndIndex) { return false; // depends on control dependency: [if], data = [none] } this.bufferStepCount++; this.buffersIndex++; if (this.buffersIndex >= this.buffers.length) { this.buffersIndex = 0; // depends on control dependency: [if], data = [none] } ByteArrayBuffer buffer = this.buffers[this.buffersIndex]; this.currentBufferBytes = buffer.getBytes(); this.currentBufferIndex = buffer.getCurrentIndex(); this.currentBufferMax = buffer.getMaximumIndex(); return true; } }
public class class_name { public static void normalizeExp(Map<String, Double> predictionScores) { Set<Map.Entry<String, Double>> entrySet = predictionScores.entrySet(); double max = Double.NEGATIVE_INFINITY; for (Map.Entry<String, Double> entry : entrySet) { max = Math.max(max, entry.getValue()); } double sum = 0.0; //通过减去最大值防止浮点数溢出 for (Map.Entry<String, Double> entry : entrySet) { Double value = Math.exp(entry.getValue() - max); entry.setValue(value); sum += value; } if (sum != 0.0) { for (Map.Entry<String, Double> entry : entrySet) { predictionScores.put(entry.getKey(), entry.getValue() / sum); } } } }
public class class_name { public static void normalizeExp(Map<String, Double> predictionScores) { Set<Map.Entry<String, Double>> entrySet = predictionScores.entrySet(); double max = Double.NEGATIVE_INFINITY; for (Map.Entry<String, Double> entry : entrySet) { max = Math.max(max, entry.getValue()); // depends on control dependency: [for], data = [entry] } double sum = 0.0; //通过减去最大值防止浮点数溢出 for (Map.Entry<String, Double> entry : entrySet) { Double value = Math.exp(entry.getValue() - max); entry.setValue(value); // depends on control dependency: [for], data = [entry] sum += value; // depends on control dependency: [for], data = [none] } if (sum != 0.0) { for (Map.Entry<String, Double> entry : entrySet) { predictionScores.put(entry.getKey(), entry.getValue() / sum); // depends on control dependency: [for], data = [entry] } } } }
public class class_name { @Override public void setValueAt(final Object value, final int row, final int col) { if (!editable) { throw new IllegalStateException("Attempted to set a value on an uneditable model"); } Object bean = data[row]; String property = properties[col]; if (bean != null) { if (".".equals(property)) { data[row] = (Serializable) value; } else { try { PropertyUtils.setProperty(bean, property, value); } catch (Exception e) { LOG.error("Failed to set bean property " + property + " on " + bean, e); } } } } }
public class class_name { @Override public void setValueAt(final Object value, final int row, final int col) { if (!editable) { throw new IllegalStateException("Attempted to set a value on an uneditable model"); } Object bean = data[row]; String property = properties[col]; if (bean != null) { if (".".equals(property)) { data[row] = (Serializable) value; // depends on control dependency: [if], data = [none] } else { try { PropertyUtils.setProperty(bean, property, value); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error("Failed to set bean property " + property + " on " + bean, e); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public void marshall(DeleteTrailRequest deleteTrailRequest, ProtocolMarshaller protocolMarshaller) { if (deleteTrailRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteTrailRequest.getName(), NAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteTrailRequest deleteTrailRequest, ProtocolMarshaller protocolMarshaller) { if (deleteTrailRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteTrailRequest.getName(), NAME_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 CanvasElement getCanvasElement() { if (LienzoCore.IS_CANVAS_SUPPORTED) { if (null == m_element) { m_element = Document.get().createCanvasElement(); m_element.getStyle().setPosition(Position.ABSOLUTE); m_element.getStyle().setDisplay(Display.INLINE_BLOCK); } if (null == m_context) { m_context = new Context2D(m_element); } } return m_element; } }
public class class_name { public CanvasElement getCanvasElement() { if (LienzoCore.IS_CANVAS_SUPPORTED) { if (null == m_element) { m_element = Document.get().createCanvasElement(); // depends on control dependency: [if], data = [none] m_element.getStyle().setPosition(Position.ABSOLUTE); // depends on control dependency: [if], data = [none] m_element.getStyle().setDisplay(Display.INLINE_BLOCK); // depends on control dependency: [if], data = [none] } if (null == m_context) { m_context = new Context2D(m_element); // depends on control dependency: [if], data = [none] } } return m_element; } }
public class class_name { protected boolean tryToAddIntoContainer(IAsmElementUmlInteractive<?, ?, ?, ?> asmElm, int screenX, int screenY) { IAsmElementUmlInteractive<? extends ContainerFull<?>, ?, ?, ?> container = findContainerAtExcept(screenX, screenY, asmElm.getElementUml().getId()); if(container != null) { container.getElementUml().getElements().add(asmElm); return true; } return false; } }
public class class_name { protected boolean tryToAddIntoContainer(IAsmElementUmlInteractive<?, ?, ?, ?> asmElm, int screenX, int screenY) { IAsmElementUmlInteractive<? extends ContainerFull<?>, ?, ?, ?> container = findContainerAtExcept(screenX, screenY, asmElm.getElementUml().getId()); if(container != null) { container.getElementUml().getElements().add(asmElm); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static base_responses add(nitro_service client, channel resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { channel addresources[] = new channel[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new channel(); addresources[i].id = resources[i].id; addresources[i].ifnum = resources[i].ifnum; addresources[i].state = resources[i].state; addresources[i].mode = resources[i].mode; addresources[i].conndistr = resources[i].conndistr; addresources[i].macdistr = resources[i].macdistr; addresources[i].lamac = resources[i].lamac; addresources[i].speed = resources[i].speed; addresources[i].flowctl = resources[i].flowctl; addresources[i].hamonitor = resources[i].hamonitor; addresources[i].tagall = resources[i].tagall; addresources[i].trunk = resources[i].trunk; addresources[i].ifalias = resources[i].ifalias; addresources[i].throughput = resources[i].throughput; addresources[i].bandwidthhigh = resources[i].bandwidthhigh; addresources[i].bandwidthnormal = resources[i].bandwidthnormal; } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { public static base_responses add(nitro_service client, channel resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { channel addresources[] = new channel[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new channel(); // depends on control dependency: [for], data = [i] addresources[i].id = resources[i].id; // depends on control dependency: [for], data = [i] addresources[i].ifnum = resources[i].ifnum; // depends on control dependency: [for], data = [i] addresources[i].state = resources[i].state; // depends on control dependency: [for], data = [i] addresources[i].mode = resources[i].mode; // depends on control dependency: [for], data = [i] addresources[i].conndistr = resources[i].conndistr; // depends on control dependency: [for], data = [i] addresources[i].macdistr = resources[i].macdistr; // depends on control dependency: [for], data = [i] addresources[i].lamac = resources[i].lamac; // depends on control dependency: [for], data = [i] addresources[i].speed = resources[i].speed; // depends on control dependency: [for], data = [i] addresources[i].flowctl = resources[i].flowctl; // depends on control dependency: [for], data = [i] addresources[i].hamonitor = resources[i].hamonitor; // depends on control dependency: [for], data = [i] addresources[i].tagall = resources[i].tagall; // depends on control dependency: [for], data = [i] addresources[i].trunk = resources[i].trunk; // depends on control dependency: [for], data = [i] addresources[i].ifalias = resources[i].ifalias; // depends on control dependency: [for], data = [i] addresources[i].throughput = resources[i].throughput; // depends on control dependency: [for], data = [i] addresources[i].bandwidthhigh = resources[i].bandwidthhigh; // depends on control dependency: [for], data = [i] addresources[i].bandwidthnormal = resources[i].bandwidthnormal; // depends on control dependency: [for], data = [i] } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { public GetIndexResponse getOrCreateIndex(String indexParam) { if(this.doesIndexExist(indexParam)) { return this.client.admin().indices().prepareGetIndex().get(); } else { CreateIndexRequestBuilder createIndexRequestBuilder = this.client.admin().indices().prepareCreate(indexParam); CreateIndexResponse mappingCreateResponse = createIndexRequestBuilder.execute().actionGet(); if(!mappingCreateResponse.isAcknowledged()) { throw new FluidElasticSearchException( "Index Creation for '"+ indexParam+"' not acknowledged by ElasticSearch."); } return this.client.admin().indices().prepareGetIndex().get(); } } }
public class class_name { public GetIndexResponse getOrCreateIndex(String indexParam) { if(this.doesIndexExist(indexParam)) { return this.client.admin().indices().prepareGetIndex().get(); // depends on control dependency: [if], data = [none] } else { CreateIndexRequestBuilder createIndexRequestBuilder = this.client.admin().indices().prepareCreate(indexParam); CreateIndexResponse mappingCreateResponse = createIndexRequestBuilder.execute().actionGet(); if(!mappingCreateResponse.isAcknowledged()) { throw new FluidElasticSearchException( "Index Creation for '"+ indexParam+"' not acknowledged by ElasticSearch."); } return this.client.admin().indices().prepareGetIndex().get(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setHighlighter(String highlighter) { try { m_highlighter = (I_CmsTermHighlighter)Class.forName(highlighter).newInstance(); } catch (Exception e) { m_highlighter = null; LOG.error(e.getLocalizedMessage(), e); } } }
public class class_name { public void setHighlighter(String highlighter) { try { m_highlighter = (I_CmsTermHighlighter)Class.forName(highlighter).newInstance(); // depends on control dependency: [try], data = [none] } catch (Exception e) { m_highlighter = null; LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void add(final Proposition proposition) { for (final Formula formula : proposition.formulas()) { this.add(formula, proposition); } } }
public class class_name { public void add(final Proposition proposition) { for (final Formula formula : proposition.formulas()) { this.add(formula, proposition); } // depends on control dependency: [for], data = [formula] } }
public class class_name { public void setRDNAttributes(List<Map<String, Object>> rdnAttrList) throws MissingInitPropertyException { int size = rdnAttrList.size(); // if size = 0, No RDN attributes defined. Same as RDN properties. if (size > 0) { iRDNAttrs = new String[size][]; iRDNObjectClass = new String[size][]; if (size == 1) { Map<String, Object> rdnAttr = rdnAttrList.get(0); String[] rdns = LdapHelper.getRDNs((String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME)); iRDNAttrs[0] = rdns; } else { int i = 0; for (Map<String, Object> rdnAttr : rdnAttrList) { String name = (String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME); String[] rdns = LdapHelper.getRDNs(name); iRDNAttrs[i] = rdns; String[] objCls = (String[]) rdnAttr.get(ConfigConstants.CONFIG_PROP_OBJECTCLASS); if (objCls == null) { throw new MissingInitPropertyException(WIMMessageKey.MISSING_INI_PROPERTY, Tr.formatMessage( tc, WIMMessageKey.MISSING_INI_PROPERTY, WIMMessageHelper.generateMsgParms(ConfigConstants.CONFIG_PROP_OBJECTCLASS))); } else { iRDNObjectClass[i] = objCls; } i++; } } } } }
public class class_name { public void setRDNAttributes(List<Map<String, Object>> rdnAttrList) throws MissingInitPropertyException { int size = rdnAttrList.size(); // if size = 0, No RDN attributes defined. Same as RDN properties. if (size > 0) { iRDNAttrs = new String[size][]; iRDNObjectClass = new String[size][]; if (size == 1) { Map<String, Object> rdnAttr = rdnAttrList.get(0); String[] rdns = LdapHelper.getRDNs((String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME)); iRDNAttrs[0] = rdns; // depends on control dependency: [if], data = [none] } else { int i = 0; for (Map<String, Object> rdnAttr : rdnAttrList) { String name = (String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME); String[] rdns = LdapHelper.getRDNs(name); iRDNAttrs[i] = rdns; // depends on control dependency: [for], data = [none] String[] objCls = (String[]) rdnAttr.get(ConfigConstants.CONFIG_PROP_OBJECTCLASS); if (objCls == null) { throw new MissingInitPropertyException(WIMMessageKey.MISSING_INI_PROPERTY, Tr.formatMessage( tc, WIMMessageKey.MISSING_INI_PROPERTY, WIMMessageHelper.generateMsgParms(ConfigConstants.CONFIG_PROP_OBJECTCLASS))); } else { iRDNObjectClass[i] = objCls; // depends on control dependency: [if], data = [none] } i++; // depends on control dependency: [for], data = [none] } } } } }
public class class_name { private PipelineDO modelToDo(Pipeline pipeline) { PipelineDO pipelineDO = new PipelineDO(); try { pipelineDO.setId(pipeline.getId()); pipelineDO.setName(pipeline.getName()); pipelineDO.setParameters(pipeline.getParameters()); pipelineDO.setDescription(pipeline.getDescription()); pipelineDO.setChannelId(pipeline.getChannelId()); pipelineDO.setGmtCreate(pipeline.getGmtCreate()); pipelineDO.setGmtModified(pipeline.getGmtModified()); } catch (Exception e) { logger.error("ERROR ## change the pipeline Model to Do has an exception"); throw new ManagerException(e); } return pipelineDO; } }
public class class_name { private PipelineDO modelToDo(Pipeline pipeline) { PipelineDO pipelineDO = new PipelineDO(); try { pipelineDO.setId(pipeline.getId()); // depends on control dependency: [try], data = [none] pipelineDO.setName(pipeline.getName()); // depends on control dependency: [try], data = [none] pipelineDO.setParameters(pipeline.getParameters()); // depends on control dependency: [try], data = [none] pipelineDO.setDescription(pipeline.getDescription()); // depends on control dependency: [try], data = [none] pipelineDO.setChannelId(pipeline.getChannelId()); // depends on control dependency: [try], data = [none] pipelineDO.setGmtCreate(pipeline.getGmtCreate()); // depends on control dependency: [try], data = [none] pipelineDO.setGmtModified(pipeline.getGmtModified()); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("ERROR ## change the pipeline Model to Do has an exception"); throw new ManagerException(e); } // depends on control dependency: [catch], data = [none] return pipelineDO; } }
public class class_name { public synchronized void addComponent(ComponentEvent event) { try { if(log.isDebugEnabled())log.debug("Component added "+event); Object o=event.getComponent(); ModelMBean mbean=ModelMBeanImpl.mbeanFor(o); if (mbean==null) log.warn("No MBean for "+o); else { ObjectName oName=null; if (mbean instanceof ModelMBeanImpl) { ((ModelMBeanImpl)mbean).setBaseObjectName(getObjectName().toString()); oName= getMBeanServer().registerMBean(mbean,null).getObjectName(); } else { oName=uniqueObjectName(getMBeanServer(), o, getObjectName().toString()); oName=getMBeanServer().registerMBean(mbean,oName) .getObjectName(); } Holder holder = new Holder(oName,mbean); _mbeanMap.put(o,holder); } } catch(Exception e) { log.warn(LogSupport.EXCEPTION,e); } } }
public class class_name { public synchronized void addComponent(ComponentEvent event) { try { if(log.isDebugEnabled())log.debug("Component added "+event); Object o=event.getComponent(); ModelMBean mbean=ModelMBeanImpl.mbeanFor(o); if (mbean==null) log.warn("No MBean for "+o); else { ObjectName oName=null; if (mbean instanceof ModelMBeanImpl) { ((ModelMBeanImpl)mbean).setBaseObjectName(getObjectName().toString()); // depends on control dependency: [if], data = [none] oName= getMBeanServer().registerMBean(mbean,null).getObjectName(); // depends on control dependency: [if], data = [none] } else { oName=uniqueObjectName(getMBeanServer(), o, getObjectName().toString()); // depends on control dependency: [if], data = [none] oName=getMBeanServer().registerMBean(mbean,oName) .getObjectName(); // depends on control dependency: [if], data = [none] } Holder holder = new Holder(oName,mbean); _mbeanMap.put(o,holder); // depends on control dependency: [if], data = [none] } } catch(Exception e) { log.warn(LogSupport.EXCEPTION,e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void execute(final ReplaceInList command) { referenceKeeper.cleanReferenceCache(); if (couldBeExecuted(command)) { executor.execute(command); } else { keepReferenceIfObservable(command.getValue()); } } }
public class class_name { @Override public void execute(final ReplaceInList command) { referenceKeeper.cleanReferenceCache(); if (couldBeExecuted(command)) { executor.execute(command); // depends on control dependency: [if], data = [none] } else { keepReferenceIfObservable(command.getValue()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void serviceChanged(ServiceEvent evt) { if (evt.getServiceReference() == logSR && evt.getType() == ServiceEvent.UNREGISTERING) { ungetLogService(); } } }
public class class_name { public void serviceChanged(ServiceEvent evt) { if (evt.getServiceReference() == logSR && evt.getType() == ServiceEvent.UNREGISTERING) { ungetLogService(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public HadoopJarStepConfig newInstallHiveStep(HiveVersion... hiveVersions) { if (hiveVersions.length > 0) { String[] versionStrings = new String[hiveVersions.length]; for (int i = 0; i < hiveVersions.length; i++) { versionStrings[i] = hiveVersions[i].toString(); } return newInstallHiveStep(versionStrings); } return newHivePigStep("hive", "--install-hive", "--hive-versions", "latest"); } }
public class class_name { public HadoopJarStepConfig newInstallHiveStep(HiveVersion... hiveVersions) { if (hiveVersions.length > 0) { String[] versionStrings = new String[hiveVersions.length]; for (int i = 0; i < hiveVersions.length; i++) { versionStrings[i] = hiveVersions[i].toString(); // depends on control dependency: [for], data = [i] } return newInstallHiveStep(versionStrings); // depends on control dependency: [if], data = [none] } return newHivePigStep("hive", "--install-hive", "--hive-versions", "latest"); } }
public class class_name { private void buildInstalledPackagesCache(Context context) { final List<PackageInfo> installedPackages = context.getPackageManager().getInstalledPackages(0); for (PackageInfo installedPackage : installedPackages) { addInstalledPackageToCache(installedPackage.packageName); } } }
public class class_name { private void buildInstalledPackagesCache(Context context) { final List<PackageInfo> installedPackages = context.getPackageManager().getInstalledPackages(0); for (PackageInfo installedPackage : installedPackages) { addInstalledPackageToCache(installedPackage.packageName); // depends on control dependency: [for], data = [installedPackage] } } }
public class class_name { public static EllipseRotated_F64 convert( EllipseQuadratic_F64 input , EllipseRotated_F64 output ) { if( output == null ) output = new EllipseRotated_F64(); double a11 = input.A; double a12 = input.B; double a22 = input.C; double b1 = 2*input.D; double b2 = 2*input.E; double c = input.F; output.center.x = (a22*b1-a12*b2)/(2*(a12*a12 - a11*a22)); output.center.y = (a11*b2-a12*b1)/(2*(a12*a12 - a11*a22)); double k1 = output.center.x; double k2 = output.center.y; double mu = 1.0/(a11*k1*k1 + 2*a12*k1*k2 + a22*k2*k2 - c); double m11 = mu*a11; double m12 = mu*a12; double m22 = mu*a22; double inner = Math.sqrt((m11-m22)*(m11-m22) + 4*m12*m12); double l1 = ((m11+m22) + inner)/2.0; double l2 = ((m11+m22) - inner)/2.0; output.b = 1/(double)Math.sqrt(l1); output.a = 1/(double)Math.sqrt(l2); // direction of minor axis double dx,dy; if( m11 >= m22 ) { dx = l1-m22; dy = m12; } else { dx = m12; dy = l1-m11; } // direction of major axis output.phi = Math.atan2(-dx,dy); if( output.phi < -GrlConstants.PId2 ) { output.phi += (double)Math.PI; } else if( output.phi > GrlConstants.PId2 ) { output.phi -= (double)Math.PI; } return output; } }
public class class_name { public static EllipseRotated_F64 convert( EllipseQuadratic_F64 input , EllipseRotated_F64 output ) { if( output == null ) output = new EllipseRotated_F64(); double a11 = input.A; double a12 = input.B; double a22 = input.C; double b1 = 2*input.D; double b2 = 2*input.E; double c = input.F; output.center.x = (a22*b1-a12*b2)/(2*(a12*a12 - a11*a22)); output.center.y = (a11*b2-a12*b1)/(2*(a12*a12 - a11*a22)); double k1 = output.center.x; double k2 = output.center.y; double mu = 1.0/(a11*k1*k1 + 2*a12*k1*k2 + a22*k2*k2 - c); double m11 = mu*a11; double m12 = mu*a12; double m22 = mu*a22; double inner = Math.sqrt((m11-m22)*(m11-m22) + 4*m12*m12); double l1 = ((m11+m22) + inner)/2.0; double l2 = ((m11+m22) - inner)/2.0; output.b = 1/(double)Math.sqrt(l1); output.a = 1/(double)Math.sqrt(l2); // direction of minor axis double dx,dy; if( m11 >= m22 ) { dx = l1-m22; // depends on control dependency: [if], data = [none] dy = m12; // depends on control dependency: [if], data = [none] } else { dx = m12; // depends on control dependency: [if], data = [none] dy = l1-m11; // depends on control dependency: [if], data = [none] } // direction of major axis output.phi = Math.atan2(-dx,dy); if( output.phi < -GrlConstants.PId2 ) { output.phi += (double)Math.PI; // depends on control dependency: [if], data = [none] } else if( output.phi > GrlConstants.PId2 ) { output.phi -= (double)Math.PI; // depends on control dependency: [if], data = [none] } return output; } }
public class class_name { public boolean setMenuTextForSwitchOff(XComponentContext xContext) { boolean ret = true; XMenuBar menubar = OfficeTools.getMenuBar(xContext); if (menubar == null) { MessageHandler.printToLogFile("Menubar is null"); return ret; } XPopupMenu toolsMenu = null; XPopupMenu ltMenu = null; short toolsId = 0; short ltId = 0; try { for (short i = 0; i < menubar.getItemCount(); i++) { toolsId = menubar.getItemId(i); String command = menubar.getCommand(toolsId); if(TOOLS_COMMAND.equals(command)) { toolsMenu = menubar.getPopupMenu(toolsId); break; } } if (toolsMenu == null) { MessageHandler.printToLogFile("Tools Menu is null"); return ret; } for (short i = 0; i < toolsMenu.getItemCount(); i++) { String command = toolsMenu.getCommand(toolsMenu.getItemId(i)); if(WORD_COUNT_COMMAND.equals(command)) { ltId = toolsMenu.getItemId((short) (i - 1)); ltMenu = toolsMenu.getPopupMenu(ltId); break; } } if (ltMenu == null) { MessageHandler.printToLogFile("LT Menu is null"); return ret; } short switchOffId = 0; for (short i = 0; i < ltMenu.getItemCount(); i++) { String command = ltMenu.getCommand(ltMenu.getItemId(i)); if(LT_SWITCH_OFF_COMMAND.equals(command)) { switchOffId = ltMenu.getItemId(i); break; } } if (switchOffId == 0) { MessageHandler.printToLogFile("switchOffId not found"); return ret; } boolean isSwitchOff = ltMenu.isItemChecked(switchOffId); if((switchOff && isSwitchOff) || (!switchOff && !isSwitchOff)) { ret = false; } ltMenu.setItemText(switchOffId, messages.getString("loMenuSwitchOff")); if(switchOff) { ltMenu.checkItem(switchOffId, true); } else { ltMenu.checkItem(switchOffId, false); } } catch (Throwable t) { MessageHandler.printException(t); } toolsMenu.setPopupMenu(ltId, ltMenu); menubar.setPopupMenu(toolsId, toolsMenu); return ret; } }
public class class_name { public boolean setMenuTextForSwitchOff(XComponentContext xContext) { boolean ret = true; XMenuBar menubar = OfficeTools.getMenuBar(xContext); if (menubar == null) { MessageHandler.printToLogFile("Menubar is null"); // depends on control dependency: [if], data = [none] return ret; // depends on control dependency: [if], data = [none] } XPopupMenu toolsMenu = null; XPopupMenu ltMenu = null; short toolsId = 0; short ltId = 0; try { for (short i = 0; i < menubar.getItemCount(); i++) { toolsId = menubar.getItemId(i); // depends on control dependency: [for], data = [i] String command = menubar.getCommand(toolsId); if(TOOLS_COMMAND.equals(command)) { toolsMenu = menubar.getPopupMenu(toolsId); // depends on control dependency: [if], data = [none] break; } } if (toolsMenu == null) { MessageHandler.printToLogFile("Tools Menu is null"); // depends on control dependency: [if], data = [none] return ret; // depends on control dependency: [if], data = [none] } for (short i = 0; i < toolsMenu.getItemCount(); i++) { String command = toolsMenu.getCommand(toolsMenu.getItemId(i)); if(WORD_COUNT_COMMAND.equals(command)) { ltId = toolsMenu.getItemId((short) (i - 1)); // depends on control dependency: [if], data = [none] ltMenu = toolsMenu.getPopupMenu(ltId); // depends on control dependency: [if], data = [none] break; } } if (ltMenu == null) { MessageHandler.printToLogFile("LT Menu is null"); // depends on control dependency: [if], data = [none] return ret; // depends on control dependency: [if], data = [none] } short switchOffId = 0; for (short i = 0; i < ltMenu.getItemCount(); i++) { String command = ltMenu.getCommand(ltMenu.getItemId(i)); if(LT_SWITCH_OFF_COMMAND.equals(command)) { switchOffId = ltMenu.getItemId(i); // depends on control dependency: [if], data = [none] break; } } if (switchOffId == 0) { MessageHandler.printToLogFile("switchOffId not found"); // depends on control dependency: [if], data = [none] return ret; // depends on control dependency: [if], data = [none] } boolean isSwitchOff = ltMenu.isItemChecked(switchOffId); if((switchOff && isSwitchOff) || (!switchOff && !isSwitchOff)) { ret = false; // depends on control dependency: [if], data = [none] } ltMenu.setItemText(switchOffId, messages.getString("loMenuSwitchOff")); // depends on control dependency: [try], data = [none] if(switchOff) { ltMenu.checkItem(switchOffId, true); // depends on control dependency: [if], data = [none] } else { ltMenu.checkItem(switchOffId, false); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { MessageHandler.printException(t); } // depends on control dependency: [catch], data = [none] toolsMenu.setPopupMenu(ltId, ltMenu); menubar.setPopupMenu(toolsId, toolsMenu); return ret; } }
public class class_name { public void update(long a0, long a1, long a2, long a3) { if (done) { throw new IllegalStateException("Can compute a hash only once per instance"); } v1[0] += mul0[0] + a0; v1[1] += mul0[1] + a1; v1[2] += mul0[2] + a2; v1[3] += mul0[3] + a3; for (int i = 0; i < 4; ++i) { mul0[i] ^= (v1[i] & 0xffffffffL) * (v0[i] >>> 32); v0[i] += mul1[i]; mul1[i] ^= (v0[i] & 0xffffffffL) * (v1[i] >>> 32); } v0[0] += zipperMerge0(v1[1], v1[0]); v0[1] += zipperMerge1(v1[1], v1[0]); v0[2] += zipperMerge0(v1[3], v1[2]); v0[3] += zipperMerge1(v1[3], v1[2]); v1[0] += zipperMerge0(v0[1], v0[0]); v1[1] += zipperMerge1(v0[1], v0[0]); v1[2] += zipperMerge0(v0[3], v0[2]); v1[3] += zipperMerge1(v0[3], v0[2]); } }
public class class_name { public void update(long a0, long a1, long a2, long a3) { if (done) { throw new IllegalStateException("Can compute a hash only once per instance"); } v1[0] += mul0[0] + a0; v1[1] += mul0[1] + a1; v1[2] += mul0[2] + a2; v1[3] += mul0[3] + a3; for (int i = 0; i < 4; ++i) { mul0[i] ^= (v1[i] & 0xffffffffL) * (v0[i] >>> 32); // depends on control dependency: [for], data = [i] v0[i] += mul1[i]; // depends on control dependency: [for], data = [i] mul1[i] ^= (v0[i] & 0xffffffffL) * (v1[i] >>> 32); // depends on control dependency: [for], data = [i] } v0[0] += zipperMerge0(v1[1], v1[0]); v0[1] += zipperMerge1(v1[1], v1[0]); v0[2] += zipperMerge0(v1[3], v1[2]); v0[3] += zipperMerge1(v1[3], v1[2]); v1[0] += zipperMerge0(v0[1], v0[0]); v1[1] += zipperMerge1(v0[1], v0[0]); v1[2] += zipperMerge0(v0[3], v0[2]); v1[3] += zipperMerge1(v0[3], v0[2]); } }
public class class_name { public void onDrawFrame(float frameTime) { final GVRSceneObject owner = getOwnerObject(); if (owner == null) { return; } final int size = mRanges.size(); final GVRTransform t = getGVRContext().getMainScene().getMainCameraRig().getCenterCamera().getTransform(); for (final Object[] range : mRanges) { ((GVRSceneObject)range[1]).setEnable(false); } for (int i = size - 1; i >= 0; --i) { final Object[] range = mRanges.get(i); final GVRSceneObject child = (GVRSceneObject) range[1]; if (child.getParent() != owner) { Log.w(TAG, "the scene object for distance greater than " + range[0] + " is not a child of the owner; skipping it"); continue; } final float[] values = child.getBoundingVolumeRawValues(); mCenter.set(values[0], values[1], values[2], 1.0f); mVector.set(t.getPositionX(), t.getPositionY(), t.getPositionZ(), 1.0f); mVector.sub(mCenter); mVector.negate(); float distance = mVector.dot(mVector); if (distance >= (Float) range[0]) { child.setEnable(true); break; } } } }
public class class_name { public void onDrawFrame(float frameTime) { final GVRSceneObject owner = getOwnerObject(); if (owner == null) { return; // depends on control dependency: [if], data = [none] } final int size = mRanges.size(); final GVRTransform t = getGVRContext().getMainScene().getMainCameraRig().getCenterCamera().getTransform(); for (final Object[] range : mRanges) { ((GVRSceneObject)range[1]).setEnable(false); // depends on control dependency: [for], data = [range] } for (int i = size - 1; i >= 0; --i) { final Object[] range = mRanges.get(i); final GVRSceneObject child = (GVRSceneObject) range[1]; if (child.getParent() != owner) { Log.w(TAG, "the scene object for distance greater than " + range[0] + " is not a child of the owner; skipping it"); // depends on control dependency: [if], data = [none] continue; } final float[] values = child.getBoundingVolumeRawValues(); mCenter.set(values[0], values[1], values[2], 1.0f); // depends on control dependency: [for], data = [none] mVector.set(t.getPositionX(), t.getPositionY(), t.getPositionZ(), 1.0f); // depends on control dependency: [for], data = [none] mVector.sub(mCenter); // depends on control dependency: [for], data = [none] mVector.negate(); // depends on control dependency: [for], data = [none] float distance = mVector.dot(mVector); if (distance >= (Float) range[0]) { child.setEnable(true); // depends on control dependency: [if], data = [none] break; } } } }
public class class_name { public double evaluateClustering(Database db, Relation<? extends NumberVector> rel, Clustering<?> c) { boolean square = !distance.isSquared(); int ignorednoise = 0; List<? extends Cluster<?>> clusters = c.getAllClusters(); double ssq = 0, sum = 0; for(Cluster<?> cluster : clusters) { if(cluster.size() <= 1 || cluster.isNoise()) { switch(noiseOption){ case IGNORE_NOISE: ignorednoise += cluster.size(); continue; case TREAT_NOISE_AS_SINGLETONS: continue; case MERGE_NOISE: break; // Treat as cluster below: } } NumberVector center = ModelUtil.getPrototypeOrCentroid(cluster.getModel(), rel, cluster.getIDs()); for(DBIDIter it1 = cluster.getIDs().iter(); it1.valid(); it1.advance()) { final double d = distance.distance(center, rel.get(it1)); sum += d; ssq += square ? d * d : d; } } final int div = Math.max(1, rel.size() - ignorednoise); if(LOG.isStatistics()) { LOG.statistics(new DoubleStatistic(key + ".mean", sum / div)); LOG.statistics(new DoubleStatistic(key + ".ssq", ssq)); LOG.statistics(new DoubleStatistic(key + ".rmsd", FastMath.sqrt(ssq / div))); } EvaluationResult ev = EvaluationResult.findOrCreate(db.getHierarchy(), c, "Internal Clustering Evaluation", "internal evaluation"); MeasurementGroup g = ev.findOrCreateGroup("Distance-based Evaluation"); g.addMeasure("Mean distance", sum / div, 0., Double.POSITIVE_INFINITY, true); g.addMeasure("Sum of Squares", ssq, 0., Double.POSITIVE_INFINITY, true); g.addMeasure("RMSD", FastMath.sqrt(ssq / div), 0., Double.POSITIVE_INFINITY, true); db.getHierarchy().add(c, ev); return ssq; } }
public class class_name { public double evaluateClustering(Database db, Relation<? extends NumberVector> rel, Clustering<?> c) { boolean square = !distance.isSquared(); int ignorednoise = 0; List<? extends Cluster<?>> clusters = c.getAllClusters(); double ssq = 0, sum = 0; for(Cluster<?> cluster : clusters) { if(cluster.size() <= 1 || cluster.isNoise()) { switch(noiseOption){ case IGNORE_NOISE: ignorednoise += cluster.size(); continue; case TREAT_NOISE_AS_SINGLETONS: continue; case MERGE_NOISE: break; // Treat as cluster below: } } NumberVector center = ModelUtil.getPrototypeOrCentroid(cluster.getModel(), rel, cluster.getIDs()); for(DBIDIter it1 = cluster.getIDs().iter(); it1.valid(); it1.advance()) { final double d = distance.distance(center, rel.get(it1)); sum += d; // depends on control dependency: [for], data = [none] ssq += square ? d * d : d; // depends on control dependency: [for], data = [none] } } final int div = Math.max(1, rel.size() - ignorednoise); if(LOG.isStatistics()) { LOG.statistics(new DoubleStatistic(key + ".mean", sum / div)); // depends on control dependency: [if], data = [none] LOG.statistics(new DoubleStatistic(key + ".ssq", ssq)); // depends on control dependency: [if], data = [none] LOG.statistics(new DoubleStatistic(key + ".rmsd", FastMath.sqrt(ssq / div))); // depends on control dependency: [if], data = [none] } EvaluationResult ev = EvaluationResult.findOrCreate(db.getHierarchy(), c, "Internal Clustering Evaluation", "internal evaluation"); MeasurementGroup g = ev.findOrCreateGroup("Distance-based Evaluation"); g.addMeasure("Mean distance", sum / div, 0., Double.POSITIVE_INFINITY, true); g.addMeasure("Sum of Squares", ssq, 0., Double.POSITIVE_INFINITY, true); g.addMeasure("RMSD", FastMath.sqrt(ssq / div), 0., Double.POSITIVE_INFINITY, true); db.getHierarchy().add(c, ev); return ssq; } }
public class class_name { private void loadSomeKeys(final HashSet<IndexScopedKey> keysCollector, final Set<IndexScopedKey> keysToExclude, final int maxElements) { if (maxElements <= 0) { return; } int collectedKeys = 0; try { //First we collect the (single) FileListCacheKey String[] listAll = directory.listAll(); if (listAll.length != 0) { FileListCacheKey rootKey = new FileListCacheKey(indexName, affinitySegmentId); if (keysToExclude == null || !keysToExclude.contains(rootKey)) { //unless it was excluded if (keysCollector.add(rootKey)) { //unless it was already collected collectedKeys++; } } } //Now we collect first all FileCacheKey (keys for file metadata) for (String fileName : listAll) { if (collectedKeys >= maxElements) return; FileCacheKey key = new FileCacheKey(indexName, fileName, affinitySegmentId); if (keysToExclude == null || !keysToExclude.contains(key)) { if (keysCollector.add(key)) { if (++collectedKeys >= maxElements) return; } } } //Next we load the ChunkCacheKey (keys for file contents) for (String fileName : listAll) { int numChunksInt = figureChunksNumber(fileName); for (int i = 0; i < numChunksInt; i++) { //Inner loop: we actually have several Chunks per file name ChunkCacheKey key = new ChunkCacheKey(indexName, fileName, i, autoChunkSize, affinitySegmentId); if (keysToExclude == null || !keysToExclude.contains(key)) { if (keysCollector.add(key)) { if (++collectedKeys >= maxElements) return; } } } } } catch (IOException e) { throw log.exceptionInCacheLoader(e); } } }
public class class_name { private void loadSomeKeys(final HashSet<IndexScopedKey> keysCollector, final Set<IndexScopedKey> keysToExclude, final int maxElements) { if (maxElements <= 0) { return; // depends on control dependency: [if], data = [none] } int collectedKeys = 0; try { //First we collect the (single) FileListCacheKey String[] listAll = directory.listAll(); if (listAll.length != 0) { FileListCacheKey rootKey = new FileListCacheKey(indexName, affinitySegmentId); if (keysToExclude == null || !keysToExclude.contains(rootKey)) { //unless it was excluded if (keysCollector.add(rootKey)) { //unless it was already collected collectedKeys++; // depends on control dependency: [if], data = [none] } } } //Now we collect first all FileCacheKey (keys for file metadata) for (String fileName : listAll) { if (collectedKeys >= maxElements) return; FileCacheKey key = new FileCacheKey(indexName, fileName, affinitySegmentId); if (keysToExclude == null || !keysToExclude.contains(key)) { if (keysCollector.add(key)) { if (++collectedKeys >= maxElements) return; } } } //Next we load the ChunkCacheKey (keys for file contents) for (String fileName : listAll) { int numChunksInt = figureChunksNumber(fileName); for (int i = 0; i < numChunksInt; i++) { //Inner loop: we actually have several Chunks per file name ChunkCacheKey key = new ChunkCacheKey(indexName, fileName, i, autoChunkSize, affinitySegmentId); if (keysToExclude == null || !keysToExclude.contains(key)) { if (keysCollector.add(key)) { if (++collectedKeys >= maxElements) return; } } } } } catch (IOException e) { throw log.exceptionInCacheLoader(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void close(final InputSource input) throws IOException { if (input != null) { final InputStream i = input.getByteStream(); if (i != null) { i.close(); } else { final Reader w = input.getCharacterStream(); if (w != null) { w.close(); } } } } }
public class class_name { public static void close(final InputSource input) throws IOException { if (input != null) { final InputStream i = input.getByteStream(); if (i != null) { i.close(); } else { final Reader w = input.getCharacterStream(); if (w != null) { w.close(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static int addAtomicToItemList(final INodeReadTrx pRtx, final AtomicValue pVal) { if (!atomics.containsKey(pRtx)) { atomics.put(pRtx, new ItemList()); } return atomics.get(pRtx).addItem(pVal); } }
public class class_name { public static int addAtomicToItemList(final INodeReadTrx pRtx, final AtomicValue pVal) { if (!atomics.containsKey(pRtx)) { atomics.put(pRtx, new ItemList()); // depends on control dependency: [if], data = [none] } return atomics.get(pRtx).addItem(pVal); } }
public class class_name { private void iterations() { int iterationCount = 0; while ((clusteringStrategy.getTerminationCondition() != null && !clusteringStrategy.getTerminationCondition().isSatisfied(iterationHistory)) || iterationHistory.getMostRecentIterationInfo().isStrategyApplied()) { currentIteration++; removePoints(); classifyPoints(); applyClusteringStrategy(); log.trace("Completed clustering iteration {}", ++iterationCount); } } }
public class class_name { private void iterations() { int iterationCount = 0; while ((clusteringStrategy.getTerminationCondition() != null && !clusteringStrategy.getTerminationCondition().isSatisfied(iterationHistory)) || iterationHistory.getMostRecentIterationInfo().isStrategyApplied()) { currentIteration++; // depends on control dependency: [while], data = [none] removePoints(); // depends on control dependency: [while], data = [none] classifyPoints(); // depends on control dependency: [while], data = [none] applyClusteringStrategy(); // depends on control dependency: [while], data = [none] log.trace("Completed clustering iteration {}", ++iterationCount); // depends on control dependency: [while], data = [none] } } }
public class class_name { public static Map<String,Object> getAggregationMetrics(Map<String,?> map ,String metrics ){ if(map != null){ return (Map<String,Object>)map.get(metrics); } return (Map<String,Object>)null; } }
public class class_name { public static Map<String,Object> getAggregationMetrics(Map<String,?> map ,String metrics ){ if(map != null){ return (Map<String,Object>)map.get(metrics); // depends on control dependency: [if], data = [none] } return (Map<String,Object>)null; } }
public class class_name { public PoolGetAllLifetimeStatisticsOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; } else { this.ocpDate = new DateTimeRfc1123(ocpDate); } return this; } }
public class class_name { public PoolGetAllLifetimeStatisticsOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; // depends on control dependency: [if], data = [none] } else { this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate] } return this; } }
public class class_name { public static Integer[] sequence(final Integer from, final Integer to, final Integer step) { Validate.notNull(from, "Value to start the sequence from cannot be null"); Validate.notNull(to, "Value to generate the sequence up to cannot be null"); Validate.notNull(step, "Step to generate the sequence cannot be null"); final int iFrom = from.intValue(); final int iTo = to.intValue(); final int iStep = step.intValue(); if (iFrom == iTo) { return new Integer[] {Integer.valueOf(iFrom)}; } if (iStep == 0) { // with iStep == 0, this would only be valid if iFrom == iTo, which it isn't - the rest are impossible throw new IllegalArgumentException("Cannot create sequence from " + iFrom + " to " + iTo + " with step " + iStep); } final List<Integer> values = new ArrayList<Integer>(10); if (iFrom < iTo && iStep > 0) { int i = iFrom; while (i <= iTo) { values.add(Integer.valueOf(i)); i += iStep; } } else if (iFrom > iTo && iStep < 0){ // iFrom > iTo int i = iFrom; while (i >= iTo) { values.add(Integer.valueOf(i)); i += iStep; } } return values.toArray(new Integer[values.size()]); } }
public class class_name { public static Integer[] sequence(final Integer from, final Integer to, final Integer step) { Validate.notNull(from, "Value to start the sequence from cannot be null"); Validate.notNull(to, "Value to generate the sequence up to cannot be null"); Validate.notNull(step, "Step to generate the sequence cannot be null"); final int iFrom = from.intValue(); final int iTo = to.intValue(); final int iStep = step.intValue(); if (iFrom == iTo) { return new Integer[] {Integer.valueOf(iFrom)}; // depends on control dependency: [if], data = [(iFrom] } if (iStep == 0) { // with iStep == 0, this would only be valid if iFrom == iTo, which it isn't - the rest are impossible throw new IllegalArgumentException("Cannot create sequence from " + iFrom + " to " + iTo + " with step " + iStep); } final List<Integer> values = new ArrayList<Integer>(10); if (iFrom < iTo && iStep > 0) { int i = iFrom; while (i <= iTo) { values.add(Integer.valueOf(i)); // depends on control dependency: [while], data = [(i] i += iStep; // depends on control dependency: [while], data = [none] } } else if (iFrom > iTo && iStep < 0){ // iFrom > iTo int i = iFrom; while (i >= iTo) { values.add(Integer.valueOf(i)); // depends on control dependency: [while], data = [(i] i += iStep; // depends on control dependency: [while], data = [none] } } return values.toArray(new Integer[values.size()]); } }
public class class_name { public boolean skipSpaces() throws IOException { // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { load(0, true); } // skip spaces int c = fCurrentEntity.ch[fCurrentEntity.position]; if (XMLChar.isSpace(c)) { boolean external = fCurrentEntity.isExternal(); do { boolean entityChanged = false; // handle newlines if (c == '\n' || (external && c == '\r')) { fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count - 1) { fCurrentEntity.ch[0] = (char)c; entityChanged = load(1, true); if (!entityChanged) // the load change the position to be 1, // need to restore it when entity not changed fCurrentEntity.position = 0; } if (c == '\r' && external) { // REVISIT: Does this need to be updated to fix the // #x0D ^#x0A newline normalization problem? -Ac if (fCurrentEntity.ch[++fCurrentEntity.position] != '\n') { fCurrentEntity.position--; } } /*** NEWLINE NORMALIZATION *** else { if (fCurrentEntity.ch[fCurrentEntity.position + 1] == '\r' && external) { fCurrentEntity.position++; } } /***/ } else { fCurrentEntity.columnNumber++; } // load more characters, if needed if (!entityChanged) fCurrentEntity.position++; if (fCurrentEntity.position == fCurrentEntity.count) { load(0, true); } } while (XMLChar.isSpace(c = fCurrentEntity.ch[fCurrentEntity.position])); return true; } // no spaces were found return false; } }
public class class_name { public boolean skipSpaces() throws IOException { // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { load(0, true); } // skip spaces int c = fCurrentEntity.ch[fCurrentEntity.position]; if (XMLChar.isSpace(c)) { boolean external = fCurrentEntity.isExternal(); do { boolean entityChanged = false; // handle newlines if (c == '\n' || (external && c == '\r')) { fCurrentEntity.lineNumber++; // depends on control dependency: [if], data = [none] fCurrentEntity.columnNumber = 1; // depends on control dependency: [if], data = [none] if (fCurrentEntity.position == fCurrentEntity.count - 1) { fCurrentEntity.ch[0] = (char)c; // depends on control dependency: [if], data = [none] entityChanged = load(1, true); // depends on control dependency: [if], data = [none] if (!entityChanged) // the load change the position to be 1, // need to restore it when entity not changed fCurrentEntity.position = 0; } if (c == '\r' && external) { // REVISIT: Does this need to be updated to fix the // #x0D ^#x0A newline normalization problem? -Ac if (fCurrentEntity.ch[++fCurrentEntity.position] != '\n') { fCurrentEntity.position--; // depends on control dependency: [if], data = [none] } } /*** NEWLINE NORMALIZATION *** else { if (fCurrentEntity.ch[fCurrentEntity.position + 1] == '\r' && external) { fCurrentEntity.position++; } } /***/ } else { fCurrentEntity.columnNumber++; // depends on control dependency: [if], data = [none] } // load more characters, if needed if (!entityChanged) fCurrentEntity.position++; if (fCurrentEntity.position == fCurrentEntity.count) { load(0, true); // depends on control dependency: [if], data = [none] } } while (XMLChar.isSpace(c = fCurrentEntity.ch[fCurrentEntity.position])); return true; } // no spaces were found return false; } }
public class class_name { public static void printResult(Number[][] m1, PrintStream out) { if (out == null) { return; } for (int i = 0; i < m1.length; i++) { for (int j = 0; j < m1[0].length; j++) { out.print(" " + m1[i][j]); } out.println(""); } } }
public class class_name { public static void printResult(Number[][] m1, PrintStream out) { if (out == null) { return; // depends on control dependency: [if], data = [none] } for (int i = 0; i < m1.length; i++) { for (int j = 0; j < m1[0].length; j++) { out.print(" " + m1[i][j]); // depends on control dependency: [for], data = [j] } out.println(""); // depends on control dependency: [for], data = [none] } } }
public class class_name { private void returnAcceleration(Buffer buffer) { Callback<Acceleration> callback = getFirstCallback(BeanMessageID.CC_ACCEL_READ); if (callback != null) { callback.onResult(Acceleration.fromPayload(buffer)); } } }
public class class_name { private void returnAcceleration(Buffer buffer) { Callback<Acceleration> callback = getFirstCallback(BeanMessageID.CC_ACCEL_READ); if (callback != null) { callback.onResult(Acceleration.fromPayload(buffer)); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void checkSrcPath(Configuration conf, List<Path> srcPaths ) throws IOException { List<IOException> rslt = new ArrayList<IOException>(); List<Path> unglobbed = new LinkedList<Path>(); for (Path p : srcPaths) { FileSystem fs = p.getFileSystem(conf); FileStatus[] inputs = fs.globStatus(p); if(inputs != null && inputs.length > 0) { for (FileStatus onePath: inputs) { unglobbed.add(onePath.getPath()); } } else { rslt.add(new IOException("Input source " + p + " does not exist.")); } } if (!rslt.isEmpty()) { throw new InvalidInputException(rslt); } srcPaths.clear(); srcPaths.addAll(unglobbed); } }
public class class_name { private static void checkSrcPath(Configuration conf, List<Path> srcPaths ) throws IOException { List<IOException> rslt = new ArrayList<IOException>(); List<Path> unglobbed = new LinkedList<Path>(); for (Path p : srcPaths) { FileSystem fs = p.getFileSystem(conf); FileStatus[] inputs = fs.globStatus(p); if(inputs != null && inputs.length > 0) { for (FileStatus onePath: inputs) { unglobbed.add(onePath.getPath()); // depends on control dependency: [for], data = [onePath] } } else { rslt.add(new IOException("Input source " + p + " does not exist.")); // depends on control dependency: [if], data = [none] } } if (!rslt.isEmpty()) { throw new InvalidInputException(rslt); } srcPaths.clear(); srcPaths.addAll(unglobbed); } }
public class class_name { public static String getOptionalStringParam(JSONObject params, String paramName) { if (params.containsKey(paramName)) { return params.getString(paramName); } return null; } }
public class class_name { public static String getOptionalStringParam(JSONObject params, String paramName) { if (params.containsKey(paramName)) { return params.getString(paramName); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public SufficientStatistics getNewSufficientStatistics() { List<SufficientStatistics> lexiconParameterList = Lists.newArrayList(); List<String> lexiconParameterNames = Lists.newArrayList(); for (int i = 0; i < lexiconFamilies.size(); i++) { ParametricCcgLexicon lexiconFamily = lexiconFamilies.get(i); lexiconParameterList.add(lexiconFamily.getNewSufficientStatistics()); lexiconParameterNames.add(Integer.toString(i)); } SufficientStatistics lexiconParameters = new ListSufficientStatistics( lexiconParameterNames, lexiconParameterList); List<SufficientStatistics> lexiconScorerParameterList = Lists.newArrayList(); List<String> lexiconScorerParameterNames = Lists.newArrayList(); for (int i = 0; i < lexiconScorerFamilies.size(); i++) { ParametricLexiconScorer lexiconScorerFamily = lexiconScorerFamilies.get(i); lexiconScorerParameterList.add(lexiconScorerFamily.getNewSufficientStatistics()); lexiconScorerParameterNames.add(Integer.toString(i)); } SufficientStatistics lexiconScorerParameters = new ListSufficientStatistics( lexiconScorerParameterNames, lexiconScorerParameterList); SufficientStatistics wordSkipParameters = ListSufficientStatistics.empty(); if (wordSkipFamily != null) { wordSkipParameters = wordSkipFamily.getNewSufficientStatistics(); } SufficientStatistics dependencyParameters = dependencyFamily.getNewSufficientStatistics(); SufficientStatistics wordDistanceParameters = wordDistanceFamily.getNewSufficientStatistics(); SufficientStatistics puncDistanceParameters = puncDistanceFamily.getNewSufficientStatistics(); SufficientStatistics verbDistanceParameters = verbDistanceFamily.getNewSufficientStatistics(); SufficientStatistics syntaxParameters = syntaxFamily.getNewSufficientStatistics(); SufficientStatistics unaryRuleParameters = unaryRuleFamily.getNewSufficientStatistics(); SufficientStatistics headedBinaryRuleParameters = headedBinaryRuleFamily.getNewSufficientStatistics(); SufficientStatistics rootSyntaxParameters = rootSyntaxFamily.getNewSufficientStatistics(); SufficientStatistics headedRootSyntaxParameters = headedRootSyntaxFamily.getNewSufficientStatistics(); return new ListSufficientStatistics(STATISTIC_NAME_LIST, Arrays.asList(lexiconParameters, lexiconScorerParameters, wordSkipParameters, dependencyParameters, wordDistanceParameters, puncDistanceParameters, verbDistanceParameters, syntaxParameters, unaryRuleParameters, headedBinaryRuleParameters, rootSyntaxParameters, headedRootSyntaxParameters)); } }
public class class_name { @Override public SufficientStatistics getNewSufficientStatistics() { List<SufficientStatistics> lexiconParameterList = Lists.newArrayList(); List<String> lexiconParameterNames = Lists.newArrayList(); for (int i = 0; i < lexiconFamilies.size(); i++) { ParametricCcgLexicon lexiconFamily = lexiconFamilies.get(i); lexiconParameterList.add(lexiconFamily.getNewSufficientStatistics()); // depends on control dependency: [for], data = [none] lexiconParameterNames.add(Integer.toString(i)); // depends on control dependency: [for], data = [i] } SufficientStatistics lexiconParameters = new ListSufficientStatistics( lexiconParameterNames, lexiconParameterList); List<SufficientStatistics> lexiconScorerParameterList = Lists.newArrayList(); List<String> lexiconScorerParameterNames = Lists.newArrayList(); for (int i = 0; i < lexiconScorerFamilies.size(); i++) { ParametricLexiconScorer lexiconScorerFamily = lexiconScorerFamilies.get(i); lexiconScorerParameterList.add(lexiconScorerFamily.getNewSufficientStatistics()); // depends on control dependency: [for], data = [none] lexiconScorerParameterNames.add(Integer.toString(i)); // depends on control dependency: [for], data = [i] } SufficientStatistics lexiconScorerParameters = new ListSufficientStatistics( lexiconScorerParameterNames, lexiconScorerParameterList); SufficientStatistics wordSkipParameters = ListSufficientStatistics.empty(); if (wordSkipFamily != null) { wordSkipParameters = wordSkipFamily.getNewSufficientStatistics(); // depends on control dependency: [if], data = [none] } SufficientStatistics dependencyParameters = dependencyFamily.getNewSufficientStatistics(); SufficientStatistics wordDistanceParameters = wordDistanceFamily.getNewSufficientStatistics(); SufficientStatistics puncDistanceParameters = puncDistanceFamily.getNewSufficientStatistics(); SufficientStatistics verbDistanceParameters = verbDistanceFamily.getNewSufficientStatistics(); SufficientStatistics syntaxParameters = syntaxFamily.getNewSufficientStatistics(); SufficientStatistics unaryRuleParameters = unaryRuleFamily.getNewSufficientStatistics(); SufficientStatistics headedBinaryRuleParameters = headedBinaryRuleFamily.getNewSufficientStatistics(); SufficientStatistics rootSyntaxParameters = rootSyntaxFamily.getNewSufficientStatistics(); SufficientStatistics headedRootSyntaxParameters = headedRootSyntaxFamily.getNewSufficientStatistics(); return new ListSufficientStatistics(STATISTIC_NAME_LIST, Arrays.asList(lexiconParameters, lexiconScorerParameters, wordSkipParameters, dependencyParameters, wordDistanceParameters, puncDistanceParameters, verbDistanceParameters, syntaxParameters, unaryRuleParameters, headedBinaryRuleParameters, rootSyntaxParameters, headedRootSyntaxParameters)); } }
public class class_name { public ValidateFieldResult<String> validateAndConvert (String string) { ValidateFieldResult<String> result = new ValidateFieldResult<>(string); try { if (string.length() != 6) { result.errors.add(NewGTFSError.forFeed(NewGTFSErrorType.COLOR_FORMAT, string)); } int integer = Integer.parseInt(string, 16); return result; // Could also store the integer. } catch (Exception ex) { throw new StorageException(NewGTFSErrorType.COLOR_FORMAT, string); } } }
public class class_name { public ValidateFieldResult<String> validateAndConvert (String string) { ValidateFieldResult<String> result = new ValidateFieldResult<>(string); try { if (string.length() != 6) { result.errors.add(NewGTFSError.forFeed(NewGTFSErrorType.COLOR_FORMAT, string)); // depends on control dependency: [if], data = [none] } int integer = Integer.parseInt(string, 16); return result; // Could also store the integer. // depends on control dependency: [try], data = [none] } catch (Exception ex) { throw new StorageException(NewGTFSErrorType.COLOR_FORMAT, string); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public short[] extractUByteArray() { byte[] bytes = devicedataDAO.extractByteArray(this); short[] shorts = new short[bytes.length]; for (int i=0 ; i<bytes.length ; i++) { shorts[i] = (short) (bytes[i] & 0xff); } return shorts; } }
public class class_name { public short[] extractUByteArray() { byte[] bytes = devicedataDAO.extractByteArray(this); short[] shorts = new short[bytes.length]; for (int i=0 ; i<bytes.length ; i++) { shorts[i] = (short) (bytes[i] & 0xff); // depends on control dependency: [for], data = [i] } return shorts; } }
public class class_name { @Override @Pure protected Rectangle2d calcBounds() { if (getPointCount() == 0) { return null; } final Iterator<Point2d> iterPoints = points().iterator(); if (!iterPoints.hasNext()) { return null; } Point2d point = iterPoints.next(); if (point == null) { return null; } double minx = point.getX(); double maxx = point.getX(); double miny = point.getY(); double maxy = point.getY(); while (iterPoints.hasNext()) { point = iterPoints.next(); if (point != null) { final double x = point.getX(); final double y = point.getY(); if (x < minx) { minx = x; } if (y < miny) { miny = y; } if (x > maxx) { maxx = x; } if (y > maxy) { maxy = y; } } } final Rectangle2d r = new Rectangle2d(); r.setFromCorners(minx, miny, maxx, maxy); return r; } }
public class class_name { @Override @Pure protected Rectangle2d calcBounds() { if (getPointCount() == 0) { return null; // depends on control dependency: [if], data = [none] } final Iterator<Point2d> iterPoints = points().iterator(); if (!iterPoints.hasNext()) { return null; // depends on control dependency: [if], data = [none] } Point2d point = iterPoints.next(); if (point == null) { return null; // depends on control dependency: [if], data = [none] } double minx = point.getX(); double maxx = point.getX(); double miny = point.getY(); double maxy = point.getY(); while (iterPoints.hasNext()) { point = iterPoints.next(); // depends on control dependency: [while], data = [none] if (point != null) { final double x = point.getX(); final double y = point.getY(); if (x < minx) { minx = x; // depends on control dependency: [if], data = [none] } if (y < miny) { miny = y; // depends on control dependency: [if], data = [none] } if (x > maxx) { maxx = x; // depends on control dependency: [if], data = [none] } if (y > maxy) { maxy = y; // depends on control dependency: [if], data = [none] } } } final Rectangle2d r = new Rectangle2d(); r.setFromCorners(minx, miny, maxx, maxy); return r; } }
public class class_name { private static void copyFunctions(FunctionLib extFL, FunctionLib newFL) { Iterator<Entry<String, FunctionLibFunction>> it = extFL.getFunctions().entrySet().iterator(); FunctionLibFunction flf; while (it.hasNext()) { flf = it.next().getValue(); // TODO function must be duplicated because it gets a new FunctionLib assigned newFL.setFunction(flf); } } }
public class class_name { private static void copyFunctions(FunctionLib extFL, FunctionLib newFL) { Iterator<Entry<String, FunctionLibFunction>> it = extFL.getFunctions().entrySet().iterator(); FunctionLibFunction flf; while (it.hasNext()) { flf = it.next().getValue(); // TODO function must be duplicated because it gets a new FunctionLib assigned // depends on control dependency: [while], data = [none] newFL.setFunction(flf); // depends on control dependency: [while], data = [none] } } }
public class class_name { protected void executeScript(URL scriptUrl) { log.debug("Executing script '{}'", scriptUrl); final Jedis jedis = pool.getResource(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(scriptUrl.openStream(), StandardCharsets.UTF_8))) { reader.lines() .filter(line -> !Strings.isNullOrEmpty(line) && line.charAt(0) != '#' && !line.startsWith("//")) .forEach(line -> { try { log.trace("execute: {}", line); String[] args = line.split(" ", 3); String command = null; if (args.length == 1) { command = String.format("return redis.call('%s')", args[0]); } else if (args.length == 2) { command = String.format("return redis.call('%s', '%s')", args[0], args[1]); } else if (args.length == 3) { command = String.format("return redis.call('%s', '%s', '%s')", args[0], args[1], unwrapQuotes(args[2])); } else { log.error("Unexpected number of script arguments {}", args.length); } log.trace("command: {}", command); Object result = jedis.eval(command); } catch (Exception e) { log.error("Failed to execute '{}'", line, e); } }); } catch (IOException e) { log.error("Failed to execute script '{}'", scriptUrl, e); pool.returnBrokenResource(jedis); // jedis = null; } finally { if (jedis != null) { pool.returnResource(jedis); } } } }
public class class_name { protected void executeScript(URL scriptUrl) { log.debug("Executing script '{}'", scriptUrl); final Jedis jedis = pool.getResource(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(scriptUrl.openStream(), StandardCharsets.UTF_8))) { reader.lines() .filter(line -> !Strings.isNullOrEmpty(line) && line.charAt(0) != '#' && !line.startsWith("//")) .forEach(line -> { try { log.trace("execute: {}", line); String[] args = line.split(" ", 3); String command = null; if (args.length == 1) { command = String.format("return redis.call('%s')", args[0]); // depends on control dependency: [if], data = [none] } else if (args.length == 2) { command = String.format("return redis.call('%s', '%s')", args[0], args[1]); // depends on control dependency: [if], data = [none] } else if (args.length == 3) { command = String.format("return redis.call('%s', '%s', '%s')", args[0], args[1], unwrapQuotes(args[2])); // depends on control dependency: [if], data = [none] } else { log.error("Unexpected number of script arguments {}", args.length); // depends on control dependency: [if], data = [none] } log.trace("command: {}", command); Object result = jedis.eval(command); } catch (Exception e) { log.error("Failed to execute '{}'", line, e); } }); } catch (IOException e) { log.error("Failed to execute script '{}'", scriptUrl, e); pool.returnBrokenResource(jedis); // jedis = null; } finally { if (jedis != null) { pool.returnResource(jedis); } } } }
public class class_name { public int getBasicConstraints() { try { String extAlias = OIDMap.getName(PKIXExtensions.BasicConstraints_Id); if (extAlias == null) return -1; BasicConstraintsExtension certExt = (BasicConstraintsExtension)this.get(extAlias); if (certExt == null) return -1; if (((Boolean)certExt.get(BasicConstraintsExtension.IS_CA) ).booleanValue() == true) return ((Integer)certExt.get( BasicConstraintsExtension.PATH_LEN)).intValue(); else return -1; } catch (Exception e) { return -1; } } }
public class class_name { public int getBasicConstraints() { try { String extAlias = OIDMap.getName(PKIXExtensions.BasicConstraints_Id); if (extAlias == null) return -1; BasicConstraintsExtension certExt = (BasicConstraintsExtension)this.get(extAlias); if (certExt == null) return -1; if (((Boolean)certExt.get(BasicConstraintsExtension.IS_CA) ).booleanValue() == true) return ((Integer)certExt.get( BasicConstraintsExtension.PATH_LEN)).intValue(); else return -1; } catch (Exception e) { return -1; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected synchronized Thread start(boolean forceRestart) { if (!forceRestart && isFixingActive()) { fixThread.interrupt(); } if (forceRestart || !isFixingActive()) { fixThread = new FixThread(); fixThread.start(); } return fixThread; } }
public class class_name { protected synchronized Thread start(boolean forceRestart) { if (!forceRestart && isFixingActive()) { fixThread.interrupt(); // depends on control dependency: [if], data = [none] } if (forceRestart || !isFixingActive()) { fixThread = new FixThread(); // depends on control dependency: [if], data = [none] fixThread.start(); // depends on control dependency: [if], data = [none] } return fixThread; } }
public class class_name { public static <T> List<T> slice(List<T> list, Integer start, Integer stop) { int size = list.size(); if (start == null) { start = 0; } else if (start < 0) { start = size + start; } if (stop == null) { stop = size; } else if (stop < 0) { stop = size + stop; } if (start >= size || stop <= 0 || start >= stop) { return Collections.emptyList(); } start = Math.max(0, start); stop = Math.min(size, stop); return list.subList(start, stop); } }
public class class_name { public static <T> List<T> slice(List<T> list, Integer start, Integer stop) { int size = list.size(); if (start == null) { start = 0; // depends on control dependency: [if], data = [none] } else if (start < 0) { start = size + start; // depends on control dependency: [if], data = [none] } if (stop == null) { stop = size; // depends on control dependency: [if], data = [none] } else if (stop < 0) { stop = size + stop; // depends on control dependency: [if], data = [none] } if (start >= size || stop <= 0 || start >= stop) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } start = Math.max(0, start); stop = Math.min(size, stop); return list.subList(start, stop); } }
public class class_name { private void handleConnectResponse(ConnectResponse response, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { LOGGER.trace("{} - Received {}", id, response); // If the connection was successfully created, immediately send a keep-alive request // to the server to ensure we maintain our session and get an updated list of server addresses. if (response.status() == Response.Status.OK) { selector.reset(response.leader(), response.members()); future.complete(connection); } else { connect(future); } } else { LOGGER.debug("{} - Failed to connect! Reason: {}", id, error); connect(future); } } } }
public class class_name { private void handleConnectResponse(ConnectResponse response, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { LOGGER.trace("{} - Received {}", id, response); // depends on control dependency: [if], data = [none] // If the connection was successfully created, immediately send a keep-alive request // to the server to ensure we maintain our session and get an updated list of server addresses. if (response.status() == Response.Status.OK) { selector.reset(response.leader(), response.members()); // depends on control dependency: [if], data = [none] future.complete(connection); // depends on control dependency: [if], data = [none] } else { connect(future); // depends on control dependency: [if], data = [none] } } else { LOGGER.debug("{} - Failed to connect! Reason: {}", id, error); // depends on control dependency: [if], data = [none] connect(future); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(RevokeFlowEntitlementRequest revokeFlowEntitlementRequest, ProtocolMarshaller protocolMarshaller) { if (revokeFlowEntitlementRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(revokeFlowEntitlementRequest.getEntitlementArn(), ENTITLEMENTARN_BINDING); protocolMarshaller.marshall(revokeFlowEntitlementRequest.getFlowArn(), FLOWARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RevokeFlowEntitlementRequest revokeFlowEntitlementRequest, ProtocolMarshaller protocolMarshaller) { if (revokeFlowEntitlementRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(revokeFlowEntitlementRequest.getEntitlementArn(), ENTITLEMENTARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(revokeFlowEntitlementRequest.getFlowArn(), FLOWARN_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 String getCrumb(ServletRequest request) { String crumb = null; if (request != null) { crumb = (String) request.getAttribute(CRUMB_ATTRIBUTE); } if (crumb == null) { crumb = issueCrumb(request, getDescriptor().getCrumbSalt()); if (request != null) { if ((crumb != null) && crumb.length()>0) { request.setAttribute(CRUMB_ATTRIBUTE, crumb); } else { request.removeAttribute(CRUMB_ATTRIBUTE); } } } return crumb; } }
public class class_name { public String getCrumb(ServletRequest request) { String crumb = null; if (request != null) { crumb = (String) request.getAttribute(CRUMB_ATTRIBUTE); // depends on control dependency: [if], data = [none] } if (crumb == null) { crumb = issueCrumb(request, getDescriptor().getCrumbSalt()); // depends on control dependency: [if], data = [none] if (request != null) { if ((crumb != null) && crumb.length()>0) { request.setAttribute(CRUMB_ATTRIBUTE, crumb); // depends on control dependency: [if], data = [none] } else { request.removeAttribute(CRUMB_ATTRIBUTE); // depends on control dependency: [if], data = [none] } } } return crumb; } }
public class class_name { private void appendEnclosing(StringBuilder buffer, char enclosingSeparator, ClassName enclosing) { if (enclosing.enclosingClass != null) { appendEnclosing(buffer, enclosingSeparator, enclosing.enclosingClass); } buffer.append(enclosing.simpleName); buffer.append(enclosingSeparator); } }
public class class_name { private void appendEnclosing(StringBuilder buffer, char enclosingSeparator, ClassName enclosing) { if (enclosing.enclosingClass != null) { appendEnclosing(buffer, enclosingSeparator, enclosing.enclosingClass); // depends on control dependency: [if], data = [none] } buffer.append(enclosing.simpleName); buffer.append(enclosingSeparator); } }
public class class_name { public SAMLEndpointResponse getSAMLAssertionVerifying(String appId, String devideId, String stateToken, String otpToken, String urlEndpoint, Boolean doNotNotify) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); String target; if (urlEndpoint != null && !urlEndpoint.isEmpty()) { target = urlEndpoint; } else { URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_SAML_VERIFY_FACTOR)); target = url.toString(); } OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(target) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); Map<String, Object> params = new HashMap<String, Object>(); params.put("app_id", appId); params.put("device_id", devideId); params.put("state_token", stateToken); params.put("do_not_notify", doNotNotify); if (otpToken != null && !otpToken.isEmpty()) { params.put("otp_token", otpToken); } String body = JSONUtils.buildJSON(params); bearerRequest.setBody(body); SAMLEndpointResponse samlEndpointResponse = null; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { samlEndpointResponse = new SAMLEndpointResponse(oAuthResponse.getType(), oAuthResponse.getMessage()); if (oAuthResponse.getType().equals("success")) { if (oAuthResponse.getMessage().equals("Success")) { samlEndpointResponse.setSAMLResponse((String)oAuthResponse.getStringFromData()); } } } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return samlEndpointResponse; } }
public class class_name { public SAMLEndpointResponse getSAMLAssertionVerifying(String appId, String devideId, String stateToken, String otpToken, String urlEndpoint, Boolean doNotNotify) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); String target; if (urlEndpoint != null && !urlEndpoint.isEmpty()) { target = urlEndpoint; } else { URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_SAML_VERIFY_FACTOR)); target = url.toString(); } OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(target) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); Map<String, Object> params = new HashMap<String, Object>(); params.put("app_id", appId); params.put("device_id", devideId); params.put("state_token", stateToken); params.put("do_not_notify", doNotNotify); if (otpToken != null && !otpToken.isEmpty()) { params.put("otp_token", otpToken); } String body = JSONUtils.buildJSON(params); bearerRequest.setBody(body); SAMLEndpointResponse samlEndpointResponse = null; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { samlEndpointResponse = new SAMLEndpointResponse(oAuthResponse.getType(), oAuthResponse.getMessage()); if (oAuthResponse.getType().equals("success")) { if (oAuthResponse.getMessage().equals("Success")) { samlEndpointResponse.setSAMLResponse((String)oAuthResponse.getStringFromData()); // depends on control dependency: [if], data = [none] } } } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return samlEndpointResponse; } }
public class class_name { protected void copy( I_CmsRepositoryItem item, ServletOutputStream ostream, Iterator<CmsWebdavRange> ranges, String contentType) throws IOException { IOException exception = null; while ((exception == null) && (ranges.hasNext())) { InputStream resourceInputStream = new ByteArrayInputStream(item.getContent()); InputStream istream = new BufferedInputStream(resourceInputStream, m_input); CmsWebdavRange currentRange = ranges.next(); // Writing MIME header. ostream.println(); ostream.println("--" + MIME_SEPARATION); if (contentType != null) { ostream.println("Content-Type: " + contentType); } ostream.println( "Content-Range: bytes " + currentRange.getStart() + "-" + currentRange.getEnd() + "/" + currentRange.getLength()); ostream.println(); // Printing content exception = copyRange(istream, ostream, currentRange.getStart(), currentRange.getEnd()); try { istream.close(); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_INPUT_STREAM_0), e); } } } ostream.println(); ostream.print("--" + MIME_SEPARATION + "--"); // Rethrow any exception that has occurred if (exception != null) { throw exception; } } }
public class class_name { protected void copy( I_CmsRepositoryItem item, ServletOutputStream ostream, Iterator<CmsWebdavRange> ranges, String contentType) throws IOException { IOException exception = null; while ((exception == null) && (ranges.hasNext())) { InputStream resourceInputStream = new ByteArrayInputStream(item.getContent()); InputStream istream = new BufferedInputStream(resourceInputStream, m_input); CmsWebdavRange currentRange = ranges.next(); // Writing MIME header. ostream.println(); ostream.println("--" + MIME_SEPARATION); if (contentType != null) { ostream.println("Content-Type: " + contentType); // depends on control dependency: [if], data = [none] } ostream.println( "Content-Range: bytes " + currentRange.getStart() + "-" + currentRange.getEnd() + "/" + currentRange.getLength()); ostream.println(); // Printing content exception = copyRange(istream, ostream, currentRange.getStart(), currentRange.getEnd()); try { istream.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_INPUT_STREAM_0), e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } ostream.println(); ostream.print("--" + MIME_SEPARATION + "--"); // Rethrow any exception that has occurred if (exception != null) { throw exception; } } }
public class class_name { public void close() { if (closed) return; if (source instanceof Closeable) { try { ((Closeable)source).close(); } catch (IOException ioe) { lastException = ioe; } } sourceClosed = true; source = null; closed = true; } }
public class class_name { public void close() { if (closed) return; if (source instanceof Closeable) { try { ((Closeable)source).close(); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { lastException = ioe; } // depends on control dependency: [catch], data = [none] } sourceClosed = true; source = null; closed = true; } }
public class class_name { void transmitMessage(String toID, JSONObject packet){ if (this.id==null){ // Not logged in. Put an error in the debug cb. mRtcListener.onDebug(new PnRTCMessage("Cannot transmit before calling Client.connect")); } try { JSONObject message = new JSONObject(); message.put(PnRTCMessage.JSON_PACKET, packet); message.put(PnRTCMessage.JSON_ID, ""); //Todo: session id, unused in js SDK? message.put(PnRTCMessage.JSON_NUMBER, this.id); this.mPubNub.publish(toID, message, new Callback() { // Todo: reconsider callback. @Override public void successCallback(String channel, Object message, String timetoken) { mRtcListener.onDebug(new PnRTCMessage((JSONObject)message)); } @Override public void errorCallback(String channel, PubnubError error) { mRtcListener.onDebug(new PnRTCMessage(error.errorObject)); } }); } catch (JSONException e){ e.printStackTrace(); } } }
public class class_name { void transmitMessage(String toID, JSONObject packet){ if (this.id==null){ // Not logged in. Put an error in the debug cb. mRtcListener.onDebug(new PnRTCMessage("Cannot transmit before calling Client.connect")); // depends on control dependency: [if], data = [none] } try { JSONObject message = new JSONObject(); message.put(PnRTCMessage.JSON_PACKET, packet); // depends on control dependency: [try], data = [none] message.put(PnRTCMessage.JSON_ID, ""); //Todo: session id, unused in js SDK? // depends on control dependency: [try], data = [none] message.put(PnRTCMessage.JSON_NUMBER, this.id); // depends on control dependency: [try], data = [none] this.mPubNub.publish(toID, message, new Callback() { // Todo: reconsider callback. @Override public void successCallback(String channel, Object message, String timetoken) { mRtcListener.onDebug(new PnRTCMessage((JSONObject)message)); } @Override public void errorCallback(String channel, PubnubError error) { mRtcListener.onDebug(new PnRTCMessage(error.errorObject)); } }); // depends on control dependency: [try], data = [none] } catch (JSONException e){ e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected boolean discardPath(String pathToEntry, Entry<String, Object> entry) { if (!foundAsPrefix(pathToEntry) || !delim.accept(entry.getKey())) { //skip traversal of subtree and remove from the traversal iterator return true; } return false; } }
public class class_name { protected boolean discardPath(String pathToEntry, Entry<String, Object> entry) { if (!foundAsPrefix(pathToEntry) || !delim.accept(entry.getKey())) { //skip traversal of subtree and remove from the traversal iterator return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { void wakeOut() { OnAvailable outFlow = _outFlow; if (outFlow == null) { return; } if (_creditsIn <= _queue.head()) { return; } StateOutPipe stateOld; StateOutPipe stateNew; do { stateOld = _stateOutRef.get(); if (! stateOld.isFull()) { return; } stateNew = stateOld.toWake(); } while (! _stateOutRef.compareAndSet(stateOld, stateNew)); try (OutboxAmp outbox = OutboxAmp.currentOrCreate(_outRef.services())) { Objects.requireNonNull(outbox); PipeWakeOutMessage<T> msg = new PipeWakeOutMessage<>(outbox, _outRef, this, outFlow); outbox.offer(msg); } } }
public class class_name { void wakeOut() { OnAvailable outFlow = _outFlow; if (outFlow == null) { return; // depends on control dependency: [if], data = [none] } if (_creditsIn <= _queue.head()) { return; // depends on control dependency: [if], data = [none] } StateOutPipe stateOld; StateOutPipe stateNew; do { stateOld = _stateOutRef.get(); if (! stateOld.isFull()) { return; // depends on control dependency: [if], data = [none] } stateNew = stateOld.toWake(); } while (! _stateOutRef.compareAndSet(stateOld, stateNew)); try (OutboxAmp outbox = OutboxAmp.currentOrCreate(_outRef.services())) { Objects.requireNonNull(outbox); PipeWakeOutMessage<T> msg = new PipeWakeOutMessage<>(outbox, _outRef, this, outFlow); outbox.offer(msg); } } }
public class class_name { @Override public void removePortalUID(final int uPortalUID) { this.transactionOperations.execute( new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus arg0) { final String name = jdbcOperations.queryForObject( "SELECT USER_NAME FROM UP_USER WHERE USER_ID=?", String.class, uPortalUID); if (name == null) { log.warn( "No user exists for id " + uPortalUID + " Nothing will be deleted"); return; } removePortalUID(name); } }); } }
public class class_name { @Override public void removePortalUID(final int uPortalUID) { this.transactionOperations.execute( new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus arg0) { final String name = jdbcOperations.queryForObject( "SELECT USER_NAME FROM UP_USER WHERE USER_ID=?", String.class, uPortalUID); if (name == null) { log.warn( "No user exists for id " + uPortalUID + " Nothing will be deleted"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } removePortalUID(name); } }); } }
public class class_name { public int getMax() { List<Integer> value = new ArrayList<Integer>(); for (AnalysisType at : analysisType) { value.add(at.getValue()); } return Collections.max(value); } }
public class class_name { public int getMax() { List<Integer> value = new ArrayList<Integer>(); for (AnalysisType at : analysisType) { value.add(at.getValue()); // depends on control dependency: [for], data = [at] } return Collections.max(value); } }
public class class_name { public static <T> List<T> subList(List<T> list, Criteria<T> criteria) { ArrayList<T> subList = new ArrayList<T>(); for(T item : list) { if(criteria.meetsCriteria(item)) { subList.add(item); } } return subList; } }
public class class_name { public static <T> List<T> subList(List<T> list, Criteria<T> criteria) { ArrayList<T> subList = new ArrayList<T>(); for(T item : list) { if(criteria.meetsCriteria(item)) { subList.add(item); // depends on control dependency: [if], data = [none] } } return subList; } }
public class class_name { public synchronized long getLastModified( Artifact artifact ) throws IOException, ArtifactNotFoundException { Map<String, Map<String, Map<Artifact, Content>>> artifactMap = contents.get( artifact.getGroupId() ); Map<String, Map<Artifact, Content>> versionMap = ( artifactMap == null ? null : artifactMap.get( artifact.getArtifactId() ) ); Map<Artifact, Content> filesMap = ( versionMap == null ? null : versionMap.get( artifact.getVersion() ) ); Content content = ( filesMap == null ? null : filesMap.get( artifact ) ); if ( content == null ) { if ( artifact.isSnapshot() && artifact.getTimestamp() == null && filesMap != null ) { Artifact best = null; for ( Map.Entry<Artifact, Content> entry : filesMap.entrySet() ) { Artifact a = entry.getKey(); if ( artifact.equalSnapshots( a ) && ( best == null || best.compareTo( a ) < 0 ) ) { best = a; content = entry.getValue(); } } if ( content == null ) { throw new ArtifactNotFoundException( artifact ); } } else { throw new ArtifactNotFoundException( artifact ); } } return content.getLastModified(); } }
public class class_name { public synchronized long getLastModified( Artifact artifact ) throws IOException, ArtifactNotFoundException { Map<String, Map<String, Map<Artifact, Content>>> artifactMap = contents.get( artifact.getGroupId() ); Map<String, Map<Artifact, Content>> versionMap = ( artifactMap == null ? null : artifactMap.get( artifact.getArtifactId() ) ); Map<Artifact, Content> filesMap = ( versionMap == null ? null : versionMap.get( artifact.getVersion() ) ); Content content = ( filesMap == null ? null : filesMap.get( artifact ) ); if ( content == null ) { if ( artifact.isSnapshot() && artifact.getTimestamp() == null && filesMap != null ) { Artifact best = null; for ( Map.Entry<Artifact, Content> entry : filesMap.entrySet() ) { Artifact a = entry.getKey(); if ( artifact.equalSnapshots( a ) && ( best == null || best.compareTo( a ) < 0 ) ) { best = a; // depends on control dependency: [if], data = [none] content = entry.getValue(); // depends on control dependency: [if], data = [none] } } if ( content == null ) { throw new ArtifactNotFoundException( artifact ); } } else { throw new ArtifactNotFoundException( artifact ); } } return content.getLastModified(); } }