code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @SuppressWarnings( "unchecked" ) public static <T extends Option> T[] filter( final Class<T> optionType, final Option... options ) { final List<T> filtered = new ArrayList<T>(); for( Option option : expand( options ) ) { if( optionType.isAssignableFrom( option.getClass() ) ) { filtered.add( (T) option ); } } final T[] result = (T[]) Array.newInstance( optionType, filtered.size() ); return filtered.toArray( result ); } }
public class class_name { @SuppressWarnings( "unchecked" ) public static <T extends Option> T[] filter( final Class<T> optionType, final Option... options ) { final List<T> filtered = new ArrayList<T>(); for( Option option : expand( options ) ) { if( optionType.isAssignableFrom( option.getClass() ) ) { filtered.add( (T) option ); // depends on control dependency: [if], data = [none] } } final T[] result = (T[]) Array.newInstance( optionType, filtered.size() ); return filtered.toArray( result ); } }
public class class_name { public static DMatrixRMaj diagR(int numRows , int numCols , double ...diagEl ) { DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols); int o = Math.min(numRows,numCols); for( int i = 0; i < o; i++ ) { ret.set(i, i, diagEl[i]); } return ret; } }
public class class_name { public static DMatrixRMaj diagR(int numRows , int numCols , double ...diagEl ) { DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols); int o = Math.min(numRows,numCols); for( int i = 0; i < o; i++ ) { ret.set(i, i, diagEl[i]); // depends on control dependency: [for], data = [i] } return ret; } }
public class class_name { Entry remove() { if (tc.isEntryEnabled()) SibTr.entry(tc, "remove"); checkEntryParent(); Entry removedEntry = null; Entry prevEntry = getPrevious(); if(prevEntry != null) { //link the previous entry to the next one prevEntry.next = next; } Entry nextEntry = getNext(); if(nextEntry != null) { //link the next entry to the previous one nextEntry.previous = prevEntry; } if(isFirst()) { //if this entry was the first in the list, //mark the next one as the first entry parentList.first = nextEntry; } if(isLast()) { //if this entry was the last in the list, //mark the previous one as the last entry parentList.last = prevEntry; } //set all of this entry's fields to null to make it absolutely //sure that it is no longer in the list next = null; previous = null; parentList = null; removedEntry = this; if (tc.isEntryEnabled()) SibTr.exit(tc, "remove", removedEntry); return removedEntry; } }
public class class_name { Entry remove() { if (tc.isEntryEnabled()) SibTr.entry(tc, "remove"); checkEntryParent(); Entry removedEntry = null; Entry prevEntry = getPrevious(); if(prevEntry != null) { //link the previous entry to the next one prevEntry.next = next; // depends on control dependency: [if], data = [none] } Entry nextEntry = getNext(); if(nextEntry != null) { //link the next entry to the previous one nextEntry.previous = prevEntry; // depends on control dependency: [if], data = [none] } if(isFirst()) { //if this entry was the first in the list, //mark the next one as the first entry parentList.first = nextEntry; // depends on control dependency: [if], data = [none] } if(isLast()) { //if this entry was the last in the list, //mark the previous one as the last entry parentList.last = prevEntry; // depends on control dependency: [if], data = [none] } //set all of this entry's fields to null to make it absolutely //sure that it is no longer in the list next = null; previous = null; parentList = null; removedEntry = this; if (tc.isEntryEnabled()) SibTr.exit(tc, "remove", removedEntry); return removedEntry; } }
public class class_name { private ServicePort parsePortMapping(String port) { Matcher matcher = PORT_MAPPING_PATTERN.matcher(port); if (!matcher.matches()) { log.error("Invalid 'port' configuration '%s'. Must match <port>(:<targetPort>)?,<port2>?,...", port); throw new IllegalArgumentException("Invalid port mapping specification " + port); } int servicePort = Integer.parseInt(matcher.group("port")); String optionalTargetPort = matcher.group("targetPort"); String protocol = getProtocol(matcher.group("protocol")); ServicePortBuilder builder = new ServicePortBuilder() .withPort(servicePort) .withProtocol(protocol) .withName(getDefaultPortName(servicePort, protocol)); // leave empty if not set. will be filled up with the port from the image config if (optionalTargetPort != null) { builder.withNewTargetPort(Integer.parseInt(optionalTargetPort)); } return builder.build(); } }
public class class_name { private ServicePort parsePortMapping(String port) { Matcher matcher = PORT_MAPPING_PATTERN.matcher(port); if (!matcher.matches()) { log.error("Invalid 'port' configuration '%s'. Must match <port>(:<targetPort>)?,<port2>?,...", port); // depends on control dependency: [if], data = [none] throw new IllegalArgumentException("Invalid port mapping specification " + port); } int servicePort = Integer.parseInt(matcher.group("port")); String optionalTargetPort = matcher.group("targetPort"); String protocol = getProtocol(matcher.group("protocol")); ServicePortBuilder builder = new ServicePortBuilder() .withPort(servicePort) .withProtocol(protocol) .withName(getDefaultPortName(servicePort, protocol)); // leave empty if not set. will be filled up with the port from the image config if (optionalTargetPort != null) { builder.withNewTargetPort(Integer.parseInt(optionalTargetPort)); // depends on control dependency: [if], data = [(optionalTargetPort] } return builder.build(); } }
public class class_name { private List<PropertyModel> buildModel(Map<String,String> properties) { List<PropertyModel> props = new ArrayList<>(); for (Map.Entry<String,String> e : properties.entrySet()) { props.add(new PropertyModel(e.getKey(), e.getValue())); } return props; } }
public class class_name { private List<PropertyModel> buildModel(Map<String,String> properties) { List<PropertyModel> props = new ArrayList<>(); for (Map.Entry<String,String> e : properties.entrySet()) { props.add(new PropertyModel(e.getKey(), e.getValue())); // depends on control dependency: [for], data = [e] } return props; } }
public class class_name { protected MessageTuple getExpectedMessage(MessageType type, String source, int timeoutMs) throws TimeoutException, InterruptedException { int startTime = (int) (System.nanoTime() / 1000000); // Waits until the expected message is received. while (true) { MessageTuple tuple = getMessage(timeoutMs); String from = tuple.getServerId(); if (tuple.getMessage().getType() == type && (source == null || source.equals(from))) { // Return message only if it's expected type and expected source. return tuple; } else { int curTime = (int) (System.nanoTime() / 1000000); if (curTime - startTime >= timeoutMs) { throw new TimeoutException("Timeout in getExpectedMessage."); } if (LOG.isDebugEnabled()) { LOG.debug("Got an unexpected message from {}: {}", tuple.getServerId(), TextFormat.shortDebugString(tuple.getMessage())); } } } } }
public class class_name { protected MessageTuple getExpectedMessage(MessageType type, String source, int timeoutMs) throws TimeoutException, InterruptedException { int startTime = (int) (System.nanoTime() / 1000000); // Waits until the expected message is received. while (true) { MessageTuple tuple = getMessage(timeoutMs); String from = tuple.getServerId(); if (tuple.getMessage().getType() == type && (source == null || source.equals(from))) { // Return message only if it's expected type and expected source. return tuple; // depends on control dependency: [if], data = [none] } else { int curTime = (int) (System.nanoTime() / 1000000); if (curTime - startTime >= timeoutMs) { throw new TimeoutException("Timeout in getExpectedMessage."); } if (LOG.isDebugEnabled()) { LOG.debug("Got an unexpected message from {}: {}", tuple.getServerId(), TextFormat.shortDebugString(tuple.getMessage())); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void setInstancePatchStates(java.util.Collection<InstancePatchState> instancePatchStates) { if (instancePatchStates == null) { this.instancePatchStates = null; return; } this.instancePatchStates = new com.amazonaws.internal.SdkInternalList<InstancePatchState>(instancePatchStates); } }
public class class_name { public void setInstancePatchStates(java.util.Collection<InstancePatchState> instancePatchStates) { if (instancePatchStates == null) { this.instancePatchStates = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.instancePatchStates = new com.amazonaws.internal.SdkInternalList<InstancePatchState>(instancePatchStates); } }
public class class_name { private static void printUsage(String cmd) { String prefix = "Usage: java " + HighTideShell.class.getSimpleName(); if ("-showConfig".equals(cmd)) { System.err.println("Usage: java org.apache.hadoop.hdfs.HighTideShell"); } else { System.err.println("Usage: java HighTideShell"); System.err.println(" [-showConfig ]"); System.err.println(" [-help [cmd]]"); System.err.println(); ToolRunner.printGenericCommandUsage(System.err); } } }
public class class_name { private static void printUsage(String cmd) { String prefix = "Usage: java " + HighTideShell.class.getSimpleName(); if ("-showConfig".equals(cmd)) { System.err.println("Usage: java org.apache.hadoop.hdfs.HighTideShell"); // depends on control dependency: [if], data = [none] } else { System.err.println("Usage: java HighTideShell"); // depends on control dependency: [if], data = [none] System.err.println(" [-showConfig ]"); // depends on control dependency: [if], data = [none] System.err.println(" [-help [cmd]]"); // depends on control dependency: [if], data = [none] System.err.println(); // depends on control dependency: [if], data = [none] ToolRunner.printGenericCommandUsage(System.err); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int wtf(String tag, Throwable tr) { collectLogEntry(Constants.VERBOSE, tag, "", tr); if (isLoggable(tag, Constants.ASSERT)) { if (useWTF) { try { return (Integer) wtfTagErrorMethod.invoke(null, new Object[] { tag, tr }); } catch (Exception e) { return LogHelper.println(Constants.ASSERT, tag, LogHelper.getStackTraceString(tr)); } } else { return LogHelper.println(Constants.ASSERT, tag, LogHelper.getStackTraceString(tr)); } } return 0; } }
public class class_name { public static int wtf(String tag, Throwable tr) { collectLogEntry(Constants.VERBOSE, tag, "", tr); if (isLoggable(tag, Constants.ASSERT)) { if (useWTF) { try { return (Integer) wtfTagErrorMethod.invoke(null, new Object[] { tag, tr }); // depends on control dependency: [try], data = [none] } catch (Exception e) { return LogHelper.println(Constants.ASSERT, tag, LogHelper.getStackTraceString(tr)); } // depends on control dependency: [catch], data = [none] } else { return LogHelper.println(Constants.ASSERT, tag, LogHelper.getStackTraceString(tr)); // depends on control dependency: [if], data = [none] } } return 0; } }
public class class_name { static public Reader scanForXMPPacket(final Object pInput) throws IOException { ImageInputStream stream = pInput instanceof ImageInputStream ? (ImageInputStream) pInput : ImageIO.createImageInputStream(pInput); // TODO: Consider if BufferedIIS is a good idea if (!(stream instanceof BufferedImageInputStream)) { stream = new BufferedImageInputStream(stream); } // TODO: Might be more than one XMP block per file (it's possible to re-start for now).. long pos; pos = scanForSequence(stream, XMP_PACKET_BEGIN); if (pos >= 0) { // Skip ' OR " (plus possible nulls for 16/32 bit) byte quote = stream.readByte(); if (quote == '\'' || quote == '"') { Charset cs = null; // Read BOM byte[] bom = new byte[4]; stream.readFully(bom); // NOTE: Empty string should be treated as UTF-8 for backwards compatibility if (bom[0] == (byte) 0xEF && bom[1] == (byte) 0xBB && bom[2] == (byte) 0xBF && bom[3] == quote || bom[0] == quote) { // UTF-8 cs = Charset.forName("UTF-8"); } else if (bom[0] == (byte) 0xFE && bom[1] == (byte) 0xFF && bom[2] == 0x00 && bom[3] == quote) { // UTF-16 BIG endian cs = Charset.forName("UTF-16BE"); } else if (bom[0] == 0x00 && bom[1] == (byte) 0xFF && bom[2] == (byte) 0xFE && bom[3] == quote) { stream.skipBytes(1); // Alignment // UTF-16 little endian cs = Charset.forName("UTF-16LE"); } else if (bom[0] == 0x00 && bom[1] == 0x00 && bom[2] == (byte) 0xFE && bom[3] == (byte) 0xFF) { // NOTE: 32-bit character set not supported by default // UTF 32 BIG endian cs = Charset.forName("UTF-32BE"); } else if (bom[0] == 0x00 && bom[1] == 0x00 && bom[2] == 0x00 && bom[3] == (byte) 0xFF && stream.read() == 0xFE) { stream.skipBytes(2); // Alignment // NOTE: 32-bit character set not supported by default // UTF 32 little endian cs = Charset.forName("UTF-32LE"); } if (cs != null) { // Read all bytes until <?xpacket end= up-front or filter stream stream.mark(); long end = scanForSequence(stream, XMP_PACKET_END); stream.reset(); long length = end - stream.getStreamPosition(); Reader reader = new InputStreamReader(IIOUtil.createStreamAdapter(stream, length), cs); // Skip until ?> while (reader.read() != '>') { } // Return reader? // How to decide between w or r?! return reader; } } } return null; } }
public class class_name { static public Reader scanForXMPPacket(final Object pInput) throws IOException { ImageInputStream stream = pInput instanceof ImageInputStream ? (ImageInputStream) pInput : ImageIO.createImageInputStream(pInput); // TODO: Consider if BufferedIIS is a good idea if (!(stream instanceof BufferedImageInputStream)) { stream = new BufferedImageInputStream(stream); } // TODO: Might be more than one XMP block per file (it's possible to re-start for now).. long pos; pos = scanForSequence(stream, XMP_PACKET_BEGIN); if (pos >= 0) { // Skip ' OR " (plus possible nulls for 16/32 bit) byte quote = stream.readByte(); if (quote == '\'' || quote == '"') { Charset cs = null; // Read BOM byte[] bom = new byte[4]; stream.readFully(bom); // depends on control dependency: [if], data = [none] // NOTE: Empty string should be treated as UTF-8 for backwards compatibility if (bom[0] == (byte) 0xEF && bom[1] == (byte) 0xBB && bom[2] == (byte) 0xBF && bom[3] == quote || bom[0] == quote) { // UTF-8 cs = Charset.forName("UTF-8"); // depends on control dependency: [if], data = [none] } else if (bom[0] == (byte) 0xFE && bom[1] == (byte) 0xFF && bom[2] == 0x00 && bom[3] == quote) { // UTF-16 BIG endian cs = Charset.forName("UTF-16BE"); // depends on control dependency: [if], data = [none] } else if (bom[0] == 0x00 && bom[1] == (byte) 0xFF && bom[2] == (byte) 0xFE && bom[3] == quote) { stream.skipBytes(1); // Alignment // depends on control dependency: [if], data = [none] // UTF-16 little endian cs = Charset.forName("UTF-16LE"); // depends on control dependency: [if], data = [none] } else if (bom[0] == 0x00 && bom[1] == 0x00 && bom[2] == (byte) 0xFE && bom[3] == (byte) 0xFF) { // NOTE: 32-bit character set not supported by default // UTF 32 BIG endian cs = Charset.forName("UTF-32BE"); // depends on control dependency: [if], data = [none] } else if (bom[0] == 0x00 && bom[1] == 0x00 && bom[2] == 0x00 && bom[3] == (byte) 0xFF && stream.read() == 0xFE) { stream.skipBytes(2); // Alignment // depends on control dependency: [if], data = [none] // NOTE: 32-bit character set not supported by default // UTF 32 little endian cs = Charset.forName("UTF-32LE"); // depends on control dependency: [if], data = [none] } if (cs != null) { // Read all bytes until <?xpacket end= up-front or filter stream stream.mark(); // depends on control dependency: [if], data = [none] long end = scanForSequence(stream, XMP_PACKET_END); stream.reset(); // depends on control dependency: [if], data = [none] long length = end - stream.getStreamPosition(); Reader reader = new InputStreamReader(IIOUtil.createStreamAdapter(stream, length), cs); // Skip until ?> while (reader.read() != '>') { } // Return reader? // How to decide between w or r?! return reader; // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { public final void forUpdate() throws RecognitionException { int forUpdate_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 103) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1097:5: ( expressionList ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1097:7: expressionList { pushFollow(FOLLOW_expressionList_in_forUpdate4775); expressionList(); state._fsp--; if (state.failed) return; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 103, forUpdate_StartIndex); } } } }
public class class_name { public final void forUpdate() throws RecognitionException { int forUpdate_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 103) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1097:5: ( expressionList ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1097:7: expressionList { pushFollow(FOLLOW_expressionList_in_forUpdate4775); expressionList(); state._fsp--; if (state.failed) return; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 103, forUpdate_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { Object getInstanceOfClass(Class cls) { if (Boolean.class.isAssignableFrom(cls) || Boolean.TYPE.isAssignableFrom(cls)) { return Boolean.FALSE; } else if (Integer.TYPE.isAssignableFrom(cls) || Short.TYPE.isAssignableFrom(cls) || Integer.class.isAssignableFrom(cls) || Short.class.isAssignableFrom(cls)) { return 0; } else if (Long.TYPE.isAssignableFrom(cls) || Long.class.isAssignableFrom(cls)) { return 0L; } else if (Float.TYPE.isAssignableFrom(cls) || Float.class.isAssignableFrom(cls)) { return 0.1F; } else if (Double.TYPE.isAssignableFrom(cls) || Double.class.isAssignableFrom(cls)) { return 0.1D; } else if (cls.isArray()) { Class<?> comp = cls.getComponentType(); Object instance = getInstanceOfClass(comp); return new Object[]{instance, instance}; } else { try { return cls.newInstance(); } catch (InstantiationException | IllegalAccessException ex) { return getObjectFromConstantFields(cls); } } } }
public class class_name { Object getInstanceOfClass(Class cls) { if (Boolean.class.isAssignableFrom(cls) || Boolean.TYPE.isAssignableFrom(cls)) { return Boolean.FALSE; // depends on control dependency: [if], data = [none] } else if (Integer.TYPE.isAssignableFrom(cls) || Short.TYPE.isAssignableFrom(cls) || Integer.class.isAssignableFrom(cls) || Short.class.isAssignableFrom(cls)) { return 0; // depends on control dependency: [if], data = [none] } else if (Long.TYPE.isAssignableFrom(cls) || Long.class.isAssignableFrom(cls)) { return 0L; // depends on control dependency: [if], data = [none] } else if (Float.TYPE.isAssignableFrom(cls) || Float.class.isAssignableFrom(cls)) { return 0.1F; // depends on control dependency: [if], data = [none] } else if (Double.TYPE.isAssignableFrom(cls) || Double.class.isAssignableFrom(cls)) { return 0.1D; // depends on control dependency: [if], data = [none] } else if (cls.isArray()) { Class<?> comp = cls.getComponentType(); Object instance = getInstanceOfClass(comp); return new Object[]{instance, instance}; // depends on control dependency: [if], data = [none] } else { try { return cls.newInstance(); // depends on control dependency: [try], data = [none] } catch (InstantiationException | IllegalAccessException ex) { return getObjectFromConstantFields(cls); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static Kernel1D_F32 table1D_F32(int radius, boolean normalized) { Kernel1D_F32 ret = new Kernel1D_F32(radius * 2 + 1); float val = normalized ? 1.0f / ret.width : 1.0f; for (int i = 0; i < ret.data.length; i++) { ret.data[i] = val; } return ret; } }
public class class_name { public static Kernel1D_F32 table1D_F32(int radius, boolean normalized) { Kernel1D_F32 ret = new Kernel1D_F32(radius * 2 + 1); float val = normalized ? 1.0f / ret.width : 1.0f; for (int i = 0; i < ret.data.length; i++) { ret.data[i] = val; // depends on control dependency: [for], data = [i] } return ret; } }
public class class_name { public static BaseRowKeySelector getBaseRowSelector(int[] keyFields, BaseRowTypeInfo rowType) { if (keyFields.length > 0) { InternalType[] inputFieldTypes = rowType.getInternalTypes(); String[] inputFieldNames = rowType.getFieldNames(); InternalType[] keyFieldTypes = new InternalType[keyFields.length]; String[] keyFieldNames = new String[keyFields.length]; for (int i = 0; i < keyFields.length; ++i) { keyFieldTypes[i] = inputFieldTypes[keyFields[i]]; keyFieldNames[i] = inputFieldNames[keyFields[i]]; } RowType returnType = new RowType(keyFieldTypes, keyFieldNames); RowType inputType = new RowType(inputFieldTypes, rowType.getFieldNames()); GeneratedProjection generatedProjection = ProjectionCodeGenerator.generateProjection( CodeGeneratorContext.apply(new TableConfig()), "KeyProjection", inputType, returnType, keyFields); BaseRowTypeInfo keyRowType = returnType.toTypeInfo(); // check if type implements proper equals/hashCode TypeCheckUtils.validateEqualsHashCode("grouping", keyRowType); return new BinaryRowKeySelector(keyRowType, generatedProjection); } else { return NullBinaryRowKeySelector.INSTANCE; } } }
public class class_name { public static BaseRowKeySelector getBaseRowSelector(int[] keyFields, BaseRowTypeInfo rowType) { if (keyFields.length > 0) { InternalType[] inputFieldTypes = rowType.getInternalTypes(); String[] inputFieldNames = rowType.getFieldNames(); InternalType[] keyFieldTypes = new InternalType[keyFields.length]; String[] keyFieldNames = new String[keyFields.length]; for (int i = 0; i < keyFields.length; ++i) { keyFieldTypes[i] = inputFieldTypes[keyFields[i]]; // depends on control dependency: [for], data = [i] keyFieldNames[i] = inputFieldNames[keyFields[i]]; // depends on control dependency: [for], data = [i] } RowType returnType = new RowType(keyFieldTypes, keyFieldNames); RowType inputType = new RowType(inputFieldTypes, rowType.getFieldNames()); GeneratedProjection generatedProjection = ProjectionCodeGenerator.generateProjection( CodeGeneratorContext.apply(new TableConfig()), "KeyProjection", inputType, returnType, keyFields); BaseRowTypeInfo keyRowType = returnType.toTypeInfo(); // check if type implements proper equals/hashCode TypeCheckUtils.validateEqualsHashCode("grouping", keyRowType); // depends on control dependency: [if], data = [none] return new BinaryRowKeySelector(keyRowType, generatedProjection); // depends on control dependency: [if], data = [none] } else { return NullBinaryRowKeySelector.INSTANCE; // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<Resource> buildResources() { List<Resource> resources = new ArrayList<Resource>(); for (ResourceBuilder builder : _resourceBuilders) { Resource resource = builder.build(); if (resource != null) { resources.add(resource); } } return resources; } }
public class class_name { public List<Resource> buildResources() { List<Resource> resources = new ArrayList<Resource>(); for (ResourceBuilder builder : _resourceBuilders) { Resource resource = builder.build(); if (resource != null) { resources.add(resource); // depends on control dependency: [if], data = [(resource] } } return resources; } }
public class class_name { public void performAnticompaction(ColumnFamilyStore cfs, Collection<Range<Token>> ranges, Refs<SSTableReader> validatedForRepair, long repairedAt) throws InterruptedException, ExecutionException, IOException { logger.info("Starting anticompaction for {}.{} on {}/{} sstables", cfs.keyspace.getName(), cfs.getColumnFamilyName(), validatedForRepair.size(), cfs.getSSTables().size()); logger.debug("Starting anticompaction for ranges {}", ranges); Set<SSTableReader> sstables = new HashSet<>(validatedForRepair); Set<SSTableReader> mutatedRepairStatuses = new HashSet<>(); Set<SSTableReader> nonAnticompacting = new HashSet<>(); Iterator<SSTableReader> sstableIterator = sstables.iterator(); try { while (sstableIterator.hasNext()) { SSTableReader sstable = sstableIterator.next(); for (Range<Token> r : Range.normalize(ranges)) { Range<Token> sstableRange = new Range<>(sstable.first.getToken(), sstable.last.getToken(), sstable.partitioner); if (r.contains(sstableRange)) { logger.info("SSTable {} fully contained in range {}, mutating repairedAt instead of anticompacting", sstable, r); sstable.descriptor.getMetadataSerializer().mutateRepairedAt(sstable.descriptor, repairedAt); sstable.reloadSSTableMetadata(); mutatedRepairStatuses.add(sstable); sstableIterator.remove(); break; } else if (!sstableRange.intersects(r)) { logger.info("SSTable {} ({}) does not intersect repaired range {}, not touching repairedAt.", sstable, sstableRange, r); nonAnticompacting.add(sstable); sstableIterator.remove(); break; } else { logger.info("SSTable {} ({}) will be anticompacted on range {}", sstable, sstableRange, r); } } } cfs.getDataTracker().notifySSTableRepairedStatusChanged(mutatedRepairStatuses); cfs.getDataTracker().unmarkCompacting(Sets.union(nonAnticompacting, mutatedRepairStatuses)); validatedForRepair.release(Sets.union(nonAnticompacting, mutatedRepairStatuses)); if (!sstables.isEmpty()) doAntiCompaction(cfs, ranges, sstables, repairedAt); } finally { validatedForRepair.release(); cfs.getDataTracker().unmarkCompacting(sstables); } logger.info(String.format("Completed anticompaction successfully")); } }
public class class_name { public void performAnticompaction(ColumnFamilyStore cfs, Collection<Range<Token>> ranges, Refs<SSTableReader> validatedForRepair, long repairedAt) throws InterruptedException, ExecutionException, IOException { logger.info("Starting anticompaction for {}.{} on {}/{} sstables", cfs.keyspace.getName(), cfs.getColumnFamilyName(), validatedForRepair.size(), cfs.getSSTables().size()); logger.debug("Starting anticompaction for ranges {}", ranges); Set<SSTableReader> sstables = new HashSet<>(validatedForRepair); Set<SSTableReader> mutatedRepairStatuses = new HashSet<>(); Set<SSTableReader> nonAnticompacting = new HashSet<>(); Iterator<SSTableReader> sstableIterator = sstables.iterator(); try { while (sstableIterator.hasNext()) { SSTableReader sstable = sstableIterator.next(); for (Range<Token> r : Range.normalize(ranges)) { Range<Token> sstableRange = new Range<>(sstable.first.getToken(), sstable.last.getToken(), sstable.partitioner); if (r.contains(sstableRange)) { logger.info("SSTable {} fully contained in range {}, mutating repairedAt instead of anticompacting", sstable, r); // depends on control dependency: [if], data = [none] sstable.descriptor.getMetadataSerializer().mutateRepairedAt(sstable.descriptor, repairedAt); // depends on control dependency: [if], data = [none] sstable.reloadSSTableMetadata(); // depends on control dependency: [if], data = [none] mutatedRepairStatuses.add(sstable); // depends on control dependency: [if], data = [none] sstableIterator.remove(); // depends on control dependency: [if], data = [none] break; } else if (!sstableRange.intersects(r)) { logger.info("SSTable {} ({}) does not intersect repaired range {}, not touching repairedAt.", sstable, sstableRange, r); // depends on control dependency: [if], data = [none] nonAnticompacting.add(sstable); // depends on control dependency: [if], data = [none] sstableIterator.remove(); // depends on control dependency: [if], data = [none] break; } else { logger.info("SSTable {} ({}) will be anticompacted on range {}", sstable, sstableRange, r); } } } cfs.getDataTracker().notifySSTableRepairedStatusChanged(mutatedRepairStatuses); cfs.getDataTracker().unmarkCompacting(Sets.union(nonAnticompacting, mutatedRepairStatuses)); validatedForRepair.release(Sets.union(nonAnticompacting, mutatedRepairStatuses)); if (!sstables.isEmpty()) doAntiCompaction(cfs, ranges, sstables, repairedAt); } finally { validatedForRepair.release(); cfs.getDataTracker().unmarkCompacting(sstables); } logger.info(String.format("Completed anticompaction successfully")); } }
public class class_name { public static Set<String> getTokenKeys(String str) { Set<String> results = new HashSet<String>(); String sDelim = "{"; String eDelim = "}"; if (StringUtils.isBlank(str)) { return results; } int start = -1; int end = 0; do { start = str.indexOf(sDelim, end); if (start != -1) { end = str.indexOf(eDelim, start); if (end != -1) { results.add(str.substring(start + sDelim.length(), end)); } } } while (start != -1 && end != -1); return results; } }
public class class_name { public static Set<String> getTokenKeys(String str) { Set<String> results = new HashSet<String>(); String sDelim = "{"; String eDelim = "}"; if (StringUtils.isBlank(str)) { return results; // depends on control dependency: [if], data = [none] } int start = -1; int end = 0; do { start = str.indexOf(sDelim, end); if (start != -1) { end = str.indexOf(eDelim, start); // depends on control dependency: [if], data = [none] if (end != -1) { results.add(str.substring(start + sDelim.length(), end)); // depends on control dependency: [if], data = [none] } } } while (start != -1 && end != -1); return results; } }
public class class_name { public void fatalError(SAXParseException e) throws SAXException { if(null != m_errorHandler) { try { m_errorHandler.fatalError(e); } catch(SAXParseException se) { // ignore } // clearCoRoutine(e); } // This is not great, but we really would rather have the error // handler be the error listener if it is a error handler. Coroutine's fatalError // can't really be configured, so I think this is the best thing right now // for error reporting. Possibly another JAXP 1.1 hole. -sb javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener(); if(errorListener instanceof ErrorHandler) { ((ErrorHandler)errorListener).fatalError(e); if(null != m_errorHandler) m_errorHandler.fatalError(e); // may not be called. } else { try { errorListener.fatalError(new javax.xml.transform.TransformerException(e)); if(null != m_errorHandler) m_errorHandler.fatalError(e); // may not be called. } catch(javax.xml.transform.TransformerException te) { throw e; } } } }
public class class_name { public void fatalError(SAXParseException e) throws SAXException { if(null != m_errorHandler) { try { m_errorHandler.fatalError(e); // depends on control dependency: [try], data = [none] } catch(SAXParseException se) { // ignore } // depends on control dependency: [catch], data = [none] // clearCoRoutine(e); } // This is not great, but we really would rather have the error // handler be the error listener if it is a error handler. Coroutine's fatalError // can't really be configured, so I think this is the best thing right now // for error reporting. Possibly another JAXP 1.1 hole. -sb javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener(); if(errorListener instanceof ErrorHandler) { ((ErrorHandler)errorListener).fatalError(e); if(null != m_errorHandler) m_errorHandler.fatalError(e); // may not be called. } else { try { errorListener.fatalError(new javax.xml.transform.TransformerException(e)); // depends on control dependency: [try], data = [none] if(null != m_errorHandler) m_errorHandler.fatalError(e); // may not be called. } catch(javax.xml.transform.TransformerException te) { throw e; } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static Protos.Payment createPaymentMessage(List<Transaction> transactions, @Nullable List<Protos.Output> refundOutputs, @Nullable String memo, @Nullable byte[] merchantData) { Protos.Payment.Builder builder = Protos.Payment.newBuilder(); for (Transaction transaction : transactions) { transaction.verify(); builder.addTransactions(ByteString.copyFrom(transaction.unsafeBitcoinSerialize())); } if (refundOutputs != null) { for (Protos.Output output : refundOutputs) builder.addRefundTo(output); } if (memo != null) builder.setMemo(memo); if (merchantData != null) builder.setMerchantData(ByteString.copyFrom(merchantData)); return builder.build(); } }
public class class_name { public static Protos.Payment createPaymentMessage(List<Transaction> transactions, @Nullable List<Protos.Output> refundOutputs, @Nullable String memo, @Nullable byte[] merchantData) { Protos.Payment.Builder builder = Protos.Payment.newBuilder(); for (Transaction transaction : transactions) { transaction.verify(); // depends on control dependency: [for], data = [transaction] builder.addTransactions(ByteString.copyFrom(transaction.unsafeBitcoinSerialize())); // depends on control dependency: [for], data = [transaction] } if (refundOutputs != null) { for (Protos.Output output : refundOutputs) builder.addRefundTo(output); } if (memo != null) builder.setMemo(memo); if (merchantData != null) builder.setMerchantData(ByteString.copyFrom(merchantData)); return builder.build(); } }
public class class_name { public BatchGetDeploymentsResult withDeploymentsInfo(DeploymentInfo... deploymentsInfo) { if (this.deploymentsInfo == null) { setDeploymentsInfo(new com.amazonaws.internal.SdkInternalList<DeploymentInfo>(deploymentsInfo.length)); } for (DeploymentInfo ele : deploymentsInfo) { this.deploymentsInfo.add(ele); } return this; } }
public class class_name { public BatchGetDeploymentsResult withDeploymentsInfo(DeploymentInfo... deploymentsInfo) { if (this.deploymentsInfo == null) { setDeploymentsInfo(new com.amazonaws.internal.SdkInternalList<DeploymentInfo>(deploymentsInfo.length)); // depends on control dependency: [if], data = [none] } for (DeploymentInfo ele : deploymentsInfo) { this.deploymentsInfo.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { static Properties convertResourceBundleToProperties(ResourceBundle resource) { Properties properties = new Properties(); Enumeration<String> keys = resource.getKeys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); properties.put(key, resource.getString(key)); } return properties; } }
public class class_name { static Properties convertResourceBundleToProperties(ResourceBundle resource) { Properties properties = new Properties(); Enumeration<String> keys = resource.getKeys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); properties.put(key, resource.getString(key)); // depends on control dependency: [while], data = [none] } return properties; } }
public class class_name { public void marshall(BatchListObjectAttributesResponse batchListObjectAttributesResponse, ProtocolMarshaller protocolMarshaller) { if (batchListObjectAttributesResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchListObjectAttributesResponse.getAttributes(), ATTRIBUTES_BINDING); protocolMarshaller.marshall(batchListObjectAttributesResponse.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(BatchListObjectAttributesResponse batchListObjectAttributesResponse, ProtocolMarshaller protocolMarshaller) { if (batchListObjectAttributesResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchListObjectAttributesResponse.getAttributes(), ATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(batchListObjectAttributesResponse.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public HttpRequest form(Map<String, Object> formMap) { if (MapUtil.isNotEmpty(formMap)) { for (Map.Entry<String, Object> entry : formMap.entrySet()) { form(entry.getKey(), entry.getValue()); } } return this; } }
public class class_name { public HttpRequest form(Map<String, Object> formMap) { if (MapUtil.isNotEmpty(formMap)) { for (Map.Entry<String, Object> entry : formMap.entrySet()) { form(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } } return this; } }
public class class_name { public static void addId(Entry entry, boolean updateRdn) { String uuid = newUUID().toString(); try { entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, UNIQUE_OBJECT_OC); entry.add(ID_ATTRIBUTE, uuid); } catch (LdapException e) { throw new LdapRuntimeException(e); } if (updateRdn) { Dn newDn = LdapUtils.concatDn(ID_ATTRIBUTE, uuid, entry.getDn().getParent()); entry.setDn(newDn); } } }
public class class_name { public static void addId(Entry entry, boolean updateRdn) { String uuid = newUUID().toString(); try { entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, UNIQUE_OBJECT_OC); // depends on control dependency: [try], data = [none] entry.add(ID_ATTRIBUTE, uuid); // depends on control dependency: [try], data = [none] } catch (LdapException e) { throw new LdapRuntimeException(e); } // depends on control dependency: [catch], data = [none] if (updateRdn) { Dn newDn = LdapUtils.concatDn(ID_ATTRIBUTE, uuid, entry.getDn().getParent()); entry.setDn(newDn); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Constraint wampDestMatchers(WampMessageType type, String... patterns) { List<MatcherBuilder> matchers = new ArrayList<>(patterns.length); for (String pattern : patterns) { matchers.add(new PathMatcherMessageMatcherBuilder(pattern, type)); } return new Constraint(matchers); } }
public class class_name { private Constraint wampDestMatchers(WampMessageType type, String... patterns) { List<MatcherBuilder> matchers = new ArrayList<>(patterns.length); for (String pattern : patterns) { matchers.add(new PathMatcherMessageMatcherBuilder(pattern, type)); // depends on control dependency: [for], data = [pattern] } return new Constraint(matchers); } }
public class class_name { public void marshall(InputSource inputSource, ProtocolMarshaller protocolMarshaller) { if (inputSource == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(inputSource.getPasswordParam(), PASSWORDPARAM_BINDING); protocolMarshaller.marshall(inputSource.getUrl(), URL_BINDING); protocolMarshaller.marshall(inputSource.getUsername(), USERNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(InputSource inputSource, ProtocolMarshaller protocolMarshaller) { if (inputSource == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(inputSource.getPasswordParam(), PASSWORDPARAM_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(inputSource.getUrl(), URL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(inputSource.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Icon getRolloverIcon(AbstractButton b, Icon defaultIcon) { ButtonModel model = b.getModel(); Icon icon; if (model.isSelected()) { icon = getIcon(b, b.getRolloverSelectedIcon(), defaultIcon, SynthConstants.MOUSE_OVER | SynthConstants.SELECTED); } else { icon = getIcon(b, b.getRolloverIcon(), defaultIcon, SynthConstants.MOUSE_OVER); } return icon; } }
public class class_name { private Icon getRolloverIcon(AbstractButton b, Icon defaultIcon) { ButtonModel model = b.getModel(); Icon icon; if (model.isSelected()) { icon = getIcon(b, b.getRolloverSelectedIcon(), defaultIcon, SynthConstants.MOUSE_OVER | SynthConstants.SELECTED); // depends on control dependency: [if], data = [none] } else { icon = getIcon(b, b.getRolloverIcon(), defaultIcon, SynthConstants.MOUSE_OVER); // depends on control dependency: [if], data = [none] } return icon; } }
public class class_name { public <T> void cleanNullReferencesAll() { for (Map<Object, Reference<Object>> objectMap : classMaps.values()) { cleanMap(objectMap); } } }
public class class_name { public <T> void cleanNullReferencesAll() { for (Map<Object, Reference<Object>> objectMap : classMaps.values()) { cleanMap(objectMap); // depends on control dependency: [for], data = [objectMap] } } }
public class class_name { @Override public CommerceShipment remove(Serializable primaryKey) throws NoSuchShipmentException { Session session = null; try { session = openSession(); CommerceShipment commerceShipment = (CommerceShipment)session.get(CommerceShipmentImpl.class, primaryKey); if (commerceShipment == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchShipmentException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceShipment); } catch (NoSuchShipmentException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { @Override public CommerceShipment remove(Serializable primaryKey) throws NoSuchShipmentException { Session session = null; try { session = openSession(); CommerceShipment commerceShipment = (CommerceShipment)session.get(CommerceShipmentImpl.class, primaryKey); if (commerceShipment == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none] } throw new NoSuchShipmentException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceShipment); } catch (NoSuchShipmentException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { public void marshall(EventContextDataType eventContextDataType, ProtocolMarshaller protocolMarshaller) { if (eventContextDataType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(eventContextDataType.getIpAddress(), IPADDRESS_BINDING); protocolMarshaller.marshall(eventContextDataType.getDeviceName(), DEVICENAME_BINDING); protocolMarshaller.marshall(eventContextDataType.getTimezone(), TIMEZONE_BINDING); protocolMarshaller.marshall(eventContextDataType.getCity(), CITY_BINDING); protocolMarshaller.marshall(eventContextDataType.getCountry(), COUNTRY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(EventContextDataType eventContextDataType, ProtocolMarshaller protocolMarshaller) { if (eventContextDataType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(eventContextDataType.getIpAddress(), IPADDRESS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eventContextDataType.getDeviceName(), DEVICENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eventContextDataType.getTimezone(), TIMEZONE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eventContextDataType.getCity(), CITY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eventContextDataType.getCountry(), COUNTRY_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 { @Override public void setFeature(Feature feature) { for (HasFeature action : actions) { action.setFeature(feature); } presenter.setFeature(feature); } }
public class class_name { @Override public void setFeature(Feature feature) { for (HasFeature action : actions) { action.setFeature(feature); // depends on control dependency: [for], data = [action] } presenter.setFeature(feature); } }
public class class_name { public BatchGetRepositoriesResult withRepositoriesNotFound(String... repositoriesNotFound) { if (this.repositoriesNotFound == null) { setRepositoriesNotFound(new java.util.ArrayList<String>(repositoriesNotFound.length)); } for (String ele : repositoriesNotFound) { this.repositoriesNotFound.add(ele); } return this; } }
public class class_name { public BatchGetRepositoriesResult withRepositoriesNotFound(String... repositoriesNotFound) { if (this.repositoriesNotFound == null) { setRepositoriesNotFound(new java.util.ArrayList<String>(repositoriesNotFound.length)); // depends on control dependency: [if], data = [none] } for (String ele : repositoriesNotFound) { this.repositoriesNotFound.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private static boolean isEmail(String account) { if (TextUtils.isEmpty(account)) { return false; } final Pattern emailPattern = Patterns.EMAIL_ADDRESS; final Matcher matcher = emailPattern.matcher(account); return matcher.matches(); } }
public class class_name { private static boolean isEmail(String account) { if (TextUtils.isEmpty(account)) { return false; // depends on control dependency: [if], data = [none] } final Pattern emailPattern = Patterns.EMAIL_ADDRESS; final Matcher matcher = emailPattern.matcher(account); return matcher.matches(); } }
public class class_name { private Module getModule(Class<?> originalClass) { if (originalClass.getName().startsWith("java")) { return module; } else { Module definingModule = Module.forClass(originalClass); Boolean hasWeldDependencies = processedStaticModules.get(definingModule.getIdentifier()); boolean logWarning = false; // only log for the first class in the module if (hasWeldDependencies == null) { hasWeldDependencies = canLoadWeldProxies(definingModule); // may be run multiple times but that does not matter logWarning = processedStaticModules.putIfAbsent(definingModule.getIdentifier(), hasWeldDependencies) == null; } if (hasWeldDependencies) { // this module declares Weld dependencies - we can use module's classloader to load the proxy class // pros: package-private members will work fine // cons: proxy classes will remain loaded by the module's classloader after undeployment (nothing else leaks) return definingModule; } else { // no weld dependencies - we use deployment's classloader to load the proxy class // pros: proxy classes unloaded with undeployment // cons: package-private methods and constructors will yield IllegalAccessException if (logWarning) { WeldLogger.ROOT_LOGGER.loadingProxiesUsingDeploymentClassLoader(definingModule.getIdentifier(), Arrays.toString(REQUIRED_WELD_DEPENDENCIES)); } return this.module; } } } }
public class class_name { private Module getModule(Class<?> originalClass) { if (originalClass.getName().startsWith("java")) { return module; // depends on control dependency: [if], data = [none] } else { Module definingModule = Module.forClass(originalClass); Boolean hasWeldDependencies = processedStaticModules.get(definingModule.getIdentifier()); boolean logWarning = false; // only log for the first class in the module if (hasWeldDependencies == null) { hasWeldDependencies = canLoadWeldProxies(definingModule); // may be run multiple times but that does not matter // depends on control dependency: [if], data = [none] logWarning = processedStaticModules.putIfAbsent(definingModule.getIdentifier(), hasWeldDependencies) == null; // depends on control dependency: [if], data = [none] } if (hasWeldDependencies) { // this module declares Weld dependencies - we can use module's classloader to load the proxy class // pros: package-private members will work fine // cons: proxy classes will remain loaded by the module's classloader after undeployment (nothing else leaks) return definingModule; // depends on control dependency: [if], data = [none] } else { // no weld dependencies - we use deployment's classloader to load the proxy class // pros: proxy classes unloaded with undeployment // cons: package-private methods and constructors will yield IllegalAccessException if (logWarning) { WeldLogger.ROOT_LOGGER.loadingProxiesUsingDeploymentClassLoader(definingModule.getIdentifier(), Arrays.toString(REQUIRED_WELD_DEPENDENCIES)); // depends on control dependency: [if], data = [none] } return this.module; // depends on control dependency: [if], data = [none] } } } }
public class class_name { @FromString public static Interval parse(CharSequence text) { Objects.requireNonNull(text, "text"); for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '/') { return parseSplit(text.subSequence(0, i), text.subSequence(i + 1, text.length())); } } throw new DateTimeParseException("Interval cannot be parsed, no forward slash found", text, 0); } }
public class class_name { @FromString public static Interval parse(CharSequence text) { Objects.requireNonNull(text, "text"); for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '/') { return parseSplit(text.subSequence(0, i), text.subSequence(i + 1, text.length())); // depends on control dependency: [if], data = [none] } } throw new DateTimeParseException("Interval cannot be parsed, no forward slash found", text, 0); } }
public class class_name { private boolean buildList(List<List<Vertex>> theList, int index, BuildStep follow) { // Each time this method is called, we're examining a new list // from the global list. So, we have to start by getting the list // that contains the set of Vertexes we're considering. List<Vertex> l = theList.get(index); // we're interested in the case where all indexes are -1... boolean allNegOne = true; // ...and in the case where every entry has a Throwable boolean allXcps = true; for (Vertex v : l) { if (v.getIndex() != -1) { // count an empty list the same as an index of -1...this // is to patch a bug somewhere in the builder if (theList.get(v.getIndex()).size() != 0) allNegOne = false; } else { if (v.getThrowable() == null) allXcps = false; } // every entry, regardless of the final use for it, is always // entered as a possible step before we take any actions mStepList.add(new BuildStep(v, BuildStep.POSSIBLE)); } if (allNegOne) { // There are two cases that we could be looking at here. We // may need to back up, or the build may have succeeded at // this point. This is based on whether or not any // exceptions were found in the list. if (allXcps) { // we need to go back...see if this is the last one if (follow == null) mStepList.add(new BuildStep(null, BuildStep.FAIL)); else mStepList.add(new BuildStep(follow.getVertex(), BuildStep.BACK)); return false; } else { // we succeeded...now the only question is which is the // successful step? If there's only one entry without // a throwable, then that's the successful step. Otherwise, // we'll have to make some guesses... List<Vertex> possibles = new ArrayList<>(); for (Vertex v : l) { if (v.getThrowable() == null) possibles.add(v); } if (possibles.size() == 1) { // real easy...we've found the final Vertex mStepList.add(new BuildStep(possibles.get(0), BuildStep.SUCCEED)); } else { // ok...at this point, there is more than one Cert // which might be the succeed step...how do we know // which it is? I'm going to assume that our builder // algorithm is good enough to know which is the // correct one, and put it first...but a FIXME goes // here anyway, and we should be comparing to the // target/initiator Cert... mStepList.add(new BuildStep(possibles.get(0), BuildStep.SUCCEED)); } return true; } } else { // There's at least one thing that we can try before we give // up and go back. Run through the list now, and enter a new // BuildStep for each path that we try to follow. If none of // the paths we try produce a successful end, we're going to // have to back out ourselves. boolean success = false; for (Vertex v : l) { // Note that we'll only find a SUCCEED case when we're // looking at the last possible path, so we don't need to // consider success in the while loop if (v.getIndex() != -1) { if (theList.get(v.getIndex()).size() != 0) { // If the entry we're looking at doesn't have an // index of -1, and doesn't lead to an empty list, // then it's something we follow! BuildStep bs = new BuildStep(v, BuildStep.FOLLOW); mStepList.add(bs); success = buildList(theList, v.getIndex(), bs); } } } if (success) { // We're already finished! return true; } else { // We failed, and we've exhausted all the paths that we // could take. The only choice is to back ourselves out. if (follow == null) mStepList.add(new BuildStep(null, BuildStep.FAIL)); else mStepList.add(new BuildStep(follow.getVertex(), BuildStep.BACK)); return false; } } } }
public class class_name { private boolean buildList(List<List<Vertex>> theList, int index, BuildStep follow) { // Each time this method is called, we're examining a new list // from the global list. So, we have to start by getting the list // that contains the set of Vertexes we're considering. List<Vertex> l = theList.get(index); // we're interested in the case where all indexes are -1... boolean allNegOne = true; // ...and in the case where every entry has a Throwable boolean allXcps = true; for (Vertex v : l) { if (v.getIndex() != -1) { // count an empty list the same as an index of -1...this // is to patch a bug somewhere in the builder if (theList.get(v.getIndex()).size() != 0) allNegOne = false; } else { if (v.getThrowable() == null) allXcps = false; } // every entry, regardless of the final use for it, is always // entered as a possible step before we take any actions mStepList.add(new BuildStep(v, BuildStep.POSSIBLE)); // depends on control dependency: [for], data = [v] } if (allNegOne) { // There are two cases that we could be looking at here. We // may need to back up, or the build may have succeeded at // this point. This is based on whether or not any // exceptions were found in the list. if (allXcps) { // we need to go back...see if this is the last one if (follow == null) mStepList.add(new BuildStep(null, BuildStep.FAIL)); else mStepList.add(new BuildStep(follow.getVertex(), BuildStep.BACK)); return false; // depends on control dependency: [if], data = [none] } else { // we succeeded...now the only question is which is the // successful step? If there's only one entry without // a throwable, then that's the successful step. Otherwise, // we'll have to make some guesses... List<Vertex> possibles = new ArrayList<>(); for (Vertex v : l) { if (v.getThrowable() == null) possibles.add(v); } if (possibles.size() == 1) { // real easy...we've found the final Vertex mStepList.add(new BuildStep(possibles.get(0), BuildStep.SUCCEED)); // depends on control dependency: [if], data = [none] } else { // ok...at this point, there is more than one Cert // which might be the succeed step...how do we know // which it is? I'm going to assume that our builder // algorithm is good enough to know which is the // correct one, and put it first...but a FIXME goes // here anyway, and we should be comparing to the // target/initiator Cert... mStepList.add(new BuildStep(possibles.get(0), BuildStep.SUCCEED)); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } } else { // There's at least one thing that we can try before we give // up and go back. Run through the list now, and enter a new // BuildStep for each path that we try to follow. If none of // the paths we try produce a successful end, we're going to // have to back out ourselves. boolean success = false; for (Vertex v : l) { // Note that we'll only find a SUCCEED case when we're // looking at the last possible path, so we don't need to // consider success in the while loop if (v.getIndex() != -1) { if (theList.get(v.getIndex()).size() != 0) { // If the entry we're looking at doesn't have an // index of -1, and doesn't lead to an empty list, // then it's something we follow! BuildStep bs = new BuildStep(v, BuildStep.FOLLOW); mStepList.add(bs); // depends on control dependency: [if], data = [none] success = buildList(theList, v.getIndex(), bs); // depends on control dependency: [if], data = [none] } } } if (success) { // We're already finished! return true; // depends on control dependency: [if], data = [none] } else { // We failed, and we've exhausted all the paths that we // could take. The only choice is to back ourselves out. if (follow == null) mStepList.add(new BuildStep(null, BuildStep.FAIL)); else mStepList.add(new BuildStep(follow.getVertex(), BuildStep.BACK)); return false; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private Node parseParamTypeExpression(JsDocToken token) { boolean restArg = false; if (token == JsDocToken.ELLIPSIS) { token = next(); if (token == JsDocToken.RIGHT_CURLY) { restoreLookAhead(token); // EMPTY represents the UNKNOWN type in the Type AST. return wrapNode(Token.ELLIPSIS, IR.empty()); } restArg = true; } Node typeNode = parseTopLevelTypeExpression(token); if (typeNode != null) { skipEOLs(); if (restArg) { typeNode = wrapNode(Token.ELLIPSIS, typeNode); } else if (match(JsDocToken.EQUALS)) { next(); skipEOLs(); typeNode = wrapNode(Token.EQUALS, typeNode); } } return typeNode; } }
public class class_name { private Node parseParamTypeExpression(JsDocToken token) { boolean restArg = false; if (token == JsDocToken.ELLIPSIS) { token = next(); // depends on control dependency: [if], data = [none] if (token == JsDocToken.RIGHT_CURLY) { restoreLookAhead(token); // depends on control dependency: [if], data = [(token] // EMPTY represents the UNKNOWN type in the Type AST. return wrapNode(Token.ELLIPSIS, IR.empty()); // depends on control dependency: [if], data = [none] } restArg = true; // depends on control dependency: [if], data = [none] } Node typeNode = parseTopLevelTypeExpression(token); if (typeNode != null) { skipEOLs(); // depends on control dependency: [if], data = [none] if (restArg) { typeNode = wrapNode(Token.ELLIPSIS, typeNode); // depends on control dependency: [if], data = [none] } else if (match(JsDocToken.EQUALS)) { next(); // depends on control dependency: [if], data = [none] skipEOLs(); // depends on control dependency: [if], data = [none] typeNode = wrapNode(Token.EQUALS, typeNode); // depends on control dependency: [if], data = [none] } } return typeNode; } }
public class class_name { public static SelectionResult ensureSelectionResult(final Database db) { List<SelectionResult> selections = ResultUtil.filterResults(db.getHierarchy(), db, SelectionResult.class); if(!selections.isEmpty()) { return selections.get(0); } SelectionResult sel = new SelectionResult(); ResultUtil.addChildResult(db, sel); return sel; } }
public class class_name { public static SelectionResult ensureSelectionResult(final Database db) { List<SelectionResult> selections = ResultUtil.filterResults(db.getHierarchy(), db, SelectionResult.class); if(!selections.isEmpty()) { return selections.get(0); // depends on control dependency: [if], data = [none] } SelectionResult sel = new SelectionResult(); ResultUtil.addChildResult(db, sel); return sel; } }
public class class_name { public static void removeSipSessionsUtil(Context envCtx, String appName, SipSessionsUtil sipSessionsUtil) { if(envCtx != null) { try { javax.naming.Context sipContext = (javax.naming.Context)envCtx.lookup(SIP_SUBCONTEXT + "/" + appName); sipContext.unbind(SIP_SESSIONS_UTIL_JNDI_NAME); } catch (NamingException e) { logger.error(sm.getString("naming.unbindFailed", e)); } } } }
public class class_name { public static void removeSipSessionsUtil(Context envCtx, String appName, SipSessionsUtil sipSessionsUtil) { if(envCtx != null) { try { javax.naming.Context sipContext = (javax.naming.Context)envCtx.lookup(SIP_SUBCONTEXT + "/" + appName); sipContext.unbind(SIP_SESSIONS_UTIL_JNDI_NAME); // depends on control dependency: [try], data = [none] } catch (NamingException e) { logger.error(sm.getString("naming.unbindFailed", e)); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public EClass getTBM() { if (tbmEClass == null) { tbmEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(342); } return tbmEClass; } }
public class class_name { public EClass getTBM() { if (tbmEClass == null) { tbmEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(342); // depends on control dependency: [if], data = [none] } return tbmEClass; } }
public class class_name { private void DrawPrimitive( DrawEntity e, World w ) throws Exception { String oldEntityName = e.getType().getValue(); String id = null; for (EntityEntry ent : net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES) { if (ent.getName().equals(oldEntityName)) { id = ent.getRegistryName().toString(); break; } } if (id == null) return; NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setString("id", id); nbttagcompound.setBoolean("PersistenceRequired", true); // Don't let this entity despawn Entity entity; try { entity = EntityList.createEntityFromNBT(nbttagcompound, w); if (entity != null) { positionEntity(entity, e.getX().doubleValue(), e.getY().doubleValue(), e.getZ().doubleValue(), e.getYaw().floatValue(), e.getPitch().floatValue()); entity.setVelocity(e.getXVel().doubleValue(), e.getYVel().doubleValue(), e.getZVel().doubleValue()); // Set all the yaw values imaginable: if (entity instanceof EntityLivingBase) { ((EntityLivingBase)entity).rotationYaw = e.getYaw().floatValue(); ((EntityLivingBase)entity).prevRotationYaw = e.getYaw().floatValue(); ((EntityLivingBase)entity).prevRotationYawHead = e.getYaw().floatValue(); ((EntityLivingBase)entity).rotationYawHead = e.getYaw().floatValue(); ((EntityLivingBase)entity).prevRenderYawOffset = e.getYaw().floatValue(); ((EntityLivingBase)entity).renderYawOffset = e.getYaw().floatValue(); } w.getBlockState(entity.getPosition()); // Force-load the chunk if necessary, to ensure spawnEntity will work. if (!w.spawnEntity(entity)) { System.out.println("WARNING: Failed to spawn entity! Chunk not loaded?"); } } } catch (RuntimeException runtimeexception) { // Cannot summon this entity. throw new Exception("Couldn't create entity type: " + e.getType().getValue()); } } }
public class class_name { private void DrawPrimitive( DrawEntity e, World w ) throws Exception { String oldEntityName = e.getType().getValue(); String id = null; for (EntityEntry ent : net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES) { if (ent.getName().equals(oldEntityName)) { id = ent.getRegistryName().toString(); // depends on control dependency: [if], data = [none] break; } } if (id == null) return; NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setString("id", id); nbttagcompound.setBoolean("PersistenceRequired", true); // Don't let this entity despawn Entity entity; try { entity = EntityList.createEntityFromNBT(nbttagcompound, w); if (entity != null) { positionEntity(entity, e.getX().doubleValue(), e.getY().doubleValue(), e.getZ().doubleValue(), e.getYaw().floatValue(), e.getPitch().floatValue()); // depends on control dependency: [if], data = [(entity] entity.setVelocity(e.getXVel().doubleValue(), e.getYVel().doubleValue(), e.getZVel().doubleValue()); // depends on control dependency: [if], data = [none] // Set all the yaw values imaginable: if (entity instanceof EntityLivingBase) { ((EntityLivingBase)entity).rotationYaw = e.getYaw().floatValue(); // depends on control dependency: [if], data = [none] ((EntityLivingBase)entity).prevRotationYaw = e.getYaw().floatValue(); // depends on control dependency: [if], data = [none] ((EntityLivingBase)entity).prevRotationYawHead = e.getYaw().floatValue(); // depends on control dependency: [if], data = [none] ((EntityLivingBase)entity).rotationYawHead = e.getYaw().floatValue(); // depends on control dependency: [if], data = [none] ((EntityLivingBase)entity).prevRenderYawOffset = e.getYaw().floatValue(); // depends on control dependency: [if], data = [none] ((EntityLivingBase)entity).renderYawOffset = e.getYaw().floatValue(); // depends on control dependency: [if], data = [none] } w.getBlockState(entity.getPosition()); // Force-load the chunk if necessary, to ensure spawnEntity will work. // depends on control dependency: [if], data = [(entity] if (!w.spawnEntity(entity)) { System.out.println("WARNING: Failed to spawn entity! Chunk not loaded?"); // depends on control dependency: [if], data = [none] } } } catch (RuntimeException runtimeexception) { // Cannot summon this entity. throw new Exception("Couldn't create entity type: " + e.getType().getValue()); } } }
public class class_name { boolean run(Iterable<? extends Archive> archives, Map<Location, Archive> locationMap) { this.locationToArchive.putAll(locationMap); // traverse and analyze all dependencies for (Archive archive : archives) { Dependences deps = new Dependences(archive, type); archive.visitDependences(deps); results.put(archive, deps); } return true; } }
public class class_name { boolean run(Iterable<? extends Archive> archives, Map<Location, Archive> locationMap) { this.locationToArchive.putAll(locationMap); // traverse and analyze all dependencies for (Archive archive : archives) { Dependences deps = new Dependences(archive, type); archive.visitDependences(deps); // depends on control dependency: [for], data = [archive] results.put(archive, deps); // depends on control dependency: [for], data = [archive] } return true; } }
public class class_name { public JKTableColumn getTableColumn(final int col, final boolean visibleIndex) { int actualIndex; if (visibleIndex) { actualIndex = this.visibilityManager.getActualIndexFromVisibleIndex(col); } else { actualIndex = col; } return this.tableColumns.get(actualIndex); } }
public class class_name { public JKTableColumn getTableColumn(final int col, final boolean visibleIndex) { int actualIndex; if (visibleIndex) { actualIndex = this.visibilityManager.getActualIndexFromVisibleIndex(col); // depends on control dependency: [if], data = [none] } else { actualIndex = col; // depends on control dependency: [if], data = [none] } return this.tableColumns.get(actualIndex); } }
public class class_name { public void marshall(PutSkillAuthorizationRequest putSkillAuthorizationRequest, ProtocolMarshaller protocolMarshaller) { if (putSkillAuthorizationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putSkillAuthorizationRequest.getAuthorizationResult(), AUTHORIZATIONRESULT_BINDING); protocolMarshaller.marshall(putSkillAuthorizationRequest.getSkillId(), SKILLID_BINDING); protocolMarshaller.marshall(putSkillAuthorizationRequest.getRoomArn(), ROOMARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PutSkillAuthorizationRequest putSkillAuthorizationRequest, ProtocolMarshaller protocolMarshaller) { if (putSkillAuthorizationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putSkillAuthorizationRequest.getAuthorizationResult(), AUTHORIZATIONRESULT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putSkillAuthorizationRequest.getSkillId(), SKILLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putSkillAuthorizationRequest.getRoomArn(), ROOMARN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private int getDaysToNextMatch(WeekDay weekDay) { for (WeekDay wd : m_weekDays) { if (wd.compareTo(weekDay) > 0) { return wd.toInt() - weekDay.toInt(); } } return (m_weekDays.iterator().next().toInt() + (m_interval * I_CmsSerialDateValue.NUM_OF_WEEKDAYS)) - weekDay.toInt(); } }
public class class_name { private int getDaysToNextMatch(WeekDay weekDay) { for (WeekDay wd : m_weekDays) { if (wd.compareTo(weekDay) > 0) { return wd.toInt() - weekDay.toInt(); // depends on control dependency: [if], data = [none] } } return (m_weekDays.iterator().next().toInt() + (m_interval * I_CmsSerialDateValue.NUM_OF_WEEKDAYS)) - weekDay.toInt(); } }
public class class_name { public boolean checked() { boolean isChecked = false; try { isChecked = element.getWebElement().isSelected(); } catch (Exception e) { log.info(e); } return isChecked; } }
public class class_name { public boolean checked() { boolean isChecked = false; try { isChecked = element.getWebElement().isSelected(); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.info(e); } // depends on control dependency: [catch], data = [none] return isChecked; } }
public class class_name { public static ImageArchiveManifest readManifest(InputStream inputStream) throws IOException, JsonParseException { Map<String, JsonParseException> parseExceptions = new LinkedHashMap<>(); Map<String, JsonElement> parsedEntries = new LinkedHashMap<>(); try (TarArchiveInputStream tarStream = new TarArchiveInputStream(createUncompressedStream(inputStream))) { TarArchiveEntry tarEntry; Gson gson = new Gson(); while((tarEntry = tarStream.getNextTarEntry()) != null) { if(tarEntry.isFile() && tarEntry.getName().endsWith(".json")) { try { JsonElement element = gson.fromJson(new InputStreamReader(tarStream, StandardCharsets.UTF_8), JsonElement.class); parsedEntries.put(tarEntry.getName(), element); } catch(JsonParseException exception) { parseExceptions.put(tarEntry.getName(), exception); } } } } JsonElement manifestJson = parsedEntries.get(MANIFEST_JSON); if(manifestJson == null) { JsonParseException parseException = parseExceptions.get(MANIFEST_JSON); if(parseException != null) { throw parseException; } return null; } ImageArchiveManifestAdapter manifest = new ImageArchiveManifestAdapter(manifestJson); for(ImageArchiveManifestEntry entry : manifest.getEntries()) { JsonElement entryConfigJson = parsedEntries.get(entry.getConfig()); if(entryConfigJson != null && entryConfigJson.isJsonObject()) { manifest.putConfig(entry.getConfig(), entryConfigJson.getAsJsonObject()); } } return manifest; } }
public class class_name { public static ImageArchiveManifest readManifest(InputStream inputStream) throws IOException, JsonParseException { Map<String, JsonParseException> parseExceptions = new LinkedHashMap<>(); Map<String, JsonElement> parsedEntries = new LinkedHashMap<>(); try (TarArchiveInputStream tarStream = new TarArchiveInputStream(createUncompressedStream(inputStream))) { TarArchiveEntry tarEntry; Gson gson = new Gson(); while((tarEntry = tarStream.getNextTarEntry()) != null) { if(tarEntry.isFile() && tarEntry.getName().endsWith(".json")) { try { JsonElement element = gson.fromJson(new InputStreamReader(tarStream, StandardCharsets.UTF_8), JsonElement.class); parsedEntries.put(tarEntry.getName(), element); // depends on control dependency: [try], data = [none] } catch(JsonParseException exception) { parseExceptions.put(tarEntry.getName(), exception); } // depends on control dependency: [catch], data = [none] } } } JsonElement manifestJson = parsedEntries.get(MANIFEST_JSON); if(manifestJson == null) { JsonParseException parseException = parseExceptions.get(MANIFEST_JSON); if(parseException != null) { throw parseException; } return null; } ImageArchiveManifestAdapter manifest = new ImageArchiveManifestAdapter(manifestJson); for(ImageArchiveManifestEntry entry : manifest.getEntries()) { JsonElement entryConfigJson = parsedEntries.get(entry.getConfig()); if(entryConfigJson != null && entryConfigJson.isJsonObject()) { manifest.putConfig(entry.getConfig(), entryConfigJson.getAsJsonObject()); // depends on control dependency: [if], data = [none] } } return manifest; } }
public class class_name { private static boolean appearsInAssignmentContext(Expression expression) { if (expression.getParentNode().isPresent()) { Node parent = expression.getParentNode().get(); if (parent instanceof ExpressionStmt) { return false; } if (parent instanceof MethodCallExpr) { return false; } if (parent instanceof ReturnStmt) { return false; } throw new UnsupportedOperationException(parent.getClass().getCanonicalName()); } return false; } }
public class class_name { private static boolean appearsInAssignmentContext(Expression expression) { if (expression.getParentNode().isPresent()) { Node parent = expression.getParentNode().get(); if (parent instanceof ExpressionStmt) { return false; // depends on control dependency: [if], data = [none] } if (parent instanceof MethodCallExpr) { return false; // depends on control dependency: [if], data = [none] } if (parent instanceof ReturnStmt) { return false; // depends on control dependency: [if], data = [none] } throw new UnsupportedOperationException(parent.getClass().getCanonicalName()); } return false; } }
public class class_name { public static Set<AtlasResourceTypes> getAtlasResourceType(String contextPath) { Set<AtlasResourceTypes> resourceTypes = new HashSet<>(); if (isDebugEnabled) { LOG.debug("==> getAtlasResourceType for {}", contextPath); } String api = getApi(contextPath); if (api.startsWith("types")) { resourceTypes.add(AtlasResourceTypes.TYPE); } else if (api.startsWith("admin") && (contextPath.contains("/session") || contextPath.contains("/version"))) { resourceTypes.add(AtlasResourceTypes.UNKNOWN); } else if ((api.startsWith("discovery") && contextPath.contains("/gremlin")) || api.startsWith("admin") || api.startsWith("graph")) { resourceTypes.add(AtlasResourceTypes.OPERATION); } else if (api.startsWith("entities") || api.startsWith("lineage") || api.startsWith("discovery") || api.startsWith("entity") || api.startsWith("search")) { resourceTypes.add(AtlasResourceTypes.ENTITY); } else if (api.startsWith("taxonomies")) { resourceTypes.add(AtlasResourceTypes.TAXONOMY); // taxonomies are modeled as entities resourceTypes.add(AtlasResourceTypes.ENTITY); if (contextPath.contains("/terms")) { resourceTypes.add(AtlasResourceTypes.TERM); } } else if (api.startsWith("relationship")) { resourceTypes.add(AtlasResourceTypes.RELATIONSHIP); } else { LOG.error("Unable to find Atlas Resource corresponding to : {}\nSetting {}" , api, AtlasResourceTypes.UNKNOWN.name()); resourceTypes.add(AtlasResourceTypes.UNKNOWN); } if (isDebugEnabled) { LOG.debug("<== Returning AtlasResources {} for api {}", resourceTypes, api); } return resourceTypes; } }
public class class_name { public static Set<AtlasResourceTypes> getAtlasResourceType(String contextPath) { Set<AtlasResourceTypes> resourceTypes = new HashSet<>(); if (isDebugEnabled) { LOG.debug("==> getAtlasResourceType for {}", contextPath); // depends on control dependency: [if], data = [none] } String api = getApi(contextPath); if (api.startsWith("types")) { resourceTypes.add(AtlasResourceTypes.TYPE); // depends on control dependency: [if], data = [none] } else if (api.startsWith("admin") && (contextPath.contains("/session") || contextPath.contains("/version"))) { resourceTypes.add(AtlasResourceTypes.UNKNOWN); // depends on control dependency: [if], data = [none] } else if ((api.startsWith("discovery") && contextPath.contains("/gremlin")) || api.startsWith("admin") || api.startsWith("graph")) { resourceTypes.add(AtlasResourceTypes.OPERATION); // depends on control dependency: [if], data = [none] } else if (api.startsWith("entities") || api.startsWith("lineage") || api.startsWith("discovery") || api.startsWith("entity") || api.startsWith("search")) { resourceTypes.add(AtlasResourceTypes.ENTITY); // depends on control dependency: [if], data = [none] } else if (api.startsWith("taxonomies")) { resourceTypes.add(AtlasResourceTypes.TAXONOMY); // depends on control dependency: [if], data = [none] // taxonomies are modeled as entities resourceTypes.add(AtlasResourceTypes.ENTITY); // depends on control dependency: [if], data = [none] if (contextPath.contains("/terms")) { resourceTypes.add(AtlasResourceTypes.TERM); // depends on control dependency: [if], data = [none] } } else if (api.startsWith("relationship")) { resourceTypes.add(AtlasResourceTypes.RELATIONSHIP); // depends on control dependency: [if], data = [none] } else { LOG.error("Unable to find Atlas Resource corresponding to : {}\nSetting {}" , api, AtlasResourceTypes.UNKNOWN.name()); // depends on control dependency: [if], data = [none] resourceTypes.add(AtlasResourceTypes.UNKNOWN); // depends on control dependency: [if], data = [none] } if (isDebugEnabled) { LOG.debug("<== Returning AtlasResources {} for api {}", resourceTypes, api); // depends on control dependency: [if], data = [none] } return resourceTypes; } }
public class class_name { public static IComplexNDArray truncate(IComplexNDArray nd, int n, int dimension) { if (nd.isVector()) { IComplexNDArray truncated = Nd4j.createComplex(new int[] {1, n}); for (int i = 0; i < n; i++) truncated.putScalar(i, nd.getComplex(i)); return truncated; } if (nd.size(dimension) > n) { long[] shape = ArrayUtil.copy(nd.shape()); shape[dimension] = n; IComplexNDArray ret = Nd4j.createComplex(shape); IComplexNDArray ndLinear = nd.linearView(); IComplexNDArray retLinear = ret.linearView(); for (int i = 0; i < ret.length(); i++) retLinear.putScalar(i, ndLinear.getComplex(i)); return ret; } return nd; } }
public class class_name { public static IComplexNDArray truncate(IComplexNDArray nd, int n, int dimension) { if (nd.isVector()) { IComplexNDArray truncated = Nd4j.createComplex(new int[] {1, n}); for (int i = 0; i < n; i++) truncated.putScalar(i, nd.getComplex(i)); return truncated; // depends on control dependency: [if], data = [none] } if (nd.size(dimension) > n) { long[] shape = ArrayUtil.copy(nd.shape()); shape[dimension] = n; // depends on control dependency: [if], data = [none] IComplexNDArray ret = Nd4j.createComplex(shape); IComplexNDArray ndLinear = nd.linearView(); IComplexNDArray retLinear = ret.linearView(); for (int i = 0; i < ret.length(); i++) retLinear.putScalar(i, ndLinear.getComplex(i)); return ret; // depends on control dependency: [if], data = [none] } return nd; } }
public class class_name { protected static Number minimum(List<?> slaveValues) { Number min = null; for (Object slaveValue : slaveValues) { if (min == null) { min = (Number) slaveValue; } else { Comparable<Object> comparable = NumberComparator.getComparable(min); if (comparable.compareTo(slaveValue) > 0) { min = (Number) slaveValue; } } } return min; } }
public class class_name { protected static Number minimum(List<?> slaveValues) { Number min = null; for (Object slaveValue : slaveValues) { if (min == null) { min = (Number) slaveValue; // depends on control dependency: [if], data = [none] } else { Comparable<Object> comparable = NumberComparator.getComparable(min); if (comparable.compareTo(slaveValue) > 0) { min = (Number) slaveValue; // depends on control dependency: [if], data = [none] } } } return min; } }
public class class_name { Changes findChanges(InvocationInfo invocationInfo) { /* Methods with one or fewer parameters cannot possibly have a swap */ if (invocationInfo.formalParameters().size() <= 1) { return Changes.empty(); } /* Sometimes we don't have enough actual parameters. This seems to happen sometimes with calls * to super and javac finds two parameters arg0 and arg1 and no arguments */ if (invocationInfo.actualParameters().size() < invocationInfo.formalParameters().size()) { return Changes.empty(); } ImmutableList<Parameter> formals = Parameter.createListFromVarSymbols(invocationInfo.formalParameters()); ImmutableList<Parameter> actuals = Parameter.createListFromExpressionTrees( invocationInfo.actualParameters().subList(0, invocationInfo.formalParameters().size())); Costs costs = new Costs(formals, actuals); /* Set the distance between a pair to Inf if not assignable */ costs .viablePairs() .filter(ParameterPair::isAlternativePairing) .filter(p -> !p.actual().isAssignableTo(p.formal(), invocationInfo.state())) .forEach(p -> costs.invalidatePair(p)); /* If there are no formal parameters which are assignable to any alternative actual parameters then we can stop without trying to look for permutations */ if (costs.viablePairs().noneMatch(ParameterPair::isAlternativePairing)) { return Changes.empty(); } /* Set the lexical distance between pairs */ costs.viablePairs().forEach(p -> costs.updatePair(p, distanceFunction().apply(p))); Changes changes = costs.computeAssignments(); if (changes.isEmpty()) { return changes; } /* Only keep this change if all of the heuristics match */ for (Heuristic heuristic : heuristics()) { if (!heuristic.isAcceptableChange( changes, invocationInfo.tree(), invocationInfo.symbol(), invocationInfo.state())) { return Changes.empty(); } } return changes; } }
public class class_name { Changes findChanges(InvocationInfo invocationInfo) { /* Methods with one or fewer parameters cannot possibly have a swap */ if (invocationInfo.formalParameters().size() <= 1) { return Changes.empty(); // depends on control dependency: [if], data = [none] } /* Sometimes we don't have enough actual parameters. This seems to happen sometimes with calls * to super and javac finds two parameters arg0 and arg1 and no arguments */ if (invocationInfo.actualParameters().size() < invocationInfo.formalParameters().size()) { return Changes.empty(); // depends on control dependency: [if], data = [none] } ImmutableList<Parameter> formals = Parameter.createListFromVarSymbols(invocationInfo.formalParameters()); ImmutableList<Parameter> actuals = Parameter.createListFromExpressionTrees( invocationInfo.actualParameters().subList(0, invocationInfo.formalParameters().size())); Costs costs = new Costs(formals, actuals); /* Set the distance between a pair to Inf if not assignable */ costs .viablePairs() .filter(ParameterPair::isAlternativePairing) .filter(p -> !p.actual().isAssignableTo(p.formal(), invocationInfo.state())) .forEach(p -> costs.invalidatePair(p)); /* If there are no formal parameters which are assignable to any alternative actual parameters then we can stop without trying to look for permutations */ if (costs.viablePairs().noneMatch(ParameterPair::isAlternativePairing)) { return Changes.empty(); // depends on control dependency: [if], data = [none] } /* Set the lexical distance between pairs */ costs.viablePairs().forEach(p -> costs.updatePair(p, distanceFunction().apply(p))); Changes changes = costs.computeAssignments(); if (changes.isEmpty()) { return changes; // depends on control dependency: [if], data = [none] } /* Only keep this change if all of the heuristics match */ for (Heuristic heuristic : heuristics()) { if (!heuristic.isAcceptableChange( changes, invocationInfo.tree(), invocationInfo.symbol(), invocationInfo.state())) { return Changes.empty(); // depends on control dependency: [if], data = [none] } } return changes; } }
public class class_name { public static Authenticator getAuthenticator(final LdapAuthenticationProperties l) { if (l.getType() == LdapAuthenticationProperties.AuthenticationTypes.AD) { LOGGER.debug("Creating active directory authenticator for {}", l.getLdapUrl()); return getActiveDirectoryAuthenticator(l); } if (l.getType() == LdapAuthenticationProperties.AuthenticationTypes.DIRECT) { LOGGER.debug("Creating direct-bind authenticator for {}", l.getLdapUrl()); return getDirectBindAuthenticator(l); } if (l.getType() == LdapAuthenticationProperties.AuthenticationTypes.SASL) { LOGGER.debug("Creating SASL authenticator for {}", l.getLdapUrl()); return getSaslAuthenticator(l); } if (l.getType() == LdapAuthenticationProperties.AuthenticationTypes.AUTHENTICATED) { LOGGER.debug("Creating authenticated authenticator for {}", l.getLdapUrl()); return getAuthenticatedOrAnonSearchAuthenticator(l); } LOGGER.debug("Creating anonymous authenticator for {}", l.getLdapUrl()); return getAuthenticatedOrAnonSearchAuthenticator(l); } }
public class class_name { public static Authenticator getAuthenticator(final LdapAuthenticationProperties l) { if (l.getType() == LdapAuthenticationProperties.AuthenticationTypes.AD) { LOGGER.debug("Creating active directory authenticator for {}", l.getLdapUrl()); // depends on control dependency: [if], data = [none] return getActiveDirectoryAuthenticator(l); // depends on control dependency: [if], data = [none] } if (l.getType() == LdapAuthenticationProperties.AuthenticationTypes.DIRECT) { LOGGER.debug("Creating direct-bind authenticator for {}", l.getLdapUrl()); // depends on control dependency: [if], data = [none] return getDirectBindAuthenticator(l); // depends on control dependency: [if], data = [none] } if (l.getType() == LdapAuthenticationProperties.AuthenticationTypes.SASL) { LOGGER.debug("Creating SASL authenticator for {}", l.getLdapUrl()); // depends on control dependency: [if], data = [none] return getSaslAuthenticator(l); // depends on control dependency: [if], data = [none] } if (l.getType() == LdapAuthenticationProperties.AuthenticationTypes.AUTHENTICATED) { LOGGER.debug("Creating authenticated authenticator for {}", l.getLdapUrl()); return getAuthenticatedOrAnonSearchAuthenticator(l); } LOGGER.debug("Creating anonymous authenticator for {}", l.getLdapUrl()); return getAuthenticatedOrAnonSearchAuthenticator(l); } }
public class class_name { public AbstractStreamParameters addLocation(float west, float south, float east, float north) { if (locations.length() > 0) { locations.append(','); } locations.append(west).append(',').append(south).append(','); locations.append(east).append(',').append(north).append(','); return this; } }
public class class_name { public AbstractStreamParameters addLocation(float west, float south, float east, float north) { if (locations.length() > 0) { locations.append(','); // depends on control dependency: [if], data = [none] } locations.append(west).append(',').append(south).append(','); locations.append(east).append(',').append(north).append(','); return this; } }
public class class_name { private static String parseNamedSql(String sql, Map<String, List<Integer>> nameIndexMap) { // I was originally using regular expressions, but they didn't work well for ignoring // parameter-like strings inside quotes. int length = sql.length(); StringBuffer parsedSql = new StringBuffer(length); boolean inSingleQuote = false; boolean inDoubleQuote = false; int index = 1; for (int i = 0; i < length; i++) { char c = sql.charAt(i); if (inSingleQuote) { if (c == '\'') { inSingleQuote = false; } } else if (inDoubleQuote) { if (c == '"') { inDoubleQuote = false; } } else { if (c == '\'') { inSingleQuote = true; } else if (c == '"') { inDoubleQuote = true; } else if (c == ':' && i + 1 < length && Character.isJavaIdentifierStart(sql.charAt(i + 1))) { int j = i + 2; while (j < length && Character.isJavaIdentifierPart(sql.charAt(j))) { j++; } String name = sql.substring(i + 1, j); c = '?'; // replace the parameter with a question mark i += name.length(); // skip past the end if the parameter List<Integer> indexList = nameIndexMap.get(name); if (indexList == null) { indexList = new LinkedList<Integer>(); nameIndexMap.put(name, indexList); } indexList.add(index); index++; } } parsedSql.append(c); } return parsedSql.toString(); } }
public class class_name { private static String parseNamedSql(String sql, Map<String, List<Integer>> nameIndexMap) { // I was originally using regular expressions, but they didn't work well for ignoring // parameter-like strings inside quotes. int length = sql.length(); StringBuffer parsedSql = new StringBuffer(length); boolean inSingleQuote = false; boolean inDoubleQuote = false; int index = 1; for (int i = 0; i < length; i++) { char c = sql.charAt(i); if (inSingleQuote) { if (c == '\'') { inSingleQuote = false; // depends on control dependency: [if], data = [none] } } else if (inDoubleQuote) { if (c == '"') { inDoubleQuote = false; // depends on control dependency: [if], data = [none] } } else { if (c == '\'') { inSingleQuote = true; // depends on control dependency: [if], data = [none] } else if (c == '"') { inDoubleQuote = true; // depends on control dependency: [if], data = [none] } else if (c == ':' && i + 1 < length && Character.isJavaIdentifierStart(sql.charAt(i + 1))) { int j = i + 2; while (j < length && Character.isJavaIdentifierPart(sql.charAt(j))) { j++; // depends on control dependency: [while], data = [none] } String name = sql.substring(i + 1, j); c = '?'; // replace the parameter with a question mark // depends on control dependency: [if], data = [none] i += name.length(); // skip past the end if the parameter // depends on control dependency: [if], data = [none] List<Integer> indexList = nameIndexMap.get(name); if (indexList == null) { indexList = new LinkedList<Integer>(); // depends on control dependency: [if], data = [none] nameIndexMap.put(name, indexList); // depends on control dependency: [if], data = [none] } indexList.add(index); // depends on control dependency: [if], data = [none] index++; // depends on control dependency: [if], data = [none] } } parsedSql.append(c); // depends on control dependency: [for], data = [none] } return parsedSql.toString(); } }
public class class_name { private static CSLName[] toAuthors(List<Map<String, Object>> authors) { CSLName[] result = new CSLName[authors.size()]; int i = 0; for (Map<String, Object> a : authors) { CSLNameBuilder builder = new CSLNameBuilder(); if (a.containsKey(FIELD_FIRSTNAME)) { builder.given(strOrNull(a.get(FIELD_FIRSTNAME))); } if (a.containsKey(FIELD_LASTNAME)) { builder.family(strOrNull(a.get(FIELD_LASTNAME))); } builder.parseNames(true); result[i] = builder.build(); ++i; } return result; } }
public class class_name { private static CSLName[] toAuthors(List<Map<String, Object>> authors) { CSLName[] result = new CSLName[authors.size()]; int i = 0; for (Map<String, Object> a : authors) { CSLNameBuilder builder = new CSLNameBuilder(); if (a.containsKey(FIELD_FIRSTNAME)) { builder.given(strOrNull(a.get(FIELD_FIRSTNAME))); // depends on control dependency: [if], data = [none] } if (a.containsKey(FIELD_LASTNAME)) { builder.family(strOrNull(a.get(FIELD_LASTNAME))); // depends on control dependency: [if], data = [none] } builder.parseNames(true); // depends on control dependency: [for], data = [a] result[i] = builder.build(); // depends on control dependency: [for], data = [none] ++i; // depends on control dependency: [for], data = [none] } return result; } }
public class class_name { private Task createTaskBase(TaskModel model, Execution execution) { Task task = new Task(); task.setOrderId(execution.getOrder().getId()); task.setTaskName(model.getName()); task.setDisplayName(model.getDisplayName()); task.setCreateTime(DateHelper.getTime()); if(model.isMajor()) { task.setTaskType(TaskType.Major.ordinal()); } else { task.setTaskType(TaskType.Aidant.ordinal()); } task.setParentTaskId(execution.getTask() == null ? START : execution.getTask().getId()); task.setModel(model); return task; } }
public class class_name { private Task createTaskBase(TaskModel model, Execution execution) { Task task = new Task(); task.setOrderId(execution.getOrder().getId()); task.setTaskName(model.getName()); task.setDisplayName(model.getDisplayName()); task.setCreateTime(DateHelper.getTime()); if(model.isMajor()) { task.setTaskType(TaskType.Major.ordinal()); // depends on control dependency: [if], data = [none] } else { task.setTaskType(TaskType.Aidant.ordinal()); // depends on control dependency: [if], data = [none] } task.setParentTaskId(execution.getTask() == null ? START : execution.getTask().getId()); task.setModel(model); return task; } }
public class class_name { @Override public void close() throws IOException { // first close the parent so we get all remaining data super.close(); // then ensure that any remaining buffer is logged synchronized (logBuffer) { if(logBuffer.length() > 0) { log.info(logBuffer.toString()); logBuffer.setLength(0); lastFlush = System.currentTimeMillis(); } } } }
public class class_name { @Override public void close() throws IOException { // first close the parent so we get all remaining data super.close(); // then ensure that any remaining buffer is logged synchronized (logBuffer) { if(logBuffer.length() > 0) { log.info(logBuffer.toString()); // depends on control dependency: [if], data = [none] logBuffer.setLength(0); // depends on control dependency: [if], data = [0)] lastFlush = System.currentTimeMillis(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void beforeStep(StepExecution stepExecution) { super.beforeStep(stepExecution); try { RestoreStatus newStatus = RestoreStatus.TRANSFERRING_TO_DURACLOUD; restoreManager.transitionRestoreStatus(restorationId, newStatus, ""); Space space = this.contentStore.getSpace(destinationSpaceId, null, 1, null); if (!CollectionUtils.isEmpty(space.getContentIds())) { stepExecution.addFailureException(new RuntimeException("destination space " + destinationSpaceId + " must be empty to receive restored content")); } } catch (NotFoundException ex) { try { this.contentStore.createSpace(destinationSpaceId); } catch (ContentStoreException e) { addError(ex.getMessage()); stepExecution.addFailureException(e); } } catch (Exception ex) { addError(ex.getMessage()); stepExecution.addFailureException(ex); } } }
public class class_name { @Override public void beforeStep(StepExecution stepExecution) { super.beforeStep(stepExecution); try { RestoreStatus newStatus = RestoreStatus.TRANSFERRING_TO_DURACLOUD; restoreManager.transitionRestoreStatus(restorationId, newStatus, ""); // depends on control dependency: [try], data = [none] Space space = this.contentStore.getSpace(destinationSpaceId, null, 1, null); if (!CollectionUtils.isEmpty(space.getContentIds())) { stepExecution.addFailureException(new RuntimeException("destination space " + destinationSpaceId + " must be empty to receive restored content")); // depends on control dependency: [if], data = [none] } } catch (NotFoundException ex) { try { this.contentStore.createSpace(destinationSpaceId); // depends on control dependency: [try], data = [none] } catch (ContentStoreException e) { addError(ex.getMessage()); stepExecution.addFailureException(e); } // depends on control dependency: [catch], data = [none] } catch (Exception ex) { // depends on control dependency: [catch], data = [none] addError(ex.getMessage()); stepExecution.addFailureException(ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ResourcePath join(String otherPath) { if (otherPath == null) { throw new IllegalArgumentException("The join(String) method cannot be called with a null argument"); } DynamicArray<String> components = tokenizePathFragment(otherPath, 0); ResourcePath result = this; for (int i = 0; i < components.size; i++) { String s = (String) components.data[i]; if (s.equals(".") || s.equals("/") || s.equals("\\") || s.equals("")) { // no-op } else if (s.equals("..")) { result = result.getParent(); if (result == null) { throw new IllegalArgumentException("Joining the path [" + otherPath + "] to the base path [" + getPathString() + "] resulted in traversing backwards past the root path element"); } } else { result = new ResourcePath(result, s); } } return result; } }
public class class_name { public ResourcePath join(String otherPath) { if (otherPath == null) { throw new IllegalArgumentException("The join(String) method cannot be called with a null argument"); } DynamicArray<String> components = tokenizePathFragment(otherPath, 0); ResourcePath result = this; for (int i = 0; i < components.size; i++) { String s = (String) components.data[i]; if (s.equals(".") || s.equals("/") || s.equals("\\") || s.equals("")) { // no-op } else if (s.equals("..")) { result = result.getParent(); // depends on control dependency: [if], data = [none] if (result == null) { throw new IllegalArgumentException("Joining the path [" + otherPath + "] to the base path [" + getPathString() + "] resulted in traversing backwards past the root path element"); } } else { result = new ResourcePath(result, s); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { private void fillWizardPageWithSelectedTypes() { final StructuredSelection selection = getSelectedItems(); if (selection == null) { return; } for (final Iterator<?> iter = selection.iterator(); iter.hasNext();) { final Object obj = iter.next(); if (obj instanceof TypeNameMatch) { accessedHistoryItem(obj); final TypeNameMatch type = (TypeNameMatch) obj; final String qualifiedName = Utilities.getNameWithTypeParameters(type.getType()); final String message; if (addTypeToWizardPage(this.typeWizardPage, qualifiedName)) { message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_2, TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS)); } else { message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_3, TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS)); } updateStatus(new StatusInfo(IStatus.INFO, message)); } } } }
public class class_name { private void fillWizardPageWithSelectedTypes() { final StructuredSelection selection = getSelectedItems(); if (selection == null) { return; // depends on control dependency: [if], data = [none] } for (final Iterator<?> iter = selection.iterator(); iter.hasNext();) { final Object obj = iter.next(); if (obj instanceof TypeNameMatch) { accessedHistoryItem(obj); // depends on control dependency: [if], data = [none] final TypeNameMatch type = (TypeNameMatch) obj; final String qualifiedName = Utilities.getNameWithTypeParameters(type.getType()); final String message; if (addTypeToWizardPage(this.typeWizardPage, qualifiedName)) { message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_2, TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS)); // depends on control dependency: [if], data = [none] } else { message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_3, TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS)); // depends on control dependency: [if], data = [none] } updateStatus(new StatusInfo(IStatus.INFO, message)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public int percentile(int p) { if (p < 1 || p > 100) { throw new IllegalArgumentException("invalid percentile: " + p); } int count = 0; // Count of values in the histogram. for (int i = 0; i < buckets.length; i++) { count += buckets[i]; } if (count == 0) { // Empty histogram. Need to special-case it, otherwise return 0; // the `if (count <= p)' below will be erroneously true. } // Find the number of elements at or below which the pth percentile is. p = count * p / 100; // Now walk the array backwards and decrement the count until it reaches p. for (int i = buckets.length - 1; i >= 0; i--) { count -= buckets[i]; if (count <= p) { return bucketHighInterval(i); } } return 0; } }
public class class_name { public int percentile(int p) { if (p < 1 || p > 100) { throw new IllegalArgumentException("invalid percentile: " + p); } int count = 0; // Count of values in the histogram. for (int i = 0; i < buckets.length; i++) { count += buckets[i]; // depends on control dependency: [for], data = [i] } if (count == 0) { // Empty histogram. Need to special-case it, otherwise return 0; // the `if (count <= p)' below will be erroneously true. // depends on control dependency: [if], data = [none] } // Find the number of elements at or below which the pth percentile is. p = count * p / 100; // Now walk the array backwards and decrement the count until it reaches p. for (int i = buckets.length - 1; i >= 0; i--) { count -= buckets[i]; // depends on control dependency: [for], data = [i] if (count <= p) { return bucketHighInterval(i); // depends on control dependency: [if], data = [none] } } return 0; } }
public class class_name { public EJBObject[] loadEntireCollection() { EJBObject[] result = null; try { result = (EJBObject[]) allRemainingElements(); } catch (NoMoreElementsException e) { // FFDCFilter.processException(e, CLASS_NAME + ".loadEntireCollection", // "270", this); return elements; } catch (EnumeratorException e) { // FFDCFilter.processException(e, CLASS_NAME + ".loadEntireCollection", // "276", this); throw new RuntimeException(e.toString()); } catch (RemoteException e) { // FFDCFilter.processException(e, CLASS_NAME + ".loadEntireCollection", // "282", this); throw new RuntimeException(e.toString()); } elements = result; return result; } }
public class class_name { public EJBObject[] loadEntireCollection() { EJBObject[] result = null; try { result = (EJBObject[]) allRemainingElements(); // depends on control dependency: [try], data = [none] } catch (NoMoreElementsException e) { // FFDCFilter.processException(e, CLASS_NAME + ".loadEntireCollection", // "270", this); return elements; } catch (EnumeratorException e) { // depends on control dependency: [catch], data = [none] // FFDCFilter.processException(e, CLASS_NAME + ".loadEntireCollection", // "276", this); throw new RuntimeException(e.toString()); } catch (RemoteException e) { // depends on control dependency: [catch], data = [none] // FFDCFilter.processException(e, CLASS_NAME + ".loadEntireCollection", // "282", this); throw new RuntimeException(e.toString()); } // depends on control dependency: [catch], data = [none] elements = result; return result; } }
public class class_name { protected boolean shouldAddToIndexMap(Element element) { if (utils.isHidden(element)) { return false; } if (utils.isPackage(element)) // Do not add to index map if -nodeprecated option is set and the // package is marked as deprecated. return !(noDeprecated && configuration.utils.isDeprecated(element)); else // Do not add to index map if -nodeprecated option is set and if the // element is marked as deprecated or the containing package is marked as // deprecated. return !(noDeprecated && (configuration.utils.isDeprecated(element) || configuration.utils.isDeprecated(utils.containingPackage(element)))); } }
public class class_name { protected boolean shouldAddToIndexMap(Element element) { if (utils.isHidden(element)) { return false; // depends on control dependency: [if], data = [none] } if (utils.isPackage(element)) // Do not add to index map if -nodeprecated option is set and the // package is marked as deprecated. return !(noDeprecated && configuration.utils.isDeprecated(element)); else // Do not add to index map if -nodeprecated option is set and if the // element is marked as deprecated or the containing package is marked as // deprecated. return !(noDeprecated && (configuration.utils.isDeprecated(element) || configuration.utils.isDeprecated(utils.containingPackage(element)))); } }
public class class_name { public static File relativize(File target, File baseDir) { String separator = File.separator; try { String absTargetPath = target.getAbsolutePath(); absTargetPath = FilenameUtils.normalizeNoEndSeparator( FilenameUtils.separatorsToSystem(absTargetPath)); String absBasePath = baseDir.getAbsolutePath(); absBasePath = FilenameUtils.normalizeNoEndSeparator( FilenameUtils.separatorsToSystem(absBasePath)); if (filePathEquals(absTargetPath, absBasePath)) { throw new IllegalArgumentException("target and base are equal: " + absTargetPath); } String[] absTargets = absTargetPath.split(Pattern.quote(separator)); String[] absBases = absBasePath.split(Pattern.quote(separator)); int minLength = Math.min(absTargets.length, absBases.length); int lastCommonRoot = -1; for (int i = 0; i < minLength; i++) { if (filePathEquals(absTargets[i], absBases[i])) { lastCommonRoot = i; } else { break; } } if (lastCommonRoot == -1) { // This case can happen on Windows when drive of two file paths differ. throw new IllegalArgumentException("no common root"); } String relativePath = ""; for (int i = lastCommonRoot + 1; i < absBases.length; i++) { relativePath = relativePath + ".." + separator; } for (int i = lastCommonRoot + 1; i < absTargets.length; i++) { relativePath = relativePath + absTargets[i]; if (i != absTargets.length - 1) { relativePath = relativePath + separator; } } return new File(relativePath); } catch (Exception e) { throw new RuntimeException(String.format( "target: %s; baseDir: %s; separator: %s", target, baseDir, separator), e); } } }
public class class_name { public static File relativize(File target, File baseDir) { String separator = File.separator; try { String absTargetPath = target.getAbsolutePath(); absTargetPath = FilenameUtils.normalizeNoEndSeparator( FilenameUtils.separatorsToSystem(absTargetPath)); // depends on control dependency: [try], data = [none] String absBasePath = baseDir.getAbsolutePath(); absBasePath = FilenameUtils.normalizeNoEndSeparator( FilenameUtils.separatorsToSystem(absBasePath)); // depends on control dependency: [try], data = [none] if (filePathEquals(absTargetPath, absBasePath)) { throw new IllegalArgumentException("target and base are equal: " + absTargetPath); } String[] absTargets = absTargetPath.split(Pattern.quote(separator)); String[] absBases = absBasePath.split(Pattern.quote(separator)); int minLength = Math.min(absTargets.length, absBases.length); int lastCommonRoot = -1; for (int i = 0; i < minLength; i++) { if (filePathEquals(absTargets[i], absBases[i])) { lastCommonRoot = i; // depends on control dependency: [if], data = [none] } else { break; } } if (lastCommonRoot == -1) { // This case can happen on Windows when drive of two file paths differ. throw new IllegalArgumentException("no common root"); } String relativePath = ""; for (int i = lastCommonRoot + 1; i < absBases.length; i++) { relativePath = relativePath + ".." + separator; // depends on control dependency: [for], data = [none] } for (int i = lastCommonRoot + 1; i < absTargets.length; i++) { relativePath = relativePath + absTargets[i]; // depends on control dependency: [for], data = [i] if (i != absTargets.length - 1) { relativePath = relativePath + separator; // depends on control dependency: [if], data = [none] } } return new File(relativePath); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(String.format( "target: %s; baseDir: %s; separator: %s", target, baseDir, separator), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static String getUserInfo(String url) { String userInfo = null; int startIndex = Integer.MIN_VALUE; int nextSlashIndex = Integer.MIN_VALUE; int endIndex = Integer.MIN_VALUE; try { // The user info start index should be the first index of "//". startIndex = url.indexOf("//"); if (startIndex != -1) { startIndex += 2; // The user info should be found before the next '/' index. nextSlashIndex = url.indexOf('/', startIndex); if (nextSlashIndex == -1) { nextSlashIndex = url.length(); } // The user info ends at the last index of '@' from the previously // computed subsequence. endIndex = url.substring(startIndex, nextSlashIndex).lastIndexOf('@'); if (endIndex != -1) { userInfo = url.substring(startIndex, startIndex + endIndex); } } } catch (StringIndexOutOfBoundsException ex) { System.err.println("String index out of bounds for:|" + url + "|"); System.err.println("Start index: " + startIndex); System.err.println("Next slash index " + nextSlashIndex); System.err.println("End index :" + endIndex); System.err.println("User info :|" + userInfo + "|"); ex.printStackTrace(); } return userInfo; } }
public class class_name { private static String getUserInfo(String url) { String userInfo = null; int startIndex = Integer.MIN_VALUE; int nextSlashIndex = Integer.MIN_VALUE; int endIndex = Integer.MIN_VALUE; try { // The user info start index should be the first index of "//". startIndex = url.indexOf("//"); if (startIndex != -1) { startIndex += 2; // The user info should be found before the next '/' index. nextSlashIndex = url.indexOf('/', startIndex); if (nextSlashIndex == -1) { nextSlashIndex = url.length(); // depends on control dependency: [if], data = [none] } // The user info ends at the last index of '@' from the previously // computed subsequence. endIndex = url.substring(startIndex, nextSlashIndex).lastIndexOf('@'); if (endIndex != -1) { userInfo = url.substring(startIndex, startIndex + endIndex); // depends on control dependency: [if], data = [none] } } } catch (StringIndexOutOfBoundsException ex) { System.err.println("String index out of bounds for:|" + url + "|"); System.err.println("Start index: " + startIndex); System.err.println("Next slash index " + nextSlashIndex); System.err.println("End index :" + endIndex); System.err.println("User info :|" + userInfo + "|"); ex.printStackTrace(); } return userInfo; } }
public class class_name { public static <T extends ImageGray<T>> void applyTransform( T input , int transform[] , int minValue , T output ) { InputSanityCheck.checkSameShape(input, output); if( input instanceof GrayU8) { EnhanceImageOps.applyTransform((GrayU8) input, transform, (GrayU8) output); } else if( input instanceof GrayS8) { EnhanceImageOps.applyTransform((GrayS8)input,transform,minValue,(GrayS8)output); } else if( input instanceof GrayU16) { EnhanceImageOps.applyTransform((GrayU16)input,transform,(GrayU16)output); } else if( input instanceof GrayS16) { EnhanceImageOps.applyTransform((GrayS16)input,transform,minValue,(GrayS16)output); } else if( input instanceof GrayS32) { EnhanceImageOps.applyTransform((GrayS32)input,transform,minValue,(GrayS32)output); } else { throw new IllegalArgumentException("Image type not supported. "+input.getClass().getSimpleName()); } } }
public class class_name { public static <T extends ImageGray<T>> void applyTransform( T input , int transform[] , int minValue , T output ) { InputSanityCheck.checkSameShape(input, output); if( input instanceof GrayU8) { EnhanceImageOps.applyTransform((GrayU8) input, transform, (GrayU8) output); // depends on control dependency: [if], data = [none] } else if( input instanceof GrayS8) { EnhanceImageOps.applyTransform((GrayS8)input,transform,minValue,(GrayS8)output); // depends on control dependency: [if], data = [none] } else if( input instanceof GrayU16) { EnhanceImageOps.applyTransform((GrayU16)input,transform,(GrayU16)output); // depends on control dependency: [if], data = [none] } else if( input instanceof GrayS16) { EnhanceImageOps.applyTransform((GrayS16)input,transform,minValue,(GrayS16)output); // depends on control dependency: [if], data = [none] } else if( input instanceof GrayS32) { EnhanceImageOps.applyTransform((GrayS32)input,transform,minValue,(GrayS32)output); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Image type not supported. "+input.getClass().getSimpleName()); } } }
public class class_name { public static final byte[] decodeUrlLoose(byte[] bytes) { if (bytes == null) { return null; } ByteArrayOutputStream buffer = new ByteArrayOutputStream(); for (int i = 0; i < bytes.length; i++) { int b = bytes[i]; if (b == '+') { buffer.write(' '); continue; } if (b == '%') { if(i+2<bytes.length) { int u = Character.digit((char)bytes[i+1], 16); int l = Character.digit((char)bytes[i+2], 16); if (u > -1 && l > -1) { // good encoding int c = ((u << 4) + l); buffer.write((char)c); i += 2; continue; } // else: bad encoding digits, leave '%' in place } // else: insufficient encoding digits, leave '%' in place } buffer.write(b); } return buffer.toByteArray(); } }
public class class_name { public static final byte[] decodeUrlLoose(byte[] bytes) { if (bytes == null) { return null; // depends on control dependency: [if], data = [none] } ByteArrayOutputStream buffer = new ByteArrayOutputStream(); for (int i = 0; i < bytes.length; i++) { int b = bytes[i]; if (b == '+') { buffer.write(' '); // depends on control dependency: [if], data = [none] continue; } if (b == '%') { if(i+2<bytes.length) { int u = Character.digit((char)bytes[i+1], 16); int l = Character.digit((char)bytes[i+2], 16); if (u > -1 && l > -1) { // good encoding int c = ((u << 4) + l); buffer.write((char)c); // depends on control dependency: [if], data = [none] i += 2; // depends on control dependency: [if], data = [none] continue; } // else: bad encoding digits, leave '%' in place } // else: insufficient encoding digits, leave '%' in place } buffer.write(b); // depends on control dependency: [for], data = [none] } return buffer.toByteArray(); } }
public class class_name { public static URL getParent(URL url) { String file = url.getFile(); int len = file.length(); if (len == 0 || len == 1 && file.charAt(0) == '/') return null; int lastSlashIndex = -1; for (int i = len - 2; lastSlashIndex == -1 && i >= 0; --i) { if (file.charAt(i) == '/') lastSlashIndex = i; } if (lastSlashIndex == -1) file = ""; //$NON-NLS-1$ else file = file.substring(0, lastSlashIndex + 1); try { url = new URL(url.getProtocol(), url.getHost(), url.getPort(), file); } catch (MalformedURLException e) { Assert.isTrue(false, e.getMessage()); } return url; } }
public class class_name { public static URL getParent(URL url) { String file = url.getFile(); int len = file.length(); if (len == 0 || len == 1 && file.charAt(0) == '/') return null; int lastSlashIndex = -1; for (int i = len - 2; lastSlashIndex == -1 && i >= 0; --i) { if (file.charAt(i) == '/') lastSlashIndex = i; } if (lastSlashIndex == -1) file = ""; //$NON-NLS-1$ else file = file.substring(0, lastSlashIndex + 1); try { url = new URL(url.getProtocol(), url.getHost(), url.getPort(), file); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { Assert.isTrue(false, e.getMessage()); } // depends on control dependency: [catch], data = [none] return url; } }
public class class_name { public BaseField setupField(int iFieldSeq) { BaseField field = null; //if (iFieldSeq == 0) //{ // field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null); // field.setHidden(true); //} //if (iFieldSeq == 1) //{ // field = new RecordChangedField(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null); // field.setHidden(true); //} //if (iFieldSeq == 2) //{ // field = new BooleanField(this, DELETED, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false)); // field.setHidden(true); //} if (iFieldSeq == 3) field = new StringField(this, SCREEN_IN_PROG_NAME, 40, null, null); if (iFieldSeq == 4) field = new ShortField(this, SCREEN_OUT_NUMBER, 2, null, null); if (iFieldSeq == 5) field = new ShortField(this, SCREEN_ITEM_NUMBER, 4, null, null); if (iFieldSeq == 6) { field = new StringField(this, SCREEN_FILE_NAME, 40, null, null); field.addListener(new InitOnceFieldHandler(null)); } if (iFieldSeq == 7) field = new StringField(this, SCREEN_FIELD_NAME, 40, null, null); if (iFieldSeq == 8) field = new ShortField(this, SCREEN_ROW, 8, null, null); if (iFieldSeq == 9) field = new ShortField(this, SCREEN_COL, 4, null, null); if (iFieldSeq == 10) field = new StringField(this, SCREEN_GROUP, 4, null, null); if (iFieldSeq == 11) field = new ShortField(this, SCREEN_PHYSICAL_NUM, 4, null, null); if (iFieldSeq == 12) field = new ScreenLocField(this, SCREEN_LOCATION, 20, null, null); if (iFieldSeq == 13) field = new FieldDescField(this, SCREEN_FIELD_DESC, 30, null, null); if (iFieldSeq == 14) field = new MemoField(this, SCREEN_TEXT, 9999, null, null); if (iFieldSeq == 15) field = new ScreenAnchorField(this, SCREEN_ANCHOR, 20, null, null); if (iFieldSeq == 16) field = new ControlTypeField(this, SCREEN_CONTROL_TYPE, 20, null, null); if (field == null) field = super.setupField(iFieldSeq); return field; } }
public class class_name { public BaseField setupField(int iFieldSeq) { BaseField field = null; //if (iFieldSeq == 0) //{ // field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null); // field.setHidden(true); //} //if (iFieldSeq == 1) //{ // field = new RecordChangedField(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null); // field.setHidden(true); //} //if (iFieldSeq == 2) //{ // field = new BooleanField(this, DELETED, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false)); // field.setHidden(true); //} if (iFieldSeq == 3) field = new StringField(this, SCREEN_IN_PROG_NAME, 40, null, null); if (iFieldSeq == 4) field = new ShortField(this, SCREEN_OUT_NUMBER, 2, null, null); if (iFieldSeq == 5) field = new ShortField(this, SCREEN_ITEM_NUMBER, 4, null, null); if (iFieldSeq == 6) { field = new StringField(this, SCREEN_FILE_NAME, 40, null, null); // depends on control dependency: [if], data = [none] field.addListener(new InitOnceFieldHandler(null)); // depends on control dependency: [if], data = [none] } if (iFieldSeq == 7) field = new StringField(this, SCREEN_FIELD_NAME, 40, null, null); if (iFieldSeq == 8) field = new ShortField(this, SCREEN_ROW, 8, null, null); if (iFieldSeq == 9) field = new ShortField(this, SCREEN_COL, 4, null, null); if (iFieldSeq == 10) field = new StringField(this, SCREEN_GROUP, 4, null, null); if (iFieldSeq == 11) field = new ShortField(this, SCREEN_PHYSICAL_NUM, 4, null, null); if (iFieldSeq == 12) field = new ScreenLocField(this, SCREEN_LOCATION, 20, null, null); if (iFieldSeq == 13) field = new FieldDescField(this, SCREEN_FIELD_DESC, 30, null, null); if (iFieldSeq == 14) field = new MemoField(this, SCREEN_TEXT, 9999, null, null); if (iFieldSeq == 15) field = new ScreenAnchorField(this, SCREEN_ANCHOR, 20, null, null); if (iFieldSeq == 16) field = new ControlTypeField(this, SCREEN_CONTROL_TYPE, 20, null, null); if (field == null) field = super.setupField(iFieldSeq); return field; } }
public class class_name { public int intersectAab(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int mask) { /* * This is an implementation of the first algorithm in "2.5 Plane masking and coherency" of the mentioned site. * * In addition to the algorithm in the paper, this method also returns the index of the first plane that culled the box. */ int plane = PLANE_NX; boolean inside = true; if ((mask & PLANE_MASK_NX) == 0 || nxX * (nxX < 0 ? minX : maxX) + nxY * (nxY < 0 ? minY : maxY) + nxZ * (nxZ < 0 ? minZ : maxZ) >= -nxW) { plane = PLANE_PX; inside &= nxX * (nxX < 0 ? maxX : minX) + nxY * (nxY < 0 ? maxY : minY) + nxZ * (nxZ < 0 ? maxZ : minZ) >= -nxW; if ((mask & PLANE_MASK_PX) == 0 || pxX * (pxX < 0 ? minX : maxX) + pxY * (pxY < 0 ? minY : maxY) + pxZ * (pxZ < 0 ? minZ : maxZ) >= -pxW) { plane = PLANE_NY; inside &= pxX * (pxX < 0 ? maxX : minX) + pxY * (pxY < 0 ? maxY : minY) + pxZ * (pxZ < 0 ? maxZ : minZ) >= -pxW; if ((mask & PLANE_MASK_NY) == 0 || nyX * (nyX < 0 ? minX : maxX) + nyY * (nyY < 0 ? minY : maxY) + nyZ * (nyZ < 0 ? minZ : maxZ) >= -nyW) { plane = PLANE_PY; inside &= nyX * (nyX < 0 ? maxX : minX) + nyY * (nyY < 0 ? maxY : minY) + nyZ * (nyZ < 0 ? maxZ : minZ) >= -nyW; if ((mask & PLANE_MASK_PY) == 0 || pyX * (pyX < 0 ? minX : maxX) + pyY * (pyY < 0 ? minY : maxY) + pyZ * (pyZ < 0 ? minZ : maxZ) >= -pyW) { plane = PLANE_NZ; inside &= pyX * (pyX < 0 ? maxX : minX) + pyY * (pyY < 0 ? maxY : minY) + pyZ * (pyZ < 0 ? maxZ : minZ) >= -pyW; if ((mask & PLANE_MASK_NZ) == 0 || nzX * (nzX < 0 ? minX : maxX) + nzY * (nzY < 0 ? minY : maxY) + nzZ * (nzZ < 0 ? minZ : maxZ) >= -nzW) { plane = PLANE_PZ; inside &= nzX * (nzX < 0 ? maxX : minX) + nzY * (nzY < 0 ? maxY : minY) + nzZ * (nzZ < 0 ? maxZ : minZ) >= -nzW; if ((mask & PLANE_MASK_PZ) == 0 || pzX * (pzX < 0 ? minX : maxX) + pzY * (pzY < 0 ? minY : maxY) + pzZ * (pzZ < 0 ? minZ : maxZ) >= -pzW) { inside &= pzX * (pzX < 0 ? maxX : minX) + pzY * (pzY < 0 ? maxY : minY) + pzZ * (pzZ < 0 ? maxZ : minZ) >= -pzW; return inside ? INSIDE : INTERSECT; } } } } } } return plane; } }
public class class_name { public int intersectAab(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int mask) { /* * This is an implementation of the first algorithm in "2.5 Plane masking and coherency" of the mentioned site. * * In addition to the algorithm in the paper, this method also returns the index of the first plane that culled the box. */ int plane = PLANE_NX; boolean inside = true; if ((mask & PLANE_MASK_NX) == 0 || nxX * (nxX < 0 ? minX : maxX) + nxY * (nxY < 0 ? minY : maxY) + nxZ * (nxZ < 0 ? minZ : maxZ) >= -nxW) { plane = PLANE_PX; // depends on control dependency: [if], data = [none] inside &= nxX * (nxX < 0 ? maxX : minX) + nxY * (nxY < 0 ? maxY : minY) + nxZ * (nxZ < 0 ? maxZ : minZ) >= -nxW; // depends on control dependency: [if], data = [none] if ((mask & PLANE_MASK_PX) == 0 || pxX * (pxX < 0 ? minX : maxX) + pxY * (pxY < 0 ? minY : maxY) + pxZ * (pxZ < 0 ? minZ : maxZ) >= -pxW) { plane = PLANE_NY; // depends on control dependency: [if], data = [none] inside &= pxX * (pxX < 0 ? maxX : minX) + pxY * (pxY < 0 ? maxY : minY) + pxZ * (pxZ < 0 ? maxZ : minZ) >= -pxW; // depends on control dependency: [if], data = [none] if ((mask & PLANE_MASK_NY) == 0 || nyX * (nyX < 0 ? minX : maxX) + nyY * (nyY < 0 ? minY : maxY) + nyZ * (nyZ < 0 ? minZ : maxZ) >= -nyW) { plane = PLANE_PY; // depends on control dependency: [if], data = [none] inside &= nyX * (nyX < 0 ? maxX : minX) + nyY * (nyY < 0 ? maxY : minY) + nyZ * (nyZ < 0 ? maxZ : minZ) >= -nyW; // depends on control dependency: [if], data = [none] if ((mask & PLANE_MASK_PY) == 0 || pyX * (pyX < 0 ? minX : maxX) + pyY * (pyY < 0 ? minY : maxY) + pyZ * (pyZ < 0 ? minZ : maxZ) >= -pyW) { plane = PLANE_NZ; // depends on control dependency: [if], data = [none] inside &= pyX * (pyX < 0 ? maxX : minX) + pyY * (pyY < 0 ? maxY : minY) + pyZ * (pyZ < 0 ? maxZ : minZ) >= -pyW; // depends on control dependency: [if], data = [none] if ((mask & PLANE_MASK_NZ) == 0 || nzX * (nzX < 0 ? minX : maxX) + nzY * (nzY < 0 ? minY : maxY) + nzZ * (nzZ < 0 ? minZ : maxZ) >= -nzW) { plane = PLANE_PZ; // depends on control dependency: [if], data = [none] inside &= nzX * (nzX < 0 ? maxX : minX) + nzY * (nzY < 0 ? maxY : minY) + nzZ * (nzZ < 0 ? maxZ : minZ) >= -nzW; // depends on control dependency: [if], data = [none] if ((mask & PLANE_MASK_PZ) == 0 || pzX * (pzX < 0 ? minX : maxX) + pzY * (pzY < 0 ? minY : maxY) + pzZ * (pzZ < 0 ? minZ : maxZ) >= -pzW) { inside &= pzX * (pzX < 0 ? maxX : minX) + pzY * (pzY < 0 ? maxY : minY) + pzZ * (pzZ < 0 ? maxZ : minZ) >= -pzW; // depends on control dependency: [if], data = [none] return inside ? INSIDE : INTERSECT; // depends on control dependency: [if], data = [none] } } } } } } return plane; } }
public class class_name { public static <T, X, E extends Throwable> Map<X, Collection<T>> groupBy (Iterable<T> coll, AFunction1<? super T, ? extends X, E> f) throws E { final Map<X, Collection<T>> result = new HashMap<>(); for(T o: coll) { final X key = f.apply(o); Collection<T> perKey = result.get(key); if(perKey == null) { perKey = new ArrayList<>(); result.put(key, perKey); } perKey.add(o); } return result; } }
public class class_name { public static <T, X, E extends Throwable> Map<X, Collection<T>> groupBy (Iterable<T> coll, AFunction1<? super T, ? extends X, E> f) throws E { final Map<X, Collection<T>> result = new HashMap<>(); for(T o: coll) { final X key = f.apply(o); Collection<T> perKey = result.get(key); if(perKey == null) { perKey = new ArrayList<>(); // depends on control dependency: [if], data = [none] result.put(key, perKey); // depends on control dependency: [if], data = [none] } perKey.add(o); } return result; } }
public class class_name { public Config setScheduledExecutorConfigs(Map<String, ScheduledExecutorConfig> scheduledExecutorConfigs) { this.scheduledExecutorConfigs.clear(); this.scheduledExecutorConfigs.putAll(scheduledExecutorConfigs); for (Entry<String, ScheduledExecutorConfig> entry : scheduledExecutorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; } }
public class class_name { public Config setScheduledExecutorConfigs(Map<String, ScheduledExecutorConfig> scheduledExecutorConfigs) { this.scheduledExecutorConfigs.clear(); this.scheduledExecutorConfigs.putAll(scheduledExecutorConfigs); for (Entry<String, ScheduledExecutorConfig> entry : scheduledExecutorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); // depends on control dependency: [for], data = [entry] } return this; } }
public class class_name { private void handleGlobalArguments(Section section) { for (String key : section.keySet()) { switch (key) { case OPTION_OFFLINE_MODE: if (section.get(key).toLowerCase().equals("true")) { this.offlineMode = true; } break; case OPTION_QUIET: if (section.get(key).toLowerCase().equals("true")) { this.quiet = true; } break; case OPTION_CREATE_REPORT: this.reportFilename = section.get(key); break; case OPTION_DUMP_LOCATION: this.dumpDirectoryLocation = section.get(key); break; case OPTION_FILTER_LANGUAGES: setLanguageFilters(section.get(key)); break; case OPTION_FILTER_SITES: setSiteFilters(section.get(key)); break; case OPTION_FILTER_PROPERTIES: setPropertyFilters(section.get(key)); break; case OPTION_LOCAL_DUMPFILE: this.inputDumpLocation = section.get(key); break; default: logger.warn("Unrecognized option: " + key); } } } }
public class class_name { private void handleGlobalArguments(Section section) { for (String key : section.keySet()) { switch (key) { case OPTION_OFFLINE_MODE: if (section.get(key).toLowerCase().equals("true")) { this.offlineMode = true; // depends on control dependency: [if], data = [none] } break; case OPTION_QUIET: if (section.get(key).toLowerCase().equals("true")) { this.quiet = true; // depends on control dependency: [if], data = [none] } break; case OPTION_CREATE_REPORT: this.reportFilename = section.get(key); break; case OPTION_DUMP_LOCATION: this.dumpDirectoryLocation = section.get(key); break; case OPTION_FILTER_LANGUAGES: setLanguageFilters(section.get(key)); break; case OPTION_FILTER_SITES: setSiteFilters(section.get(key)); break; case OPTION_FILTER_PROPERTIES: setPropertyFilters(section.get(key)); break; case OPTION_LOCAL_DUMPFILE: this.inputDumpLocation = section.get(key); break; default: logger.warn("Unrecognized option: " + key); } } } }
public class class_name { public static void renameFiles(File[] files, String[] fileNames) { int length = Integer.min(files.length, fileNames.length); for (int i = 0; i < length; i++) { String fileName = files[i].getParent() + ValueConsts.SEPARATOR + fileNames[i]; if (!fileName.contains(".")) { fileName += files[i].getName().substring(files[i].getName().lastIndexOf(".")); } if (files[i].renameTo(new File(fileName))) { logger.info("rename file '" + files[i].getAbsolutePath() + "' to '" + fileName + "'"); } else { logger.info("rename file '" + files[i].getAbsolutePath() + "' error"); } } } }
public class class_name { public static void renameFiles(File[] files, String[] fileNames) { int length = Integer.min(files.length, fileNames.length); for (int i = 0; i < length; i++) { String fileName = files[i].getParent() + ValueConsts.SEPARATOR + fileNames[i]; if (!fileName.contains(".")) { fileName += files[i].getName().substring(files[i].getName().lastIndexOf(".")); // depends on control dependency: [if], data = [none] } if (files[i].renameTo(new File(fileName))) { logger.info("rename file '" + files[i].getAbsolutePath() + "' to '" + fileName + "'"); // depends on control dependency: [if], data = [none] } else { logger.info("rename file '" + files[i].getAbsolutePath() + "' error"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public double calculateAverageAUC() { assertIndex(0); double sum = 0.0; for (int i = 0; i < underlying.length; i++) { sum += calculateAUC(i); } return sum / underlying.length; } }
public class class_name { public double calculateAverageAUC() { assertIndex(0); double sum = 0.0; for (int i = 0; i < underlying.length; i++) { sum += calculateAUC(i); // depends on control dependency: [for], data = [i] } return sum / underlying.length; } }
public class class_name { public DescribeSnapshotCopyGrantsResult withSnapshotCopyGrants(SnapshotCopyGrant... snapshotCopyGrants) { if (this.snapshotCopyGrants == null) { setSnapshotCopyGrants(new com.amazonaws.internal.SdkInternalList<SnapshotCopyGrant>(snapshotCopyGrants.length)); } for (SnapshotCopyGrant ele : snapshotCopyGrants) { this.snapshotCopyGrants.add(ele); } return this; } }
public class class_name { public DescribeSnapshotCopyGrantsResult withSnapshotCopyGrants(SnapshotCopyGrant... snapshotCopyGrants) { if (this.snapshotCopyGrants == null) { setSnapshotCopyGrants(new com.amazonaws.internal.SdkInternalList<SnapshotCopyGrant>(snapshotCopyGrants.length)); // depends on control dependency: [if], data = [none] } for (SnapshotCopyGrant ele : snapshotCopyGrants) { this.snapshotCopyGrants.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public AssociationContext getAssociationContext() { if ( associationContext == null ) { associationContext = new AssociationContextImpl( associationTypeContext, hostingEntity != null ? OgmEntityEntryState.getStateFor( session, hostingEntity ).getTuplePointer() : new TuplePointer(), transactionContext( session ) ); } return associationContext; } }
public class class_name { public AssociationContext getAssociationContext() { if ( associationContext == null ) { associationContext = new AssociationContextImpl( associationTypeContext, hostingEntity != null ? OgmEntityEntryState.getStateFor( session, hostingEntity ).getTuplePointer() : new TuplePointer(), transactionContext( session ) ); // depends on control dependency: [if], data = [none] } return associationContext; } }
public class class_name { public void marshall(GetSigningCertificateRequest getSigningCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (getSigningCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getSigningCertificateRequest.getUserPoolId(), USERPOOLID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetSigningCertificateRequest getSigningCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (getSigningCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getSigningCertificateRequest.getUserPoolId(), USERPOOLID_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 { void persistDom(String name, @Nullable String dom) { try { Files.write(Strings.nullToEmpty(dom), new File(doms, name + ".html"), Charsets.UTF_8); } catch (IOException e) { LOG.warn("Could not save dom state for {}", name); LOG.debug("Could not save dom state", e); } } }
public class class_name { void persistDom(String name, @Nullable String dom) { try { Files.write(Strings.nullToEmpty(dom), new File(doms, name + ".html"), Charsets.UTF_8); // depends on control dependency: [try], data = [none] } catch (IOException e) { LOG.warn("Could not save dom state for {}", name); LOG.debug("Could not save dom state", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void send(ByteBuffer data) { try { this.socket.send(new DatagramPacket( data.array(), data.capacity(), this.address)); } catch (IOException ioe) { logger.info("Error sending datagram packet to tracker at {}: {}.", this.address, ioe.getMessage()); } } }
public class class_name { private void send(ByteBuffer data) { try { this.socket.send(new DatagramPacket( data.array(), data.capacity(), this.address)); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { logger.info("Error sending datagram packet to tracker at {}: {}.", this.address, ioe.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public byte[] getOctets() { byte[] octets = new byte[8]; long bits = this.bits; for (int n = 8; --n >= 0; bits >>= 8) { octets[n] = (byte) (bits & 0xff); } return octets; } }
public class class_name { public byte[] getOctets() { byte[] octets = new byte[8]; long bits = this.bits; for (int n = 8; --n >= 0; bits >>= 8) { octets[n] = (byte) (bits & 0xff); // depends on control dependency: [for], data = [n] } return octets; } }
public class class_name { public java.util.List<ParameterObject> getParameterObjects() { if (parameterObjects == null) { parameterObjects = new com.amazonaws.internal.SdkInternalList<ParameterObject>(); } return parameterObjects; } }
public class class_name { public java.util.List<ParameterObject> getParameterObjects() { if (parameterObjects == null) { parameterObjects = new com.amazonaws.internal.SdkInternalList<ParameterObject>(); // depends on control dependency: [if], data = [none] } return parameterObjects; } }
public class class_name { public Object getComponentNewInstance(String name) { Debug.logVerbose("[JdonFramework]getComponentNewInstance: name=" + name, module); ComponentAdapter componentAdapter = container.getComponentAdapter(name); if (componentAdapter == null) { Debug.logWarning("[JdonFramework]Not find the component in container :" + name, module); return null; } return componentAdapter.getComponentInstance(container); } }
public class class_name { public Object getComponentNewInstance(String name) { Debug.logVerbose("[JdonFramework]getComponentNewInstance: name=" + name, module); ComponentAdapter componentAdapter = container.getComponentAdapter(name); if (componentAdapter == null) { Debug.logWarning("[JdonFramework]Not find the component in container :" + name, module); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } return componentAdapter.getComponentInstance(container); } }
public class class_name { public EList<MCF1RG> getRG() { if (rg == null) { rg = new EObjectContainmentEList.Resolving<MCF1RG>(MCF1RG.class, this, AfplibPackage.MCF1__RG); } return rg; } }
public class class_name { public EList<MCF1RG> getRG() { if (rg == null) { rg = new EObjectContainmentEList.Resolving<MCF1RG>(MCF1RG.class, this, AfplibPackage.MCF1__RG); // depends on control dependency: [if], data = [none] } return rg; } }
public class class_name { public void addOperations(final Map<MemcachedNode, Operation> ops) { for (Map.Entry<MemcachedNode, Operation> me : ops.entrySet()) { addOperation(me.getKey(), me.getValue()); } } }
public class class_name { public void addOperations(final Map<MemcachedNode, Operation> ops) { for (Map.Entry<MemcachedNode, Operation> me : ops.entrySet()) { addOperation(me.getKey(), me.getValue()); // depends on control dependency: [for], data = [me] } } }
public class class_name { private Map<NodeKey, Integer> computeReferrersCountDelta( List<NodeKey> addedReferrers, List<NodeKey> removedReferrers ) { Map<NodeKey, Integer> referrersCountDelta = new HashMap<NodeKey, Integer>(0); Set<NodeKey> addedReferrersUnique = new HashSet<NodeKey>(addedReferrers); for (NodeKey addedReferrer : addedReferrersUnique) { int referrersCount = Collections.frequency(addedReferrers, addedReferrer) - Collections.frequency(removedReferrers, addedReferrer); referrersCountDelta.put(addedReferrer, referrersCount); } Set<NodeKey> removedReferrersUnique = new HashSet<NodeKey>(removedReferrers); for (NodeKey removedReferrer : removedReferrersUnique) { // process what's left in the removed list, only if not found in the added if (!referrersCountDelta.containsKey(removedReferrer)) { referrersCountDelta.put(removedReferrer, -1 * Collections.frequency(removedReferrers, removedReferrer)); } } return referrersCountDelta; } }
public class class_name { private Map<NodeKey, Integer> computeReferrersCountDelta( List<NodeKey> addedReferrers, List<NodeKey> removedReferrers ) { Map<NodeKey, Integer> referrersCountDelta = new HashMap<NodeKey, Integer>(0); Set<NodeKey> addedReferrersUnique = new HashSet<NodeKey>(addedReferrers); for (NodeKey addedReferrer : addedReferrersUnique) { int referrersCount = Collections.frequency(addedReferrers, addedReferrer) - Collections.frequency(removedReferrers, addedReferrer); referrersCountDelta.put(addedReferrer, referrersCount); // depends on control dependency: [for], data = [addedReferrer] } Set<NodeKey> removedReferrersUnique = new HashSet<NodeKey>(removedReferrers); for (NodeKey removedReferrer : removedReferrersUnique) { // process what's left in the removed list, only if not found in the added if (!referrersCountDelta.containsKey(removedReferrer)) { referrersCountDelta.put(removedReferrer, -1 * Collections.frequency(removedReferrers, removedReferrer)); // depends on control dependency: [if], data = [none] } } return referrersCountDelta; } }
public class class_name { public static boolean isRtl() { if (sEnable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()); } return false; } }
public class class_name { public static boolean isRtl() { if (sEnable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public int getMappedColumn(final int renderCol) { if (columnMapping == null || renderCol == -1) { return renderCol; } else { final Integer result = columnMapping.get(renderCol); if (result == null) { throw new IllegalArgumentException("Invalid index " + renderCol); } return result; } } }
public class class_name { public int getMappedColumn(final int renderCol) { if (columnMapping == null || renderCol == -1) { return renderCol; // depends on control dependency: [if], data = [none] } else { final Integer result = columnMapping.get(renderCol); if (result == null) { throw new IllegalArgumentException("Invalid index " + renderCol); } return result; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Map<String, Object> updateUserTone(Map<String, Object> context, ToneAnalysis toneAnalyzerPayload, boolean maintainHistory) { List<ToneScore> emotionTone = new ArrayList<ToneScore>(); List<ToneScore> languageTone = new ArrayList<ToneScore>(); List<ToneScore> socialTone = new ArrayList<ToneScore>(); // If the context doesn't already contain the user object, initialize it if (!context.containsKey("user")) { context.put("user", initUser()); } // For convenience sake, define a variable for the user object to @SuppressWarnings("unchecked") Map<String, Object> user = (Map<String, Object>) context.get("user"); if (toneAnalyzerPayload != null && toneAnalyzerPayload.getDocumentTone() != null) { List<ToneCategory> tones = toneAnalyzerPayload.getDocumentTone().getToneCategories(); for (ToneCategory tone : tones) { if (tone.getCategoryId().equals(EMOTION_TONE_LABEL)) { emotionTone = tone.getTones(); } if (tone.getCategoryId().equals(LANGUAGE_TONE_LABEL)) { languageTone = tone.getTones(); } if (tone.getCategoryId().equals(SOCIAL_TONE_LABEL)) { socialTone = tone.getTones(); } } updateEmotionTone(user, emotionTone, maintainHistory); updateLanguageTone(user, languageTone, maintainHistory); updateSocialTone(user, socialTone, maintainHistory); } context.put("user", user); return user; } }
public class class_name { public static Map<String, Object> updateUserTone(Map<String, Object> context, ToneAnalysis toneAnalyzerPayload, boolean maintainHistory) { List<ToneScore> emotionTone = new ArrayList<ToneScore>(); List<ToneScore> languageTone = new ArrayList<ToneScore>(); List<ToneScore> socialTone = new ArrayList<ToneScore>(); // If the context doesn't already contain the user object, initialize it if (!context.containsKey("user")) { context.put("user", initUser()); // depends on control dependency: [if], data = [none] } // For convenience sake, define a variable for the user object to @SuppressWarnings("unchecked") Map<String, Object> user = (Map<String, Object>) context.get("user"); if (toneAnalyzerPayload != null && toneAnalyzerPayload.getDocumentTone() != null) { List<ToneCategory> tones = toneAnalyzerPayload.getDocumentTone().getToneCategories(); for (ToneCategory tone : tones) { if (tone.getCategoryId().equals(EMOTION_TONE_LABEL)) { emotionTone = tone.getTones(); // depends on control dependency: [if], data = [none] } if (tone.getCategoryId().equals(LANGUAGE_TONE_LABEL)) { languageTone = tone.getTones(); // depends on control dependency: [if], data = [none] } if (tone.getCategoryId().equals(SOCIAL_TONE_LABEL)) { socialTone = tone.getTones(); // depends on control dependency: [if], data = [none] } } updateEmotionTone(user, emotionTone, maintainHistory); // depends on control dependency: [if], data = [none] updateLanguageTone(user, languageTone, maintainHistory); // depends on control dependency: [if], data = [none] updateSocialTone(user, socialTone, maintainHistory); // depends on control dependency: [if], data = [none] } context.put("user", user); return user; } }
public class class_name { static ClassLoader setContextClassLoader(final ClassLoader cl) { if (System.getSecurityManager() == null) { ClassLoader result = Thread.currentThread().getContextClassLoader(); if (cl != null) Thread.currentThread().setContextClassLoader(cl); return result; } else { try { return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>() { public ClassLoader run() throws Exception { try { ClassLoader result = Thread.currentThread().getContextClassLoader(); if (cl != null) Thread.currentThread().setContextClassLoader(cl); return result; } catch (Exception e) { throw e; } catch (Error e) { throw e; } catch (Throwable e) { throw new RuntimeException("Error setting context classloader", e); } } }); } catch (PrivilegedActionException e) { throw new RuntimeException("Error running privileged action", e.getCause()); } } } }
public class class_name { static ClassLoader setContextClassLoader(final ClassLoader cl) { if (System.getSecurityManager() == null) { ClassLoader result = Thread.currentThread().getContextClassLoader(); if (cl != null) Thread.currentThread().setContextClassLoader(cl); return result; // depends on control dependency: [if], data = [none] } else { try { return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>() { public ClassLoader run() throws Exception { try { ClassLoader result = Thread.currentThread().getContextClassLoader(); if (cl != null) Thread.currentThread().setContextClassLoader(cl); return result; } catch (Exception e) // depends on control dependency: [try], data = [none] { throw e; } catch (Error e) // depends on control dependency: [try], data = [none] { throw e; } catch (Throwable e) // depends on control dependency: [try], data = [none] { throw new RuntimeException("Error setting context classloader", e); } } }); } catch (PrivilegedActionException e) { throw new RuntimeException("Error running privileged action", e.getCause()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static void printResult(Number[][] m1, Number[][] m2, Number[][] m3, char op, PrintStream out) { for (int i = 0; i < m1.length; i++) { for (int j = 0; j < m1[0].length; j++) { out.print(" " + m1[i][j]); } if (i == m1.length / 2) { out.print(" " + op + " "); } else { out.print(" "); } for (int j = 0; j < m2.length; j++) { out.print(" " + m2[i][j]); } if (i == m1.length / 2) { out.print(" = "); } else { out.print(" "); } for (int j = 0; j < m3.length; j++) { out.print(m3[i][j] + " "); } out.println(); } } }
public class class_name { public static void printResult(Number[][] m1, Number[][] m2, Number[][] m3, char op, PrintStream out) { 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] } if (i == m1.length / 2) { out.print(" " + op + " "); // depends on control dependency: [if], data = [none] } else { out.print(" "); // depends on control dependency: [if], data = [none] } for (int j = 0; j < m2.length; j++) { out.print(" " + m2[i][j]); // depends on control dependency: [for], data = [j] } if (i == m1.length / 2) { out.print(" = "); // depends on control dependency: [if], data = [none] } else { out.print(" "); // depends on control dependency: [if], data = [none] } for (int j = 0; j < m3.length; j++) { out.print(m3[i][j] + " "); // depends on control dependency: [for], data = [j] } out.println(); // depends on control dependency: [for], data = [none] } } }
public class class_name { @Override public EEnum getIfcTransitionCode() { if (ifcTransitionCodeEEnum == null) { ifcTransitionCodeEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1090); } return ifcTransitionCodeEEnum; } }
public class class_name { @Override public EEnum getIfcTransitionCode() { if (ifcTransitionCodeEEnum == null) { ifcTransitionCodeEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1090); // depends on control dependency: [if], data = [none] } return ifcTransitionCodeEEnum; } }
public class class_name { public synchronized long read(long offset, final ByteBuffer buf) { if (!validState) { throw new InvalidStateException(); } try { int readed; while (true) { if (offset >= offsetOutputCommited) { if (bufOutput.position() > 0) { log.warn("WARN: autoflush forced"); flushBuffer(); } } bufInput.clear(); readed = fcInput.position(offset).read(bufInput); // Read 1 sector if (readed < HEADER_LEN) { // short+int (6 bytes) return -1; } bufInput.flip(); final int magicB1 = (bufInput.get() & 0xFF); // Header - Magic (short, 2 bytes, msb-first) final int magicB2 = (bufInput.get() & 0xFF); // Header - Magic (short, 2 bytes, lsb-last) if (alignBlocks && (magicB1 == MAGIC_PADDING)) { final int diffOffset = nextBlockBoundary(offset); if (diffOffset > 0) { // log.info("WARN: skipping " + diffOffset + "bytes to next block-boundary"); offset += diffOffset; continue; } } final int magic = ((magicB1 << 8) | magicB2); if (magic != MAGIC) { log.error("MAGIC HEADER fake=" + Integer.toHexString(magic) + " expected=" + Integer.toHexString(MAGIC)); return -1; } break; } // final int datalen = bufInput.getInt(); // Header - Data Size (int, 4 bytes) final int dataUnderFlow = (datalen - (readed - HEADER_LEN)); int footer = -12345678; if (dataUnderFlow < 0) { footer = bufInput.get(datalen + HEADER_LEN); // Footer (byte) } bufInput.limit(Math.min(readed, datalen + HEADER_LEN)); buf.put(bufInput); if (dataUnderFlow > 0) { buf.limit(datalen); int len = fcInput.read(buf); if (len < dataUnderFlow) { log.error("Unable to read payload readed=" + len + " expected=" + dataUnderFlow); return -1; } } if (dataUnderFlow >= 0) { // Read Footer (byte) bufInput.clear(); bufInput.limit(FOOTER_LEN); if (fcInput.read(bufInput) < FOOTER_LEN) { return -1; } bufInput.flip(); footer = bufInput.get(); } if (footer != MAGIC_FOOT) { log.error("MAGIC FOOT fake=" + Integer.toHexString(footer) + " expected=" + Integer.toHexString(MAGIC_FOOT)); return -1; } buf.flip(); return (offset + HEADER_LEN + datalen + FOOTER_LEN); } catch (Exception e) { log.error("Exception in read(" + offset + ")", e); } return -1; } }
public class class_name { public synchronized long read(long offset, final ByteBuffer buf) { if (!validState) { throw new InvalidStateException(); } try { int readed; while (true) { if (offset >= offsetOutputCommited) { if (bufOutput.position() > 0) { log.warn("WARN: autoflush forced"); // depends on control dependency: [if], data = [none] flushBuffer(); // depends on control dependency: [if], data = [none] } } bufInput.clear(); // depends on control dependency: [while], data = [none] readed = fcInput.position(offset).read(bufInput); // Read 1 sector // depends on control dependency: [while], data = [none] if (readed < HEADER_LEN) { // short+int (6 bytes) return -1; // depends on control dependency: [if], data = [none] } bufInput.flip(); // depends on control dependency: [while], data = [none] final int magicB1 = (bufInput.get() & 0xFF); // Header - Magic (short, 2 bytes, msb-first) final int magicB2 = (bufInput.get() & 0xFF); // Header - Magic (short, 2 bytes, lsb-last) if (alignBlocks && (magicB1 == MAGIC_PADDING)) { final int diffOffset = nextBlockBoundary(offset); if (diffOffset > 0) { // log.info("WARN: skipping " + diffOffset + "bytes to next block-boundary"); offset += diffOffset; // depends on control dependency: [if], data = [none] continue; } } final int magic = ((magicB1 << 8) | magicB2); if (magic != MAGIC) { log.error("MAGIC HEADER fake=" + Integer.toHexString(magic) + " expected=" + Integer.toHexString(MAGIC)); // depends on control dependency: [if], data = [none] return -1; // depends on control dependency: [if], data = [none] } break; } // final int datalen = bufInput.getInt(); // Header - Data Size (int, 4 bytes) final int dataUnderFlow = (datalen - (readed - HEADER_LEN)); int footer = -12345678; if (dataUnderFlow < 0) { footer = bufInput.get(datalen + HEADER_LEN); // Footer (byte) // depends on control dependency: [if], data = [none] } bufInput.limit(Math.min(readed, datalen + HEADER_LEN)); // depends on control dependency: [try], data = [none] buf.put(bufInput); // depends on control dependency: [try], data = [none] if (dataUnderFlow > 0) { buf.limit(datalen); // depends on control dependency: [if], data = [none] int len = fcInput.read(buf); if (len < dataUnderFlow) { log.error("Unable to read payload readed=" + len + " expected=" + dataUnderFlow); // depends on control dependency: [if], data = [dataUnderFlow)] return -1; // depends on control dependency: [if], data = [none] } } if (dataUnderFlow >= 0) { // Read Footer (byte) bufInput.clear(); // depends on control dependency: [if], data = [none] bufInput.limit(FOOTER_LEN); // depends on control dependency: [if], data = [none] if (fcInput.read(bufInput) < FOOTER_LEN) { return -1; // depends on control dependency: [if], data = [none] } bufInput.flip(); // depends on control dependency: [if], data = [none] footer = bufInput.get(); // depends on control dependency: [if], data = [none] } if (footer != MAGIC_FOOT) { log.error("MAGIC FOOT fake=" + Integer.toHexString(footer) + " expected=" + Integer.toHexString(MAGIC_FOOT)); // depends on control dependency: [if], data = [none] return -1; // depends on control dependency: [if], data = [none] } buf.flip(); // depends on control dependency: [try], data = [none] return (offset + HEADER_LEN + datalen + FOOTER_LEN); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.error("Exception in read(" + offset + ")", e); } // depends on control dependency: [catch], data = [none] return -1; } }
public class class_name { public static String getResponseDesc(int code) { String[] iab_msgs = ("0:OK/1:User Canceled/2:Unknown/" + "3:Billing Unavailable/4:Item unavailable/" + "5:Developer Error/6:Error/7:Item Already Owned/" + "8:Item not owned").split("/"); String[] iabhelper_msgs = ("0:OK/-1001:Remote exception during initialization/" + "-1002:Bad response received/" + "-1003:Purchase signature verification failed/" + "-1004:Send intent failed/" + "-1005:User cancelled/" + "-1006:Unknown purchase response/" + "-1007:Missing token/" + "-1008:Unknown error/" + "-1009:Subscriptions not available/" + "-1010:Invalid consumption attempt").split("/"); if (code <= IABHELPER_ERROR_BASE) { int index = IABHELPER_ERROR_BASE - code; if (index >= 0 && index < iabhelper_msgs.length) return iabhelper_msgs[index]; else return String.valueOf(code) + ":Unknown IAB Helper Error"; } else if (code < 0 || code >= iab_msgs.length) { return String.valueOf(code) + ":Unknown"; } else { return iab_msgs[code]; } } }
public class class_name { public static String getResponseDesc(int code) { String[] iab_msgs = ("0:OK/1:User Canceled/2:Unknown/" + "3:Billing Unavailable/4:Item unavailable/" + "5:Developer Error/6:Error/7:Item Already Owned/" + "8:Item not owned").split("/"); String[] iabhelper_msgs = ("0:OK/-1001:Remote exception during initialization/" + "-1002:Bad response received/" + "-1003:Purchase signature verification failed/" + "-1004:Send intent failed/" + "-1005:User cancelled/" + "-1006:Unknown purchase response/" + "-1007:Missing token/" + "-1008:Unknown error/" + "-1009:Subscriptions not available/" + "-1010:Invalid consumption attempt").split("/"); if (code <= IABHELPER_ERROR_BASE) { int index = IABHELPER_ERROR_BASE - code; if (index >= 0 && index < iabhelper_msgs.length) return iabhelper_msgs[index]; else return String.valueOf(code) + ":Unknown IAB Helper Error"; } else if (code < 0 || code >= iab_msgs.length) { return String.valueOf(code) + ":Unknown"; // depends on control dependency: [if], data = [none] } else { return iab_msgs[code]; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static Mode decodeAsciiSegment(BitSource bits, StringBuilder result, StringBuilder resultTrailer) throws FormatException { boolean upperShift = false; do { int oneByte = bits.readBits(8); if (oneByte == 0) { throw FormatException.getFormatInstance(); } else if (oneByte <= 128) { // ASCII data (ASCII value + 1) if (upperShift) { oneByte += 128; //upperShift = false; } result.append((char) (oneByte - 1)); return Mode.ASCII_ENCODE; } else if (oneByte == 129) { // Pad return Mode.PAD_ENCODE; } else if (oneByte <= 229) { // 2-digit data 00-99 (Numeric Value + 130) int value = oneByte - 130; if (value < 10) { // pad with '0' for single digit values result.append('0'); } result.append(value); } else { switch (oneByte) { case 230: // Latch to C40 encodation return Mode.C40_ENCODE; case 231: // Latch to Base 256 encodation return Mode.BASE256_ENCODE; case 232: // FNC1 result.append((char) 29); // translate as ASCII 29 break; case 233: // Structured Append case 234: // Reader Programming // Ignore these symbols for now //throw ReaderException.getInstance(); break; case 235: // Upper Shift (shift to Extended ASCII) upperShift = true; break; case 236: // 05 Macro result.append("[)>\u001E05\u001D"); resultTrailer.insert(0, "\u001E\u0004"); break; case 237: // 06 Macro result.append("[)>\u001E06\u001D"); resultTrailer.insert(0, "\u001E\u0004"); break; case 238: // Latch to ANSI X12 encodation return Mode.ANSIX12_ENCODE; case 239: // Latch to Text encodation return Mode.TEXT_ENCODE; case 240: // Latch to EDIFACT encodation return Mode.EDIFACT_ENCODE; case 241: // ECI Character // TODO(bbrown): I think we need to support ECI //throw ReaderException.getInstance(); // Ignore this symbol for now break; default: // Not to be used in ASCII encodation // but work around encoders that end with 254, latch back to ASCII if (oneByte != 254 || bits.available() != 0) { throw FormatException.getFormatInstance(); } break; } } } while (bits.available() > 0); return Mode.ASCII_ENCODE; } }
public class class_name { private static Mode decodeAsciiSegment(BitSource bits, StringBuilder result, StringBuilder resultTrailer) throws FormatException { boolean upperShift = false; do { int oneByte = bits.readBits(8); if (oneByte == 0) { throw FormatException.getFormatInstance(); } else if (oneByte <= 128) { // ASCII data (ASCII value + 1) if (upperShift) { oneByte += 128; // depends on control dependency: [if], data = [none] //upperShift = false; } result.append((char) (oneByte - 1)); // depends on control dependency: [if], data = [(oneByte] return Mode.ASCII_ENCODE; // depends on control dependency: [if], data = [none] } else if (oneByte == 129) { // Pad return Mode.PAD_ENCODE; // depends on control dependency: [if], data = [none] } else if (oneByte <= 229) { // 2-digit data 00-99 (Numeric Value + 130) int value = oneByte - 130; if (value < 10) { // pad with '0' for single digit values result.append('0'); // depends on control dependency: [if], data = [none] } result.append(value); // depends on control dependency: [if], data = [none] } else { switch (oneByte) { case 230: // Latch to C40 encodation return Mode.C40_ENCODE; case 231: // Latch to Base 256 encodation return Mode.BASE256_ENCODE; case 232: // FNC1 result.append((char) 29); // translate as ASCII 29 break; case 233: // Structured Append case 234: // Reader Programming // Ignore these symbols for now //throw ReaderException.getInstance(); break; case 235: // Upper Shift (shift to Extended ASCII) upperShift = true; break; case 236: // 05 Macro result.append("[)>\u001E05\u001D"); resultTrailer.insert(0, "\u001E\u0004"); break; case 237: // 06 Macro result.append("[)>\u001E06\u001D"); resultTrailer.insert(0, "\u001E\u0004"); break; case 238: // Latch to ANSI X12 encodation return Mode.ANSIX12_ENCODE; case 239: // Latch to Text encodation return Mode.TEXT_ENCODE; case 240: // Latch to EDIFACT encodation return Mode.EDIFACT_ENCODE; case 241: // ECI Character // TODO(bbrown): I think we need to support ECI //throw ReaderException.getInstance(); // Ignore this symbol for now break; default: // Not to be used in ASCII encodation // but work around encoders that end with 254, latch back to ASCII if (oneByte != 254 || bits.available() != 0) { throw FormatException.getFormatInstance(); } break; } } } while (bits.available() > 0); return Mode.ASCII_ENCODE; } }
public class class_name { public void close() throws IOException { // if we haven't started the application, we have nothing to do if (isOk) { OutputCollector<K3, V3> nullCollector = new OutputCollector<K3, V3>() { public void collect(K3 key, V3 value) throws IOException { // NULL } }; startApplication(nullCollector, Reporter.NULL); } try { if (isOk) { application.getDownlink().endOfInput(); } else { // send the abort to the application and let it clean up application.getDownlink().abort(); } LOG.info("waiting for finish"); application.waitForFinish(); LOG.info("got done"); } catch (Throwable t) { application.abort(t); } finally { application.cleanup(); } } }
public class class_name { public void close() throws IOException { // if we haven't started the application, we have nothing to do if (isOk) { OutputCollector<K3, V3> nullCollector = new OutputCollector<K3, V3>() { public void collect(K3 key, V3 value) throws IOException { // NULL } }; startApplication(nullCollector, Reporter.NULL); } try { if (isOk) { application.getDownlink().endOfInput(); // depends on control dependency: [if], data = [none] } else { // send the abort to the application and let it clean up application.getDownlink().abort(); // depends on control dependency: [if], data = [none] } LOG.info("waiting for finish"); application.waitForFinish(); LOG.info("got done"); } catch (Throwable t) { application.abort(t); } finally { application.cleanup(); } } }
public class class_name { public GetCelebrityInfoResult withUrls(String... urls) { if (this.urls == null) { setUrls(new java.util.ArrayList<String>(urls.length)); } for (String ele : urls) { this.urls.add(ele); } return this; } }
public class class_name { public GetCelebrityInfoResult withUrls(String... urls) { if (this.urls == null) { setUrls(new java.util.ArrayList<String>(urls.length)); // depends on control dependency: [if], data = [none] } for (String ele : urls) { this.urls.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public Observable<ServiceResponse<ManagedClusterAccessProfileInner>> getAccessProfileWithServiceResponseAsync(String resourceGroupName, String resourceName, String roleName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceName == null) { throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (roleName == null) { throw new IllegalArgumentException("Parameter roleName is required and cannot be null."); } final String apiVersion = "2019-02-01"; return service.getAccessProfile(this.client.subscriptionId(), resourceGroupName, resourceName, roleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagedClusterAccessProfileInner>>>() { @Override public Observable<ServiceResponse<ManagedClusterAccessProfileInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ManagedClusterAccessProfileInner> clientResponse = getAccessProfileDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<ManagedClusterAccessProfileInner>> getAccessProfileWithServiceResponseAsync(String resourceGroupName, String resourceName, String roleName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceName == null) { throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (roleName == null) { throw new IllegalArgumentException("Parameter roleName is required and cannot be null."); } final String apiVersion = "2019-02-01"; return service.getAccessProfile(this.client.subscriptionId(), resourceGroupName, resourceName, roleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagedClusterAccessProfileInner>>>() { @Override public Observable<ServiceResponse<ManagedClusterAccessProfileInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ManagedClusterAccessProfileInner> clientResponse = getAccessProfileDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { private static List<Subchannel> filterNonFailingSubchannels( Collection<Subchannel> subchannels) { List<Subchannel> readySubchannels = new ArrayList<>(subchannels.size()); for (Subchannel subchannel : subchannels) { if (isReady(subchannel)) { readySubchannels.add(subchannel); } } return readySubchannels; } }
public class class_name { private static List<Subchannel> filterNonFailingSubchannels( Collection<Subchannel> subchannels) { List<Subchannel> readySubchannels = new ArrayList<>(subchannels.size()); for (Subchannel subchannel : subchannels) { if (isReady(subchannel)) { readySubchannels.add(subchannel); // depends on control dependency: [if], data = [none] } } return readySubchannels; } }