code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public Float getFloat(final String key, final Float def) { Float val = getFloat(key); if (val == null) { if (map.containsKey(key)) { return null; } return def; } return val; } }
public class class_name { public Float getFloat(final String key, final Float def) { Float val = getFloat(key); if (val == null) { if (map.containsKey(key)) { return null; // depends on control dependency: [if], data = [none] } return def; // depends on control dependency: [if], data = [none] } return val; } }
public class class_name { public static DZcs cs_load(InputStream in) { int i, j; double x[], x_re, x_im ; DZcs T; String line, tokens[] ; Reader r = new InputStreamReader(in); BufferedReader br = new BufferedReader(r); T = cs_spalloc(0, 0, 1, true, true) ; /* allocate result */ try { while ((line = br.readLine()) != null) { tokens = line.trim().split("\\s+") ; if (tokens.length != 4) return null ; i = Integer.parseInt(tokens [0]) ; j = Integer.parseInt(tokens [1]) ; x_re = Double.parseDouble(tokens [2]) ; x_im = Double.parseDouble(tokens [3]) ; x = new double[] {x_re, x_im} ; if (!cs_entry(T, i, j, x)) return (null) ; } r.close(); br.close(); } catch (IOException e) { return (null) ; } return (T) ; } }
public class class_name { public static DZcs cs_load(InputStream in) { int i, j; double x[], x_re, x_im ; DZcs T; String line, tokens[] ; Reader r = new InputStreamReader(in); BufferedReader br = new BufferedReader(r); T = cs_spalloc(0, 0, 1, true, true) ; /* allocate result */ try { while ((line = br.readLine()) != null) { tokens = line.trim().split("\\s+") ; // depends on control dependency: [while], data = [none] if (tokens.length != 4) return null ; i = Integer.parseInt(tokens [0]) ; // depends on control dependency: [while], data = [none] j = Integer.parseInt(tokens [1]) ; // depends on control dependency: [while], data = [none] x_re = Double.parseDouble(tokens [2]) ; // depends on control dependency: [while], data = [none] x_im = Double.parseDouble(tokens [3]) ; // depends on control dependency: [while], data = [none] x = new double[] {x_re, x_im} ; // depends on control dependency: [while], data = [none] if (!cs_entry(T, i, j, x)) return (null) ; } r.close(); // depends on control dependency: [try], data = [none] br.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { return (null) ; } // depends on control dependency: [catch], data = [none] return (T) ; } }
public class class_name { protected static FileList transformFileList(final CSNodeWrapper node) { final List<File> files = new LinkedList<File>(); // Add all the child files if (node.getChildren() != null && node.getChildren().getItems() != null) { final List<CSNodeWrapper> childNodes = node.getChildren().getItems(); final HashMap<CSNodeWrapper, File> fileNodes = new HashMap<CSNodeWrapper, File>(); for (final CSNodeWrapper childNode : childNodes) { fileNodes.put(childNode, transformFile(childNode)); } // Sort the file list nodes so that they are in the right order based on next/prev values. final LinkedHashMap<CSNodeWrapper, File> sortedMap = CSNodeSorter.sortMap(fileNodes); // Add the child nodes to the file list now that they are in the right order. final Iterator<Map.Entry<CSNodeWrapper, File>> iter = sortedMap.entrySet().iterator(); while (iter.hasNext()) { final Map.Entry<CSNodeWrapper, File> entry = iter.next(); files.add(entry.getValue()); } } return new FileList(CommonConstants.CS_FILE_TITLE, files); } }
public class class_name { protected static FileList transformFileList(final CSNodeWrapper node) { final List<File> files = new LinkedList<File>(); // Add all the child files if (node.getChildren() != null && node.getChildren().getItems() != null) { final List<CSNodeWrapper> childNodes = node.getChildren().getItems(); final HashMap<CSNodeWrapper, File> fileNodes = new HashMap<CSNodeWrapper, File>(); for (final CSNodeWrapper childNode : childNodes) { fileNodes.put(childNode, transformFile(childNode)); // depends on control dependency: [for], data = [childNode] } // Sort the file list nodes so that they are in the right order based on next/prev values. final LinkedHashMap<CSNodeWrapper, File> sortedMap = CSNodeSorter.sortMap(fileNodes); // Add the child nodes to the file list now that they are in the right order. final Iterator<Map.Entry<CSNodeWrapper, File>> iter = sortedMap.entrySet().iterator(); while (iter.hasNext()) { final Map.Entry<CSNodeWrapper, File> entry = iter.next(); files.add(entry.getValue()); // depends on control dependency: [while], data = [none] } } return new FileList(CommonConstants.CS_FILE_TITLE, files); } }
public class class_name { public void setBoneMap(int[] bonemap) { GVRSkeleton dstskel = mDestSkeleton; int numbones; if (bonemap == null) { return; } if (dstskel == null) { return; } numbones = dstskel.getNumBones(); if (numbones == 0) { return; } mBoneMap = bonemap; } }
public class class_name { public void setBoneMap(int[] bonemap) { GVRSkeleton dstskel = mDestSkeleton; int numbones; if (bonemap == null) { return; // depends on control dependency: [if], data = [none] } if (dstskel == null) { return; // depends on control dependency: [if], data = [none] } numbones = dstskel.getNumBones(); if (numbones == 0) { return; // depends on control dependency: [if], data = [none] } mBoneMap = bonemap; } }
public class class_name { @Override public void execute() { if ( "pom".equals( project.getPackaging() ) ) { return; } if ( skip ) { return; } long ts = System.currentTimeMillis(); Properties projectProperties = project.getProperties(); restoreProperty( projectProperties, "sbt._scalacOptions" ); restoreProperty( projectProperties, "sbt._scalacPlugins" ); restoreProperty( projectProperties, "addScalacArgs" ); restoreProperty( projectProperties, "analysisCacheFile" ); restoreProperty( projectProperties, "maven.test.failure.ignore" ); long te = System.currentTimeMillis(); getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) ); } }
public class class_name { @Override public void execute() { if ( "pom".equals( project.getPackaging() ) ) { return; // depends on control dependency: [if], data = [none] } if ( skip ) { return; // depends on control dependency: [if], data = [none] } long ts = System.currentTimeMillis(); Properties projectProperties = project.getProperties(); restoreProperty( projectProperties, "sbt._scalacOptions" ); restoreProperty( projectProperties, "sbt._scalacPlugins" ); restoreProperty( projectProperties, "addScalacArgs" ); restoreProperty( projectProperties, "analysisCacheFile" ); restoreProperty( projectProperties, "maven.test.failure.ignore" ); long te = System.currentTimeMillis(); getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) ); } }
public class class_name { public static List<ConnectionNotation> hybridizeAntiparallel(PolymerNotation one, PolymerNotation two) throws RNAUtilsException, NotationException, HELM2HandledException, ChemistryException, NucleotideLoadingException { checkRNA(one); checkRNA(two); List<ConnectionNotation> connections = new ArrayList<ConnectionNotation>(); ConnectionNotation connection; /* Length of the two rnas have to be the same */ if (areAntiparallel(one, two)) { for (int i = 0; i < PolymerUtils.getTotalMonomerCount(one); i++) { int backValue = PolymerUtils.getTotalMonomerCount(one) - i; int firstValue = i + 1; String details = firstValue + ":pair-" + backValue + ":pair"; connection = new ConnectionNotation(one.getPolymerID(), two.getPolymerID(), details); connections.add(connection); } return connections; } else { throw new RNAUtilsException("The given RNAs are not antiparallel to each other"); } } }
public class class_name { public static List<ConnectionNotation> hybridizeAntiparallel(PolymerNotation one, PolymerNotation two) throws RNAUtilsException, NotationException, HELM2HandledException, ChemistryException, NucleotideLoadingException { checkRNA(one); checkRNA(two); List<ConnectionNotation> connections = new ArrayList<ConnectionNotation>(); ConnectionNotation connection; /* Length of the two rnas have to be the same */ if (areAntiparallel(one, two)) { for (int i = 0; i < PolymerUtils.getTotalMonomerCount(one); i++) { int backValue = PolymerUtils.getTotalMonomerCount(one) - i; int firstValue = i + 1; String details = firstValue + ":pair-" + backValue + ":pair"; connection = new ConnectionNotation(one.getPolymerID(), two.getPolymerID(), details); // depends on control dependency: [for], data = [none] connections.add(connection); // depends on control dependency: [for], data = [none] } return connections; } else { throw new RNAUtilsException("The given RNAs are not antiparallel to each other"); } } }
public class class_name { private List<PipelineStage> findUnmappedStages(Dashboard dashboard,List<PipelineStage> pipelineStageList){ List<PipelineStage> unmappedStages = new ArrayList<>(); Map<PipelineStage, String> stageToEnvironmentNameMap = PipelineUtils.getStageToEnvironmentNameMap(dashboard); for (PipelineStage systemStage : pipelineStageList) { if (PipelineStageType.DEPLOY.equals(systemStage.getType())) { String mappedName = stageToEnvironmentNameMap.get(systemStage); if (mappedName == null || mappedName.isEmpty()) { unmappedStages.add(systemStage); } } } return unmappedStages; } }
public class class_name { private List<PipelineStage> findUnmappedStages(Dashboard dashboard,List<PipelineStage> pipelineStageList){ List<PipelineStage> unmappedStages = new ArrayList<>(); Map<PipelineStage, String> stageToEnvironmentNameMap = PipelineUtils.getStageToEnvironmentNameMap(dashboard); for (PipelineStage systemStage : pipelineStageList) { if (PipelineStageType.DEPLOY.equals(systemStage.getType())) { String mappedName = stageToEnvironmentNameMap.get(systemStage); if (mappedName == null || mappedName.isEmpty()) { unmappedStages.add(systemStage); // depends on control dependency: [if], data = [none] } } } return unmappedStages; } }
public class class_name { protected void launch(String projectName, String fullyQualifiedName, String mode) throws CoreException { final List<ILaunchConfiguration> configs = getCandidates(projectName, fullyQualifiedName); ILaunchConfiguration config = null; final int count = configs.size(); if (count == 1) { config = configs.get(0); } else if (count > 1) { config = chooseConfiguration(configs); if (config == null) { return; } } if (config == null) { config = createConfiguration(projectName, fullyQualifiedName); } if (config != null) { DebugUITools.launch(config, mode); } } }
public class class_name { protected void launch(String projectName, String fullyQualifiedName, String mode) throws CoreException { final List<ILaunchConfiguration> configs = getCandidates(projectName, fullyQualifiedName); ILaunchConfiguration config = null; final int count = configs.size(); if (count == 1) { config = configs.get(0); } else if (count > 1) { config = chooseConfiguration(configs); if (config == null) { return; // depends on control dependency: [if], data = [none] } } if (config == null) { config = createConfiguration(projectName, fullyQualifiedName); } if (config != null) { DebugUITools.launch(config, mode); } } }
public class class_name { private Principal selectedPrincipal() { if (browseByColumn.getSelectedItem().getTitle().equals(Console.CONSTANTS.common_label_users())) { return userColumn.getSelectedItem(); } else if (browseByColumn.getSelectedItem().getTitle().equals(Console.CONSTANTS.common_label_groups())) { return groupColumn.getSelectedItem(); } return null; } }
public class class_name { private Principal selectedPrincipal() { if (browseByColumn.getSelectedItem().getTitle().equals(Console.CONSTANTS.common_label_users())) { return userColumn.getSelectedItem(); // depends on control dependency: [if], data = [none] } else if (browseByColumn.getSelectedItem().getTitle().equals(Console.CONSTANTS.common_label_groups())) { return groupColumn.getSelectedItem(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void marshall(JdbcTarget jdbcTarget, ProtocolMarshaller protocolMarshaller) { if (jdbcTarget == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(jdbcTarget.getConnectionName(), CONNECTIONNAME_BINDING); protocolMarshaller.marshall(jdbcTarget.getPath(), PATH_BINDING); protocolMarshaller.marshall(jdbcTarget.getExclusions(), EXCLUSIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(JdbcTarget jdbcTarget, ProtocolMarshaller protocolMarshaller) { if (jdbcTarget == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(jdbcTarget.getConnectionName(), CONNECTIONNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(jdbcTarget.getPath(), PATH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(jdbcTarget.getExclusions(), EXCLUSIONS_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 boolean gatherCandidate(IceComponent component, InetAddress address, int startingPort, RtpPortManager portManager, Selector selector) { // Recursion stop criteria if(startingPort == portManager.peek()) { return false; } // Gather the candidate using current port try { int port = portManager.current(); DatagramChannel channel = openUdpChannel(address, port, selector); HostCandidate candidate = new HostCandidate(component, address, port); this.foundations.assignFoundation(candidate); component.addLocalCandidate(new LocalCandidateWrapper(candidate, channel)); return true; } catch (IOException e) { // The port is occupied. Try again with next logical port. portManager.next(); return gatherCandidate(component, address, startingPort, portManager, selector); } } }
public class class_name { private boolean gatherCandidate(IceComponent component, InetAddress address, int startingPort, RtpPortManager portManager, Selector selector) { // Recursion stop criteria if(startingPort == portManager.peek()) { return false; // depends on control dependency: [if], data = [none] } // Gather the candidate using current port try { int port = portManager.current(); DatagramChannel channel = openUdpChannel(address, port, selector); HostCandidate candidate = new HostCandidate(component, address, port); this.foundations.assignFoundation(candidate); // depends on control dependency: [try], data = [none] component.addLocalCandidate(new LocalCandidateWrapper(candidate, channel)); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (IOException e) { // The port is occupied. Try again with next logical port. portManager.next(); return gatherCandidate(component, address, startingPort, portManager, selector); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setRepositoryFolderHandler(I_CmsRepositoryFolderHandler clazz) { m_repositoryFolderHandler = clazz; if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( org.opencms.configuration.Messages.get().getBundle().key( org.opencms.configuration.Messages.INIT_REPOSITORY_FOLDER_1, m_repositoryFolderHandler.getClass().getName())); } } }
public class class_name { public void setRepositoryFolderHandler(I_CmsRepositoryFolderHandler clazz) { m_repositoryFolderHandler = clazz; if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( org.opencms.configuration.Messages.get().getBundle().key( org.opencms.configuration.Messages.INIT_REPOSITORY_FOLDER_1, m_repositoryFolderHandler.getClass().getName())); // depends on control dependency: [if], data = [none] } } }
public class class_name { int getContentLength(HttpURLConnection conn) { String transferEncoding = conn.getHeaderField(TRANSFER_ENCODING); if (transferEncoding == null || transferEncoding.equalsIgnoreCase("chunked")) { return conn.getHeaderFieldInt(CONTENT_LENGTH, -1); } else { return -1; } } }
public class class_name { int getContentLength(HttpURLConnection conn) { String transferEncoding = conn.getHeaderField(TRANSFER_ENCODING); if (transferEncoding == null || transferEncoding.equalsIgnoreCase("chunked")) { return conn.getHeaderFieldInt(CONTENT_LENGTH, -1); // depends on control dependency: [if], data = [none] } else { return -1; // depends on control dependency: [if], data = [none] } } }
public class class_name { public String[] getContentValue() { List<WebElement> options = getElement().findElements(By.tagName("option")); List<String> contents = new ArrayList<String>(); for (WebElement option : options) { contents.add(option.getAttribute("value")); } return (String[]) contents.toArray(new String[contents.size()]); } }
public class class_name { public String[] getContentValue() { List<WebElement> options = getElement().findElements(By.tagName("option")); List<String> contents = new ArrayList<String>(); for (WebElement option : options) { contents.add(option.getAttribute("value")); // depends on control dependency: [for], data = [option] } return (String[]) contents.toArray(new String[contents.size()]); } }
public class class_name { @SuppressWarnings("deprecation") static JdkApplicationProtocolNegotiator toNegotiator(ApplicationProtocolConfig config, boolean isServer) { if (config == null) { return JdkDefaultApplicationProtocolNegotiator.INSTANCE; } switch(config.protocol()) { case NONE: return JdkDefaultApplicationProtocolNegotiator.INSTANCE; case ALPN: if (isServer) { switch(config.selectorFailureBehavior()) { case FATAL_ALERT: return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); case NO_ADVERTISE: return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectorFailureBehavior()).append(" failure behavior").toString()); } } else { switch(config.selectedListenerFailureBehavior()) { case ACCEPT: return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); case FATAL_ALERT: return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectedListenerFailureBehavior()).append(" failure behavior").toString()); } } case NPN: if (isServer) { switch(config.selectedListenerFailureBehavior()) { case ACCEPT: return new JdkNpnApplicationProtocolNegotiator(false, config.supportedProtocols()); case FATAL_ALERT: return new JdkNpnApplicationProtocolNegotiator(true, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectedListenerFailureBehavior()).append(" failure behavior").toString()); } } else { switch(config.selectorFailureBehavior()) { case FATAL_ALERT: return new JdkNpnApplicationProtocolNegotiator(true, config.supportedProtocols()); case NO_ADVERTISE: return new JdkNpnApplicationProtocolNegotiator(false, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectorFailureBehavior()).append(" failure behavior").toString()); } } default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.protocol()).append(" protocol").toString()); } } }
public class class_name { @SuppressWarnings("deprecation") static JdkApplicationProtocolNegotiator toNegotiator(ApplicationProtocolConfig config, boolean isServer) { if (config == null) { return JdkDefaultApplicationProtocolNegotiator.INSTANCE; // depends on control dependency: [if], data = [none] } switch(config.protocol()) { case NONE: return JdkDefaultApplicationProtocolNegotiator.INSTANCE; case ALPN: if (isServer) { switch(config.selectorFailureBehavior()) { case FATAL_ALERT: return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); case NO_ADVERTISE: return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectorFailureBehavior()).append(" failure behavior").toString()); } } else { switch(config.selectedListenerFailureBehavior()) { case ACCEPT: return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); case FATAL_ALERT: return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectedListenerFailureBehavior()).append(" failure behavior").toString()); } } case NPN: if (isServer) { switch(config.selectedListenerFailureBehavior()) { case ACCEPT: return new JdkNpnApplicationProtocolNegotiator(false, config.supportedProtocols()); case FATAL_ALERT: return new JdkNpnApplicationProtocolNegotiator(true, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectedListenerFailureBehavior()).append(" failure behavior").toString()); } } else { switch(config.selectorFailureBehavior()) { case FATAL_ALERT: return new JdkNpnApplicationProtocolNegotiator(true, config.supportedProtocols()); case NO_ADVERTISE: return new JdkNpnApplicationProtocolNegotiator(false, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectorFailureBehavior()).append(" failure behavior").toString()); } } default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.protocol()).append(" protocol").toString()); } } }
public class class_name { static Vector2d newAtomAnnotationVector(IAtom atom, List<IBond> bonds, List<Vector2d> auxVectors) { final List<Vector2d> vectors = new ArrayList<Vector2d>(bonds.size()); for (IBond bond : bonds) vectors.add(VecmathUtil.newUnitVector(atom, bond)); if (vectors.size() == 0) { // no bonds, place below if (auxVectors.size() == 0) return new Vector2d(0, -1); if (auxVectors.size() == 1) return VecmathUtil.negate(auxVectors.get(0)); return VecmathUtil.newVectorInLargestGap(auxVectors); } else if (vectors.size() == 1) { // 1 bond connected // H0, then label simply appears on the opposite side if (auxVectors.size() == 0) return VecmathUtil.negate(vectors.get(0)); // !H0, then place it in the largest gap vectors.addAll(auxVectors); return VecmathUtil.newVectorInLargestGap(vectors); } else if (vectors.size() == 2 && auxVectors.size() == 0) { // 2 bonds connected to an atom with no hydrogen labels // sum the vectors such that the label appears in the acute/nook of the two bonds Vector2d combined = VecmathUtil.sum(vectors.get(0), vectors.get(1)); // shallow angle (< 30 deg) means the label probably won't fit if (vectors.get(0).angle(vectors.get(1)) < Math.toRadians(65)) combined.negate(); // flip vector if either bond is a non-single bond or a wedge, this will // place the label in the largest space. // However - when both bonds are wedged (consider a bridging system) to // keep the label in the nook of the wedges else if ((!isPlainBond(bonds.get(0)) || !isPlainBond(bonds.get(1))) && !(isWedged(bonds.get(0)) && isWedged(bonds.get(1)))) combined.negate(); combined.normalize(); // did we divide by 0? whoops - this happens when the bonds are collinear if (Double.isNaN(combined.length())) return VecmathUtil.newVectorInLargestGap(vectors); return combined; } else { if (vectors.size() == 3 && auxVectors.size() == 0) { // 3 bonds connected to an atom with no hydrogen label // the easy and common case is to check when two bonds are plain // (i.e. non-stereo sigma bonds) and use those. This gives good // placement for fused conjugated rings List<Vector2d> plainVectors = new ArrayList<Vector2d>(); List<Vector2d> wedgeVectors = new ArrayList<Vector2d>(); for (IBond bond : bonds) { if (isPlainBond(bond)) plainVectors.add(VecmathUtil.newUnitVector(atom, bond)); if (isWedged(bond)) wedgeVectors.add(VecmathUtil.newUnitVector(atom, bond)); } if (plainVectors.size() == 2) { return VecmathUtil.sum(plainVectors.get(0), plainVectors.get(1)); } else if (plainVectors.size() + wedgeVectors.size() == 2) { plainVectors.addAll(wedgeVectors); return VecmathUtil.sum(plainVectors.get(0), plainVectors.get(1)); } } // the default option is to find the largest gap if (auxVectors.size() > 0) vectors.addAll(auxVectors); return VecmathUtil.newVectorInLargestGap(vectors); } } }
public class class_name { static Vector2d newAtomAnnotationVector(IAtom atom, List<IBond> bonds, List<Vector2d> auxVectors) { final List<Vector2d> vectors = new ArrayList<Vector2d>(bonds.size()); for (IBond bond : bonds) vectors.add(VecmathUtil.newUnitVector(atom, bond)); if (vectors.size() == 0) { // no bonds, place below if (auxVectors.size() == 0) return new Vector2d(0, -1); if (auxVectors.size() == 1) return VecmathUtil.negate(auxVectors.get(0)); return VecmathUtil.newVectorInLargestGap(auxVectors); // depends on control dependency: [if], data = [none] } else if (vectors.size() == 1) { // 1 bond connected // H0, then label simply appears on the opposite side if (auxVectors.size() == 0) return VecmathUtil.negate(vectors.get(0)); // !H0, then place it in the largest gap vectors.addAll(auxVectors); // depends on control dependency: [if], data = [none] return VecmathUtil.newVectorInLargestGap(vectors); // depends on control dependency: [if], data = [none] } else if (vectors.size() == 2 && auxVectors.size() == 0) { // 2 bonds connected to an atom with no hydrogen labels // sum the vectors such that the label appears in the acute/nook of the two bonds Vector2d combined = VecmathUtil.sum(vectors.get(0), vectors.get(1)); // shallow angle (< 30 deg) means the label probably won't fit if (vectors.get(0).angle(vectors.get(1)) < Math.toRadians(65)) combined.negate(); // flip vector if either bond is a non-single bond or a wedge, this will // place the label in the largest space. // However - when both bonds are wedged (consider a bridging system) to // keep the label in the nook of the wedges else if ((!isPlainBond(bonds.get(0)) || !isPlainBond(bonds.get(1))) && !(isWedged(bonds.get(0)) && isWedged(bonds.get(1)))) combined.negate(); combined.normalize(); // depends on control dependency: [if], data = [none] // did we divide by 0? whoops - this happens when the bonds are collinear if (Double.isNaN(combined.length())) return VecmathUtil.newVectorInLargestGap(vectors); return combined; // depends on control dependency: [if], data = [none] } else { if (vectors.size() == 3 && auxVectors.size() == 0) { // 3 bonds connected to an atom with no hydrogen label // the easy and common case is to check when two bonds are plain // (i.e. non-stereo sigma bonds) and use those. This gives good // placement for fused conjugated rings List<Vector2d> plainVectors = new ArrayList<Vector2d>(); List<Vector2d> wedgeVectors = new ArrayList<Vector2d>(); for (IBond bond : bonds) { if (isPlainBond(bond)) plainVectors.add(VecmathUtil.newUnitVector(atom, bond)); if (isWedged(bond)) wedgeVectors.add(VecmathUtil.newUnitVector(atom, bond)); } if (plainVectors.size() == 2) { return VecmathUtil.sum(plainVectors.get(0), plainVectors.get(1)); // depends on control dependency: [if], data = [none] } else if (plainVectors.size() + wedgeVectors.size() == 2) { plainVectors.addAll(wedgeVectors); // depends on control dependency: [if], data = [none] return VecmathUtil.sum(plainVectors.get(0), plainVectors.get(1)); // depends on control dependency: [if], data = [none] } } // the default option is to find the largest gap if (auxVectors.size() > 0) vectors.addAll(auxVectors); return VecmathUtil.newVectorInLargestGap(vectors); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public int getId() { if (mId != 0) { return mId; } if (!TextUtils.isEmpty(mPath) && !TextUtils.isEmpty(mUrl)) { return mId = FileDownloadUtils.generateId(mUrl, mPath, mPathAsDirectory); } return 0; } }
public class class_name { @Override public int getId() { if (mId != 0) { return mId; // depends on control dependency: [if], data = [none] } if (!TextUtils.isEmpty(mPath) && !TextUtils.isEmpty(mUrl)) { return mId = FileDownloadUtils.generateId(mUrl, mPath, mPathAsDirectory); // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { public boolean sameJSONFormat(JSONFormat jf){ Map<String,String> featLinks = new HashMap<>(); if(!this.name.equals(jf.name) || !this.creator.equals(jf.creator) || !this.license.equals(jf.license) || !this.source.equals(jf.source)){ return false; }else if(!this.sameFeatures(jf, featLinks)){ System.out.println("\nDifferences in features"); return false; }else if(!this.sameProducts(jf, featLinks, false)){ System.out.println("\nDifferences in products"); return false; } return true; } }
public class class_name { public boolean sameJSONFormat(JSONFormat jf){ Map<String,String> featLinks = new HashMap<>(); if(!this.name.equals(jf.name) || !this.creator.equals(jf.creator) || !this.license.equals(jf.license) || !this.source.equals(jf.source)){ return false; // depends on control dependency: [if], data = [none] }else if(!this.sameFeatures(jf, featLinks)){ System.out.println("\nDifferences in features"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] }else if(!this.sameProducts(jf, featLinks, false)){ System.out.println("\nDifferences in products"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public void marshall(DescribeMaintenanceStartTimeRequest describeMaintenanceStartTimeRequest, ProtocolMarshaller protocolMarshaller) { if (describeMaintenanceStartTimeRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeMaintenanceStartTimeRequest.getGatewayARN(), GATEWAYARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeMaintenanceStartTimeRequest describeMaintenanceStartTimeRequest, ProtocolMarshaller protocolMarshaller) { if (describeMaintenanceStartTimeRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeMaintenanceStartTimeRequest.getGatewayARN(), GATEWAYARN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void error( String msg, Throwable t ) { if( m_delegate.isErrorEnabled() ) { m_delegate.error( msg, t ); } } }
public class class_name { public void error( String msg, Throwable t ) { if( m_delegate.isErrorEnabled() ) { m_delegate.error( msg, t ); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public double getForecastTimeIntervalSizeInHours(Grib2Pds pds) { Grib2Pds.PdsInterval pdsIntv = (Grib2Pds.PdsInterval) pds; // override here only if timeRangeUnit = 255 boolean needOverride = false; for (Grib2Pds.TimeInterval ti : pdsIntv.getTimeIntervals()) { needOverride = (ti.timeRangeUnit == 255); } if (!needOverride) return super.getForecastTimeIntervalSizeInHours(pds); return 12.0; } }
public class class_name { @Override public double getForecastTimeIntervalSizeInHours(Grib2Pds pds) { Grib2Pds.PdsInterval pdsIntv = (Grib2Pds.PdsInterval) pds; // override here only if timeRangeUnit = 255 boolean needOverride = false; for (Grib2Pds.TimeInterval ti : pdsIntv.getTimeIntervals()) { needOverride = (ti.timeRangeUnit == 255); // depends on control dependency: [for], data = [ti] } if (!needOverride) return super.getForecastTimeIntervalSizeInHours(pds); return 12.0; } }
public class class_name { public void rows(int numOfRows) { int rows = checkRows(numOfRows, 0, 0); String reason = NO_ELEMENT_FOUND; if (rows < 0 && getElement().is().present()) { reason = "Element not table"; } assertTrue(reason, rows >= 0); assertEquals("Number of rows mismatch", numOfRows, rows); } }
public class class_name { public void rows(int numOfRows) { int rows = checkRows(numOfRows, 0, 0); String reason = NO_ELEMENT_FOUND; if (rows < 0 && getElement().is().present()) { reason = "Element not table"; // depends on control dependency: [if], data = [none] } assertTrue(reason, rows >= 0); assertEquals("Number of rows mismatch", numOfRows, rows); } }
public class class_name { public void marshall(BotMetadata botMetadata, ProtocolMarshaller protocolMarshaller) { if (botMetadata == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(botMetadata.getName(), NAME_BINDING); protocolMarshaller.marshall(botMetadata.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(botMetadata.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(botMetadata.getLastUpdatedDate(), LASTUPDATEDDATE_BINDING); protocolMarshaller.marshall(botMetadata.getCreatedDate(), CREATEDDATE_BINDING); protocolMarshaller.marshall(botMetadata.getVersion(), VERSION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(BotMetadata botMetadata, ProtocolMarshaller protocolMarshaller) { if (botMetadata == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(botMetadata.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(botMetadata.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(botMetadata.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(botMetadata.getLastUpdatedDate(), LASTUPDATEDDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(botMetadata.getCreatedDate(), CREATEDDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(botMetadata.getVersion(), VERSION_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Predicate<Throwable> throwableContainsMessage(final String expected, final boolean caseSensitive) { return new Predicate<Throwable>() { public boolean apply(Throwable input) { String actual = input.getMessage(); String exp = expected; if (! caseSensitive) { actual = actual.toLowerCase(); exp = exp.toLowerCase(); } return actual.contains(exp); } }; } }
public class class_name { public static Predicate<Throwable> throwableContainsMessage(final String expected, final boolean caseSensitive) { return new Predicate<Throwable>() { public boolean apply(Throwable input) { String actual = input.getMessage(); String exp = expected; if (! caseSensitive) { actual = actual.toLowerCase(); // depends on control dependency: [if], data = [none] exp = exp.toLowerCase(); // depends on control dependency: [if], data = [none] } return actual.contains(exp); } }; } }
public class class_name { public OutputGate getOutputGate(int index) { if (index < this.outputGates.size()) { return this.outputGates.get(index); } return null; } }
public class class_name { public OutputGate getOutputGate(int index) { if (index < this.outputGates.size()) { return this.outputGates.get(index); // depends on control dependency: [if], data = [(index] } return null; } }
public class class_name { private static InputStream createInputStream(GraphicFactory graphicFactory, String relativePathPrefix, String src) throws IOException { InputStream inputStream; if (src.startsWith(PREFIX_ASSETS)) { src = src.substring(PREFIX_ASSETS.length()); inputStream = inputStreamFromAssets(graphicFactory, relativePathPrefix, src); } else if (src.startsWith(PREFIX_FILE)) { src = src.substring(PREFIX_FILE.length()); inputStream = inputStreamFromFile(relativePathPrefix, src); } else if (src.startsWith(PREFIX_JAR) || src.startsWith(PREFIX_JAR_V1)) { if (src.startsWith(PREFIX_JAR)) { src = src.substring(PREFIX_JAR.length()); } else if (src.startsWith(PREFIX_JAR_V1)) { src = src.substring(PREFIX_JAR_V1.length()); } inputStream = inputStreamFromJar(relativePathPrefix, src); } else { inputStream = inputStreamFromFile(relativePathPrefix, src); if (inputStream == null) { inputStream = inputStreamFromAssets(graphicFactory, relativePathPrefix, src); } if (inputStream == null) { inputStream = inputStreamFromJar(relativePathPrefix, src); } } // Fallback to internal resources if (inputStream == null) { inputStream = inputStreamFromJar("/assets/", src); if (inputStream != null) { LOGGER.info("internal resource: " + src); } } if (inputStream != null) { return inputStream; } LOGGER.severe("invalid resource: " + src); throw new FileNotFoundException("invalid resource: " + src); } }
public class class_name { private static InputStream createInputStream(GraphicFactory graphicFactory, String relativePathPrefix, String src) throws IOException { InputStream inputStream; if (src.startsWith(PREFIX_ASSETS)) { src = src.substring(PREFIX_ASSETS.length()); inputStream = inputStreamFromAssets(graphicFactory, relativePathPrefix, src); } else if (src.startsWith(PREFIX_FILE)) { src = src.substring(PREFIX_FILE.length()); inputStream = inputStreamFromFile(relativePathPrefix, src); } else if (src.startsWith(PREFIX_JAR) || src.startsWith(PREFIX_JAR_V1)) { if (src.startsWith(PREFIX_JAR)) { src = src.substring(PREFIX_JAR.length()); // depends on control dependency: [if], data = [none] } else if (src.startsWith(PREFIX_JAR_V1)) { src = src.substring(PREFIX_JAR_V1.length()); // depends on control dependency: [if], data = [none] } inputStream = inputStreamFromJar(relativePathPrefix, src); } else { inputStream = inputStreamFromFile(relativePathPrefix, src); if (inputStream == null) { inputStream = inputStreamFromAssets(graphicFactory, relativePathPrefix, src); // depends on control dependency: [if], data = [none] } if (inputStream == null) { inputStream = inputStreamFromJar(relativePathPrefix, src); // depends on control dependency: [if], data = [none] } } // Fallback to internal resources if (inputStream == null) { inputStream = inputStreamFromJar("/assets/", src); if (inputStream != null) { LOGGER.info("internal resource: " + src); } } if (inputStream != null) { return inputStream; } LOGGER.severe("invalid resource: " + src); throw new FileNotFoundException("invalid resource: " + src); } }
public class class_name { public void removeToken(Object token) { m_tokens.remove(token); if (m_tokens.isEmpty()) { if (m_joinAction != null) { m_joinAction.run(); } } } }
public class class_name { public void removeToken(Object token) { m_tokens.remove(token); if (m_tokens.isEmpty()) { if (m_joinAction != null) { m_joinAction.run(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public EClass getIfcDamperType() { if (ifcDamperTypeEClass == null) { ifcDamperTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(141); } return ifcDamperTypeEClass; } }
public class class_name { public EClass getIfcDamperType() { if (ifcDamperTypeEClass == null) { ifcDamperTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(141); // depends on control dependency: [if], data = [none] } return ifcDamperTypeEClass; } }
public class class_name { public void setClusterNames(java.util.Collection<String> clusterNames) { if (clusterNames == null) { this.clusterNames = null; return; } this.clusterNames = new java.util.ArrayList<String>(clusterNames); } }
public class class_name { public void setClusterNames(java.util.Collection<String> clusterNames) { if (clusterNames == null) { this.clusterNames = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.clusterNames = new java.util.ArrayList<String>(clusterNames); } }
public class class_name { private List<String> readLinkExcludes(CmsObject cms) { List<String> linkExcludes = new ArrayList<String>(); try { // get the link exclude file String filePath = OpenCms.getSystemInfo().getConfigFilePath(cms, LINK_EXCLUDE_DEFINIFITON_FILE); CmsResource res = cms.readResource(filePath); CmsFile file = cms.readFile(res); CmsXmlContent linkExcludeDefinitions = CmsXmlContentFactory.unmarshal(cms, file); // get number of excludes int count = linkExcludeDefinitions.getIndexCount(XPATH_LINK, Locale.ENGLISH); for (int i = 1; i <= count; i++) { String exclude = linkExcludeDefinitions.getStringValue(cms, XPATH_LINK + "[" + i + "]", Locale.ENGLISH); linkExcludes.add(exclude); } } catch (CmsException e) { LOG.error(e); } return linkExcludes; } }
public class class_name { private List<String> readLinkExcludes(CmsObject cms) { List<String> linkExcludes = new ArrayList<String>(); try { // get the link exclude file String filePath = OpenCms.getSystemInfo().getConfigFilePath(cms, LINK_EXCLUDE_DEFINIFITON_FILE); CmsResource res = cms.readResource(filePath); CmsFile file = cms.readFile(res); CmsXmlContent linkExcludeDefinitions = CmsXmlContentFactory.unmarshal(cms, file); // get number of excludes int count = linkExcludeDefinitions.getIndexCount(XPATH_LINK, Locale.ENGLISH); for (int i = 1; i <= count; i++) { String exclude = linkExcludeDefinitions.getStringValue(cms, XPATH_LINK + "[" + i + "]", Locale.ENGLISH); linkExcludes.add(exclude); // depends on control dependency: [for], data = [none] } } catch (CmsException e) { LOG.error(e); } // depends on control dependency: [catch], data = [none] return linkExcludes; } }
public class class_name { @Deprecated public static Word2Vec readWord2Vec(File file) throws IOException { File tmpFileSyn0 = DL4JFileUtils.createTempFile("word2vec", "0"); File tmpFileSyn1 = DL4JFileUtils.createTempFile("word2vec", "1"); File tmpFileC = DL4JFileUtils.createTempFile("word2vec", "c"); File tmpFileH = DL4JFileUtils.createTempFile("word2vec", "h"); File tmpFileF = DL4JFileUtils.createTempFile("word2vec", "f"); tmpFileSyn0.deleteOnExit(); tmpFileSyn1.deleteOnExit(); tmpFileH.deleteOnExit(); tmpFileC.deleteOnExit(); tmpFileF.deleteOnExit(); int originalFreq = Nd4j.getMemoryManager().getOccasionalGcFrequency(); boolean originalPeriodic = Nd4j.getMemoryManager().isPeriodicGcActive(); if (originalPeriodic) Nd4j.getMemoryManager().togglePeriodicGc(false); Nd4j.getMemoryManager().setOccasionalGcFrequency(50000); try { ZipFile zipFile = new ZipFile(file); ZipEntry syn0 = zipFile.getEntry("syn0.txt"); InputStream stream = zipFile.getInputStream(syn0); FileUtils.copyInputStreamToFile(stream, tmpFileSyn0); ZipEntry syn1 = zipFile.getEntry("syn1.txt"); stream = zipFile.getInputStream(syn1); FileUtils.copyInputStreamToFile(stream, tmpFileSyn1); ZipEntry codes = zipFile.getEntry("codes.txt"); stream = zipFile.getInputStream(codes); FileUtils.copyInputStreamToFile(stream, tmpFileC); ZipEntry huffman = zipFile.getEntry("huffman.txt"); stream = zipFile.getInputStream(huffman); FileUtils.copyInputStreamToFile(stream, tmpFileH); ZipEntry config = zipFile.getEntry("config.json"); stream = zipFile.getInputStream(config); StringBuilder builder = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { String line; while ((line = reader.readLine()) != null) { builder.append(line); } } VectorsConfiguration configuration = VectorsConfiguration.fromJson(builder.toString().trim()); // we read first 4 files as w2v model Word2Vec w2v = readWord2VecFromText(tmpFileSyn0, tmpFileSyn1, tmpFileC, tmpFileH, configuration); // we read frequencies from frequencies.txt, however it's possible that we might not have this file ZipEntry frequencies = zipFile.getEntry("frequencies.txt"); if (frequencies != null) { stream = zipFile.getInputStream(frequencies); try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { String line; while ((line = reader.readLine()) != null) { String[] split = line.split(" "); VocabWord word = w2v.getVocab().tokenFor(decodeB64(split[0])); word.setElementFrequency((long) Double.parseDouble(split[1])); word.setSequencesCount((long) Double.parseDouble(split[2])); } } } ZipEntry zsyn1Neg = zipFile.getEntry("syn1Neg.txt"); if (zsyn1Neg != null) { stream = zipFile.getInputStream(zsyn1Neg); try (InputStreamReader isr = new InputStreamReader(stream); BufferedReader reader = new BufferedReader(isr)) { String line = null; List<INDArray> rows = new ArrayList<>(); while ((line = reader.readLine()) != null) { String[] split = line.split(" "); double array[] = new double[split.length]; for (int i = 0; i < split.length; i++) { array[i] = Double.parseDouble(split[i]); } rows.add(Nd4j.create(array, new long[]{array.length}, ((InMemoryLookupTable) w2v.getLookupTable()).getSyn0().dataType())); } // it's possible to have full model without syn1Neg if (!rows.isEmpty()) { INDArray syn1Neg = Nd4j.vstack(rows); ((InMemoryLookupTable) w2v.getLookupTable()).setSyn1Neg(syn1Neg); } } } return w2v; } finally { if (originalPeriodic) Nd4j.getMemoryManager().togglePeriodicGc(true); Nd4j.getMemoryManager().setOccasionalGcFrequency(originalFreq); for (File f : new File[]{tmpFileSyn0, tmpFileSyn1, tmpFileC, tmpFileH, tmpFileF}) { try { f.delete(); } catch (Exception e) { //Ignore, is temp file } } } } }
public class class_name { @Deprecated public static Word2Vec readWord2Vec(File file) throws IOException { File tmpFileSyn0 = DL4JFileUtils.createTempFile("word2vec", "0"); File tmpFileSyn1 = DL4JFileUtils.createTempFile("word2vec", "1"); File tmpFileC = DL4JFileUtils.createTempFile("word2vec", "c"); File tmpFileH = DL4JFileUtils.createTempFile("word2vec", "h"); File tmpFileF = DL4JFileUtils.createTempFile("word2vec", "f"); tmpFileSyn0.deleteOnExit(); tmpFileSyn1.deleteOnExit(); tmpFileH.deleteOnExit(); tmpFileC.deleteOnExit(); tmpFileF.deleteOnExit(); int originalFreq = Nd4j.getMemoryManager().getOccasionalGcFrequency(); boolean originalPeriodic = Nd4j.getMemoryManager().isPeriodicGcActive(); if (originalPeriodic) Nd4j.getMemoryManager().togglePeriodicGc(false); Nd4j.getMemoryManager().setOccasionalGcFrequency(50000); try { ZipFile zipFile = new ZipFile(file); ZipEntry syn0 = zipFile.getEntry("syn0.txt"); InputStream stream = zipFile.getInputStream(syn0); FileUtils.copyInputStreamToFile(stream, tmpFileSyn0); ZipEntry syn1 = zipFile.getEntry("syn1.txt"); stream = zipFile.getInputStream(syn1); FileUtils.copyInputStreamToFile(stream, tmpFileSyn1); ZipEntry codes = zipFile.getEntry("codes.txt"); stream = zipFile.getInputStream(codes); FileUtils.copyInputStreamToFile(stream, tmpFileC); ZipEntry huffman = zipFile.getEntry("huffman.txt"); stream = zipFile.getInputStream(huffman); FileUtils.copyInputStreamToFile(stream, tmpFileH); ZipEntry config = zipFile.getEntry("config.json"); stream = zipFile.getInputStream(config); StringBuilder builder = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { String line; while ((line = reader.readLine()) != null) { builder.append(line); // depends on control dependency: [while], data = [none] } } VectorsConfiguration configuration = VectorsConfiguration.fromJson(builder.toString().trim()); // we read first 4 files as w2v model Word2Vec w2v = readWord2VecFromText(tmpFileSyn0, tmpFileSyn1, tmpFileC, tmpFileH, configuration); // we read frequencies from frequencies.txt, however it's possible that we might not have this file ZipEntry frequencies = zipFile.getEntry("frequencies.txt"); if (frequencies != null) { stream = zipFile.getInputStream(frequencies); try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { String line; while ((line = reader.readLine()) != null) { String[] split = line.split(" "); VocabWord word = w2v.getVocab().tokenFor(decodeB64(split[0])); word.setElementFrequency((long) Double.parseDouble(split[1])); // depends on control dependency: [while], data = [none] word.setSequencesCount((long) Double.parseDouble(split[2])); // depends on control dependency: [while], data = [none] } } } ZipEntry zsyn1Neg = zipFile.getEntry("syn1Neg.txt"); if (zsyn1Neg != null) { stream = zipFile.getInputStream(zsyn1Neg); try (InputStreamReader isr = new InputStreamReader(stream); BufferedReader reader = new BufferedReader(isr)) { String line = null; List<INDArray> rows = new ArrayList<>(); while ((line = reader.readLine()) != null) { String[] split = line.split(" "); double array[] = new double[split.length]; for (int i = 0; i < split.length; i++) { array[i] = Double.parseDouble(split[i]); } rows.add(Nd4j.create(array, new long[]{array.length}, ((InMemoryLookupTable) w2v.getLookupTable()).getSyn0().dataType())); } // it's possible to have full model without syn1Neg if (!rows.isEmpty()) { INDArray syn1Neg = Nd4j.vstack(rows); ((InMemoryLookupTable) w2v.getLookupTable()).setSyn1Neg(syn1Neg); } } } return w2v; } finally { if (originalPeriodic) Nd4j.getMemoryManager().togglePeriodicGc(true); Nd4j.getMemoryManager().setOccasionalGcFrequency(originalFreq); for (File f : new File[]{tmpFileSyn0, tmpFileSyn1, tmpFileC, tmpFileH, tmpFileF}) { try { f.delete(); } catch (Exception e) { //Ignore, is temp file } } } } }
public class class_name { private boolean compareFs(FileSystem srcFs, FileSystem destFs) { URI srcUri = srcFs.getUri(); URI dstUri = destFs.getUri(); if (srcUri.getScheme() == null) { return false; } if (!srcUri.getScheme().equals(dstUri.getScheme())) { return false; } String srcHost = srcUri.getHost(); String dstHost = dstUri.getHost(); if ((srcHost != null) && (dstHost != null)) { try { srcHost = InetAddress.getByName(srcHost).getCanonicalHostName(); dstHost = InetAddress.getByName(dstHost).getCanonicalHostName(); } catch(UnknownHostException ue) { return false; } if (!srcHost.equals(dstHost)) { return false; } } else if (srcHost == null && dstHost != null) { return false; } else if (srcHost != null && dstHost == null) { return false; } //check for ports if (srcUri.getPort() != dstUri.getPort()) { return false; } return true; } }
public class class_name { private boolean compareFs(FileSystem srcFs, FileSystem destFs) { URI srcUri = srcFs.getUri(); URI dstUri = destFs.getUri(); if (srcUri.getScheme() == null) { return false; // depends on control dependency: [if], data = [none] } if (!srcUri.getScheme().equals(dstUri.getScheme())) { return false; // depends on control dependency: [if], data = [none] } String srcHost = srcUri.getHost(); String dstHost = dstUri.getHost(); if ((srcHost != null) && (dstHost != null)) { try { srcHost = InetAddress.getByName(srcHost).getCanonicalHostName(); // depends on control dependency: [try], data = [none] dstHost = InetAddress.getByName(dstHost).getCanonicalHostName(); // depends on control dependency: [try], data = [none] } catch(UnknownHostException ue) { return false; } // depends on control dependency: [catch], data = [none] if (!srcHost.equals(dstHost)) { return false; // depends on control dependency: [if], data = [none] } } else if (srcHost == null && dstHost != null) { return false; // depends on control dependency: [if], data = [none] } else if (srcHost != null && dstHost == null) { return false; // depends on control dependency: [if], data = [none] } //check for ports if (srcUri.getPort() != dstUri.getPort()) { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { void addIndexCondition(Expression[] exprList, Index index, int colCount, boolean isJoin) { // VoltDB extension if (rangeIndex == index && isJoinIndex && (!isJoin) && (multiColumnCount > 0) && (colCount == 0)) { // This is one particular set of conditions which broke the classification of // ON and WHERE clauses. return; } // End of VoltDB extension rangeIndex = index; isJoinIndex = isJoin; for (int i = 0; i < colCount; i++) { Expression e = exprList[i]; indexEndCondition = ExpressionLogical.andExpressions(indexEndCondition, e); } if (colCount == 1) { indexCondition = exprList[0]; } else { findFirstExpressions = exprList; isMultiFindFirst = true; multiColumnCount = colCount; } } }
public class class_name { void addIndexCondition(Expression[] exprList, Index index, int colCount, boolean isJoin) { // VoltDB extension if (rangeIndex == index && isJoinIndex && (!isJoin) && (multiColumnCount > 0) && (colCount == 0)) { // This is one particular set of conditions which broke the classification of // ON and WHERE clauses. return; // depends on control dependency: [if], data = [none] } // End of VoltDB extension rangeIndex = index; isJoinIndex = isJoin; for (int i = 0; i < colCount; i++) { Expression e = exprList[i]; indexEndCondition = ExpressionLogical.andExpressions(indexEndCondition, e); // depends on control dependency: [for], data = [none] } if (colCount == 1) { indexCondition = exprList[0]; // depends on control dependency: [if], data = [none] } else { findFirstExpressions = exprList; // depends on control dependency: [if], data = [none] isMultiFindFirst = true; // depends on control dependency: [if], data = [none] multiColumnCount = colCount; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void registerLoaderIndicators(By... loaderIndicators) { for(By locator : loaderIndicators) { log.debug("Registered loader: " + locator); this.expectedGlobalConditions.add(new ExpectedWebElementCondition(locator)); } } }
public class class_name { public void registerLoaderIndicators(By... loaderIndicators) { for(By locator : loaderIndicators) { log.debug("Registered loader: " + locator); // depends on control dependency: [for], data = [locator] this.expectedGlobalConditions.add(new ExpectedWebElementCondition(locator)); // depends on control dependency: [for], data = [locator] } } }
public class class_name { @SuppressWarnings("deprecation") private void jobCompleteUnprotected() { // // All tasks are complete, then the job is done! if(this.terminated == JobStatus.FAILED || this.terminated == JobStatus.KILLED) { terminate(this.terminated); } if (this.status.getRunState() == JobStatus.RUNNING || this.status.getRunState() == JobStatus.PREP) { changeStateTo(JobStatus.SUCCEEDED); this.status.setCleanupProgress(1.0f); if (maps.length == 0) { this.status.setMapProgress(1.0f); } if (reduces.length == 0) { this.status.setReduceProgress(1.0f); } this.finishTime = clock.getTime(); LOG.info("Job " + this.status.getJobID() + " has completed successfully."); // Log the job summary (this should be done prior to logging to // job-history to ensure job-counters are in-sync JobSummary.logJobSummary(this); Counters counters = getCounters(); // Log job-history jobHistory.logFinished(finishTime, this.finishedMapTasks, this.finishedReduceTasks, failedMapTasks, failedReduceTasks, killedMapTasks, killedReduceTasks, getMapCounters(), getReduceCounters(), counters); } } }
public class class_name { @SuppressWarnings("deprecation") private void jobCompleteUnprotected() { // // All tasks are complete, then the job is done! if(this.terminated == JobStatus.FAILED || this.terminated == JobStatus.KILLED) { terminate(this.terminated); // depends on control dependency: [if], data = [(this.terminated] } if (this.status.getRunState() == JobStatus.RUNNING || this.status.getRunState() == JobStatus.PREP) { changeStateTo(JobStatus.SUCCEEDED); // depends on control dependency: [if], data = [none] this.status.setCleanupProgress(1.0f); // depends on control dependency: [if], data = [none] if (maps.length == 0) { this.status.setMapProgress(1.0f); // depends on control dependency: [if], data = [none] } if (reduces.length == 0) { this.status.setReduceProgress(1.0f); // depends on control dependency: [if], data = [none] } this.finishTime = clock.getTime(); // depends on control dependency: [if], data = [none] LOG.info("Job " + this.status.getJobID() + " has completed successfully."); // depends on control dependency: [if], data = [none] // Log the job summary (this should be done prior to logging to // job-history to ensure job-counters are in-sync JobSummary.logJobSummary(this); // depends on control dependency: [if], data = [none] Counters counters = getCounters(); // Log job-history jobHistory.logFinished(finishTime, this.finishedMapTasks, this.finishedReduceTasks, failedMapTasks, failedReduceTasks, killedMapTasks, killedReduceTasks, getMapCounters(), getReduceCounters(), counters); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean cleanLockedObjects(ITransaction transaction, LockedObject lo, boolean temporary) { if (lo._children == null) { if (lo._owner == null) { if (temporary) { lo.removeTempLockedObject(); } else { lo.removeLockedObject(); } return true; } else { return false; } } else { boolean canDelete = true; int limit = lo._children.length; for (int i = 0; i < limit; i++) { if (!cleanLockedObjects(transaction, lo._children[i], temporary)) { canDelete = false; } else { // because the deleting shifts the array i--; limit--; } } if (canDelete) { if (lo._owner == null) { if (temporary) { lo.removeTempLockedObject(); } else { lo.removeLockedObject(); } return true; } else { return false; } } else { return false; } } } }
public class class_name { private boolean cleanLockedObjects(ITransaction transaction, LockedObject lo, boolean temporary) { if (lo._children == null) { if (lo._owner == null) { if (temporary) { lo.removeTempLockedObject(); // depends on control dependency: [if], data = [none] } else { lo.removeLockedObject(); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } else { boolean canDelete = true; int limit = lo._children.length; for (int i = 0; i < limit; i++) { if (!cleanLockedObjects(transaction, lo._children[i], temporary)) { canDelete = false; // depends on control dependency: [if], data = [none] } else { // because the deleting shifts the array i--; // depends on control dependency: [if], data = [none] limit--; // depends on control dependency: [if], data = [none] } } if (canDelete) { if (lo._owner == null) { if (temporary) { lo.removeTempLockedObject(); // depends on control dependency: [if], data = [none] } else { lo.removeLockedObject(); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } else { return false; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public MultiTouchAction perform() { List<TouchAction> touchActions = actions.build(); checkArgument(touchActions.size() > 0, "MultiTouch action must have at least one TouchAction added before it can be performed"); if (touchActions.size() > 1) { performsTouchActions.performMultiTouchAction(this); return this; } //android doesn't like having multi-touch actions with only a single TouchAction... performsTouchActions.performTouchAction(touchActions.get(0)); return this; } }
public class class_name { public MultiTouchAction perform() { List<TouchAction> touchActions = actions.build(); checkArgument(touchActions.size() > 0, "MultiTouch action must have at least one TouchAction added before it can be performed"); if (touchActions.size() > 1) { performsTouchActions.performMultiTouchAction(this); // depends on control dependency: [if], data = [none] return this; // depends on control dependency: [if], data = [none] } //android doesn't like having multi-touch actions with only a single TouchAction... performsTouchActions.performTouchAction(touchActions.get(0)); return this; } }
public class class_name { private static void setAllowUnsafeSslRenegotiationSystemProperty(boolean allow) { String ibmSystemPropertyValue; if (allow) { logger.info("Unsafe SSL renegotiation enabled."); ibmSystemPropertyValue = "ALL"; } else { logger.info("Unsafe SSL renegotiation disabled."); ibmSystemPropertyValue = "NONE"; } System.setProperty("com.ibm.jsse2.renegotiate", ibmSystemPropertyValue); System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", String.valueOf(allow)); } }
public class class_name { private static void setAllowUnsafeSslRenegotiationSystemProperty(boolean allow) { String ibmSystemPropertyValue; if (allow) { logger.info("Unsafe SSL renegotiation enabled."); // depends on control dependency: [if], data = [none] ibmSystemPropertyValue = "ALL"; // depends on control dependency: [if], data = [none] } else { logger.info("Unsafe SSL renegotiation disabled."); // depends on control dependency: [if], data = [none] ibmSystemPropertyValue = "NONE"; // depends on control dependency: [if], data = [none] } System.setProperty("com.ibm.jsse2.renegotiate", ibmSystemPropertyValue); System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", String.valueOf(allow)); } }
public class class_name { private void populateRelation(TaskField field, Task sourceTask, String relationship) throws MPXJException { int index = 0; int length = relationship.length(); // // Extract the identifier // while ((index < length) && (Character.isDigit(relationship.charAt(index)) == true)) { ++index; } Integer taskID; try { taskID = Integer.valueOf(relationship.substring(0, index)); } catch (NumberFormatException ex) { throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'"); } // // Now find the task, so we can extract the unique ID // Task targetTask; if (field == TaskField.PREDECESSORS) { targetTask = m_projectFile.getTaskByID(taskID); } else { targetTask = m_projectFile.getTaskByUniqueID(taskID); } // // If we haven't reached the end, we next expect to find // SF, SS, FS, FF // RelationType type = null; Duration lag = null; if (index == length) { type = RelationType.FINISH_START; lag = Duration.getInstance(0, TimeUnit.DAYS); } else { if ((index + 1) == length) { throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'"); } type = RelationTypeUtility.getInstance(m_locale, relationship.substring(index, index + 2)); index += 2; if (index == length) { lag = Duration.getInstance(0, TimeUnit.DAYS); } else { if (relationship.charAt(index) == '+') { ++index; } lag = DurationUtility.getInstance(relationship.substring(index), m_formats.getDurationDecimalFormat(), m_locale); } } if (type == null) { throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'"); } // We have seen at least one example MPX file where an invalid task ID // is present. We'll ignore this as the schedule is otherwise valid. if (targetTask != null) { Relation relation = sourceTask.addPredecessor(targetTask, type, lag); m_eventManager.fireRelationReadEvent(relation); } } }
public class class_name { private void populateRelation(TaskField field, Task sourceTask, String relationship) throws MPXJException { int index = 0; int length = relationship.length(); // // Extract the identifier // while ((index < length) && (Character.isDigit(relationship.charAt(index)) == true)) { ++index; } Integer taskID; try { taskID = Integer.valueOf(relationship.substring(0, index)); } catch (NumberFormatException ex) { throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'"); } // // Now find the task, so we can extract the unique ID // Task targetTask; if (field == TaskField.PREDECESSORS) { targetTask = m_projectFile.getTaskByID(taskID); } else { targetTask = m_projectFile.getTaskByUniqueID(taskID); } // // If we haven't reached the end, we next expect to find // SF, SS, FS, FF // RelationType type = null; Duration lag = null; if (index == length) { type = RelationType.FINISH_START; lag = Duration.getInstance(0, TimeUnit.DAYS); } else { if ((index + 1) == length) { throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'"); } type = RelationTypeUtility.getInstance(m_locale, relationship.substring(index, index + 2)); index += 2; if (index == length) { lag = Duration.getInstance(0, TimeUnit.DAYS); // depends on control dependency: [if], data = [none] } else { if (relationship.charAt(index) == '+') { ++index; // depends on control dependency: [if], data = [none] } lag = DurationUtility.getInstance(relationship.substring(index), m_formats.getDurationDecimalFormat(), m_locale); // depends on control dependency: [if], data = [(index] } } if (type == null) { throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'"); } // We have seen at least one example MPX file where an invalid task ID // is present. We'll ignore this as the schedule is otherwise valid. if (targetTask != null) { Relation relation = sourceTask.addPredecessor(targetTask, type, lag); m_eventManager.fireRelationReadEvent(relation); } } }
public class class_name { private static @Nullable Path getParentPath(Path path) { Path parent = path.getParent(); // Paths that have a parent: if (parent != null) { // "/foo" ("/") // "foo/bar" ("foo") // "C:\foo" ("C:\") // "\foo" ("\" - current drive for process on Windows) // "C:foo" ("C:" - working dir of drive C on Windows) return parent; } // Paths that don't have a parent: if (path.getNameCount() == 0) { // "/", "C:\", "\" (no parent) // "" (undefined, though typically parent of working dir) // "C:" (parent of working dir of drive C on Windows) // // For working dir paths ("" and "C:"), return null because: // A) it's not specified that "" is the path to the working directory. // B) if we're getting this path for recursive delete, it's typically not possible to // delete the working dir with a relative path anyway, so it's ok to fail. // C) if we're getting it for opening a new SecureDirectoryStream, there's no need to get // the parent path anyway since we can safely open a DirectoryStream to the path without // worrying about a symlink. return null; } else { // "foo" (working dir) return path.getFileSystem().getPath("."); } } }
public class class_name { private static @Nullable Path getParentPath(Path path) { Path parent = path.getParent(); // Paths that have a parent: if (parent != null) { // "/foo" ("/") // "foo/bar" ("foo") // "C:\foo" ("C:\") // "\foo" ("\" - current drive for process on Windows) // "C:foo" ("C:" - working dir of drive C on Windows) return parent; // depends on control dependency: [if], data = [none] } // Paths that don't have a parent: if (path.getNameCount() == 0) { // "/", "C:\", "\" (no parent) // "" (undefined, though typically parent of working dir) // "C:" (parent of working dir of drive C on Windows) // // For working dir paths ("" and "C:"), return null because: // A) it's not specified that "" is the path to the working directory. // B) if we're getting this path for recursive delete, it's typically not possible to // delete the working dir with a relative path anyway, so it's ok to fail. // C) if we're getting it for opening a new SecureDirectoryStream, there's no need to get // the parent path anyway since we can safely open a DirectoryStream to the path without // worrying about a symlink. return null; // depends on control dependency: [if], data = [none] } else { // "foo" (working dir) return path.getFileSystem().getPath("."); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final ResTable_config withSdkVersion(int sdkVersion) { if (sdkVersion == this.sdkVersion) { return this; } return new ResTable_config(size, mcc, mnc, language, country, orientation, touchscreen, density, keyboard, navigation, inputFlags, screenWidth, screenHeight, sdkVersion, minorVersion, screenLayout, uiMode, smallestScreenWidthDp, screenWidthDp, screenHeightDp, localeScript, localeVariant, screenLayout2, colorMode, screenConfigPad2, unknown); } }
public class class_name { public final ResTable_config withSdkVersion(int sdkVersion) { if (sdkVersion == this.sdkVersion) { return this; // depends on control dependency: [if], data = [none] } return new ResTable_config(size, mcc, mnc, language, country, orientation, touchscreen, density, keyboard, navigation, inputFlags, screenWidth, screenHeight, sdkVersion, minorVersion, screenLayout, uiMode, smallestScreenWidthDp, screenWidthDp, screenHeightDp, localeScript, localeVariant, screenLayout2, colorMode, screenConfigPad2, unknown); } }
public class class_name { public int compareTo(Address a) { int compare = workManagerId.compareTo(a.getWorkManagerId()); if (compare != 0) return compare; compare = workManagerName.compareTo(a.getWorkManagerName()); if (compare != 0) return compare; if (transportId != null) { if (a.getTransportId() != null) { return transportId.compareTo(a.getTransportId()); } else { return 1; } } else { if (a.getTransportId() != null) { return -1; } } return 0; } }
public class class_name { public int compareTo(Address a) { int compare = workManagerId.compareTo(a.getWorkManagerId()); if (compare != 0) return compare; compare = workManagerName.compareTo(a.getWorkManagerName()); if (compare != 0) return compare; if (transportId != null) { if (a.getTransportId() != null) { return transportId.compareTo(a.getTransportId()); // depends on control dependency: [if], data = [(a.getTransportId()] } else { return 1; // depends on control dependency: [if], data = [none] } } else { if (a.getTransportId() != null) { return -1; // depends on control dependency: [if], data = [none] } } return 0; } }
public class class_name { public static double [] boundLargestEigenValue(DMatrixRMaj A , double []bound ) { if( A.numRows != A.numCols ) throw new IllegalArgumentException("A must be a square matrix."); double min = Double.MAX_VALUE; double max = 0; int n = A.numRows; for( int i = 0; i < n; i++ ) { double total = 0; for( int j = 0; j < n; j++ ) { double v = A.get(i,j); if( v < 0 ) throw new IllegalArgumentException("Matrix must be positive"); total += v; } if( total < min ) { min = total; } if( total > max ) { max = total; } } if( bound == null ) bound = new double[2]; bound[0] = min; bound[1] = max; return bound; } }
public class class_name { public static double [] boundLargestEigenValue(DMatrixRMaj A , double []bound ) { if( A.numRows != A.numCols ) throw new IllegalArgumentException("A must be a square matrix."); double min = Double.MAX_VALUE; double max = 0; int n = A.numRows; for( int i = 0; i < n; i++ ) { double total = 0; for( int j = 0; j < n; j++ ) { double v = A.get(i,j); if( v < 0 ) throw new IllegalArgumentException("Matrix must be positive"); total += v; // depends on control dependency: [for], data = [none] } if( total < min ) { min = total; // depends on control dependency: [if], data = [none] } if( total > max ) { max = total; // depends on control dependency: [if], data = [none] } } if( bound == null ) bound = new double[2]; bound[0] = min; bound[1] = max; return bound; } }
public class class_name { protected List<Dependency> createFlattenedDependencies( Model effectiveModel ) { List<Dependency> flattenedDependencies = new ArrayList<Dependency>(); // resolve all direct and inherited dependencies... createFlattenedDependencies( effectiveModel, flattenedDependencies ); if ( isEmbedBuildProfileDependencies() ) { Model projectModel = this.project.getModel(); Dependencies modelDependencies = new Dependencies(); modelDependencies.addAll( projectModel.getDependencies() ); for ( Profile profile : projectModel.getProfiles() ) { // build-time driven activation (by property or file)? if ( isBuildTimeDriven( profile.getActivation() ) ) { List<Dependency> profileDependencies = profile.getDependencies(); for ( Dependency profileDependency : profileDependencies ) { if ( modelDependencies.contains( profileDependency ) ) { // our assumption here is that the profileDependency has been added to model because of // this build-time driven profile. Therefore we need to add it to the flattened POM. // Non build-time driven profiles will remain in the flattened POM with their dependencies // and // allow dynamic dependencies due to OS or JDK. flattenedDependencies.add( profileDependency ); } } } } getLog().debug( "Resolved " + flattenedDependencies.size() + " dependency/-ies for flattened POM." ); } return flattenedDependencies; } }
public class class_name { protected List<Dependency> createFlattenedDependencies( Model effectiveModel ) { List<Dependency> flattenedDependencies = new ArrayList<Dependency>(); // resolve all direct and inherited dependencies... createFlattenedDependencies( effectiveModel, flattenedDependencies ); if ( isEmbedBuildProfileDependencies() ) { Model projectModel = this.project.getModel(); Dependencies modelDependencies = new Dependencies(); modelDependencies.addAll( projectModel.getDependencies() ); // depends on control dependency: [if], data = [none] for ( Profile profile : projectModel.getProfiles() ) { // build-time driven activation (by property or file)? if ( isBuildTimeDriven( profile.getActivation() ) ) { List<Dependency> profileDependencies = profile.getDependencies(); for ( Dependency profileDependency : profileDependencies ) { if ( modelDependencies.contains( profileDependency ) ) { // our assumption here is that the profileDependency has been added to model because of // this build-time driven profile. Therefore we need to add it to the flattened POM. // Non build-time driven profiles will remain in the flattened POM with their dependencies // and // allow dynamic dependencies due to OS or JDK. flattenedDependencies.add( profileDependency ); // depends on control dependency: [if], data = [none] } } } } getLog().debug( "Resolved " + flattenedDependencies.size() + " dependency/-ies for flattened POM." ); // depends on control dependency: [if], data = [none] } return flattenedDependencies; } }
public class class_name { private boolean compare(ByteDataBuffer serializedRepresentation, long key) { long position = key & POINTER_MASK; int sizeOfData = VarInt.readVInt(byteData.getUnderlyingArray(), position); if (sizeOfData != serializedRepresentation.length()) { return false; } position += VarInt.sizeOfVInt(sizeOfData); for (int i = 0; i < sizeOfData; i++) { if (serializedRepresentation.get(i) != byteData.get(position++)) { return false; } } return true; } }
public class class_name { private boolean compare(ByteDataBuffer serializedRepresentation, long key) { long position = key & POINTER_MASK; int sizeOfData = VarInt.readVInt(byteData.getUnderlyingArray(), position); if (sizeOfData != serializedRepresentation.length()) { return false; // depends on control dependency: [if], data = [none] } position += VarInt.sizeOfVInt(sizeOfData); for (int i = 0; i < sizeOfData; i++) { if (serializedRepresentation.get(i) != byteData.get(position++)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { boolean fitEpipolar(FastQueue<AssociatedIndex> matches , List<Point2D_F64> pointsA , List<Point2D_F64> pointsB , ModelMatcher<?,AssociatedPair> ransac , PairwiseImageGraph.Motion edge ) { pairs.resize(matches.size); for (int i = 0; i < matches.size; i++) { AssociatedIndex a = matches.get(i); pairs.get(i).p1.set(pointsA.get(a.src)); pairs.get(i).p2.set(pointsB.get(a.dst)); } if( !ransac.process(pairs.toList()) ) return false; int N = ransac.getMatchSet().size(); for (int i = 0; i < N; i++) { AssociatedIndex a = matches.get(ransac.getInputIndex(i)); edge.associated.add( a.copy() ); } return true; } }
public class class_name { boolean fitEpipolar(FastQueue<AssociatedIndex> matches , List<Point2D_F64> pointsA , List<Point2D_F64> pointsB , ModelMatcher<?,AssociatedPair> ransac , PairwiseImageGraph.Motion edge ) { pairs.resize(matches.size); for (int i = 0; i < matches.size; i++) { AssociatedIndex a = matches.get(i); pairs.get(i).p1.set(pointsA.get(a.src)); // depends on control dependency: [for], data = [i] pairs.get(i).p2.set(pointsB.get(a.dst)); // depends on control dependency: [for], data = [i] } if( !ransac.process(pairs.toList()) ) return false; int N = ransac.getMatchSet().size(); for (int i = 0; i < N; i++) { AssociatedIndex a = matches.get(ransac.getInputIndex(i)); edge.associated.add( a.copy() ); // depends on control dependency: [for], data = [none] } return true; } }
public class class_name { public void writeIncludes(CodeType codeType) { ClassInfo recClassInfo2 = null; ClassFields recClassFields = null; try { ClassInfo recClassInfo = (ClassInfo)this.getMainRecord(); String classType = recClassInfo.getField(ClassInfo.CLASS_TYPE).toString(); String strPackage = this.getPackage(codeType); m_StreamOut.writeit("package " + strPackage + ";\n\n"); m_IncludeNameList.addName(strPackage); // Don't include this!!! if ("interface".equalsIgnoreCase(classType)) codeType = CodeType.INTERFACE; if (codeType == CodeType.THICK) { //m_StreamOut.writeit("import java.awt.*;\n"); //j Temp m_StreamOut.writeit("import java.util.*;\n\n"); //j Temp m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.db"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "thin.base.util"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "thin.base.db"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.db.event"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.db.filter"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.field"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.field.convert"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.field.event"); // Don't include this!!! if (("Screen".equalsIgnoreCase(classType)) || ("Report".equalsIgnoreCase(classType))) { m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.screen.model"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.screen.model.util"); // Don't include this!!! } m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.model"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.util"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "model"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "model.db"); // Don't include this!!! m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "model.screen"); // Don't include this!!! } // Now write the include files for any base classes not in this file or fields with class defs not in file recClassInfo2 = new ClassInfo(this); recClassFields = new ClassFields(this); recClassFields.setKeyArea(ClassFields.CLASS_INFO_CLASS_NAME_KEY); SubFileFilter fileBehavior2 = new SubFileFilter(recClassInfo2.getField(ClassInfo.CLASS_NAME), ClassFields.CLASS_INFO_CLASS_NAME, null, null, null, null); recClassFields.addListener(fileBehavior2); // Only read through the class fields String strFileName = recClassInfo.getField(ClassInfo.CLASS_SOURCE_FILE).toString(); recClassInfo2.setKeyArea(ClassInfo.CLASS_SOURCE_FILE_KEY); StringSubFileFilter fileBehavior = new StringSubFileFilter(strFileName, ClassInfo.CLASS_SOURCE_FILE, null, null, null, null); recClassInfo2.addListener(fileBehavior); // Only select records which match m_strFileName recClassInfo2.setKeyArea(ClassInfo.CLASS_SOURCE_FILE_KEY); recClassInfo2.close(); while (recClassInfo2.hasNext()) { recClassInfo2.next(); if ((codeType == CodeType.THIN) && (!recClassInfo2.isARecord(false))) continue; //if ((codeType == CodeType.INTERFACE) && (!recClassInfo2.isARecord(false))) // continue; String strBaseRecordClass = recClassInfo2.getField(ClassInfo.BASE_CLASS_NAME).getString(); if (codeType == CodeType.THICK) m_IncludeNameList.addInclude(strBaseRecordClass, null); // Include the base class if it isn't in this file recClassFields.close(); while (recClassFields.hasNext()) { recClassFields.next(); if (!((IncludeScopeField)recClassFields.getField(ClassFields.INCLUDE_SCOPE)).includeThis(codeType, false)) continue; String strFieldName = recClassFields.getField(ClassFields.CLASS_FIELD_NAME).getString(); String strFieldClass = recClassFields.getField(ClassFields.CLASS_FIELD_CLASS).getString(); String strReference = ""; String strClassFieldType = recClassFields.getField(ClassFields.CLASS_FIELDS_TYPE).toString(); if (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_PACKAGE)) { if (strFieldClass.length() > 0) if (strFieldClass.charAt(0) == '.') { ClassProject classProject = (ClassProject)((ReferenceField)recClassInfo2.getField(ClassInfo.CLASS_PROJECT_ID)).getReference(); if ((classProject != null) && ((classProject.getEditMode() == DBConstants.EDIT_CURRENT) || (classProject.getEditMode() == DBConstants.EDIT_IN_PROGRESS))) { CodeType codeType2 = CodeType.THICK; if (strFieldClass.startsWith(".thin")) codeType2 = CodeType.THIN; if (strFieldClass.startsWith(".res")) codeType2 = CodeType.RESOURCE_CODE; strFieldClass = classProject.getFullPackage(CodeType.THICK, strFieldClass); if (codeType2 != CodeType.THICK) { int end = strFieldClass.indexOf(codeType2 == CodeType.THIN ? ".thin" : ".res"); int start = strFieldClass.indexOf('.'); if (start != -1) start = strFieldClass.indexOf('.', start + 1); if (start != -1) strFieldClass = strFieldClass.substring(0, start) + strFieldClass.substring(end); } } else strFieldClass = DBConstants.ROOT_PACKAGE + strFieldClass.substring(1); } m_IncludeNameList.addPackage(strFieldClass); } else if ((strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_CLASS_PACKAGE)) || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_MODEL_PACKAGE)) // For now || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_RES_PACKAGE)) // For now || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_THIN_PACKAGE)) // For now || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.CLASS_FIELD)) // For now || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_CLASS))) { CodeType codeType3 = CodeType.THICK; if (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_MODEL_PACKAGE)) codeType3 = CodeType.INTERFACE; if (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_RES_PACKAGE)) // For now codeType3 = CodeType.RESOURCE_CODE; if (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_THIN_PACKAGE)) // For now codeType3 = CodeType.THIN; m_IncludeNameList.addInclude(strFieldClass, codeType3); strReference = "Y"; } if (recClassFields.getField(ClassFields.CLASS_FIELD_PROTECT).getString().equalsIgnoreCase("S")) // Static, initialize now { if (strReference.length() == 0) strReference = "0"; if (strReference.charAt(0) == 'Y') strReference = "null"; else { strReference = recClassFields.getField(ClassFields.CLASS_FIELD_INITIAL).getString(); if (strReference.length() == 0) strReference = "0"; } if (!strReference.equals("(none)")) m_StreamOut.writeit(strFieldClass + " " + strFieldName + " = " + strReference + ";\n"); } } recClassFields.close(); } // End of write record method(s) loop recClassInfo2.removeListener(fileBehavior, true); recClassInfo2.close(); } catch (DBException ex) { ex.printStackTrace(); } finally { if (recClassInfo2 != null) recClassInfo2.free(); if (recClassFields != null) recClassFields.free(); } } }
public class class_name { public void writeIncludes(CodeType codeType) { ClassInfo recClassInfo2 = null; ClassFields recClassFields = null; try { ClassInfo recClassInfo = (ClassInfo)this.getMainRecord(); String classType = recClassInfo.getField(ClassInfo.CLASS_TYPE).toString(); String strPackage = this.getPackage(codeType); m_StreamOut.writeit("package " + strPackage + ";\n\n"); m_IncludeNameList.addName(strPackage); // Don't include this!!! if ("interface".equalsIgnoreCase(classType)) codeType = CodeType.INTERFACE; if (codeType == CodeType.THICK) { //m_StreamOut.writeit("import java.awt.*;\n"); //j Temp m_StreamOut.writeit("import java.util.*;\n\n"); //j Temp // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.db"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "thin.base.util"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "thin.base.db"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.db.event"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.db.filter"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.field"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.field.convert"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.field.event"); // Don't include this!!! // depends on control dependency: [if], data = [none] if (("Screen".equalsIgnoreCase(classType)) || ("Report".equalsIgnoreCase(classType))) { m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.screen.model"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.screen.model.util"); // Don't include this!!! // depends on control dependency: [if], data = [none] } m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.model"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "base.util"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "model"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "model.db"); // Don't include this!!! // depends on control dependency: [if], data = [none] m_IncludeNameList.addPackage(DBConstants.ROOT_PACKAGE + "model.screen"); // Don't include this!!! // depends on control dependency: [if], data = [none] } // Now write the include files for any base classes not in this file or fields with class defs not in file recClassInfo2 = new ClassInfo(this); recClassFields = new ClassFields(this); recClassFields.setKeyArea(ClassFields.CLASS_INFO_CLASS_NAME_KEY); SubFileFilter fileBehavior2 = new SubFileFilter(recClassInfo2.getField(ClassInfo.CLASS_NAME), ClassFields.CLASS_INFO_CLASS_NAME, null, null, null, null); recClassFields.addListener(fileBehavior2); // Only read through the class fields String strFileName = recClassInfo.getField(ClassInfo.CLASS_SOURCE_FILE).toString(); recClassInfo2.setKeyArea(ClassInfo.CLASS_SOURCE_FILE_KEY); StringSubFileFilter fileBehavior = new StringSubFileFilter(strFileName, ClassInfo.CLASS_SOURCE_FILE, null, null, null, null); recClassInfo2.addListener(fileBehavior); // Only select records which match m_strFileName recClassInfo2.setKeyArea(ClassInfo.CLASS_SOURCE_FILE_KEY); recClassInfo2.close(); while (recClassInfo2.hasNext()) { recClassInfo2.next(); if ((codeType == CodeType.THIN) && (!recClassInfo2.isARecord(false))) continue; //if ((codeType == CodeType.INTERFACE) && (!recClassInfo2.isARecord(false))) // continue; String strBaseRecordClass = recClassInfo2.getField(ClassInfo.BASE_CLASS_NAME).getString(); if (codeType == CodeType.THICK) m_IncludeNameList.addInclude(strBaseRecordClass, null); // Include the base class if it isn't in this file recClassFields.close(); while (recClassFields.hasNext()) { recClassFields.next(); if (!((IncludeScopeField)recClassFields.getField(ClassFields.INCLUDE_SCOPE)).includeThis(codeType, false)) continue; String strFieldName = recClassFields.getField(ClassFields.CLASS_FIELD_NAME).getString(); String strFieldClass = recClassFields.getField(ClassFields.CLASS_FIELD_CLASS).getString(); String strReference = ""; String strClassFieldType = recClassFields.getField(ClassFields.CLASS_FIELDS_TYPE).toString(); if (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_PACKAGE)) { if (strFieldClass.length() > 0) if (strFieldClass.charAt(0) == '.') { ClassProject classProject = (ClassProject)((ReferenceField)recClassInfo2.getField(ClassInfo.CLASS_PROJECT_ID)).getReference(); if ((classProject != null) && ((classProject.getEditMode() == DBConstants.EDIT_CURRENT) || (classProject.getEditMode() == DBConstants.EDIT_IN_PROGRESS))) { CodeType codeType2 = CodeType.THICK; if (strFieldClass.startsWith(".thin")) codeType2 = CodeType.THIN; if (strFieldClass.startsWith(".res")) codeType2 = CodeType.RESOURCE_CODE; strFieldClass = classProject.getFullPackage(CodeType.THICK, strFieldClass); // depends on control dependency: [if], data = [none] if (codeType2 != CodeType.THICK) { int end = strFieldClass.indexOf(codeType2 == CodeType.THIN ? ".thin" : ".res"); int start = strFieldClass.indexOf('.'); if (start != -1) start = strFieldClass.indexOf('.', start + 1); if (start != -1) strFieldClass = strFieldClass.substring(0, start) + strFieldClass.substring(end); } } else strFieldClass = DBConstants.ROOT_PACKAGE + strFieldClass.substring(1); } m_IncludeNameList.addPackage(strFieldClass); // depends on control dependency: [if], data = [none] } else if ((strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_CLASS_PACKAGE)) || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_MODEL_PACKAGE)) // For now || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_RES_PACKAGE)) // For now || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_THIN_PACKAGE)) // For now || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.CLASS_FIELD)) // For now || (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_CLASS))) { CodeType codeType3 = CodeType.THICK; if (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_MODEL_PACKAGE)) codeType3 = CodeType.INTERFACE; if (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_RES_PACKAGE)) // For now codeType3 = CodeType.RESOURCE_CODE; if (strClassFieldType.equalsIgnoreCase(ClassFieldsTypeField.INCLUDE_THIN_PACKAGE)) // For now codeType3 = CodeType.THIN; m_IncludeNameList.addInclude(strFieldClass, codeType3); // depends on control dependency: [if], data = [none] strReference = "Y"; // depends on control dependency: [if], data = [none] } if (recClassFields.getField(ClassFields.CLASS_FIELD_PROTECT).getString().equalsIgnoreCase("S")) // Static, initialize now { if (strReference.length() == 0) strReference = "0"; if (strReference.charAt(0) == 'Y') strReference = "null"; else { strReference = recClassFields.getField(ClassFields.CLASS_FIELD_INITIAL).getString(); // depends on control dependency: [if], data = [none] if (strReference.length() == 0) strReference = "0"; } if (!strReference.equals("(none)")) m_StreamOut.writeit(strFieldClass + " " + strFieldName + " = " + strReference + ";\n"); } } recClassFields.close(); } // End of write record method(s) loop recClassInfo2.removeListener(fileBehavior, true); recClassInfo2.close(); } catch (DBException ex) { ex.printStackTrace(); } finally { if (recClassInfo2 != null) recClassInfo2.free(); if (recClassFields != null) recClassFields.free(); } } }
public class class_name { synchronized final JsMsgPart getPayload(JMFSchema schema) { if (payload == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "getPayload will call getPart"); payload = jmo.getPayloadPart().getPart(JsPayloadAccess.PAYLOAD_DATA, schema); } return payload; } }
public class class_name { synchronized final JsMsgPart getPayload(JMFSchema schema) { if (payload == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "getPayload will call getPart"); payload = jmo.getPayloadPart().getPart(JsPayloadAccess.PAYLOAD_DATA, schema); // depends on control dependency: [if], data = [none] } return payload; } }
public class class_name { @Override public boolean canServe(URL refUrl) { if (refUrl == null || !this.getPath().equals(refUrl.getPath())) { return false; } if(!protocol.equals(refUrl.getProtocol())) { return false; } if (!Constants.NODE_TYPE_SERVICE.equals(this.getParameter(URLParamType.nodeType.getName()))) { return false; } String version = getParameter(URLParamType.version.getName(), URLParamType.version.getValue()); String refVersion = refUrl.getParameter(URLParamType.version.getName(), URLParamType.version.getValue()); if (!version.equals(refVersion)) { return false; } // check serialize String serialize = getParameter(URLParamType.serialize.getName(), URLParamType.serialize.getValue()); String refSerialize = refUrl.getParameter(URLParamType.serialize.getName(), URLParamType.serialize.getValue()); if (!serialize.equals(refSerialize)) { return false; } // Not going to check group as cross group call is needed return true; } }
public class class_name { @Override public boolean canServe(URL refUrl) { if (refUrl == null || !this.getPath().equals(refUrl.getPath())) { return false; // depends on control dependency: [if], data = [none] } if(!protocol.equals(refUrl.getProtocol())) { return false; // depends on control dependency: [if], data = [none] } if (!Constants.NODE_TYPE_SERVICE.equals(this.getParameter(URLParamType.nodeType.getName()))) { return false; // depends on control dependency: [if], data = [none] } String version = getParameter(URLParamType.version.getName(), URLParamType.version.getValue()); String refVersion = refUrl.getParameter(URLParamType.version.getName(), URLParamType.version.getValue()); if (!version.equals(refVersion)) { return false; // depends on control dependency: [if], data = [none] } // check serialize String serialize = getParameter(URLParamType.serialize.getName(), URLParamType.serialize.getValue()); String refSerialize = refUrl.getParameter(URLParamType.serialize.getName(), URLParamType.serialize.getValue()); if (!serialize.equals(refSerialize)) { return false; // depends on control dependency: [if], data = [none] } // Not going to check group as cross group call is needed return true; } }
public class class_name { public static String truncate(final String value, final int length, final String filler) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); if (length == 0) { return ""; } if (length >= value.length()) { return value; } return append(value.substring(0, length - filler.length()), filler); } }
public class class_name { public static String truncate(final String value, final int length, final String filler) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); if (length == 0) { return ""; // depends on control dependency: [if], data = [none] } if (length >= value.length()) { return value; // depends on control dependency: [if], data = [none] } return append(value.substring(0, length - filler.length()), filler); } }
public class class_name { @Override public void onFileChange(Path path) { String fileExtension = path.getName().substring(path.getName().lastIndexOf('.') + 1); if (fileExtension.equalsIgnoreCase(SchedulerUtils.JOB_PROPS_FILE_EXTENSION)) { LOG.info("Detected change to common properties file " + path.toString()); loadNewCommonConfigAndHandleNewJob(path, JobScheduler.Action.RESCHEDULE); return; } if (!jobScheduler.jobConfigFileExtensions.contains(fileExtension)) { // Not a job configuration file, ignore. return; } LOG.info("Detected change to job configuration file " + path.toString()); loadNewJobConfigAndHandleNewJob(path, JobScheduler.Action.RESCHEDULE); } }
public class class_name { @Override public void onFileChange(Path path) { String fileExtension = path.getName().substring(path.getName().lastIndexOf('.') + 1); if (fileExtension.equalsIgnoreCase(SchedulerUtils.JOB_PROPS_FILE_EXTENSION)) { LOG.info("Detected change to common properties file " + path.toString()); // depends on control dependency: [if], data = [none] loadNewCommonConfigAndHandleNewJob(path, JobScheduler.Action.RESCHEDULE); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (!jobScheduler.jobConfigFileExtensions.contains(fileExtension)) { // Not a job configuration file, ignore. return; // depends on control dependency: [if], data = [none] } LOG.info("Detected change to job configuration file " + path.toString()); loadNewJobConfigAndHandleNewJob(path, JobScheduler.Action.RESCHEDULE); } }
public class class_name { public static base_responses unset(nitro_service client, String ipaddress[], String args[]) throws Exception { base_responses result = null; if (ipaddress != null && ipaddress.length > 0) { nsrpcnode unsetresources[] = new nsrpcnode[ipaddress.length]; for (int i=0;i<ipaddress.length;i++){ unsetresources[i] = new nsrpcnode(); unsetresources[i].ipaddress = ipaddress[i]; } result = unset_bulk_request(client, unsetresources,args); } return result; } }
public class class_name { public static base_responses unset(nitro_service client, String ipaddress[], String args[]) throws Exception { base_responses result = null; if (ipaddress != null && ipaddress.length > 0) { nsrpcnode unsetresources[] = new nsrpcnode[ipaddress.length]; for (int i=0;i<ipaddress.length;i++){ unsetresources[i] = new nsrpcnode(); // depends on control dependency: [for], data = [i] unsetresources[i].ipaddress = ipaddress[i]; // depends on control dependency: [for], data = [i] } result = unset_bulk_request(client, unsetresources,args); } return result; } }
public class class_name { @Override public void close() throws IOException { if (!closed) { closed = true; try { byte[] buffer = cipher.doFinal(); if (buffer != null) { output.write(buffer); } } catch (IllegalBlockSizeException | BadPaddingException e) { throw new CipherException(e); } finally { if (closeOutput) { super.close(); } else { flush(); } } } } }
public class class_name { @Override public void close() throws IOException { if (!closed) { closed = true; try { byte[] buffer = cipher.doFinal(); if (buffer != null) { output.write(buffer); // depends on control dependency: [if], data = [(buffer] } } catch (IllegalBlockSizeException | BadPaddingException e) { throw new CipherException(e); } finally { if (closeOutput) { super.close(); // depends on control dependency: [if], data = [none] } else { flush(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the RateCardService. RateCardServiceInterface rateCardService = adManagerServices.get(session, RateCardServiceInterface.class); // Create a statement to get all rate cards using USD as currency. StatementBuilder statementBuilder = new StatementBuilder() .where("currencyCode = 'USD'") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get rate cards by statement. RateCardPage page = rateCardService.getRateCardsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (RateCard rateCard : page.getResults()) { System.out.printf( "%d) Rate card with ID %d, name '%s', and currency '%s' was found.%n", i++, rateCard.getId(), rateCard.getName(), rateCard.getCurrencyCode()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); } }
public class class_name { public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the RateCardService. RateCardServiceInterface rateCardService = adManagerServices.get(session, RateCardServiceInterface.class); // Create a statement to get all rate cards using USD as currency. StatementBuilder statementBuilder = new StatementBuilder() .where("currencyCode = 'USD'") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get rate cards by statement. RateCardPage page = rateCardService.getRateCardsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); // depends on control dependency: [if], data = [none] int i = page.getStartIndex(); for (RateCard rateCard : page.getResults()) { System.out.printf( "%d) Rate card with ID %d, name '%s', and currency '%s' was found.%n", i++, rateCard.getId(), rateCard.getName(), rateCard.getCurrencyCode()); // depends on control dependency: [for], data = [rateCard] } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); } }
public class class_name { public final void int_key() throws RecognitionException { Token id=null; try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:776:5: ({...}? =>id= ID ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:776:12: {...}? =>id= ID { if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.INT)))) ) { if (state.backtracking>0) {state.failed=true; return;} throw new FailedPredicateException(input, "int_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.INT))"); } id=(Token)match(input,ID,FOLLOW_ID_in_int_key4940); if (state.failed) return; if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public final void int_key() throws RecognitionException { Token id=null; try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:776:5: ({...}? =>id= ID ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:776:12: {...}? =>id= ID { if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.INT)))) ) { if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] throw new FailedPredicateException(input, "int_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.INT))"); } id=(Token)match(input,ID,FOLLOW_ID_in_int_key4940); if (state.failed) return; if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); } // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public DateMidnight withDurationAdded(ReadableDuration durationToAdd, int scalar) { if (durationToAdd == null || scalar == 0) { return this; } return withDurationAdded(durationToAdd.getMillis(), scalar); } }
public class class_name { public DateMidnight withDurationAdded(ReadableDuration durationToAdd, int scalar) { if (durationToAdd == null || scalar == 0) { return this; // depends on control dependency: [if], data = [none] } return withDurationAdded(durationToAdd.getMillis(), scalar); } }
public class class_name { public final String evalSqlCreateTable(final String pEntityName) { TableSql tableSql = getTablesMap().get(pEntityName); StringBuffer result = new StringBuffer("create table " + pEntityName.toUpperCase() + " (\n"); boolean isFirstField = true; for (Map.Entry<String, FieldSql> entry : tableSql.getFieldsMap().entrySet()) { if (!(entry.getValue().getTypeField().equals(ETypeField.COMPOSITE_FK) || entry.getValue().getTypeField() .equals(ETypeField.COMPOSITE_FK_PK))) { if (isFirstField) { isFirstField = false; } else { result.append(",\n"); } result.append(entry.getKey().toUpperCase() + " " + tableSql.getFieldsMap().get(entry.getKey()).getDefinition()); } } if (tableSql.getConstraint() != null) { result.append(",\n" + tableSql.getConstraint()); } result.append(");\n"); return result.toString(); } }
public class class_name { public final String evalSqlCreateTable(final String pEntityName) { TableSql tableSql = getTablesMap().get(pEntityName); StringBuffer result = new StringBuffer("create table " + pEntityName.toUpperCase() + " (\n"); boolean isFirstField = true; for (Map.Entry<String, FieldSql> entry : tableSql.getFieldsMap().entrySet()) { if (!(entry.getValue().getTypeField().equals(ETypeField.COMPOSITE_FK) || entry.getValue().getTypeField() .equals(ETypeField.COMPOSITE_FK_PK))) { if (isFirstField) { isFirstField = false; // depends on control dependency: [if], data = [none] } else { result.append(",\n"); // depends on control dependency: [if], data = [none] } result.append(entry.getKey().toUpperCase() + " " + tableSql.getFieldsMap().get(entry.getKey()).getDefinition()); // depends on control dependency: [if], data = [none] } } if (tableSql.getConstraint() != null) { result.append(",\n" + tableSql.getConstraint()); // depends on control dependency: [if], data = [none] } result.append(");\n"); return result.toString(); } }
public class class_name { public static String getPinYin(String chinese) { final StrBuilder result = StrUtil.strBuilder(); String strTemp = null; int len = chinese.length(); for (int j = 0; j < len; j++) { strTemp = chinese.substring(j, j + 1); int ascii = getChsAscii(strTemp); if (ascii > 0) { //非汉字 result.append((char)ascii); } else { for (int i = pinyinValue.length - 1; i >= 0; i--) { if (pinyinValue[i] <= ascii) { result.append(pinyinStr[i]); break; } } } } return result.toString(); } }
public class class_name { public static String getPinYin(String chinese) { final StrBuilder result = StrUtil.strBuilder(); String strTemp = null; int len = chinese.length(); for (int j = 0; j < len; j++) { strTemp = chinese.substring(j, j + 1); // depends on control dependency: [for], data = [j] int ascii = getChsAscii(strTemp); if (ascii > 0) { //非汉字 result.append((char)ascii); // depends on control dependency: [if], data = [none] } else { for (int i = pinyinValue.length - 1; i >= 0; i--) { if (pinyinValue[i] <= ascii) { result.append(pinyinStr[i]); // depends on control dependency: [if], data = [none] break; } } } } return result.toString(); } }
public class class_name { public static String rsaSign(String content, String privateKey) { if (null == content || privateKey == null) { return null; } try { PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64.decode(privateKey, Base64.DEFAULT)); KeyFactory keyf = KeyFactory.getInstance("RSA"); PrivateKey priKey = keyf.generatePrivate(priPKCS8); java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS); signature.initSign(priKey); signature.update(content.getBytes(CHARSET)); byte[] signed = signature.sign(); return Base64.encodeToString(signed, Base64.DEFAULT); } catch (Exception e) { // 这里是安全算法,为避免出现异常时泄露加密信息,这里不打印具体日志 HMSAgentLog.e("rsaSign error"); } return null; } }
public class class_name { public static String rsaSign(String content, String privateKey) { if (null == content || privateKey == null) { return null; // depends on control dependency: [if], data = [none] } try { PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64.decode(privateKey, Base64.DEFAULT)); KeyFactory keyf = KeyFactory.getInstance("RSA"); PrivateKey priKey = keyf.generatePrivate(priPKCS8); java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS); signature.initSign(priKey); // depends on control dependency: [try], data = [none] signature.update(content.getBytes(CHARSET)); // depends on control dependency: [try], data = [none] byte[] signed = signature.sign(); return Base64.encodeToString(signed, Base64.DEFAULT); // depends on control dependency: [try], data = [none] } catch (Exception e) { // 这里是安全算法,为避免出现异常时泄露加密信息,这里不打印具体日志 HMSAgentLog.e("rsaSign error"); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public EClass getIfcCraneRailFShapeProfileDef() { if (ifcCraneRailFShapeProfileDefEClass == null) { ifcCraneRailFShapeProfileDefEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(128); } return ifcCraneRailFShapeProfileDefEClass; } }
public class class_name { public EClass getIfcCraneRailFShapeProfileDef() { if (ifcCraneRailFShapeProfileDefEClass == null) { ifcCraneRailFShapeProfileDefEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(128); // depends on control dependency: [if], data = [none] } return ifcCraneRailFShapeProfileDefEClass; } }
public class class_name { @Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { if (pvalue == null) { return true; } try { String valueCountry = BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, this.fieldCountryCode); final String valueIban = BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, this.fieldIban); final String valueBic = BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, this.fieldBic); final String bicOfIban = IbanUtil.getBicOfIban(valueIban); if (StringUtils.isEmpty(valueIban) && StringUtils.isEmpty(valueBic)) { return true; } else if (StringUtils.isEmpty(valueIban)) { pcontext.disableDefaultConstraintViolation(); pcontext.buildConstraintViolationWithTemplate(NOT_EMPTY_MESSAGE) .addPropertyNode(this.fieldIban).addConstraintViolation(); return false; } else if (StringUtils.isEmpty(valueBic)) { pcontext.disableDefaultConstraintViolation(); pcontext.buildConstraintViolationWithTemplate(NOT_EMPTY_MESSAGE) .addPropertyNode(this.fieldBic).addConstraintViolation(); return false; } else if (StringUtils.length(valueIban) >= IbanValidator.IBAN_LENGTH_MIN && StringUtils.length(valueBic) >= BicValidator.BIC_LENGTH_MIN) { String countryIban = valueIban.replaceAll("\\s+", StringUtils.EMPTY).substring(0, 2); String countryBic = valueBic.replaceAll("\\s+", StringUtils.EMPTY).substring(4, 6); if (StringUtils.length(valueCountry) != 2) { // missing country selection, us country of iban valueCountry = countryIban; } if (this.allowLowerCaseCountryCode) { valueCountry = StringUtils.upperCase(valueCountry); countryIban = StringUtils.upperCase(countryIban); countryBic = StringUtils.upperCase(countryIban); } boolean ibanCodeMatches = false; boolean bicCodeMatches = false; final boolean bicIbanMatches = bicOfIban == null || StringUtils.equals(bicOfIban, valueBic); switch (valueCountry) { case "GF": // French Guyana case "GP": // Guadeloupe case "MQ": // Martinique case "RE": // Reunion case "PF": // French Polynesia case "TF": // French Southern Territories case "YT": // Mayotte case "NC": // New Caledonia case "BL": // Saint Barthelemy case "MF": // Saint Martin case "PM": // Saint Pierre et Miquelon case "WF": // Wallis and Futuna Islands // special solution for French oversea teritorials with french registry ibanCodeMatches = "FR".equals(countryIban); bicCodeMatches = "FR".equals(countryBic); break; case "JE": // Jersey case "GG": // Guernsey // they can use GB or FR registry, but iban and bic code must match ibanCodeMatches = ("GB".equals(countryIban) || "FR".equals(countryIban)) && countryBic.equals(countryIban); bicCodeMatches = "GB".equals(countryBic) || "FR".equals(countryBic); break; default: ibanCodeMatches = valueCountry.equals(countryIban); bicCodeMatches = valueCountry.equals(countryBic); break; } if (ibanCodeMatches && bicCodeMatches && bicIbanMatches) { return true; } pcontext.disableDefaultConstraintViolation(); if (!ibanCodeMatches) { pcontext.buildConstraintViolationWithTemplate(this.message) .addPropertyNode(this.fieldIban).addConstraintViolation(); } if (!bicCodeMatches) { pcontext.buildConstraintViolationWithTemplate(this.message).addPropertyNode(this.fieldBic) .addConstraintViolation(); } if (!bicIbanMatches) { pcontext.buildConstraintViolationWithTemplate(this.messageWrongBic) .addPropertyNode(this.fieldBic).addConstraintViolation(); } return false; } else { // wrong format, should be handled by other validators return true; } } catch (final Exception ignore) { return false; } } }
public class class_name { @Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { if (pvalue == null) { return true; // depends on control dependency: [if], data = [none] } try { String valueCountry = BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, this.fieldCountryCode); final String valueIban = BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, this.fieldIban); final String valueBic = BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, this.fieldBic); final String bicOfIban = IbanUtil.getBicOfIban(valueIban); if (StringUtils.isEmpty(valueIban) && StringUtils.isEmpty(valueBic)) { return true; // depends on control dependency: [if], data = [none] } else if (StringUtils.isEmpty(valueIban)) { pcontext.disableDefaultConstraintViolation(); // depends on control dependency: [if], data = [none] pcontext.buildConstraintViolationWithTemplate(NOT_EMPTY_MESSAGE) .addPropertyNode(this.fieldIban).addConstraintViolation(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } else if (StringUtils.isEmpty(valueBic)) { pcontext.disableDefaultConstraintViolation(); // depends on control dependency: [if], data = [none] pcontext.buildConstraintViolationWithTemplate(NOT_EMPTY_MESSAGE) .addPropertyNode(this.fieldBic).addConstraintViolation(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } else if (StringUtils.length(valueIban) >= IbanValidator.IBAN_LENGTH_MIN && StringUtils.length(valueBic) >= BicValidator.BIC_LENGTH_MIN) { String countryIban = valueIban.replaceAll("\\s+", StringUtils.EMPTY).substring(0, 2); String countryBic = valueBic.replaceAll("\\s+", StringUtils.EMPTY).substring(4, 6); if (StringUtils.length(valueCountry) != 2) { // missing country selection, us country of iban valueCountry = countryIban; // depends on control dependency: [if], data = [none] } if (this.allowLowerCaseCountryCode) { valueCountry = StringUtils.upperCase(valueCountry); // depends on control dependency: [if], data = [none] countryIban = StringUtils.upperCase(countryIban); // depends on control dependency: [if], data = [none] countryBic = StringUtils.upperCase(countryIban); // depends on control dependency: [if], data = [none] } boolean ibanCodeMatches = false; boolean bicCodeMatches = false; final boolean bicIbanMatches = bicOfIban == null || StringUtils.equals(bicOfIban, valueBic); switch (valueCountry) { case "GF": // French Guyana case "GP": // Guadeloupe case "MQ": // Martinique case "RE": // Reunion case "PF": // French Polynesia case "TF": // French Southern Territories case "YT": // Mayotte case "NC": // New Caledonia case "BL": // Saint Barthelemy case "MF": // Saint Martin case "PM": // Saint Pierre et Miquelon case "WF": // Wallis and Futuna Islands // special solution for French oversea teritorials with french registry ibanCodeMatches = "FR".equals(countryIban); bicCodeMatches = "FR".equals(countryBic); break; case "JE": // Jersey case "GG": // Guernsey // they can use GB or FR registry, but iban and bic code must match ibanCodeMatches = ("GB".equals(countryIban) || "FR".equals(countryIban)) && countryBic.equals(countryIban); bicCodeMatches = "GB".equals(countryBic) || "FR".equals(countryBic); break; default: ibanCodeMatches = valueCountry.equals(countryIban); bicCodeMatches = valueCountry.equals(countryBic); break; } if (ibanCodeMatches && bicCodeMatches && bicIbanMatches) { return true; // depends on control dependency: [if], data = [none] } pcontext.disableDefaultConstraintViolation(); // depends on control dependency: [if], data = [none] if (!ibanCodeMatches) { pcontext.buildConstraintViolationWithTemplate(this.message) .addPropertyNode(this.fieldIban).addConstraintViolation(); // depends on control dependency: [if], data = [none] } if (!bicCodeMatches) { pcontext.buildConstraintViolationWithTemplate(this.message).addPropertyNode(this.fieldBic) .addConstraintViolation(); // depends on control dependency: [if], data = [none] } if (!bicIbanMatches) { pcontext.buildConstraintViolationWithTemplate(this.messageWrongBic) .addPropertyNode(this.fieldBic).addConstraintViolation(); // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [if], data = [none] } else { // wrong format, should be handled by other validators return true; // depends on control dependency: [if], data = [none] } } catch (final Exception ignore) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void processAnimations(FragmentAnimation animation, FragmentTransaction ft) { if (animation != null) { if (animation.isCompletedAnimation()) { ft.setCustomAnimations(animation.getEnterAnim(), animation.getExitAnim(), animation.getPushInAnim(), animation.getPopOutAnim()); } else { ft.setCustomAnimations(animation.getEnterAnim(), animation.getExitAnim()); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) for (LollipopAnim sharedElement : animation.getSharedViews()) { ft.addSharedElement(sharedElement.view, sharedElement.name); } } } }
public class class_name { protected void processAnimations(FragmentAnimation animation, FragmentTransaction ft) { if (animation != null) { if (animation.isCompletedAnimation()) { ft.setCustomAnimations(animation.getEnterAnim(), animation.getExitAnim(), animation.getPushInAnim(), animation.getPopOutAnim()); // depends on control dependency: [if], data = [none] } else { ft.setCustomAnimations(animation.getEnterAnim(), animation.getExitAnim()); // depends on control dependency: [if], data = [none] } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) for (LollipopAnim sharedElement : animation.getSharedViews()) { ft.addSharedElement(sharedElement.view, sharedElement.name); // depends on control dependency: [for], data = [sharedElement] } } } }
public class class_name { protected final SessionState getSessionState() { if (sessionTracker != null) { Session currentSession = sessionTracker.getSession(); return (currentSession != null) ? currentSession.getState() : null; } return null; } }
public class class_name { protected final SessionState getSessionState() { if (sessionTracker != null) { Session currentSession = sessionTracker.getSession(); return (currentSession != null) ? currentSession.getState() : null; // depends on control dependency: [if], data = [null)] } return null; } }
public class class_name { public static CompilationFailedException create(final IMessage[] errors) { final StringBuilder sb = new StringBuilder(); sb.append("AJC compiler errors:").append(LINE_SEPARATOR); for (final IMessage error : errors) { sb.append(error.toString()).append(LINE_SEPARATOR); } return new CompilationFailedException(sb.toString()); } }
public class class_name { public static CompilationFailedException create(final IMessage[] errors) { final StringBuilder sb = new StringBuilder(); sb.append("AJC compiler errors:").append(LINE_SEPARATOR); for (final IMessage error : errors) { sb.append(error.toString()).append(LINE_SEPARATOR); // depends on control dependency: [for], data = [error] } return new CompilationFailedException(sb.toString()); } }
public class class_name { protected String getApplicationFilename() { // A project doesn't build a web application artifact but getting the // application artifacts from dependencies. e.g. liberty-assembly type // project. if ("dependencies".equals(getInstallAppPackages())) { return null; } // project artifact has not be created yet when create-server goal is // called in pre-package phase String name = project.getBuild().getFinalName(); if (stripVersion) { int versionBeginIndex = project.getBuild().getFinalName().lastIndexOf("-" + project.getVersion()); if (versionBeginIndex != -1) { name = project.getBuild().getFinalName().substring(0, versionBeginIndex); } } // liberty only supports these application types: ear, war, eba, esa switch (project.getPackaging()) { case "ear": case "war": case "eba": case "esa": name += "." + project.getPackaging(); if (looseApplication) { name += ".xml"; } break; case "liberty-assembly": // assuming liberty-assembly project will also have a war file // output. File dir = getWarSourceDirectory(project); if (dir.exists()) { name += ".war"; if (looseApplication) { name += ".xml"; } } break; default: log.debug("The project artifact cannot be installed to a Liberty server because " + project.getPackaging() + " is not a supported packaging type."); name = null; break; } return name; } }
public class class_name { protected String getApplicationFilename() { // A project doesn't build a web application artifact but getting the // application artifacts from dependencies. e.g. liberty-assembly type // project. if ("dependencies".equals(getInstallAppPackages())) { return null; // depends on control dependency: [if], data = [none] } // project artifact has not be created yet when create-server goal is // called in pre-package phase String name = project.getBuild().getFinalName(); if (stripVersion) { int versionBeginIndex = project.getBuild().getFinalName().lastIndexOf("-" + project.getVersion()); if (versionBeginIndex != -1) { name = project.getBuild().getFinalName().substring(0, versionBeginIndex); // depends on control dependency: [if], data = [none] } } // liberty only supports these application types: ear, war, eba, esa switch (project.getPackaging()) { case "ear": case "war": case "eba": case "esa": name += "." + project.getPackaging(); if (looseApplication) { name += ".xml"; // depends on control dependency: [if], data = [none] } break; case "liberty-assembly": // assuming liberty-assembly project will also have a war file // output. File dir = getWarSourceDirectory(project); if (dir.exists()) { name += ".war"; // depends on control dependency: [if], data = [none] if (looseApplication) { name += ".xml"; // depends on control dependency: [if], data = [none] } } break; default: log.debug("The project artifact cannot be installed to a Liberty server because " + project.getPackaging() + " is not a supported packaging type."); name = null; break; } return name; } }
public class class_name { public void marshall(S3Config s3Config, ProtocolMarshaller protocolMarshaller) { if (s3Config == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(s3Config.getBucketAccessRoleArn(), BUCKETACCESSROLEARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(S3Config s3Config, ProtocolMarshaller protocolMarshaller) { if (s3Config == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(s3Config.getBucketAccessRoleArn(), BUCKETACCESSROLEARN_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 { <A> AbstractFunction1<Connection, A> connectionFunction(final ConnectionCallable<A> block) { return new AbstractFunction1<Connection, A>() { public A apply(Connection connection) { try { return block.call(connection); } catch (java.sql.SQLException e) { throw new RuntimeException("Connection callable failed", e); } } }; } }
public class class_name { <A> AbstractFunction1<Connection, A> connectionFunction(final ConnectionCallable<A> block) { return new AbstractFunction1<Connection, A>() { public A apply(Connection connection) { try { return block.call(connection); // depends on control dependency: [try], data = [none] } catch (java.sql.SQLException e) { throw new RuntimeException("Connection callable failed", e); } // depends on control dependency: [catch], data = [none] } }; } }
public class class_name { public static Constraint digits(final Number integer, final Number fraction) { return new Constraint("digits", digitsPayload(integer, fraction)) { public boolean isValid(Object actualValue) { if (actualValue != null) { if (!((actualValue instanceof Number) || (actualValue instanceof String))) { return false; } else { if (integer != null && fraction != null) { String val = actualValue.toString(); String[] split = val.split("[,.]"); if (!NumberUtils.isDigits(split[0])) { return false; } if (integer.intValue() < split[0].length()) { return false; } if (split.length > 1 && fraction.intValue() < split[1].length()) { return false; } } } } return true; } }; } }
public class class_name { public static Constraint digits(final Number integer, final Number fraction) { return new Constraint("digits", digitsPayload(integer, fraction)) { public boolean isValid(Object actualValue) { if (actualValue != null) { if (!((actualValue instanceof Number) || (actualValue instanceof String))) { return false; // depends on control dependency: [if], data = [none] } else { if (integer != null && fraction != null) { String val = actualValue.toString(); String[] split = val.split("[,.]"); if (!NumberUtils.isDigits(split[0])) { return false; // depends on control dependency: [if], data = [none] } if (integer.intValue() < split[0].length()) { return false; // depends on control dependency: [if], data = [none] } if (split.length > 1 && fraction.intValue() < split[1].length()) { return false; // depends on control dependency: [if], data = [none] } } } } return true; } }; } }
public class class_name { public static String join(Object[] array, String separator) { if (array == null) { return null; } StringBuilder builder = new StringBuilder(); for (int i = 0; i < array.length; i++) { Object o = array[i]; if (i > 0) { builder.append(separator); } builder.append(o); } return builder.toString(); } }
public class class_name { public static String join(Object[] array, String separator) { if (array == null) { return null; // depends on control dependency: [if], data = [none] } StringBuilder builder = new StringBuilder(); for (int i = 0; i < array.length; i++) { Object o = array[i]; if (i > 0) { builder.append(separator); // depends on control dependency: [if], data = [none] } builder.append(o); // depends on control dependency: [for], data = [none] } return builder.toString(); } }
public class class_name { public RequestLaunchTemplateData withSecurityGroups(String... securityGroups) { if (this.securityGroups == null) { setSecurityGroups(new com.amazonaws.internal.SdkInternalList<String>(securityGroups.length)); } for (String ele : securityGroups) { this.securityGroups.add(ele); } return this; } }
public class class_name { public RequestLaunchTemplateData withSecurityGroups(String... securityGroups) { if (this.securityGroups == null) { setSecurityGroups(new com.amazonaws.internal.SdkInternalList<String>(securityGroups.length)); // depends on control dependency: [if], data = [none] } for (String ele : securityGroups) { this.securityGroups.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static Locale parseLocale(String localeString) { if (localeString == null || localeString.length() == 0) { return Locale.getDefault(); } localeString = localeString.trim(); if (localeString == null) { return null; } String language = ""; String country = ""; String variant = ""; // language int start = 0; int index = localeString.indexOf("_"); if (index >= 0) { language = localeString.substring(start, index).trim(); // country start = index + 1; index = localeString.indexOf("_", start); if (index >= 0) { country = localeString.substring(start, index).trim(); // variant variant = localeString.substring(index + 1).trim(); } else { country = localeString.substring(start).trim(); } } else { language = localeString.substring(start).trim(); } return new Locale(language, country, variant); } }
public class class_name { public static Locale parseLocale(String localeString) { if (localeString == null || localeString.length() == 0) { return Locale.getDefault(); // depends on control dependency: [if], data = [none] } localeString = localeString.trim(); if (localeString == null) { return null; // depends on control dependency: [if], data = [none] } String language = ""; String country = ""; String variant = ""; // language int start = 0; int index = localeString.indexOf("_"); if (index >= 0) { language = localeString.substring(start, index).trim(); // depends on control dependency: [if], data = [none] // country start = index + 1; // depends on control dependency: [if], data = [none] index = localeString.indexOf("_", start); // depends on control dependency: [if], data = [none] if (index >= 0) { country = localeString.substring(start, index).trim(); // depends on control dependency: [if], data = [none] // variant variant = localeString.substring(index + 1).trim(); // depends on control dependency: [if], data = [(index] } else { country = localeString.substring(start).trim(); // depends on control dependency: [if], data = [none] } } else { language = localeString.substring(start).trim(); // depends on control dependency: [if], data = [none] } return new Locale(language, country, variant); } }
public class class_name { private FieldDescriptor[] getExtentFieldDescriptors(TableAlias extAlias, FieldDescriptor[] fds) { FieldDescriptor[] result = new FieldDescriptor[fds.length]; for (int i = 0; i < fds.length; i++) { result[i] = extAlias.cld.getFieldDescriptorByName(fds[i].getAttributeName()); } return result; } }
public class class_name { private FieldDescriptor[] getExtentFieldDescriptors(TableAlias extAlias, FieldDescriptor[] fds) { FieldDescriptor[] result = new FieldDescriptor[fds.length]; for (int i = 0; i < fds.length; i++) { result[i] = extAlias.cld.getFieldDescriptorByName(fds[i].getAttributeName()); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { @Nonnull @ReturnsMutableCopy public static ICommonsList <Date> computeFireTimes (final IOperableTrigger trigg, final ICalendar cal, final int numTimes) { final ICommonsList <Date> lst = new CommonsArrayList <> (); final IOperableTrigger t = trigg.clone (); if (t.getNextFireTime () == null) t.computeFirstFireTime (cal); for (int i = 0; i < numTimes; i++) { final Date d = t.getNextFireTime (); if (d != null) { lst.add (d); t.triggered (cal); } else { break; } } return lst; } }
public class class_name { @Nonnull @ReturnsMutableCopy public static ICommonsList <Date> computeFireTimes (final IOperableTrigger trigg, final ICalendar cal, final int numTimes) { final ICommonsList <Date> lst = new CommonsArrayList <> (); final IOperableTrigger t = trigg.clone (); if (t.getNextFireTime () == null) t.computeFirstFireTime (cal); for (int i = 0; i < numTimes; i++) { final Date d = t.getNextFireTime (); if (d != null) { lst.add (d); // depends on control dependency: [if], data = [(d] t.triggered (cal); // depends on control dependency: [if], data = [none] } else { break; } } return lst; } }
public class class_name { public void releaseRequest(HttpRequestMessageImpl request) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "releaseRequest: " + request); } this.reqPool.put(request); } }
public class class_name { public void releaseRequest(HttpRequestMessageImpl request) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "releaseRequest: " + request); // depends on control dependency: [if], data = [none] } this.reqPool.put(request); } }
public class class_name { public static String getGenericString(Field field){ String fieldDescription = field.toGenericString(); List<String> splitResult = new ArrayList<String>(); char[] charResult = fieldDescription.toCharArray(); boolean isFinished = false; int separatorIndex = fieldDescription.indexOf(" "); int previousIndex = 0; while(!isFinished){ // if previous character is "," don't cut the string int position = separatorIndex-1; char specialChar = charResult[position]; boolean isSpecialChar = true; if(specialChar!=',' && specialChar != '?'){ if(specialChar == 's'){ String specialString = null; try{ specialString = fieldDescription.substring(position - "extends".length(), position+1); if(isNull(specialString) || !" extends".equals(specialString)) isSpecialChar = false; }catch(IndexOutOfBoundsException e){ isSpecialChar = false; } }else isSpecialChar = false; } if(!isSpecialChar){ splitResult.add(fieldDescription.substring(previousIndex, separatorIndex)); previousIndex = separatorIndex+1; } separatorIndex = fieldDescription.indexOf(" ",separatorIndex+1); if(separatorIndex == -1)isFinished = true; } for (String description : splitResult) if(!isAccessModifier(description)) return description; return null; } }
public class class_name { public static String getGenericString(Field field){ String fieldDescription = field.toGenericString(); List<String> splitResult = new ArrayList<String>(); char[] charResult = fieldDescription.toCharArray(); boolean isFinished = false; int separatorIndex = fieldDescription.indexOf(" "); int previousIndex = 0; while(!isFinished){ // if previous character is "," don't cut the string int position = separatorIndex-1; char specialChar = charResult[position]; boolean isSpecialChar = true; if(specialChar!=',' && specialChar != '?'){ if(specialChar == 's'){ String specialString = null; try{ specialString = fieldDescription.substring(position - "extends".length(), position+1); // depends on control dependency: [try], data = [none] if(isNull(specialString) || !" extends".equals(specialString)) isSpecialChar = false; }catch(IndexOutOfBoundsException e){ isSpecialChar = false; } // depends on control dependency: [catch], data = [none] }else isSpecialChar = false; } if(!isSpecialChar){ splitResult.add(fieldDescription.substring(previousIndex, separatorIndex)); // depends on control dependency: [if], data = [none] previousIndex = separatorIndex+1; // depends on control dependency: [if], data = [none] } separatorIndex = fieldDescription.indexOf(" ",separatorIndex+1); // depends on control dependency: [while], data = [none] if(separatorIndex == -1)isFinished = true; } for (String description : splitResult) if(!isAccessModifier(description)) return description; return null; } }
public class class_name { private static double log(double x) { double y = 0.0; if (x < 1E-300) { y = -690.7755; } else { y = java.lang.Math.log(x); } return y; } }
public class class_name { private static double log(double x) { double y = 0.0; if (x < 1E-300) { y = -690.7755; // depends on control dependency: [if], data = [none] } else { y = java.lang.Math.log(x); // depends on control dependency: [if], data = [(x] } return y; } }
public class class_name { public static void copyFields(Connection connection, SimpleResultSet rs, TableLocation tableLocation) throws SQLException { DatabaseMetaData meta = connection.getMetaData(); ResultSet columnsRs = meta.getColumns(tableLocation.getCatalog(null), tableLocation.getSchema(null), tableLocation.getTable(), null); Map<Integer, Object[]> columns = new HashMap<Integer, Object[]>(); int COLUMN_NAME = 0, COLUMN_TYPE = 1, COLUMN_TYPENAME = 2, COLUMN_PRECISION = 3, COLUMN_SCALE = 4; try { while (columnsRs.next()) { Object[] columnInfoObjects = new Object[COLUMN_SCALE + 1]; columnInfoObjects[COLUMN_NAME] = columnsRs.getString("COLUMN_NAME"); columnInfoObjects[COLUMN_TYPE] = columnsRs.getInt("DATA_TYPE"); columnInfoObjects[COLUMN_TYPENAME] = columnsRs.getString("TYPE_NAME"); columnInfoObjects[COLUMN_PRECISION] = columnsRs.getInt("COLUMN_SIZE"); columnInfoObjects[COLUMN_SCALE] = columnsRs.getInt("DECIMAL_DIGITS"); columns.put(columnsRs.getInt("ORDINAL_POSITION"), columnInfoObjects); } } finally { columnsRs.close(); } for(int i=1;i<=columns.size();i++) { Object[] columnInfoObjects = columns.get(i); rs.addColumn((String)columnInfoObjects[COLUMN_NAME], (Integer)columnInfoObjects[COLUMN_TYPE], (String)columnInfoObjects[COLUMN_TYPENAME], (Integer)columnInfoObjects[COLUMN_PRECISION] , (Integer)columnInfoObjects[COLUMN_SCALE]); } } }
public class class_name { public static void copyFields(Connection connection, SimpleResultSet rs, TableLocation tableLocation) throws SQLException { DatabaseMetaData meta = connection.getMetaData(); ResultSet columnsRs = meta.getColumns(tableLocation.getCatalog(null), tableLocation.getSchema(null), tableLocation.getTable(), null); Map<Integer, Object[]> columns = new HashMap<Integer, Object[]>(); int COLUMN_NAME = 0, COLUMN_TYPE = 1, COLUMN_TYPENAME = 2, COLUMN_PRECISION = 3, COLUMN_SCALE = 4; try { while (columnsRs.next()) { Object[] columnInfoObjects = new Object[COLUMN_SCALE + 1]; columnInfoObjects[COLUMN_NAME] = columnsRs.getString("COLUMN_NAME"); // depends on control dependency: [while], data = [none] columnInfoObjects[COLUMN_TYPE] = columnsRs.getInt("DATA_TYPE"); // depends on control dependency: [while], data = [none] columnInfoObjects[COLUMN_TYPENAME] = columnsRs.getString("TYPE_NAME"); // depends on control dependency: [while], data = [none] columnInfoObjects[COLUMN_PRECISION] = columnsRs.getInt("COLUMN_SIZE"); // depends on control dependency: [while], data = [none] columnInfoObjects[COLUMN_SCALE] = columnsRs.getInt("DECIMAL_DIGITS"); // depends on control dependency: [while], data = [none] columns.put(columnsRs.getInt("ORDINAL_POSITION"), columnInfoObjects); // depends on control dependency: [while], data = [none] } } finally { columnsRs.close(); } for(int i=1;i<=columns.size();i++) { Object[] columnInfoObjects = columns.get(i); rs.addColumn((String)columnInfoObjects[COLUMN_NAME], (Integer)columnInfoObjects[COLUMN_TYPE], (String)columnInfoObjects[COLUMN_TYPENAME], (Integer)columnInfoObjects[COLUMN_PRECISION] , (Integer)columnInfoObjects[COLUMN_SCALE]); } } }
public class class_name { public AnnotationInfoList getAnnotationInfo() { if (!scanResult.scanSpec.enableAnnotationInfo) { throw new IllegalArgumentException("Please call ClassGraph#enableAnnotationInfo() before #scan()"); } if (annotationInfo == null || annotationInfo.length == 0) { return AnnotationInfoList.EMPTY_LIST; } else { final AnnotationInfoList annotationInfoList = new AnnotationInfoList(annotationInfo.length); Collections.addAll(annotationInfoList, annotationInfo); return AnnotationInfoList.getIndirectAnnotations(annotationInfoList, /* annotatedClass = */ null); } } }
public class class_name { public AnnotationInfoList getAnnotationInfo() { if (!scanResult.scanSpec.enableAnnotationInfo) { throw new IllegalArgumentException("Please call ClassGraph#enableAnnotationInfo() before #scan()"); } if (annotationInfo == null || annotationInfo.length == 0) { return AnnotationInfoList.EMPTY_LIST; // depends on control dependency: [if], data = [none] } else { final AnnotationInfoList annotationInfoList = new AnnotationInfoList(annotationInfo.length); Collections.addAll(annotationInfoList, annotationInfo); // depends on control dependency: [if], data = [(annotationInfo] return AnnotationInfoList.getIndirectAnnotations(annotationInfoList, /* annotatedClass = */ null); // depends on control dependency: [if], data = [(annotationInfo] } } }
public class class_name { protected void stop() { final EventManager eventManager = BeanManager.getInstance().getReference(EventManager.class); for (final AbstractEventListener<?> eventListener : eventListeners) { eventManager.unregisterListener(eventListener); } } }
public class class_name { protected void stop() { final EventManager eventManager = BeanManager.getInstance().getReference(EventManager.class); for (final AbstractEventListener<?> eventListener : eventListeners) { eventManager.unregisterListener(eventListener); // depends on control dependency: [for], data = [eventListener] } } }
public class class_name { public ChannelData[] generateChildDataArray(ChannelData[] parentChannelData, boolean[] childrenCreated) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "generateChildDataArray"); } ChannelData newChannelDataArray[] = new ChannelData[parentChannelData.length]; ChannelDataImpl parent = null; ChildChannelDataImpl child = null; ChainDataImpl runningChainData = null; List<ChainData> chainDataList = new ArrayList<ChainData>(); for (int i = 0; i < parentChannelData.length; i++) { // Get the parent channel data object. parent = (ChannelDataImpl) channelDataMap.get(parentChannelData[i].getName()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Find or create a child for parent " + parent.getName()); } // Check if it is in the runtime yet. if (parent.getNumChildren() == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Parent not in runtime"); } // Channel not in runtime yet. Create it. newChannelDataArray[i] = parent.createChild(); childrenCreated[i] = true; // All next channels will either converge or need to be created. for (int j = i + 1; j < newChannelDataArray.length; j++) { // Get the parent channel data object. parent = (ChannelDataImpl) channelDataMap.get(parentChannelData[j].getName()); // Create the child for use in this chain. newChannelDataArray[j] = parent.createChild(); childrenCreated[j] = true; } // Children have all been created. Break out of for loop. break; } else if (i == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found connector channel"); } // Get list of all running chain data using this channel ... for future // interrogation chainDataList = getRunningChains(parent); // Found connector channel. Special case. Only ever zero or one instance // in runtime newChannelDataArray[i] = parent.getInboundChild(); if (newChannelDataArray[i] == null) { newChannelDataArray[i] = parent.createChild(); childrenCreated[i] = true; } else { childrenCreated[i] = false; } } else { // Non connector channel found in runtime. Need to pick the right one. // Weed chain data list down to those that include this channel as the // i-th channel boolean foundChild = false; String inputChannelName = parentChannelData[i].getName(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found non connector channel, " + inputChannelName); } while (chainDataList.size() > 0) { runningChainData = (ChainDataImpl) chainDataList.get(0); // Weed out outbound chains using this parent channel config. if (runningChainData.getType().equals(FlowType.OUTBOUND)) { // Can't consider this chain since it is outbound. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Removing chain that is outbound, " + runningChainData.getName()); } chainDataList.remove(runningChainData); continue; } // Extract the i-th channel from the current running chain data if (i + 1 > runningChainData.getChannelList().length) { // Chain doesn't have any more channels. Nothing at i-th position. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Removing chain that is too short, " + runningChainData.getName()); } chainDataList.remove(runningChainData); continue; } child = (ChildChannelDataImpl) runningChainData.getChannelList()[i]; // Check if the runtime channel is a child of the input parent. if (!inputChannelName.equals(child.getExternalName())) { // Child did not come from input parent. Remove divergent chain. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Removing divergent chain, " + runningChainData.getName()); } chainDataList.remove(runningChainData); } else { // Found a match. Use it and break. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found reusable channel from chain, " + runningChainData.getName()); } newChannelDataArray[i] = child; childrenCreated[i] = false; foundChild = true; break; } } // At this point, chainDataList only includes the runtime chains that // match // up to the i-th channel of the input chain data. // Example: if i=1 and we have ABX, the list may contain ABC and ABD. // If the list is empty, create a new child. if (!foundChild) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Channel not in runtime so create it, " + parent.getName()); } // Channel not in runtime yet. Create it. newChannelDataArray[i] = parent.createChild(); childrenCreated[i] = true; // All next channels will either converge or need to be created. for (int j = i + 1; j < newChannelDataArray.length; j++) { // Get the parent channel data object. parent = (ChannelDataImpl) channelDataMap.get(parentChannelData[j].getName()); // Create the child for use in this chain. newChannelDataArray[j] = parent.createChild(); childrenCreated[j] = true; } // Children have all been created. Break out of for loop. break; } } } // end for loop creating new channel array of children if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "generateChildDataArray"); } return newChannelDataArray; } }
public class class_name { public ChannelData[] generateChildDataArray(ChannelData[] parentChannelData, boolean[] childrenCreated) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "generateChildDataArray"); // depends on control dependency: [if], data = [none] } ChannelData newChannelDataArray[] = new ChannelData[parentChannelData.length]; ChannelDataImpl parent = null; ChildChannelDataImpl child = null; ChainDataImpl runningChainData = null; List<ChainData> chainDataList = new ArrayList<ChainData>(); for (int i = 0; i < parentChannelData.length; i++) { // Get the parent channel data object. parent = (ChannelDataImpl) channelDataMap.get(parentChannelData[i].getName()); // depends on control dependency: [for], data = [i] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Find or create a child for parent " + parent.getName()); // depends on control dependency: [if], data = [none] } // Check if it is in the runtime yet. if (parent.getNumChildren() == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Parent not in runtime"); // depends on control dependency: [if], data = [none] } // Channel not in runtime yet. Create it. newChannelDataArray[i] = parent.createChild(); // depends on control dependency: [if], data = [none] childrenCreated[i] = true; // depends on control dependency: [if], data = [none] // All next channels will either converge or need to be created. for (int j = i + 1; j < newChannelDataArray.length; j++) { // Get the parent channel data object. parent = (ChannelDataImpl) channelDataMap.get(parentChannelData[j].getName()); // depends on control dependency: [for], data = [j] // Create the child for use in this chain. newChannelDataArray[j] = parent.createChild(); // depends on control dependency: [for], data = [j] childrenCreated[j] = true; // depends on control dependency: [for], data = [j] } // Children have all been created. Break out of for loop. break; } else if (i == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found connector channel"); // depends on control dependency: [if], data = [none] } // Get list of all running chain data using this channel ... for future // interrogation chainDataList = getRunningChains(parent); // depends on control dependency: [if], data = [none] // Found connector channel. Special case. Only ever zero or one instance // in runtime newChannelDataArray[i] = parent.getInboundChild(); // depends on control dependency: [if], data = [none] if (newChannelDataArray[i] == null) { newChannelDataArray[i] = parent.createChild(); // depends on control dependency: [if], data = [none] childrenCreated[i] = true; // depends on control dependency: [if], data = [none] } else { childrenCreated[i] = false; // depends on control dependency: [if], data = [none] } } else { // Non connector channel found in runtime. Need to pick the right one. // Weed chain data list down to those that include this channel as the // i-th channel boolean foundChild = false; String inputChannelName = parentChannelData[i].getName(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found non connector channel, " + inputChannelName); // depends on control dependency: [if], data = [none] } while (chainDataList.size() > 0) { runningChainData = (ChainDataImpl) chainDataList.get(0); // depends on control dependency: [while], data = [0)] // Weed out outbound chains using this parent channel config. if (runningChainData.getType().equals(FlowType.OUTBOUND)) { // Can't consider this chain since it is outbound. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Removing chain that is outbound, " + runningChainData.getName()); // depends on control dependency: [if], data = [none] } chainDataList.remove(runningChainData); // depends on control dependency: [if], data = [none] continue; } // Extract the i-th channel from the current running chain data if (i + 1 > runningChainData.getChannelList().length) { // Chain doesn't have any more channels. Nothing at i-th position. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Removing chain that is too short, " + runningChainData.getName()); // depends on control dependency: [if], data = [none] } chainDataList.remove(runningChainData); // depends on control dependency: [if], data = [none] continue; } child = (ChildChannelDataImpl) runningChainData.getChannelList()[i]; // depends on control dependency: [while], data = [none] // Check if the runtime channel is a child of the input parent. if (!inputChannelName.equals(child.getExternalName())) { // Child did not come from input parent. Remove divergent chain. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Removing divergent chain, " + runningChainData.getName()); // depends on control dependency: [if], data = [none] } chainDataList.remove(runningChainData); // depends on control dependency: [if], data = [none] } else { // Found a match. Use it and break. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found reusable channel from chain, " + runningChainData.getName()); // depends on control dependency: [if], data = [none] } newChannelDataArray[i] = child; // depends on control dependency: [if], data = [none] childrenCreated[i] = false; // depends on control dependency: [if], data = [none] foundChild = true; // depends on control dependency: [if], data = [none] break; } } // At this point, chainDataList only includes the runtime chains that // match // up to the i-th channel of the input chain data. // Example: if i=1 and we have ABX, the list may contain ABC and ABD. // If the list is empty, create a new child. if (!foundChild) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Channel not in runtime so create it, " + parent.getName()); // depends on control dependency: [if], data = [none] } // Channel not in runtime yet. Create it. newChannelDataArray[i] = parent.createChild(); // depends on control dependency: [if], data = [none] childrenCreated[i] = true; // depends on control dependency: [if], data = [none] // All next channels will either converge or need to be created. for (int j = i + 1; j < newChannelDataArray.length; j++) { // Get the parent channel data object. parent = (ChannelDataImpl) channelDataMap.get(parentChannelData[j].getName()); // depends on control dependency: [for], data = [j] // Create the child for use in this chain. newChannelDataArray[j] = parent.createChild(); // depends on control dependency: [for], data = [j] childrenCreated[j] = true; // depends on control dependency: [for], data = [j] } // Children have all been created. Break out of for loop. break; } } } // end for loop creating new channel array of children if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "generateChildDataArray"); // depends on control dependency: [if], data = [none] } return newChannelDataArray; } }
public class class_name { public void setScanHeadersAllRequests(boolean scanAllRequests) { if (scanAllRequests == scanHeadersAllRequests) { return; } this.scanHeadersAllRequests = scanAllRequests; getConfig().setProperty(SCAN_HEADERS_ALL_REQUESTS, this.scanHeadersAllRequests); } }
public class class_name { public void setScanHeadersAllRequests(boolean scanAllRequests) { if (scanAllRequests == scanHeadersAllRequests) { return; // depends on control dependency: [if], data = [none] } this.scanHeadersAllRequests = scanAllRequests; getConfig().setProperty(SCAN_HEADERS_ALL_REQUESTS, this.scanHeadersAllRequests); } }
public class class_name { private void generateOrderedDepGraph() { TopologicalOrderIterator<Predicate, DefaultEdge> iter = new TopologicalOrderIterator<Predicate, DefaultEdge>(predicateDependencyGraph); while (iter.hasNext()){ Predicate pred = iter.next(); predicatesInBottomUp.add(pred); } Collections.reverse(predicatesInBottomUp); } }
public class class_name { private void generateOrderedDepGraph() { TopologicalOrderIterator<Predicate, DefaultEdge> iter = new TopologicalOrderIterator<Predicate, DefaultEdge>(predicateDependencyGraph); while (iter.hasNext()){ Predicate pred = iter.next(); predicatesInBottomUp.add(pred); // depends on control dependency: [while], data = [none] } Collections.reverse(predicatesInBottomUp); } }
public class class_name { public boolean isExceptionAtThisTime() { Time now = new Time(); for (TimeSpan span : timesOfDay) { if (span.isWithin(now)) { return true; } } return false; } }
public class class_name { public boolean isExceptionAtThisTime() { Time now = new Time(); for (TimeSpan span : timesOfDay) { if (span.isWithin(now)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public static void addPropertiesToSpec(ModuleSpec.Builder moduleSpecBuilder, Map<String, String> properties) { for (Entry<String, String> entry : properties.entrySet()) { moduleSpecBuilder.addProperty(entry.getKey(), entry.getValue()); } } }
public class class_name { public static void addPropertiesToSpec(ModuleSpec.Builder moduleSpecBuilder, Map<String, String> properties) { for (Entry<String, String> entry : properties.entrySet()) { moduleSpecBuilder.addProperty(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } } }
public class class_name { private static double euclideanNorm(double vector[]) { int n = vector.length; if (n < 1) { return 0; } if (n == 1) { return Math.abs(vector[0]); } // this algorithm is (often) more accurate than just summing up the squares and taking the square-root afterwards double scale = 0; // scaling factor that is factored out double sum = 1; // basic sum of squares from which scale has been factored out for (int i = 0; i < n; i++) { if (vector[i] != 0) { double abs = Math.abs(vector[i]); // try to get the best scaling factor if (scale < abs) { double t = scale / abs; sum = 1 + sum * (t * t); scale = abs; } else { double t = abs / scale; sum += t * t; } } } return scale * Math.sqrt(sum); } }
public class class_name { private static double euclideanNorm(double vector[]) { int n = vector.length; if (n < 1) { return 0; // depends on control dependency: [if], data = [none] } if (n == 1) { return Math.abs(vector[0]); // depends on control dependency: [if], data = [none] } // this algorithm is (often) more accurate than just summing up the squares and taking the square-root afterwards double scale = 0; // scaling factor that is factored out double sum = 1; // basic sum of squares from which scale has been factored out for (int i = 0; i < n; i++) { if (vector[i] != 0) { double abs = Math.abs(vector[i]); // try to get the best scaling factor if (scale < abs) { double t = scale / abs; sum = 1 + sum * (t * t); // depends on control dependency: [if], data = [none] scale = abs; // depends on control dependency: [if], data = [none] } else { double t = abs / scale; sum += t * t; // depends on control dependency: [if], data = [none] } } } return scale * Math.sqrt(sum); } }
public class class_name { @Override public final void onNext(ReadRowsResponse readRowsResponse) { if (complete) { onError(new IllegalStateException("Adding partialRow after completion")); return; } int rowsProcessed = 0; for (int i = 0; i < readRowsResponse.getChunksCount(); i++) { try { CellChunk chunk = readRowsResponse.getChunks(i); state.validateChunk(rowInProgress, lastCompletedRowKey, chunk); if (chunk.getResetRow()) { rowInProgress = null; state = RowMergerState.NewRow; continue; } if(state == RowMergerState.NewRow) { rowInProgress = new RowInProgress(); rowInProgress.updateCurrentKey(chunk); } else if (state == RowMergerState.RowInProgress) { rowInProgress.updateCurrentKey(chunk); } if (chunk.getValueSize() > 0) { rowInProgress.addPartialCellChunk(chunk); state = RowMergerState.CellInProgress; } else if (rowInProgress.hasChunkInProgess()) { rowInProgress.addPartialCellChunk(chunk); rowInProgress.completeMultiChunkCell(); state = RowMergerState.RowInProgress; } else { rowInProgress.addFullChunk(chunk); state = RowMergerState.RowInProgress; } if (chunk.getCommitRow()) { observer.onNext(rowInProgress.buildRow()); lastCompletedRowKey = rowInProgress.getRowKey(); state = RowMergerState.NewRow; rowInProgress = null; rowsProcessed++; } } catch (Throwable e) { onError(e); return; } } this.rowCountInLastMessage = rowsProcessed; } }
public class class_name { @Override public final void onNext(ReadRowsResponse readRowsResponse) { if (complete) { onError(new IllegalStateException("Adding partialRow after completion")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } int rowsProcessed = 0; for (int i = 0; i < readRowsResponse.getChunksCount(); i++) { try { CellChunk chunk = readRowsResponse.getChunks(i); state.validateChunk(rowInProgress, lastCompletedRowKey, chunk); // depends on control dependency: [try], data = [none] if (chunk.getResetRow()) { rowInProgress = null; // depends on control dependency: [if], data = [none] state = RowMergerState.NewRow; // depends on control dependency: [if], data = [none] continue; } if(state == RowMergerState.NewRow) { rowInProgress = new RowInProgress(); // depends on control dependency: [if], data = [none] rowInProgress.updateCurrentKey(chunk); // depends on control dependency: [if], data = [none] } else if (state == RowMergerState.RowInProgress) { rowInProgress.updateCurrentKey(chunk); // depends on control dependency: [if], data = [none] } if (chunk.getValueSize() > 0) { rowInProgress.addPartialCellChunk(chunk); // depends on control dependency: [if], data = [none] state = RowMergerState.CellInProgress; // depends on control dependency: [if], data = [none] } else if (rowInProgress.hasChunkInProgess()) { rowInProgress.addPartialCellChunk(chunk); // depends on control dependency: [if], data = [none] rowInProgress.completeMultiChunkCell(); // depends on control dependency: [if], data = [none] state = RowMergerState.RowInProgress; // depends on control dependency: [if], data = [none] } else { rowInProgress.addFullChunk(chunk); // depends on control dependency: [if], data = [none] state = RowMergerState.RowInProgress; // depends on control dependency: [if], data = [none] } if (chunk.getCommitRow()) { observer.onNext(rowInProgress.buildRow()); // depends on control dependency: [if], data = [none] lastCompletedRowKey = rowInProgress.getRowKey(); // depends on control dependency: [if], data = [none] state = RowMergerState.NewRow; // depends on control dependency: [if], data = [none] rowInProgress = null; // depends on control dependency: [if], data = [none] rowsProcessed++; // depends on control dependency: [if], data = [none] } } catch (Throwable e) { onError(e); return; } // depends on control dependency: [catch], data = [none] } this.rowCountInLastMessage = rowsProcessed; } }
public class class_name { @Override public void visitMethod(Method obj) { Code c = obj.getCode(); if (c != null) { byte[] opcodes = c.getCode(); if (opcodes != null) { trPCPos = opcodes.length - 1; if (!obj.getSignature().endsWith(Values.SIG_VOID)) { trPCPos -= 1; } trPCPos -= TAILRECURSIONFUDGE; possibleTailRecursion = true; isStatic = obj.isStatic(); stack.resetForMethodEntry(this); super.visitMethod(obj); } } } }
public class class_name { @Override public void visitMethod(Method obj) { Code c = obj.getCode(); if (c != null) { byte[] opcodes = c.getCode(); if (opcodes != null) { trPCPos = opcodes.length - 1; // depends on control dependency: [if], data = [none] if (!obj.getSignature().endsWith(Values.SIG_VOID)) { trPCPos -= 1; // depends on control dependency: [if], data = [none] } trPCPos -= TAILRECURSIONFUDGE; // depends on control dependency: [if], data = [none] possibleTailRecursion = true; // depends on control dependency: [if], data = [none] isStatic = obj.isStatic(); // depends on control dependency: [if], data = [none] stack.resetForMethodEntry(this); // depends on control dependency: [if], data = [none] super.visitMethod(obj); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void addCharts(PageParameters parameters){ List<Chart> charts = getChartFromParams(parameters); //If we have more than one chart - use SmallComponents if(charts.size() > 1){ List<SmallChartComponent> components = new ArrayList<>(); for(Chart i : charts){ components.add(new SmallChartComponent(i)); } add( new ListView<SmallChartComponent>( "components", components ){ protected void populateItem(ListItem item) { item.add( (SmallChartComponent)item.getModelObject() ); } }); }else { //else use the regular full-width chart component List<ChartComponent> components = new ArrayList<>(); for (Chart i : charts) { components.add(new ChartComponent(i)); } add( new ListView<ChartComponent>( "components", components ){ protected void populateItem(ListItem item) { item.add( (ChartComponent)item.getModelObject() ); } }); } //Add Code Components List<CodeComponent> code_components = new ArrayList<>(); for(Chart i : charts){ code_components.add(new CodeComponent(i)); } add( new ListView<CodeComponent>( "code_components", code_components ){ protected void populateItem(ListItem item){ item.add( (CodeComponent)item.getModelObject() ); } }); } }
public class class_name { private void addCharts(PageParameters parameters){ List<Chart> charts = getChartFromParams(parameters); //If we have more than one chart - use SmallComponents if(charts.size() > 1){ List<SmallChartComponent> components = new ArrayList<>(); for(Chart i : charts){ components.add(new SmallChartComponent(i)); // depends on control dependency: [for], data = [i] } add( new ListView<SmallChartComponent>( "components", components ){ protected void populateItem(ListItem item) { item.add( (SmallChartComponent)item.getModelObject() ); } }); // depends on control dependency: [if], data = [none] }else { //else use the regular full-width chart component List<ChartComponent> components = new ArrayList<>(); for (Chart i : charts) { components.add(new ChartComponent(i)); // depends on control dependency: [for], data = [i] } add( new ListView<ChartComponent>( "components", components ){ protected void populateItem(ListItem item) { item.add( (ChartComponent)item.getModelObject() ); } }); // depends on control dependency: [if], data = [none] } //Add Code Components List<CodeComponent> code_components = new ArrayList<>(); for(Chart i : charts){ code_components.add(new CodeComponent(i)); // depends on control dependency: [for], data = [i] } add( new ListView<CodeComponent>( "code_components", code_components ){ protected void populateItem(ListItem item){ item.add( (CodeComponent)item.getModelObject() ); } }); } }
public class class_name { @Override public CPOptionValue remove(Serializable primaryKey) throws NoSuchCPOptionValueException { Session session = null; try { session = openSession(); CPOptionValue cpOptionValue = (CPOptionValue)session.get(CPOptionValueImpl.class, primaryKey); if (cpOptionValue == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchCPOptionValueException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(cpOptionValue); } catch (NoSuchCPOptionValueException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { @Override public CPOptionValue remove(Serializable primaryKey) throws NoSuchCPOptionValueException { Session session = null; try { session = openSession(); CPOptionValue cpOptionValue = (CPOptionValue)session.get(CPOptionValueImpl.class, primaryKey); if (cpOptionValue == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none] } throw new NoSuchCPOptionValueException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(cpOptionValue); } catch (NoSuchCPOptionValueException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { @Override public INDArray get(INDArrayIndex... indexes) { sort(); if (indexes.length == 1 && indexes[0] instanceof NDArrayIndexAll || (indexes.length == 2 && (isRowVector() && indexes[0] instanceof PointIndex && indexes[0].offset() == 0 && indexes[1] instanceof NDArrayIndexAll || isColumnVector() && indexes[1] instanceof PointIndex && indexes[0].offset() == 0 && indexes[0] instanceof NDArrayIndexAll))) return this; indexes = NDArrayIndex.resolve(shapeInfoDataBuffer(), indexes); ShapeOffsetResolution resolution = new ShapeOffsetResolution(this); resolution.exec(indexes); if (indexes.length < 1) throw new IllegalStateException("Invalid index found of zero length"); // FIXME: LONG int[] shape = LongUtils.toInts(resolution.getShapes()); int numSpecifiedIndex = 0; for (int i = 0; i < indexes.length; i++) if (indexes[i] instanceof SpecifiedIndex) numSpecifiedIndex++; if (shape != null && numSpecifiedIndex > 0) { Generator<List<List<Long>>> gen = SpecifiedIndex.iterateOverSparse(indexes); INDArray ret = Nd4j.createSparseCOO(new double[] {}, new int[][] {}, shape); int count = 0; int maxValue = ArrayUtil.prod(shape()); while (count < maxValue) { try { List<List<Long>> next = gen.next(); List<Integer> coordsCombo = new ArrayList<>(); List<Integer> cooIdx = new ArrayList<>(); for (int i = 0; i < next.size(); i++) { if (next.get(i).size() != 2) throw new IllegalStateException("Illegal entry returned"); coordsCombo.add(next.get(i).get(0).intValue()); cooIdx.add(next.get(i).get(1).intValue()); } count++; /* * if the coordinates are in the original array * -> add it in the new sparse ndarray * else * -> do nothing * */ int[] idx = Ints.toArray(coordsCombo); if (!isZero(idx)) { double val = getDouble(idx); ret.putScalar(filterOutFixedDimensions(resolution.getFixed(), cooIdx), val); } } catch (NoSuchElementException e) { break; } } return ret; } int numNewAxis = 0; for (int i = 0; i < indexes.length; i++) if (indexes[i] instanceof NewAxis) numNewAxis++; if (numNewAxis != 0) { } INDArray ret = subArray(resolution); return ret; } }
public class class_name { @Override public INDArray get(INDArrayIndex... indexes) { sort(); if (indexes.length == 1 && indexes[0] instanceof NDArrayIndexAll || (indexes.length == 2 && (isRowVector() && indexes[0] instanceof PointIndex && indexes[0].offset() == 0 && indexes[1] instanceof NDArrayIndexAll || isColumnVector() && indexes[1] instanceof PointIndex && indexes[0].offset() == 0 && indexes[0] instanceof NDArrayIndexAll))) return this; indexes = NDArrayIndex.resolve(shapeInfoDataBuffer(), indexes); ShapeOffsetResolution resolution = new ShapeOffsetResolution(this); resolution.exec(indexes); if (indexes.length < 1) throw new IllegalStateException("Invalid index found of zero length"); // FIXME: LONG int[] shape = LongUtils.toInts(resolution.getShapes()); int numSpecifiedIndex = 0; for (int i = 0; i < indexes.length; i++) if (indexes[i] instanceof SpecifiedIndex) numSpecifiedIndex++; if (shape != null && numSpecifiedIndex > 0) { Generator<List<List<Long>>> gen = SpecifiedIndex.iterateOverSparse(indexes); INDArray ret = Nd4j.createSparseCOO(new double[] {}, new int[][] {}, shape); int count = 0; int maxValue = ArrayUtil.prod(shape()); while (count < maxValue) { try { List<List<Long>> next = gen.next(); List<Integer> coordsCombo = new ArrayList<>(); List<Integer> cooIdx = new ArrayList<>(); for (int i = 0; i < next.size(); i++) { if (next.get(i).size() != 2) throw new IllegalStateException("Illegal entry returned"); coordsCombo.add(next.get(i).get(0).intValue()); // depends on control dependency: [for], data = [i] cooIdx.add(next.get(i).get(1).intValue()); // depends on control dependency: [for], data = [i] } count++; // depends on control dependency: [try], data = [none] /* * if the coordinates are in the original array * -> add it in the new sparse ndarray * else * -> do nothing * */ int[] idx = Ints.toArray(coordsCombo); if (!isZero(idx)) { double val = getDouble(idx); ret.putScalar(filterOutFixedDimensions(resolution.getFixed(), cooIdx), val); // depends on control dependency: [if], data = [none] } } catch (NoSuchElementException e) { break; } // depends on control dependency: [catch], data = [none] } return ret; // depends on control dependency: [if], data = [none] } int numNewAxis = 0; for (int i = 0; i < indexes.length; i++) if (indexes[i] instanceof NewAxis) numNewAxis++; if (numNewAxis != 0) { } INDArray ret = subArray(resolution); return ret; } }
public class class_name { public boolean addTag(String tagName, String tagValue) { boolean result = false; if (firstIFD != null) { if (firstIFD.containsTagId(TiffTags.getTagId(tagName))) { firstIFD.removeTag(tagName); } firstIFD.addTag(tagName, tagValue); createMetadataDictionary(); } return result; } }
public class class_name { public boolean addTag(String tagName, String tagValue) { boolean result = false; if (firstIFD != null) { if (firstIFD.containsTagId(TiffTags.getTagId(tagName))) { firstIFD.removeTag(tagName); // depends on control dependency: [if], data = [none] } firstIFD.addTag(tagName, tagValue); // depends on control dependency: [if], data = [none] createMetadataDictionary(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public Evaluation getEvaluation(int relativeIndex) { Evaluation result = null; if (relativeIndex <= 0) { result = _currentEvaluation; while((++relativeIndex < 0) && (result != null)) { result = result.getParent(); } } return result; } }
public class class_name { public Evaluation getEvaluation(int relativeIndex) { Evaluation result = null; if (relativeIndex <= 0) { result = _currentEvaluation; // depends on control dependency: [if], data = [none] while((++relativeIndex < 0) && (result != null)) { result = result.getParent(); // depends on control dependency: [while], data = [none] } } return result; } }
public class class_name { public Label newLabel(Label oldLabel) { if (oldLabel instanceof HasTag) { return new WordTag(oldLabel.value(), ((HasTag) oldLabel).tag()); } else { return new WordTag(oldLabel.value()); } } }
public class class_name { public Label newLabel(Label oldLabel) { if (oldLabel instanceof HasTag) { return new WordTag(oldLabel.value(), ((HasTag) oldLabel).tag()); // depends on control dependency: [if], data = [none] } else { return new WordTag(oldLabel.value()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Observable<ServiceResponse<ImageAnalysis>> analyzeImageWithServiceResponseAsync(String url, List<VisualFeatureTypes> visualFeatures, List<Details> details, String language) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } Validator.validate(visualFeatures); Validator.validate(details); ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String visualFeaturesConverted = this.client.serializerAdapter().serializeList(visualFeatures, CollectionFormat.CSV); String detailsConverted = this.client.serializerAdapter().serializeList(details, CollectionFormat.CSV); return service.analyzeImage(visualFeaturesConverted, detailsConverted, language, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ImageAnalysis>>>() { @Override public Observable<ServiceResponse<ImageAnalysis>> call(Response<ResponseBody> response) { try { ServiceResponse<ImageAnalysis> clientResponse = analyzeImageDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<ImageAnalysis>> analyzeImageWithServiceResponseAsync(String url, List<VisualFeatureTypes> visualFeatures, List<Details> details, String language) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } Validator.validate(visualFeatures); Validator.validate(details); ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String visualFeaturesConverted = this.client.serializerAdapter().serializeList(visualFeatures, CollectionFormat.CSV); String detailsConverted = this.client.serializerAdapter().serializeList(details, CollectionFormat.CSV); return service.analyzeImage(visualFeaturesConverted, detailsConverted, language, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ImageAnalysis>>>() { @Override public Observable<ServiceResponse<ImageAnalysis>> call(Response<ResponseBody> response) { try { ServiceResponse<ImageAnalysis> clientResponse = analyzeImageDelegate(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 JsonParserIterator<TaskStatusPlus> getTasks( DruidLeaderClient indexingServiceClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler ) { Request request; try { request = indexingServiceClient.makeRequest( HttpMethod.GET, StringUtils.format("/druid/indexer/v1/tasks"), false ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = indexingServiceClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<TaskStatusPlus>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, responseHandler ); } }
public class class_name { private static JsonParserIterator<TaskStatusPlus> getTasks( DruidLeaderClient indexingServiceClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler ) { Request request; try { request = indexingServiceClient.makeRequest( HttpMethod.GET, StringUtils.format("/druid/indexer/v1/tasks"), false ); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] ListenableFuture<InputStream> future = indexingServiceClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<TaskStatusPlus>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, responseHandler ); } }
public class class_name { private static float[] normalize(float[] in) { float[] out = new float[in.length]; for (int i = 0; i < in.length; i++) { out[i] = (in[i] / 255.0f); } return out; } }
public class class_name { private static float[] normalize(float[] in) { float[] out = new float[in.length]; for (int i = 0; i < in.length; i++) { out[i] = (in[i] / 255.0f); // depends on control dependency: [for], data = [i] } return out; } }
public class class_name { public static boolean unpackEntry(File zip, String name, File file, Charset charset) { ZipFile zf = null; try { if (charset != null) { zf = new ZipFile(zip, charset); } else { zf = new ZipFile(zip); } return doUnpackEntry(zf, name, file); } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } finally { closeQuietly(zf); } } }
public class class_name { public static boolean unpackEntry(File zip, String name, File file, Charset charset) { ZipFile zf = null; try { if (charset != null) { zf = new ZipFile(zip, charset); // depends on control dependency: [if], data = [none] } else { zf = new ZipFile(zip); // depends on control dependency: [if], data = [none] } return doUnpackEntry(zf, name, file); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } // depends on control dependency: [catch], data = [none] finally { closeQuietly(zf); } } }
public class class_name { void clusterHeartbeat(String clusterId, UpdateServerHeartbeat updateSelf, UpdateRackHeartbeat updateRack, UpdatePodSystem updatePod, long sequence) { if (startUpdate(updateRack, updatePod)) { getHeartbeat().clusterHeartbeat(clusterId, updateSelf, updateRack, updatePod, sequence); } } }
public class class_name { void clusterHeartbeat(String clusterId, UpdateServerHeartbeat updateSelf, UpdateRackHeartbeat updateRack, UpdatePodSystem updatePod, long sequence) { if (startUpdate(updateRack, updatePod)) { getHeartbeat().clusterHeartbeat(clusterId, updateSelf, updateRack, updatePod, sequence); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static String replaceIntegerStringByBooleanRepresentation(final String value) { if (value.equals("0")) { return FALSE.toString(); } else if (value.equals("1")) { return TRUE.toString(); } return value; } }
public class class_name { private static String replaceIntegerStringByBooleanRepresentation(final String value) { if (value.equals("0")) { return FALSE.toString(); // depends on control dependency: [if], data = [none] } else if (value.equals("1")) { return TRUE.toString(); // depends on control dependency: [if], data = [none] } return value; } }
public class class_name { public long calculateDuration() { if (!nodes.isEmpty()) { long endTime = 0; for (int i = 0; i < getNodes().size(); i++) { Node node = getNodes().get(i); long nodeEndTime = node.overallEndTime(); if (nodeEndTime > endTime) { endTime = nodeEndTime; } } return endTime - getNodes().get(0).getTimestamp(); } return 0L; } }
public class class_name { public long calculateDuration() { if (!nodes.isEmpty()) { long endTime = 0; for (int i = 0; i < getNodes().size(); i++) { Node node = getNodes().get(i); long nodeEndTime = node.overallEndTime(); if (nodeEndTime > endTime) { endTime = nodeEndTime; // depends on control dependency: [if], data = [none] } } return endTime - getNodes().get(0).getTimestamp(); // depends on control dependency: [if], data = [none] } return 0L; } }