code
stringlengths
73
34.1k
label
stringclasses
1 value
public String getAuthorizationUri(final String redirectUri, final Set<String> scopes, final String state) { if (account == null) throw new IllegalArgumentException("Auth is not set"); if (account.getClientId() == null) throw new IllegalArgumentException("client_id is not set"); ...
java
public void finishFlow(final String code, final String state) throws ApiException { if (account == null) throw new IllegalArgumentException("Auth is not set"); if (codeVerifier == null) throw new IllegalArgumentException("code_verifier is not set"); if (account.getClientI...
java
public ApiResponse<String> getPingWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getPingValidateBeforeCall(null); Type localVarReturnType = new TypeToken<String>() { }.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiClient setHttpClient(OkHttpClient newHttpClient) { if (!httpClient.equals(newHttpClient)) { newHttpClient.networkInterceptors().addAll(httpClient.networkInterceptors()); httpClient.networkInterceptors().clear(); newHttpClient.interceptors().addAll(httpClient.interce...
java
private void addProgressInterceptor() { httpClient.networkInterceptors().add(new Interceptor() { @Override public Response intercept(Interceptor.Chain chain) throws IOException { final Request request = chain.request(); final Response originalResponse = ch...
java
public com.squareup.okhttp.Call postUiAutopilotWaypointCall(Boolean addToBeginning, Boolean clearOtherWaypoints, Long destinationId, String datasource, String token, final ApiCallback callback) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables ...
java
public void setColorSchemeResources(int... colorResIds) { final Resources res = getResources(); int[] colorRes = new int[colorResIds.length]; for (int i = 0; i < colorResIds.length; i++) { colorRes[i] = res.getColor(colorResIds[i]); } setColorSchemeColors(colorRes); ...
java
public void setBackgroundColor(int colorRes) { if (getBackground() instanceof ShapeDrawable) { final Resources res = getResources(); ((ShapeDrawable) getBackground()).getPaint().setColor(res.getColor(colorRes)); } }
java
private void logBinaryStringInfo(StringBuilder binaryString) { encodeInfo += "Binary Length: " + binaryString.length() + "\n"; encodeInfo += "Binary String: "; int nibble = 0; for (int i = 0; i < binaryString.length(); i++) { switch (i % 4) { case 0: ...
java
private int combineSubsetBlocks(Mode[] mode_type, int[] mode_length, int index_point) { /* bring together same type blocks */ if (index_point > 1) { for (int i = 1; i < index_point; i++) { if (mode_type[i - 1] == mode_type[i]) { /* bring together */ ...
java
public static void main(String[] args) { Settings settings = new Settings(); new JCommander(settings, args); if (!settings.isGuiSupressed()) { OkapiUI okapiUi = new OkapiUI(); okapiUi.setVisible(true); } else { int returnValue; ...
java
private int[] getPrimaryCodewords() { assert mode == 2 || mode == 3; if (primaryData.length() != 15) { throw new OkapiException("Invalid Primary String"); } for (int i = 9; i < 15; i++) { /* check that country code and service are numeric */ if (primar...
java
private static int[] getMode2PrimaryCodewords(String postcode, int country, int service) { for (int i = 0; i < postcode.length(); i++) { if (postcode.charAt(i) < '0' || postcode.charAt(i) > '9') { postcode = postcode.substring(0, i); break; } ...
java
private static int[] getMode3PrimaryCodewords(String postcode, int country, int service) { int[] postcodeNums = new int[postcode.length()]; postcode = postcode.toUpperCase(); for (int i = 0; i < postcodeNums.length; i++) { postcodeNums[i] = postcode.charAt(i); if...
java
private int bestSurroundingSet(int index, int length, int... valid) { int option1 = set[index - 1]; if (index + 1 < length) { // we have two options to check int option2 = set[index + 1]; if (contains(valid, option1) && contains(valid, option2)) { ...
java
private void insert(int position, int c) { for (int i = 143; i > position; i--) { set[i] = set[i - 1]; character[i] = character[i - 1]; } character[position] = c; }
java
private static int[] getErrorCorrection(int[] codewords, int ecclen) { ReedSolomon rs = new ReedSolomon(); rs.init_gf(0x43); rs.init_code(ecclen, 1); rs.encode(codewords.length, codewords); int[] results = new int[ecclen]; for (int i = 0; i < ecclen; i++) { ...
java
public void setStructuredAppendMessageId(String messageId) { if (messageId != null && !messageId.matches("^[\\x21-\\x7F]+$")) { throw new IllegalArgumentException("Invalid Aztec Code structured append message ID: " + messageId); } this.structuredAppendMessageId = messageId; ...
java
private void addErrorCorrection(StringBuilder adjustedString, int codewordSize, int dataBlocks, int eccBlocks) { int x, poly, startWeight; /* Split into codewords and calculate Reed-Solomon error correction codes */ switch (codewordSize) { case 6: x = 32; ...
java
public ExtendedOutputStreamWriter append(double d) throws IOException { super.append(String.format(Locale.ROOT, doubleFormat, d)); return this; }
java
public static int positionOf(char value, char[] array) { for (int i = 0; i < array.length; i++) { if (value == array[i]) { return i; } } throw new OkapiException("Unable to find character '" + value + "' in character array."); }
java
public static int[] insertArray(int[] original, int index, int[] inserted) { int[] modified = new int[original.length + inserted.length]; System.arraycopy(original, 0, modified, 0, index); System.arraycopy(inserted, 0, modified, index, inserted.length); System.arraycopy(original, index, ...
java
private static int getBinaryLength(int version, QrMode[] inputModeUnoptimized, int[] inputData, boolean gs1, int eciMode) { int i, j; QrMode currentMode; int inputLength = inputModeUnoptimized.length; int count = 0; int alphaLength; int percent = 0; // ZINT NOTE...
java
private static int blockLength(int start, QrMode[] inputMode) { QrMode mode = inputMode[start]; int count = 0; int i = start; do { count++; } while (((i + count) < inputMode.length) && (inputMode[i + count] == mode)); return count; }
java
private static int tribus(int version, int a, int b, int c) { if (version < 10) { return a; } else if (version >= 10 && version <= 26) { return b; } else { return c; } }
java
private static void addEcc(int[] fullstream, int[] datastream, int version, int data_cw, int blocks) { int ecc_cw = QR_TOTAL_CODEWORDS[version - 1] - data_cw; int short_data_block_length = data_cw / blocks; int qty_long_blocks = data_cw % blocks; int qty_short_blocks = blocks - qty_long...
java
private static void addFormatInfoEval(byte[] eval, int size, EccLevel ecc_level, int pattern) { int format = pattern; int seq; int i; switch(ecc_level) { case L: format += 0x08; break; case Q: format += 0x18; break; case H: format += 0x10; break; ...
java
private static void addVersionInfo(byte[] grid, int size, int version) { // TODO: Zint masks with 0x41 instead of 0x01; which is correct? https://sourceforge.net/p/zint/tickets/110/ long version_data = QR_ANNEX_D[version - 7]; for (int i = 0; i < 6; i++) { grid[((size - 11) * size) +...
java
private static List< Block > createBlocks(int[] data, boolean debug) { List< Block > blocks = new ArrayList<>(); Block current = null; for (int i = 0; i < data.length; i++) { EncodingMode mode = chooseMode(data[i]); if ((current != null && current.mode == mode) &...
java
private static void mergeBlocks(List< Block > blocks) { for (int i = 1; i < blocks.size(); i++) { Block b1 = blocks.get(i - 1); Block b2 = blocks.get(i); if ((b1.mode == b2.mode) && (b1.mode != EncodingMode.NUM || b1.length + b2.length <= MAX_NUMERIC_COMP...
java
protected void eciProcess() { EciMode eci = EciMode.of(content, "ISO8859_1", 3) .or(content, "ISO8859_2", 4) .or(content, "ISO8859_3", 5) .or(content, "ISO8859_4", 6) .or(content, "IS...
java
protected void mergeVerticalBlocks() { for(int i = 0; i < rectangles.size() - 1; i++) { for(int j = i + 1; j < rectangles.size(); j++) { Rectangle2D.Double firstRect = rectangles.get(i); Rectangle2D.Double secondRect = rectangles.get(j); if (roughlyEqu...
java
private String hibcProcess(String source) { // HIBC 2.6 allows up to 110 characters, not including the "+" prefix or the check digit if (source.length() > 110) { throw new OkapiException("Data too long for HIBC LIC"); } source = source.toUpperCase(); if (!source.mat...
java
protected int[] getPatternAsCodewords(int size) { if (size >= 10) { throw new IllegalArgumentException("Pattern groups of 10 or more digits are likely to be too large to parse as integers."); } if (pattern == null || pattern.length == 0) { return new int[0]; } els...
java
private static double arcAngle(Point center, Point a, Point b, Rect area, int radius) { double angle = threePointsAngle(center, a, b); Point innerPoint = findMidnormalPoint(center, a, b, area, radius); Point midInsectPoint = new Point((a.x + b.x) / 2, (a.y + b.y) / 2); double distance = ...
java
private static Point findMidnormalPoint(Point center, Point a, Point b, Rect area, int radius) { if (a.y == b.y) { //top if (a.y < center.y) { return new Point((a.x + b.x) / 2, center.y + radius); } //bottom return new Point((a.x + b.x)...
java
public static boolean inArea(Point point, Rect area, float offsetRatio) { int offset = (int) (area.width() * offsetRatio); return point.x >= area.left - offset && point.x <= area.right + offset && point.y >= area.top - offset && point.y <= area.bottom + offset; }
java
private static double threePointsAngle(Point vertex, Point A, Point B) { double b = pointsDistance(vertex, A); double c = pointsDistance(A, B); double a = pointsDistance(B, vertex); return Math.toDegrees(Math.acos((a * a + b * b - c * c) / (2 * a * b))); }
java
private static double pointsDistance(Point a, Point b) { int dx = b.x - a.x; int dy = b.y - a.y; return Math.sqrt(dx * dx + dy * dy); }
java
private void calculateMenuItemPosition() { float itemRadius = (expandedRadius + collapsedRadius) / 2, f; RectF area = new RectF( center.x - itemRadius, center.y - itemRadius, center.x + itemRadius, center.y + itemRadius); Path path...
java
private boolean isClockwise(Point center, Point a, Point b) { double cross = (a.x - center.x) * (b.y - center.y) - (b.x - center.x) * (a.y - center.y); return cross > 0; }
java
public void inputValues(boolean... values) { for (boolean value : values) { InputValue inputValue = new InputValue(); inputValue.setChecked(value); this.inputValues.add(inputValue); } }
java
public void clearTmpData() { for (Enumeration<?> e = breadthFirstEnumeration(); e.hasMoreElements(); ) { ((LblTree) e.nextElement()).setTmpData(null); } }
java
public static String getXPathExpression(Node node) { Object xpathCache = node.getUserData(FULL_XPATH_CACHE); if (xpathCache != null) { return xpathCache.toString(); } Node parent = node.getParentNode(); if ((parent == null) || parent.getNodeName().contains("#document")) { String xPath = "/" + node.getN...
java
public static List<Node> getSiblings(Node parent, Node element) { List<Node> result = new ArrayList<>(); NodeList list = parent.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node el = list.item(i); if (el.getNodeName().equals(element.getNodeName())) { result.add(el); } } return...
java
public static NodeList evaluateXpathExpression(String domStr, String xpathExpr) throws XPathExpressionException, IOException { Document dom = DomUtils.asDocument(domStr); return evaluateXpathExpression(dom, xpathExpr); }
java
public static NodeList evaluateXpathExpression(Document dom, String xpathExpr) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile(xpathExpr); Object result = expr.evaluate(dom, XPathConstants.NODESET); ...
java
public static int getXPathLocation(String dom, String xpath) { String dom_lower = dom.toLowerCase(); String xpath_lower = xpath.toLowerCase(); String[] elements = xpath_lower.split("/"); int pos = 0; int temp; int number; for (String element : elements) { if (!element.isEmpty() && !element.startsWith("...
java
double getThreshold(String x, String y, double p) { return 2 * Math.max(x.length(), y.length()) * (1 - p); }
java
@Override public boolean check(EmbeddedBrowser browser) { String js = "try{ if(" + expression + "){return '1';}else{" + "return '0';}}catch(e){" + " return '0';}"; try { Object object = browser.executeJavaScript(js); if (object == null) { return false; } return object.toString()...
java
public static void objectToXML(Object object, String fileName) throws FileNotFoundException { FileOutputStream fo = new FileOutputStream(fileName); XMLEncoder encoder = new XMLEncoder(fo); encoder.writeObject(object); encoder.close(); }
java
public static Object xmlToObject(String fileName) throws FileNotFoundException { FileInputStream fi = new FileInputStream(fileName); XMLDecoder decoder = new XMLDecoder(fi); Object object = decoder.readObject(); decoder.close(); return object; }
java
public By getWebDriverBy() { switch (how) { case name: return By.name(this.value); case xpath: // Work around HLWK driver bug return By.xpath(this.value.replaceAll("/BODY\\[1\\]/", "/BODY/")); case id: return By.id(this.value); case tag: return By.tagName(this.value); case text...
java
protected String escapeApostrophes(String text) { String resultString; if (text.contains("'")) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("concat('"); stringBuilder.append(text.replace("'", "',\"'\",'")); stringBuilder.append("')"); resultString = stringBuilder.t...
java
@Override public CrawlSession call() { setMaximumCrawlTimeIfNeeded(); plugins.runPreCrawlingPlugins(config); CrawlTaskConsumer firstConsumer = consumerFactory.get(); StateVertex firstState = firstConsumer.crawlIndex(); crawlSessionProvider.setup(firstState); plugins.runOnNewStatePlugins(firstConsumer.getCo...
java
public ImmutableList<CandidateElement> extract(StateVertex currentState) throws CrawljaxException { LinkedList<CandidateElement> results = new LinkedList<>(); if (!checkedElements.checkCrawlCondition(browser)) { LOG.info("State {} did not satisfy the CrawlConditions.", currentState.getName()); return Immu...
java
private ImmutableList<Element> getNodeListForTagElement(Document dom, CrawlElement crawlElement, EventableConditionChecker eventableConditionChecker) { Builder<Element> result = ImmutableList.builder(); if (crawlElement.getTagName() == null) { return result.build(); } EventableCondition eventableCon...
java
public void runOnInvariantViolationPlugins(Invariant invariant, CrawlerContext context) { LOGGER.debug("Running OnInvariantViolationPlugins..."); counters.get(OnInvariantViolationPlugin.class).inc(); for (Plugin plugin : plugins.get(OnInvariantViolationPlugin.class)) { if (plugin instanceof OnInvariantViola...
java
public void runOnBrowserCreatedPlugins(EmbeddedBrowser newBrowser) { LOGGER.debug("Running OnBrowserCreatedPlugins..."); counters.get(OnBrowserCreatedPlugin.class).inc(); for (Plugin plugin : plugins.get(OnBrowserCreatedPlugin.class)) { if (plugin instanceof OnBrowserCreatedPlugin) { LOGGER.debug("Calling ...
java
public boolean equalId(Element otherElement) { if (getElementId() == null || otherElement.getElementId() == null) { return false; } return getElementId().equalsIgnoreCase(otherElement.getElementId()); }
java
public String getElementId() { for (Entry<String, String> attribute : attributes.entrySet()) { if (attribute.getKey().equalsIgnoreCase("id")) { return attribute.getValue(); } } return null; }
java
public boolean checkXpathStartsWithXpathEventableCondition(Document dom, EventableCondition eventableCondition, String xpath) throws XPathExpressionException { if (eventableCondition == null || Strings .isNullOrEmpty(eventableCondition.getInXPath())) { throw new CrawljaxException("Eventable has no XPath con...
java
public static double getRobustTreeEditDistance(String dom1, String dom2) { LblTree domTree1 = null, domTree2 = null; try { domTree1 = getDomTree(dom1); domTree2 = getDomTree(dom2); } catch (IOException e) { e.printStackTrace(); } double DD = 0.0; RTED_InfoTree_Opt rted; double ted; rted = ne...
java
private static LblTree createTree(TreeWalker walker) { Node parent = walker.getCurrentNode(); LblTree node = new LblTree(parent.getNodeName(), -1); // treeID = -1 for (Node n = walker.firstChild(); n != null; n = walker.nextSibling()) { node.add(createTree(walker)); } walker.setCurrentNode(parent); retur...
java
public ExcludeByParentBuilder dontClickChildrenOf(String tagName) { checkNotRead(); Preconditions.checkNotNull(tagName); ExcludeByParentBuilder exclude = new ExcludeByParentBuilder( tagName.toUpperCase()); crawlParentsExcluded.add(exclude); return exclude; }
java
public FormInput inputField(InputType type, Identification identification) { FormInput input = new FormInput(type, identification); this.formInputs.add(input); return input; }
java
private Options getOptions() { Options options = new Options(); options.addOption("h", HELP, false, "print this message"); options.addOption(VERSION, false, "print the version information and exit"); options.addOption("b", BROWSER, true, "browser type: " + availableBrowsers() + ". Default is Firefox"...
java
public static void directoryCheck(String dir) throws IOException { final File file = new File(dir); if (!file.exists()) { FileUtils.forceMkdir(file); } }
java
public static void checkFolderForFile(String fileName) throws IOException { if (fileName.lastIndexOf(File.separator) > 0) { String folder = fileName.substring(0, fileName.lastIndexOf(File.separator)); directoryCheck(folder); } }
java
@GuardedBy("elementsLock") @Override public boolean markChecked(CandidateElement element) { String generalString = element.getGeneralString(); String uniqueString = element.getUniqueString(); synchronized (elementsLock) { if (elements.contains(uniqueString)) { return false; } else { elements.add(g...
java
private void readFormDataFromFile() { List<FormInput> formInputList = FormInputValueHelper.deserializeFormInputs(config.getSiteDir()); if (formInputList != null) { InputSpecification inputSpecs = config.getCrawlRules().getInputSpecification(); for (FormInput input : formInputList) { inputSpecs.input...
java
@Override public CrawlSession call() { Injector injector = Guice.createInjector(new CoreModule(config)); controller = injector.getInstance(CrawlController.class); CrawlSession session = controller.call(); reason = controller.getReason(); return session; }
java
public static Integer distance(String h1, String h2) { HammingDistance distance = new HammingDistance(); return distance.apply(h1, h2); }
java
public static synchronized FormInputValueHelper getInstance( InputSpecification inputSpecification, FormFillMode formFillMode) { if (instance == null) instance = new FormInputValueHelper(inputSpecification, formFillMode); return instance; }
java
private FormInput formInputMatchingNode(Node element) { NamedNodeMap attributes = element.getAttributes(); Identification id; if (attributes.getNamedItem("id") != null && formFillMode != FormFillMode.XPATH_TRAINING) { id = new Identification(Identification.How.id, attributes.getNamedItem("id").getNod...
java
public void reset() { CrawlSession session = context.getSession(); if (crawlpath != null) { session.addCrawlPath(crawlpath); } List<StateVertex> onURLSetTemp = new ArrayList<>(); if (stateMachine != null) onURLSetTemp = stateMachine.getOnURLSet(); stateMachine = new StateMachine(graphProvider.get(), c...
java
private boolean fireEvent(Eventable eventable) { Eventable eventToFire = eventable; if (eventable.getIdentification().getHow().toString().equals("xpath") && eventable.getRelatedFrame().equals("")) { eventToFire = resolveByXpath(eventable, eventToFire); } boolean isFired = false; try { isFired = brow...
java
public StateVertex crawlIndex() { LOG.debug("Setting up vertex of the index page"); if (basicAuthUrl != null) { browser.goToUrl(basicAuthUrl); } browser.goToUrl(url); // Run url first load plugin to clear the application state plugins.runOnUrlFirstLoadPlugins(context); plugins.runOnUrlLoadPlugins(c...
java
public double nonNormalizedTreeDist(LblTree t1, LblTree t2) { init(t1, t2); STR = new int[size1][size2]; computeOptimalStrategy(); return computeDistUsingStrArray(it1, it2); }
java
public void init(LblTree t1, LblTree t2) { LabelDictionary ld = new LabelDictionary(); it1 = new InfoTree(t1, ld); it2 = new InfoTree(t2, ld); size1 = it1.getSize(); size2 = it2.getSize(); IJ = new int[Math.max(size1, size2)][Math.max(size1, size2)]; delta = new double[size1][size2]; deltaBit = new byte...
java
public boolean changeState(StateVertex nextState) { if (nextState == null) { LOGGER.info("nextState given is null"); return false; } LOGGER.debug("Trying to change to state: '{}' from: '{}'", nextState.getName(), currentState.getName()); if (stateFlowGraph.canGoTo(currentState, nextState)) { LOGG...
java
private StateVertex addStateToCurrentState(StateVertex newState, Eventable eventable) { LOGGER.debug("addStateToCurrentState currentState: {} newState {}", currentState.getName(), newState.getName()); // Add the state to the stateFlowGraph. Store the result StateVertex cloneState = stateFlowGraph.putIfAbsent...
java
public boolean switchToStateAndCheckIfClone(final Eventable event, StateVertex newState, CrawlerContext context) { StateVertex cloneState = this.addStateToCurrentState(newState, event); runOnInvariantViolationPlugins(context); if (cloneState == null) { changeState(newState); plugins.runOnNewSt...
java
@SuppressWarnings("unchecked") static void logToFile(String filename) { Logger rootLogger = (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); FileAppender<ILoggingEvent> fileappender = new FileAppender<>(); fileappender.setContext(rootLogger.getLoggerContext()); fileappender.setFile(filenam...
java
public static void main(String[] args) { try { JarRunner runner = new JarRunner(args); runner.runIfConfigured(); } catch (NumberFormatException e) { System.err.println("Could not parse number " + e.getMessage()); System.exit(1); } catch (RuntimeException e) { System.err.println(e.getMessage()); ...
java
public static String toPrettyJson(Object o) { try { return MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(o); } catch (JsonProcessingException e) { LoggerFactory .getLogger(Serializer.class) .error("Could not serialize the object. This will be ignored and the error will be wr...
java
private void postTraversalProcessing() { int nc1 = treeSize; info[KR] = new int[leafCount]; info[RKR] = new int[leafCount]; int lc = leafCount; int i = 0; // compute left-most leaf descendants // go along the left-most path, remember each node and assign to it the path's // leaf // compute right-mos...
java
static int[] toIntArray(List<Integer> integers) { int[] ints = new int[integers.size()]; int i = 0; for (Integer n : integers) { ints[i++] = n; } return ints; }
java
@Override public void onNewState(CrawlerContext context, StateVertex vertex) { LOG.debug("onNewState"); StateBuilder state = outModelCache.addStateIfAbsent(vertex); visitedStates.putIfAbsent(state.getName(), vertex); saveScreenshot(context.getBrowser(), state.getName(), vertex); ...
java
@Override public void preStateCrawling(CrawlerContext context, ImmutableList<CandidateElement> candidateElements, StateVertex state) { LOG.debug("preStateCrawling"); List<CandidateElementPosition> newElements = Lists.newLinkedList(); LOG.info("Prestate found ...
java
@Override public void postCrawling(CrawlSession session, ExitStatus exitStatus) { LOG.debug("postCrawling"); StateFlowGraph sfg = session.getStateFlowGraph(); checkSFG(sfg); // TODO: call state abstraction function to get distance matrix and run rscript on it to // create clu...
java
public FormAction setValuesInForm(Form form) { FormAction formAction = new FormAction(); form.setFormAction(formAction); this.forms.add(form); return formAction; }
java
public static Document removeTags(Document dom, String tagName) { NodeList list; try { list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase()); while (list.getLength() > 0) { Node sc = list.item(0); if (s...
java
public static byte[] getDocumentToByteArray(Document dom) { try { TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer ...
java
public static String addFolderSlashIfNeeded(String folderName) { if (!"".equals(folderName) && !folderName.endsWith("/")) { return folderName + "/"; } else { return folderName; } }
java
public static String getTemplateAsString(String fileName) throws IOException { // in .jar file String fNameJar = getFileNameInPath(fileName); InputStream inStream = DomUtils.class.getResourceAsStream("/" + fNameJar); if (inStream == null) { // try to find file...
java
public static void writeDocumentToFile(Document document, String filePathname, String method, int indent) throws TransformerException, IOException { Transformer transformer = TransformerFactory.newInstance() .newTransformer(); trans...
java
public static String getTextContent(Document document, boolean individualTokens) { String textContent = null; if (individualTokens) { List<String> tokens = getTextTokens(document); textContent = StringUtils.join(tokens, ","); } else { textContent = ...
java
public boolean equivalent(Element otherElement, boolean logging) { if (eventable.getElement().equals(otherElement)) { if (logging) { LOGGER.info("Element equal"); } return true; } if (eventable.getElement().equalAttributes(otherElement)) { if (logging) { LOGGER.info("Element attributes equal"...
java
@SuppressWarnings("unchecked") public List<Difference> compare() { Diff diff = new Diff(this.controlDOM, this.testDOM); DetailedDiff detDiff = new DetailedDiff(diff); return detDiff.getAllDifferences(); }
java