id
stringlengths
7
14
text
stringlengths
1
106k
551254_3
@Override public void loadFromStream(InputStream is) throws DataSourceException { Parser parser = new HTMLParse().getParserPublic(); data = new ArrayList<List<String>>(); ParserCallback callback = new DataSourceHtmlParser(); try { parser.parse(new InputStreamReader(is), callback, true); is.close(); } catch (IOException e) { throw new DataSourceException("Error while reading HTML: " + e.getMessage(), e); } if (hadRowOrColSpan) { throw new DataSourceException( "The input table in the HTML file had rowspan or colspan attributes. These are not allowed for a data source!"); } if (data.size() == 0) { throw new DataSourceException("No table data found in HTML file!"); } this.headings = data.remove(0); }
551254_4
@Override public void loadFromStream(InputStream data) throws DataSourceException { OdfDocument ods; try { ods = OdfSpreadsheetDocument.loadDocument(data); } catch (Exception e) { throw new DataSourceException( "Error while reading the ODS data source", e); } table = ods.getTableList().get(sheetIndex); extractFieldNames(); calculateRowCount(); }
551254_5
@ConfigurationOption(defaultValue = "" + DEFAULT_SHEET_INDEX, description = "The number of the sheet in which the test data reside. Counting starts with 1 for the first sheet.") public void setSheet(String index) { checkIfMayAlterConfiguration(); try { int currentSheetIndex = Integer.parseInt(index) - 1; if (currentSheetIndex < 0) { throw new IllegalArgumentException( "Sheet Index must be a positive number but was " + currentSheetIndex); } this.sheetIndex = currentSheetIndex; } catch (Exception e) { throw new IllegalArgumentException( "Sheet Index must be a positive number", e); } }
551254_6
Element buildCoverageMarkerMessage(Element msgElement, IActivity a) { Document msgDoc = msgElement.getOwnerDocument(); List<? extends IDocumentation> documentation = a.getDocumentation(); if (documentation != null && documentation.size() > 0) { IDocumentation firstDoc = documentation.get(0); for (Node n : firstDoc.getDocumentationElements()) { if (isMarkerElement(n)) { Element markerElement = msgDoc.createElementNS( CoverageConstants.MARKER_SERVICE_NAMESPACE, CoverageConstants.COVERAGE_MSG_MARKER_ELEMENT); XMLUtil.appendTextNode(markerElement, XMLUtil.getTextContent(n)); msgElement.appendChild(markerElement); } } } return msgElement; }
551254_7
Element buildCoverageMarkerMessage(Element msgElement, IActivity a) { Document msgDoc = msgElement.getOwnerDocument(); List<? extends IDocumentation> documentation = a.getDocumentation(); if (documentation != null && documentation.size() > 0) { IDocumentation firstDoc = documentation.get(0); for (Node n : firstDoc.getDocumentationElements()) { if (isMarkerElement(n)) { Element markerElement = msgDoc.createElementNS( CoverageConstants.MARKER_SERVICE_NAMESPACE, CoverageConstants.COVERAGE_MSG_MARKER_ELEMENT); XMLUtil.appendTextNode(markerElement, XMLUtil.getTextContent(n)); msgElement.appendChild(markerElement); } } } return msgElement; }
551254_8
IScope createScopeForMarkers(IActivity a) { IActivityContainer parent = a.getParent(); IScope scope = parent.wrapActivityInNewScope(a); scope.setName(CoverageConstants.INSTRUMENTATION_SCOPE_NAME_PREFIX + a.getName()); ISequence sequence = scope.wrapActivityInNewSequence(a); IVariable v = scope.addVariable(); v.setName(CoverageConstants.VARIABLE_MARK_REQUEST); v.setMessageType(CoverageConstants.MARKER_SERVICE_MARK_REQUEST_MESSAGE_TYPE); IAssign assign = sequence.addAssign(); assign.setName(a.getName() + "_Prepare_Mark_Request"); ICopy copy = assign.addCopy(); Element msgElement = copy.getFrom().setNewLiteral( CoverageConstants.MARKER_SERVICE_NAMESPACE, CoverageConstants.COVERAGE_MSG_ELEMENT); buildCoverageMarkerMessage(msgElement, a); copy.getTo().setVariable(v); copy.getTo() .setPart(CoverageConstants.MARKER_SERVICE_MARK_REQUEST_PART); copy.getTo().setExpression("/"); IInvoke invoke = sequence.addInvoke(); invoke.setName(a.getName() + "_Invoke_Marker_Service"); invoke.setInputVariable(v); invoke.setOperation(CoverageConstants.COVERAGE_SERVICE_MARK_OPERATION); invoke.setPartnerLink(CoverageConstants.MARKER_SERVICE_PARTNERLINK); if (startsInstance(a)) { sequence.moveBefore(assign, a); sequence.moveBefore(invoke, a); } return scope; }
551254_9
public List<ICoverageResult> getCoverageResult() { return new ArrayList<ICoverageResult>(results); }
558963_0
public boolean isEmpty() { return varyHeaders.isEmpty(); }
558963_1
public boolean matches(final HTTPRequest request) { if (varyHeaders.containsKey("ALL")) return false; Headers headers = request.getAllHeaders(); for (Map.Entry<String, String> varyEntry : varyHeaders.entrySet()) { if (request.getChallenge().isPresent() && varyEntry.getKey().equals(HeaderConstants.AUTHORIZATION)) { if (!request.getChallenge().get().getIdentifier().equals(varyEntry.getValue())) { return false; } } else { List<Header> requestHeaderValue = headers.getHeaders(varyEntry.getKey()); boolean valid = requestHeaderValue.isEmpty() ? varyEntry.getValue() == null : headers.getFirstHeader(varyEntry.getKey()).get().getValue().equals(varyEntry.getValue()); if (!valid) { return false; } } } List<Preference> preferences = new ArrayList<>(); preferences.addAll(headers.getAccept()); preferences.addAll(headers.getAcceptCharset()); preferences.addAll(headers.getAcceptLanguage()); return !(varyHeaders.isEmpty() && !preferences.isEmpty()); }
558963_2
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Vary vary = (Vary) o; if (varyHeaders != null ? !varyHeaders.equals(vary.varyHeaders) : vary.varyHeaders != null) { return false; } return true; }
558963_3
public synchronized File createFile(Key key, InputStream stream) throws IOException { File file = resolve(key); if (!file.getParentFile().exists()) { ensureDirectoryExists(file.getParentFile()); } try (InputStream is = stream; OutputStream to = Files.newOutputStream(file.toPath())) { IOUtils.copy(is, to); } if (file.length() == 0) { file.delete(); file = null; } if (file != null && !file.exists()) { throw new IOException(String.format("Failed to create File '%s' for Key: %s", file.getName(), key)); } return file; }
558963_4
public synchronized File createFile(Key key, InputStream stream) throws IOException { File file = resolve(key); if (!file.getParentFile().exists()) { ensureDirectoryExists(file.getParentFile()); } try (InputStream is = stream; OutputStream to = Files.newOutputStream(file.toPath())) { IOUtils.copy(is, to); } if (file.length() == 0) { file.delete(); file = null; } if (file != null && !file.exists()) { throw new IOException(String.format("Failed to create File '%s' for Key: %s", file.getName(), key)); } return file; }
558963_5
public synchronized File resolve(Key key) { File uriFolder = resolve(key.getURI()); String vary; if (key.getVary().isEmpty()) { vary = "default"; } else { vary = Digester.md5(key.getVary().toString(), StandardCharsets.UTF_8); } return new File(uriFolder, vary); }
558963_6
public static Key create(URI uri, Vary vary) { return new Key( URIBuilder.fromURI(Objects.requireNonNull(uri, "URI may not be null")).toNormalizedURI(), Objects.requireNonNull(vary, "vary may not be null") ); }
558963_7
public static Key create(URI uri, Vary vary) { return new Key( URIBuilder.fromURI(Objects.requireNonNull(uri, "URI may not be null")).toNormalizedURI(), Objects.requireNonNull(vary, "vary may not be null") ); }
558963_8
public static CacheItem parse(Properties object) { Optional<LocalDateTime> time = HeaderUtils.fromHttpDate(new Header("cache-time", object.getProperty("cache-time"))); Status status = Status.valueOf(NumberUtils.toInt(object.getProperty("status"), 200)); Headers headers = Headers.parse(object.getProperty("headers")); Optional<Payload> p = Optional.empty(); if (object.containsKey("file")) { p = Optional.of(new FilePayload(new File(object.getProperty("file")), headers.getContentType().orElse(MIMEType.APPLICATION_OCTET_STREAM))); } return new DefaultCacheItem(new HTTPResponse(p, status, headers), time.get()); }
558963_9
@Override public V put(K key, V value) { V put = super.put(key, value); for (ModificationListener<K, V> listener : listeners) { listener.onPut(key, value); } return put; }
56904_10
public static String string(String message, Object... args) { for (Object arg : args) { int i = message.indexOf("{}"); if (i != -1) { message = message.substring(0, i) + String.valueOf(arg) + message.substring(i + 2); } } return message; }
56904_11
public static String string(String message, Object... args) { for (Object arg : args) { int i = message.indexOf("{}"); if (i != -1) { message = message.substring(0, i) + String.valueOf(arg) + message.substring(i + 2); } } return message; }
56904_12
public static String string(String message, Object... args) { for (Object arg : args) { int i = message.indexOf("{}"); if (i != -1) { message = message.substring(0, i) + String.valueOf(arg) + message.substring(i + 2); } } return message; }
56904_13
public static String string(String message, Object... args) { for (Object arg : args) { int i = message.indexOf("{}"); if (i != -1) { message = message.substring(0, i) + String.valueOf(arg) + message.substring(i + 2); } } return message; }
56904_14
public static String string(String message, Object... args) { for (Object arg : args) { int i = message.indexOf("{}"); if (i != -1) { message = message.substring(0, i) + String.valueOf(arg) + message.substring(i + 2); } } return message; }
56904_15
public static <T> FluentList<T> unique(Collection<T> source) { return new FluentList<T>(source).unique(); }
56904_16
public static String quotes(String input) { return Wrap.wrap(input, "\""); }
56904_17
public static String backquotes(String input) { return Wrap.wrap(input, "`"); }
56904_18
public static String ticks(String input) { return Wrap.wrap(input, "'"); }
56904_19
public static File classpathResourceToTempFile(String resource) { // cheat and use File.getName to parse the resource try { File destination = File.createTempFile(new File(resource).getName() + ".", ""); destination.deleteOnExit(); InputStream in = Write.class.getResourceAsStream(resource); Write.toFile(destination, in); in.close(); return destination; } catch (IOException io) { throw new RuntimeException(io); } }
56904_20
public static void toFile(String path, String content, Charset charset) { Write.toFile(new File(path), content, charset); }
56904_21
public static void toFile(String path, String content, Charset charset) { Write.toFile(new File(path), content, charset); }
56904_22
public static void overrideForSuffix(String suffix, Properties p) { for (Entry<Object, Object> e : Copy.list(p.entrySet())) { String key = (String) e.getKey(); if (key.endsWith("." + suffix)) { String actualKey = key.substring(0, key.length() - ("." + suffix).length()); p.setProperty(actualKey, (String) e.getValue()); } } }
56904_23
public static void overrideForSuffix(String suffix, Properties p) { for (Entry<Object, Object> e : Copy.list(p.entrySet())) { String key = (String) e.getKey(); if (key.endsWith("." + suffix)) { String actualKey = key.substring(0, key.length() - ("." + suffix).length()); p.setProperty(actualKey, (String) e.getValue()); } } }
56904_24
public static <T> ListDiff<T> of(Collection<T> original, Collection<T> updated) { List<T> added = new ArrayList<T>(); List<T> removed = new ArrayList<T>(); if (original == null && updated == null) { // do nothing } else if (original != null && updated == null) { removed.addAll(original); } else if (original == null && updated != null) { added.addAll(updated); } else { for (T t : original) { if (!updated.contains(t)) { removed.add(t); } } for (T t : updated) { if (!original.contains(t)) { added.add(t); } } } return new ListDiff<T>(added, removed); }
56904_25
public static <T> ListDiff<T> of(Collection<T> original, Collection<T> updated) { List<T> added = new ArrayList<T>(); List<T> removed = new ArrayList<T>(); if (original == null && updated == null) { // do nothing } else if (original != null && updated == null) { removed.addAll(original); } else if (original == null && updated != null) { added.addAll(updated); } else { for (T t : original) { if (!updated.contains(t)) { removed.add(t); } } for (T t : updated) { if (!original.contains(t)) { added.add(t); } } } return new ListDiff<T>(added, removed); }
56904_26
public static <T> ListDiff<T> of(Collection<T> original, Collection<T> updated) { List<T> added = new ArrayList<T>(); List<T> removed = new ArrayList<T>(); if (original == null && updated == null) { // do nothing } else if (original != null && updated == null) { removed.addAll(original); } else if (original == null && updated != null) { added.addAll(updated); } else { for (T t : original) { if (!updated.contains(t)) { removed.add(t); } } for (T t : updated) { if (!original.contains(t)) { added.add(t); } } } return new ListDiff<T>(added, removed); }
56904_27
public static <T> ListDiff<T> of(Collection<T> original, Collection<T> updated) { List<T> added = new ArrayList<T>(); List<T> removed = new ArrayList<T>(); if (original == null && updated == null) { // do nothing } else if (original != null && updated == null) { removed.addAll(original); } else if (original == null && updated != null) { added.addAll(updated); } else { for (T t : original) { if (!updated.contains(t)) { removed.add(t); } } for (T t : updated) { if (!original.contains(t)) { added.add(t); } } } return new ListDiff<T>(added, removed); }
56904_28
public static <T> ListDiff<T> of(Collection<T> original, Collection<T> updated) { List<T> added = new ArrayList<T>(); List<T> removed = new ArrayList<T>(); if (original == null && updated == null) { // do nothing } else if (original != null && updated == null) { removed.addAll(original); } else if (original == null && updated != null) { added.addAll(updated); } else { for (T t : original) { if (!updated.contains(t)) { removed.add(t); } } for (T t : updated) { if (!original.contains(t)) { added.add(t); } } } return new ListDiff<T>(added, removed); }
56904_29
public static <T> ListDiff<T> of(Collection<T> original, Collection<T> updated) { List<T> added = new ArrayList<T>(); List<T> removed = new ArrayList<T>(); if (original == null && updated == null) { // do nothing } else if (original != null && updated == null) { removed.addAll(original); } else if (original == null && updated != null) { added.addAll(updated); } else { for (T t : original) { if (!updated.contains(t)) { removed.add(t); } } for (T t : updated) { if (!original.contains(t)) { added.add(t); } } } return new ListDiff<T>(added, removed); }
56904_30
public static String toQuote(String message) { message = Tick.standaloneTick.matcher(message).replaceAll("\""); message = Tick.twoTicks.matcher(message).replaceAll("'"); return message; }
56904_31
public static String toQuote(String message) { message = Tick.standaloneTick.matcher(message).replaceAll("\""); message = Tick.twoTicks.matcher(message).replaceAll("'"); return message; }
56904_32
public BufferedResult toBuffer() { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); Result r = this.execute(out, err); // copy into a new BufferedResult with our capture in/out BufferedResult br = new BufferedResult(); br.exitValue = r.exitValue; br.success = r.success; br.out = out.toString(); br.err = err.toString(); return br; }
56904_33
public Result toSystemOut() { return this.execute(System.out, System.err); }
56904_34
public Result toFile(String outPath) { return this.toFile(new File(outPath)); }
56904_35
public Execute addAllEnv() { this.env.putAll(System.getenv()); return this; }
56904_36
public BufferedResult toBuffer() { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); Result r = this.execute(out, err); // copy into a new BufferedResult with our capture in/out BufferedResult br = new BufferedResult(); br.exitValue = r.exitValue; br.success = r.success; br.out = out.toString(); br.err = err.toString(); return br; }
56904_37
public BufferedResult toBuffer() { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); Result r = this.execute(out, err); // copy into a new BufferedResult with our capture in/out BufferedResult br = new BufferedResult(); br.exitValue = r.exitValue; br.success = r.success; br.out = out.toString(); br.err = err.toString(); return br; }
56904_38
private ToString() { }
56904_39
public String toCode() { StringBuilderr sb = new StringBuilderr(); if (this.name.packageName != null) { sb.line("package {};", this.name.packageName); sb.line(); } if (this.isAnonymous) { sb.line("new {}() {", this.name.simpleNameWithGenerics); } else { if (this.imports.size() > 0) { for (String importClassName : this.imports) { sb.line("import {};", importClassName); } sb.line(); } for (String annotation : this.annotations) { sb.line(annotation); } sb.append(this.access.asPrefix()); if (this.isStaticInnerClass) { sb.append("static "); } if (this.isAbstract) { sb.append("abstract "); } if (this.isEnum) { sb.append("enum "); } else if (this.isInterface) { sb.append("interface "); } else { sb.append("class "); } sb.append(this.name.simpleNameWithGenerics); sb.append(" "); if (!this.isInterface) { if (this.baseClassName != null) { sb.append("extends {} ", this.stripAndImportPackageIfPossible(this.baseClassName)); } if (this.implementsInterfaces.size() > 0) { sb.append("implements {} ", Join.commaSpace(this.implementsInterfaces)); } } else { List<String> interfaces = Copy.list(); if (this.baseClassName != null) { interfaces.add(this.baseClassName); } interfaces.addAll(this.implementsInterfaces); if (!interfaces.isEmpty()) { sb.append("extends {} ", Join.commaSpace(interfaces)); } } sb.line("{"); } if (this.isEnum && this.enumValues.size() > 0) { boolean hasMore = this.fields.size() > 0 || this.methods.size() > 0 || this.constructors.size() > 0; this.lineIfNotAnonymousOrInner(sb); for (Iterator<String> i = this.enumValues.iterator(); i.hasNext();) { sb.append(1, i.next()); sb.append(i.hasNext() ? "," : hasMore ? ";" : ""); sb.line(); } } if (this.fields.size() > 0) { this.lineIfNotAnonymousOrInner(sb); for (GField field : this.fields) { sb.append(1, field.toCode()); } } if (this.staticInitializer.toString().length() > 0) { sb.line(); sb.line(1, "static {"); sb.append(2, this.staticInitializer.toString()); sb.lineIfNeeded(); sb.line(1, "}"); } for (GMethod constructor : this.constructors) { this.lineIfNotAnonymousOrInner(sb); sb.append(1, constructor.toCode()); } if (this.methods.size() > 0) { for (GMethod method : this.methods) { this.lineIfNotAnonymousOrInner(sb); sb.append(1, method.toCode()); } } if (this.innerClasses.size() > 0) { for (GClass gc : this.innerClasses) { sb.line(); sb.append(1, gc.toCode()); } } this.lineIfNotAnonymousOrInner(sb); sb.line("}"); return sb.toString(); }
56904_40
public String toCode() { StringBuilderr sb = new StringBuilderr(); if (this.name.packageName != null) { sb.line("package {};", this.name.packageName); sb.line(); } if (this.isAnonymous) { sb.line("new {}() {", this.name.simpleNameWithGenerics); } else { if (this.imports.size() > 0) { for (String importClassName : this.imports) { sb.line("import {};", importClassName); } sb.line(); } for (String annotation : this.annotations) { sb.line(annotation); } sb.append(this.access.asPrefix()); if (this.isStaticInnerClass) { sb.append("static "); } if (this.isAbstract) { sb.append("abstract "); } if (this.isEnum) { sb.append("enum "); } else if (this.isInterface) { sb.append("interface "); } else { sb.append("class "); } sb.append(this.name.simpleNameWithGenerics); sb.append(" "); if (!this.isInterface) { if (this.baseClassName != null) { sb.append("extends {} ", this.stripAndImportPackageIfPossible(this.baseClassName)); } if (this.implementsInterfaces.size() > 0) { sb.append("implements {} ", Join.commaSpace(this.implementsInterfaces)); } } else { List<String> interfaces = Copy.list(); if (this.baseClassName != null) { interfaces.add(this.baseClassName); } interfaces.addAll(this.implementsInterfaces); if (!interfaces.isEmpty()) { sb.append("extends {} ", Join.commaSpace(interfaces)); } } sb.line("{"); } if (this.isEnum && this.enumValues.size() > 0) { boolean hasMore = this.fields.size() > 0 || this.methods.size() > 0 || this.constructors.size() > 0; this.lineIfNotAnonymousOrInner(sb); for (Iterator<String> i = this.enumValues.iterator(); i.hasNext();) { sb.append(1, i.next()); sb.append(i.hasNext() ? "," : hasMore ? ";" : ""); sb.line(); } } if (this.fields.size() > 0) { this.lineIfNotAnonymousOrInner(sb); for (GField field : this.fields) { sb.append(1, field.toCode()); } } if (this.staticInitializer.toString().length() > 0) { sb.line(); sb.line(1, "static {"); sb.append(2, this.staticInitializer.toString()); sb.lineIfNeeded(); sb.line(1, "}"); } for (GMethod constructor : this.constructors) { this.lineIfNotAnonymousOrInner(sb); sb.append(1, constructor.toCode()); } if (this.methods.size() > 0) { for (GMethod method : this.methods) { this.lineIfNotAnonymousOrInner(sb); sb.append(1, method.toCode()); } } if (this.innerClasses.size() > 0) { for (GClass gc : this.innerClasses) { sb.line(); sb.append(1, gc.toCode()); } } this.lineIfNotAnonymousOrInner(sb); sb.line("}"); return sb.toString(); }
56904_41
public GMethod getMethod(String name, Object... args) { name = Interpolate.string(name, args); if (name.indexOf('(') == -1) { for (GMethod method : this.methods) { if (method.getName().equals(name)) { return method; } } GMethod method = new GMethod(this, name); this.methods.add(method); return method; } else { String typesAndNames = this.stripAndImportPackageIfPossible(name.substring(name.indexOf('(') + 1, name.length() - 1)); name = name.substring(0, name.indexOf('(')); for (GMethod method : this.methods) { if (method.getName().equals(name) && method.hasSameArguments(typesAndNames)) { return method; } } GMethod method = new GMethod(this, name); method.arguments(typesAndNames); this.methods.add(method); return method; } }
56904_42
public String toString() { return this.getFullName(); }
56904_43
public void output() { for (GClass gc : this.classes) { String newCode = gc.toCode(); File file = this.getFile(gc); if (file.exists()) { String existingCode = Read.fromFile(file, this.charset); if (newCode.equals(existingCode)) { this.touched.add(file); continue; } } file.getParentFile().mkdirs(); log.info("Saving {}", file); Write.toFile(file, newCode, this.charset); this.touched.add(file); } }
56904_44
public void markTouched(File file) { this.touched.add(file); }
56904_45
public GField autoImportInitialValue() { this.initialValue = this.gclass.stripAndImportPackageIfPossible(this.initialValue); return this; }
56904_46
public static List<Argument> split(String... typesAndNames) { List<Argument> arguments = new ArrayList<Argument>(); if (typesAndNames.length == 1) { String line = typesAndNames[0].trim(); if (line.length() == 0) { return arguments; } int last = 0; int parenCount = 0; int current = 0; for (; current < line.length(); current++) { if (line.charAt(current) == '<') { parenCount++; } else if (line.charAt(current) == '>') { parenCount--; } else if (line.charAt(current) == ',' && parenCount == 0) { arguments.add(new Argument(line.substring(last, current))); last = current + 1; } } arguments.add(new Argument(line.substring(last, current))); } else { for (String typeAndName : typesAndNames) { arguments.add(new Argument(typeAndName)); } } return arguments; }
56904_47
public String toCode() { StringBuilderr sb = new StringBuilderr(); for (String annotation : this.annotations) { sb.line(annotation); } boolean isStaticBlock = this.isStatic && this.constructorFor != null; if (!isStaticBlock) { sb.append(this.access.asPrefix()); } if (this.isStatic) { sb.append("static "); } if (this.isAbstract) { sb.append("abstract "); } if (this.typeParameters != null) { sb.append("<{}> ", this.typeParameters); } if (this.constructorFor != null) { if (!isStaticBlock) { sb.append(this.constructorFor); } } else { sb.append("{} {}", this.returnClassName, this.getName()); } if (!isStaticBlock) { sb.append("({})", Join.commaSpace(this.arguments)); } if (this.exceptions.size() > 0) { sb.append(" throws "); List<String> exceptionTypes = new ArrayList<String>(); for (String exception : this.exceptions) { exceptionTypes.add(this.gclass.stripAndImportPackageIfPossible(exception)); } sb.append(Join.commaSpace(exceptionTypes)); } if (this.gclass.isInterface || this.isAbstract) { sb.line(";"); } else { sb.line(" {"); sb.append(1, this.body.toString()); sb.lineIfNeeded(); // The body may or may not have a trailing new line on it sb.line(0, "}"); } return sb.toString(); }
56904_48
public String toCode() { StringBuilderr sb = new StringBuilderr(); for (String annotation : this.annotations) { sb.line(annotation); } boolean isStaticBlock = this.isStatic && this.constructorFor != null; if (!isStaticBlock) { sb.append(this.access.asPrefix()); } if (this.isStatic) { sb.append("static "); } if (this.isAbstract) { sb.append("abstract "); } if (this.typeParameters != null) { sb.append("<{}> ", this.typeParameters); } if (this.constructorFor != null) { if (!isStaticBlock) { sb.append(this.constructorFor); } } else { sb.append("{} {}", this.returnClassName, this.getName()); } if (!isStaticBlock) { sb.append("({})", Join.commaSpace(this.arguments)); } if (this.exceptions.size() > 0) { sb.append(" throws "); List<String> exceptionTypes = new ArrayList<String>(); for (String exception : this.exceptions) { exceptionTypes.add(this.gclass.stripAndImportPackageIfPossible(exception)); } sb.append(Join.commaSpace(exceptionTypes)); } if (this.gclass.isInterface || this.isAbstract) { sb.line(";"); } else { sb.line(" {"); sb.append(1, this.body.toString()); sb.lineIfNeeded(); // The body may or may not have a trailing new line on it sb.line(0, "}"); } return sb.toString(); }
56904_49
public String toCode() { StringBuilderr sb = new StringBuilderr(); for (String annotation : this.annotations) { sb.line(annotation); } boolean isStaticBlock = this.isStatic && this.constructorFor != null; if (!isStaticBlock) { sb.append(this.access.asPrefix()); } if (this.isStatic) { sb.append("static "); } if (this.isAbstract) { sb.append("abstract "); } if (this.typeParameters != null) { sb.append("<{}> ", this.typeParameters); } if (this.constructorFor != null) { if (!isStaticBlock) { sb.append(this.constructorFor); } } else { sb.append("{} {}", this.returnClassName, this.getName()); } if (!isStaticBlock) { sb.append("({})", Join.commaSpace(this.arguments)); } if (this.exceptions.size() > 0) { sb.append(" throws "); List<String> exceptionTypes = new ArrayList<String>(); for (String exception : this.exceptions) { exceptionTypes.add(this.gclass.stripAndImportPackageIfPossible(exception)); } sb.append(Join.commaSpace(exceptionTypes)); } if (this.gclass.isInterface || this.isAbstract) { sb.line(";"); } else { sb.line(" {"); sb.append(1, this.body.toString()); sb.lineIfNeeded(); // The body may or may not have a trailing new line on it sb.line(0, "}"); } return sb.toString(); }
56904_50
public String toCode() { StringBuilderr sb = new StringBuilderr(); for (String annotation : this.annotations) { sb.line(annotation); } boolean isStaticBlock = this.isStatic && this.constructorFor != null; if (!isStaticBlock) { sb.append(this.access.asPrefix()); } if (this.isStatic) { sb.append("static "); } if (this.isAbstract) { sb.append("abstract "); } if (this.typeParameters != null) { sb.append("<{}> ", this.typeParameters); } if (this.constructorFor != null) { if (!isStaticBlock) { sb.append(this.constructorFor); } } else { sb.append("{} {}", this.returnClassName, this.getName()); } if (!isStaticBlock) { sb.append("({})", Join.commaSpace(this.arguments)); } if (this.exceptions.size() > 0) { sb.append(" throws "); List<String> exceptionTypes = new ArrayList<String>(); for (String exception : this.exceptions) { exceptionTypes.add(this.gclass.stripAndImportPackageIfPossible(exception)); } sb.append(Join.commaSpace(exceptionTypes)); } if (this.gclass.isInterface || this.isAbstract) { sb.line(";"); } else { sb.line(" {"); sb.append(1, this.body.toString()); sb.lineIfNeeded(); // The body may or may not have a trailing new line on it sb.line(0, "}"); } return sb.toString(); }
56904_51
public GMethod typeParameters(String typeParameters) { this.typeParameters = typeParameters; return this; }
56904_52
public String toCode() { StringBuilderr sb = new StringBuilderr(); for (String annotation : this.annotations) { sb.line(annotation); } boolean isStaticBlock = this.isStatic && this.constructorFor != null; if (!isStaticBlock) { sb.append(this.access.asPrefix()); } if (this.isStatic) { sb.append("static "); } if (this.isAbstract) { sb.append("abstract "); } if (this.typeParameters != null) { sb.append("<{}> ", this.typeParameters); } if (this.constructorFor != null) { if (!isStaticBlock) { sb.append(this.constructorFor); } } else { sb.append("{} {}", this.returnClassName, this.getName()); } if (!isStaticBlock) { sb.append("({})", Join.commaSpace(this.arguments)); } if (this.exceptions.size() > 0) { sb.append(" throws "); List<String> exceptionTypes = new ArrayList<String>(); for (String exception : this.exceptions) { exceptionTypes.add(this.gclass.stripAndImportPackageIfPossible(exception)); } sb.append(Join.commaSpace(exceptionTypes)); } if (this.gclass.isInterface || this.isAbstract) { sb.line(";"); } else { sb.line(" {"); sb.append(1, this.body.toString()); sb.lineIfNeeded(); // The body may or may not have a trailing new line on it sb.line(0, "}"); } return sb.toString(); }
56904_53
@Override public Money toDomainValue(Long jdbcValue) { if (jdbcValue == null) { return null; } return Money.dollars(jdbcValue.intValue() / 100.0); }
56904_54
@Override public Long toJdbcValue(Money domainValue) { if (domainValue == null) { return null; } return domainValue.getAmount().multiply(new BigDecimal(100)).toBigIntegerExact().longValue(); }
56904_55
public static Where and(Where... wheres) { return Where.make("AND", Type.AND, wheres); }
56904_56
public static Where or(Where... wheres) { return Where.make("OR", Type.OR, wheres); }
56904_57
public List<U> get() { if (this.loaded == null) { if (this.parent.isNew() || UnitTesting.isEnabled()) { // parent is brand new, so don't bother hitting the database this.loaded = new ArrayList<U>(); } else { if (!UoW.isOpen()) { throw new DisconnectedException(); } if (!EagerLoading.isEnabled()) { // fetch only the children for this parent from the db Select<U> q = Select.from(this.childAlias); q.where(this.childForeignKeyToParentColumn.eq(this.parent)); q.orderBy(this.childAlias.getIdColumn().asc()); q.limit(UoW.getIdentityMap().getCurrentSizeLimit()); this.loaded = q.list(); } else { // preemptively fetch all children for all parents from the db MapToList<Long, U> byParentId = UoW.getEagerCache().get(this.childForeignKeyToParentColumn); if (!byParentId.containsKey(this.parent.getId())) { Collection<Long> idsToLoad = UoW.getEagerCache().getIdsToLoad(this.parent, this.childForeignKeyToParentColumn); if (!idsToLoad.contains(this.parent.getId())) { throw new IllegalStateException("Instance has been disconnected from the UoW: " + this.parent); } this.eagerlyLoad(byParentId, idsToLoad); } this.loaded = new ArrayList<U>(); this.loaded.addAll(byParentId.get(this.parent.getId())); } } if (this.addedBeforeLoaded.size() > 0 || this.removedBeforeLoaded.size() > 0) { // apply back any adds/removes that we'd been holding off on this.loaded.addAll(this.addedBeforeLoaded); this.loaded.removeAll(this.removedBeforeLoaded); this.loaded = Copy.unique(this.loaded); } this.proxy = new ListProxy<U>(this.loaded, this.listDelegate); } return this.proxy; }
56904_58
public List<U> get() { if (this.loaded == null) { if (this.parent.isNew() || UnitTesting.isEnabled()) { // parent is brand new, so don't bother hitting the database this.loaded = new ArrayList<U>(); } else { if (!UoW.isOpen()) { throw new DisconnectedException(); } if (!EagerLoading.isEnabled()) { // fetch only the children for this parent from the db Select<U> q = Select.from(this.childAlias); q.where(this.childForeignKeyToParentColumn.eq(this.parent)); q.orderBy(this.childAlias.getIdColumn().asc()); q.limit(UoW.getIdentityMap().getCurrentSizeLimit()); this.loaded = q.list(); } else { // preemptively fetch all children for all parents from the db MapToList<Long, U> byParentId = UoW.getEagerCache().get(this.childForeignKeyToParentColumn); if (!byParentId.containsKey(this.parent.getId())) { Collection<Long> idsToLoad = UoW.getEagerCache().getIdsToLoad(this.parent, this.childForeignKeyToParentColumn); if (!idsToLoad.contains(this.parent.getId())) { throw new IllegalStateException("Instance has been disconnected from the UoW: " + this.parent); } this.eagerlyLoad(byParentId, idsToLoad); } this.loaded = new ArrayList<U>(); this.loaded.addAll(byParentId.get(this.parent.getId())); } } if (this.addedBeforeLoaded.size() > 0 || this.removedBeforeLoaded.size() > 0) { // apply back any adds/removes that we'd been holding off on this.loaded.addAll(this.addedBeforeLoaded); this.loaded.removeAll(this.removedBeforeLoaded); this.loaded = Copy.unique(this.loaded); } this.proxy = new ListProxy<U>(this.loaded, this.listDelegate); } return this.proxy; }
56904_59
public List<U> get() { if (this.loaded == null) { if (this.parent.isNew() || UnitTesting.isEnabled()) { // parent is brand new, so don't bother hitting the database this.loaded = new ArrayList<U>(); } else { if (!UoW.isOpen()) { throw new DisconnectedException(); } if (!EagerLoading.isEnabled()) { // fetch only the children for this parent from the db Select<U> q = Select.from(this.childAlias); q.where(this.childForeignKeyToParentColumn.eq(this.parent)); q.orderBy(this.childAlias.getIdColumn().asc()); q.limit(UoW.getIdentityMap().getCurrentSizeLimit()); this.loaded = q.list(); } else { // preemptively fetch all children for all parents from the db MapToList<Long, U> byParentId = UoW.getEagerCache().get(this.childForeignKeyToParentColumn); if (!byParentId.containsKey(this.parent.getId())) { Collection<Long> idsToLoad = UoW.getEagerCache().getIdsToLoad(this.parent, this.childForeignKeyToParentColumn); if (!idsToLoad.contains(this.parent.getId())) { throw new IllegalStateException("Instance has been disconnected from the UoW: " + this.parent); } this.eagerlyLoad(byParentId, idsToLoad); } this.loaded = new ArrayList<U>(); this.loaded.addAll(byParentId.get(this.parent.getId())); } } if (this.addedBeforeLoaded.size() > 0 || this.removedBeforeLoaded.size() > 0) { // apply back any adds/removes that we'd been holding off on this.loaded.addAll(this.addedBeforeLoaded); this.loaded.removeAll(this.removedBeforeLoaded); this.loaded = Copy.unique(this.loaded); } this.proxy = new ListProxy<U>(this.loaded, this.listDelegate); } return this.proxy; }
56904_60
@Override public String toString() { return this.loaded != null ? this.loaded.toString() : "unloaded + " + this.addedBeforeLoaded + " - " + this.removedBeforeLoaded; }
56904_61
@Override public String toString() { return this.instance != null ? this.instance.toString() : this.childClass.getSimpleName() + "[" + ObjectUtils.toString(this.id, null) + "]"; }
574877_0
@Override public String adapt(StateMachine stateMachine) { return stateMachine == null ? null : stateMachine.toJson(); }
574877_1
public static String jsonToString(JsonNode node) { try { return node == null ? null : MAPPER.writeValueAsString(node); } catch (JsonProcessingException e) { throw new SdkClientException("Could not serialize JSON", e); } }
574877_2
public static String jsonToString(JsonNode node) { try { return node == null ? null : MAPPER.writeValueAsString(node); } catch (JsonProcessingException e) { throw new SdkClientException("Could not serialize JSON", e); } }
574877_3
public static String jsonToString(JsonNode node) { try { return node == null ? null : MAPPER.writeValueAsString(node); } catch (JsonProcessingException e) { throw new SdkClientException("Could not serialize JSON", e); } }
574877_4
public static JsonNode stringToJsonNode(String paramName, String val) { if (val == null) { return null; } try { return MAPPER.readTree(val); } catch (IOException e) { throw new SdkClientException(paramName + " must be a valid JSON document", e); } }
574877_5
public static JsonNode stringToJsonNode(String paramName, String val) { if (val == null) { return null; } try { return MAPPER.readTree(val); } catch (IOException e) { throw new SdkClientException(paramName + " must be a valid JSON document", e); } }
574877_6
public static JsonNode stringToJsonNode(String paramName, String val) { if (val == null) { return null; } try { return MAPPER.readTree(val); } catch (IOException e) { throw new SdkClientException(paramName + " must be a valid JSON document", e); } }
574877_7
public static JsonNode objectToJsonNode(Object val) { return MAPPER.valueToTree(val); }
574877_8
public T visit(ChoiceState choiceState) { return null; }
574877_9
public static boolean path(JsonNode expectedResult, JsonNode finalResult) { return finalResult.equals(expectedResult); }
578435_0
@Override public Object deserialize(Writable blob) throws SerDeException { BytesWritable bytes = (BytesWritable) blob; try { return protobufConverter.fromBytes(bytes.getBytes(), 0, bytes.getLength()); } catch (IOException e) { throw new SerDeException(e); } }
578435_1
@Override public ObjectInspector getObjectInspector() throws SerDeException { return objectInspector; }
578435_2
@Override public ObjectInspector getObjectInspector() throws SerDeException { return objectInspector; }
578435_3
@Override public ObjectInspector getObjectInspector() throws SerDeException { return objectInspector; }
578435_4
public static void sourceConfInit(JobConf conf) { updateJobConfForLocalSettings(conf); // Since the EB combiner works over the mapreduce API while Cascading is on the mapred API, // in order to use the EB combiner we must wrap the mapred SequenceFileInputFormat // with the MapReduceInputFormatWrapper, then wrap the DelegateCombineFileInputFormat // again with DeprecatedInputFormatWrapper to make it compatible with Cascading. MapReduceInputFormatWrapper.setWrappedInputFormat(SequenceFileInputFormat.class, conf); DelegateCombineFileInputFormat.setDelegateInputFormat(conf, MapReduceInputFormatWrapper.class); }
578435_5
@Override public List<InputSplit> getSplits(JobContext job) throws IOException, InterruptedException { // load settings from job conf loadConfig(HadoopCompat.getConfiguration(job)); // find all the index dirs and create a split for each PriorityQueue<LuceneIndexInputSplit> splits = findSplits(HadoopCompat.getConfiguration(job)); // combine the splits based on maxCombineSplitSize List<InputSplit> combinedSplits = combineSplits(splits, maxCombinedIndexSizePerSplit, maxNumIndexesPerSplit); return combinedSplits; }
578435_6
protected List<InputSplit> combineSplits(PriorityQueue<LuceneIndexInputSplit> splits, long maxCombinedIndexSizePerSplit, long maxNumIndexesPerSplit) { // now take the one-split-per-index splits and combine them into multi-index-per-split splits List<InputSplit> combinedSplits = Lists.newLinkedList(); LuceneIndexInputSplit currentSplit = splits.poll(); while (currentSplit != null) { while (currentSplit.getLength() < maxCombinedIndexSizePerSplit) { LuceneIndexInputSplit nextSplit = splits.peek(); if (nextSplit == null) { break; } if (currentSplit.getLength() + nextSplit.getLength() > maxCombinedIndexSizePerSplit) { break; } if (currentSplit.getIndexDirs().size() >= maxNumIndexesPerSplit) { break; } currentSplit.combine(nextSplit); splits.poll(); } combinedSplits.add(currentSplit); currentSplit = splits.poll(); } return combinedSplits; }
578435_7
protected List<InputSplit> combineSplits(PriorityQueue<LuceneIndexInputSplit> splits, long maxCombinedIndexSizePerSplit, long maxNumIndexesPerSplit) { // now take the one-split-per-index splits and combine them into multi-index-per-split splits List<InputSplit> combinedSplits = Lists.newLinkedList(); LuceneIndexInputSplit currentSplit = splits.poll(); while (currentSplit != null) { while (currentSplit.getLength() < maxCombinedIndexSizePerSplit) { LuceneIndexInputSplit nextSplit = splits.peek(); if (nextSplit == null) { break; } if (currentSplit.getLength() + nextSplit.getLength() > maxCombinedIndexSizePerSplit) { break; } if (currentSplit.getIndexDirs().size() >= maxNumIndexesPerSplit) { break; } currentSplit.combine(nextSplit); splits.poll(); } combinedSplits.add(currentSplit); currentSplit = splits.poll(); } return combinedSplits; }
578435_8
protected List<InputSplit> combineSplits(PriorityQueue<LuceneIndexInputSplit> splits, long maxCombinedIndexSizePerSplit, long maxNumIndexesPerSplit) { // now take the one-split-per-index splits and combine them into multi-index-per-split splits List<InputSplit> combinedSplits = Lists.newLinkedList(); LuceneIndexInputSplit currentSplit = splits.poll(); while (currentSplit != null) { while (currentSplit.getLength() < maxCombinedIndexSizePerSplit) { LuceneIndexInputSplit nextSplit = splits.peek(); if (nextSplit == null) { break; } if (currentSplit.getLength() + nextSplit.getLength() > maxCombinedIndexSizePerSplit) { break; } if (currentSplit.getIndexDirs().size() >= maxNumIndexesPerSplit) { break; } currentSplit.combine(nextSplit); splits.poll(); } combinedSplits.add(currentSplit); currentSplit = splits.poll(); } return combinedSplits; }
578435_9
protected List<InputSplit> combineSplits(PriorityQueue<LuceneIndexInputSplit> splits, long maxCombinedIndexSizePerSplit, long maxNumIndexesPerSplit) { // now take the one-split-per-index splits and combine them into multi-index-per-split splits List<InputSplit> combinedSplits = Lists.newLinkedList(); LuceneIndexInputSplit currentSplit = splits.poll(); while (currentSplit != null) { while (currentSplit.getLength() < maxCombinedIndexSizePerSplit) { LuceneIndexInputSplit nextSplit = splits.peek(); if (nextSplit == null) { break; } if (currentSplit.getLength() + nextSplit.getLength() > maxCombinedIndexSizePerSplit) { break; } if (currentSplit.getIndexDirs().size() >= maxNumIndexesPerSplit) { break; } currentSplit.combine(nextSplit); splits.poll(); } combinedSplits.add(currentSplit); currentSplit = splits.poll(); } return combinedSplits; }
581866_0
public static IOTransition.IOLetter fullLetter(String message) { Matcher matcher = lettersPattern.matcher(message); if (matcher.matches()) { if (matcher.group(1).equals("^")) { if (matcher.group(2) == null) { return new IOTransition.IOLetter(new Message(matcher.group(5), matcher.group(5), matcher.group(6)), IOAlphabetType.INTERNAL); } else { if (matcher.group(4).equals("->")) { return new IOTransition.IOLetter(new Message(matcher.group(3), matcher.group(5), matcher.group(6)), IOAlphabetType.INTERNAL); } else { return new IOTransition.IOLetter(new Message(matcher.group(5), matcher.group(3), matcher.group(6)), IOAlphabetType.INTERNAL); } } } if (matcher.group(1).equals("!")) { if (matcher.group(4).equals("->")) { return new IOTransition.IOLetter(new Message(matcher.group(3), matcher.group(5), matcher.group(6)), IOAlphabetType.OUTPUT); } else { return new IOTransition.IOLetter(new Message(matcher.group(5), matcher.group(3), matcher.group(6)), IOAlphabetType.OUTPUT); } } else { if (matcher.group(4).equals("->")) { return new IOTransition.IOLetter(new Message(matcher.group(3), matcher.group(5), matcher.group(6)), IOAlphabetType.INPUT); } else { return new IOTransition.IOLetter(new Message(matcher.group(5), matcher.group(3), matcher.group(6)), IOAlphabetType.INPUT); } } } throw rejectLetter(message); }
581866_1
public static IOTransition.IOLetter fullLetter(String message) { Matcher matcher = lettersPattern.matcher(message); if (matcher.matches()) { if (matcher.group(1).equals("^")) { if (matcher.group(2) == null) { return new IOTransition.IOLetter(new Message(matcher.group(5), matcher.group(5), matcher.group(6)), IOAlphabetType.INTERNAL); } else { if (matcher.group(4).equals("->")) { return new IOTransition.IOLetter(new Message(matcher.group(3), matcher.group(5), matcher.group(6)), IOAlphabetType.INTERNAL); } else { return new IOTransition.IOLetter(new Message(matcher.group(5), matcher.group(3), matcher.group(6)), IOAlphabetType.INTERNAL); } } } if (matcher.group(1).equals("!")) { if (matcher.group(4).equals("->")) { return new IOTransition.IOLetter(new Message(matcher.group(3), matcher.group(5), matcher.group(6)), IOAlphabetType.OUTPUT); } else { return new IOTransition.IOLetter(new Message(matcher.group(5), matcher.group(3), matcher.group(6)), IOAlphabetType.OUTPUT); } } else { if (matcher.group(4).equals("->")) { return new IOTransition.IOLetter(new Message(matcher.group(3), matcher.group(5), matcher.group(6)), IOAlphabetType.INPUT); } else { return new IOTransition.IOLetter(new Message(matcher.group(5), matcher.group(3), matcher.group(6)), IOAlphabetType.INPUT); } } } throw rejectLetter(message); }
585380_0
@Override public void add(Key key, Context context, KUID valueId) throws SQLException { long now = System.currentTimeMillis(); Date created = new Date(now); Timestamp modified = new Timestamp(now); context.addHeader(Constants.VALUE_ID, valueId.toHexString()); context.addHeader(Constants.DATE, DateUtils.format(now)); KUID bucketId = key.getId(); String bucket = key.getBucket(); URI uri = key.getURI(); KUID keyId = KeyId.valueOf(key); try { cm.beginTxn(); // BUCKETS { PreparedStatement ps = cm.prepareStatement( factory.upsertBuckets()); try { setBytes(ps, 1, bucketId); ps.setString(2, bucket); ps.setDate(3, created); ps.setTimestamp(4, modified); ps.executeUpdate(); } finally { Utils.close(ps); } } // KEYS { PreparedStatement ps = cm.prepareStatement( factory.upsertKeys()); try { setBytes(ps, 1, keyId); setBytes(ps, 2, bucketId); ps.setString(3, uri.toString()); ps.setDate(4, created); ps.setTimestamp(5, modified); ps.executeUpdate(); } finally { Utils.close(ps); } } // VALUES { PreparedStatement ps = cm.prepareStatement(INSERT_VALUE); try { setBytes(ps, 1, valueId); setBytes(ps, 2, keyId); ps.setDate(3, created); ps.executeUpdate(); } finally { Utils.close(ps); } } // PROPERTIES { PreparedStatement ps = cm.prepareStatement(INSERT_PROPERTY); try { for (Header header : context.getHeaders()) { String name = header.getName(); String value = header.getValue(); setBytes(ps, 1, valueId); ps.setString(2, name); ps.setString(3, value); ps.addBatch(); } ps.executeBatch(); } finally { Utils.close(ps); } } cm.commit(); } finally { cm.endTxn(); } }
585380_1
@Override protected void lookup(Contact dst, KUID lookupId, long timeout, TimeUnit unit) throws IOException { MessageFactory factory = getMessageFactory(); NodeRequest message = factory.createNodeRequest(dst, lookupId); send(dst, message, timeout, unit); }
585380_2
@Override public boolean isBitSet(int bitIndex) { int index = (int)(bitIndex / Byte.SIZE); int bit = (int)(bitIndex % Byte.SIZE); return (value[index] & mask(bit)) != 0; }
585380_3
@Override public int bitIndex(KUID otherId) { if (!isCompatible(otherId)) { throw new IllegalArgumentException("otherKey=" + otherId); } boolean allNull = true; for (int i = 0; i < value.length; i++) { byte b1 = value[i]; byte b2 = otherId.value[i]; if (b1 != b2) { int xor = b1 ^ b2; for (int j = 0; j < Byte.SIZE; j++) { if ((xor & mask(j)) != 0) { return (i * Byte.SIZE) + j; } } } if (b1 != 0) { allNull = false; } } if (allNull) { return KeyAnalyzer.NULL_BIT_KEY; } return KeyAnalyzer.EQUAL_BIT_KEY; }
585380_4
public boolean isCloserTo(KUID key, KUID otherId) { return compareTo(key, otherId) < 0; }
585380_5
public int commonPrefix(KUID otherId) { int bitIndex = bitIndex(otherId); if (bitIndex < 0) { switch (bitIndex) { case KeyAnalyzer.EQUAL_BIT_KEY: case KeyAnalyzer.NULL_BIT_KEY: return lengthInBits(); default: throw new IllegalStateException("bitIndex=" + bitIndex); } } return bitIndex; }
589869_0
public void reset(int i, int j) { this.i = i; this.j = j; x = 0; y = 0; detector = 0; view_zenith = 0.0; sun_zenith = 0.0; delta_azimuth = 0.0; sun_azimuth = 0.0; mus = 0.0; muv = 0.0; airMass = 0.0; altitude = 0.0; windu = 0.0; windv = 0.0; press_ecmwf = 0.0; ozone_ecmwf = 0.0; l1flags = 0; l2flags = 0; SATURATED_F = 0; ANNOT_F = 0; for (int n = 0; n < Constants.L1_BAND_NUM; n++) { TOAR[n] = 0.0; rho_ag[n] = 0.0; rho_toa[n] = 0.0; rho_top[n] = 0.0; rhoR[n] = 0.0; transRv[n] = 0.0; transRs[n] = 0.0; sphalbR[n] = 0.0; } }
590532_0
protected static String ipToNormalizedLongString(String ip) { StringBuilder builder = new StringBuilder(); int i = 0,j = 0; while ((j=ip.indexOf('.', i)) != -1) { builder.append(String.format("%03d",Integer.parseInt(ip.substring(i,j)))); i = j+1; } builder.append(String.format("%03d",Integer.parseInt(ip.substring(i, ip.length())))); return builder.toString(); }
590532_1
protected static Object portToNormalizedLongString(String port) { return String.format("%05d", Long.parseLong(port)); }