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 (IO... |
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);
ex... |
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 (curr... |
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 : firstD... |
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 : firstD... |
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... |
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.AU... |
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;
}
... |
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())) {
IOU... |
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())) {
IOU... |
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("he... |
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.to... |
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, (S... |
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, (S... |
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 (or... |
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 (or... |
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 (or... |
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 (or... |
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 (or... |
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 (or... |
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.exitVal... |
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.exitVal... |
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.exitVal... |
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... |
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... |
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(m... |
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;
}
}
... |
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;
... |
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... |
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... |
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... |
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... |
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... |
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 (!E... |
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 (!E... |
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 (!E... |
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... |
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.getCo... |
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-spli... |
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-spli... |
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-spli... |
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-spli... |
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.... |
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.... |
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.... |
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 = ... |
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);
}
}
... |
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 = ... |
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.subs... |
590532_1 | protected static Object portToNormalizedLongString(String port) {
return String.format("%05d", Long.parseLong(port));
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.