label
int64 0
10
| text
stringlengths 45
511
|
---|---|
10 | private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
{
var gfx = e.Graphics;
_brushes.Add("black", gfx.CreateSolidBrush(0, 0, 0));
_brushes.Add("white", gfx.CreateSolidBrush(255, 255, 255));
_brushes.Add("background", gfx.CreateSolidBrush(0, 0x27, 0x31, 255.0f * 0.8f));
_fonts.Add("arial", gfx.CreateFont("Arial", 14));
} |
2 | @Test
public void testUpdateWithParameter() {
db().update("update person set score=20 where name=?") //
.parameter("FRED").counts() //
.test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) //
.assertValue(1) //
.assertComplete();
} |
4 | [TestMethod]
public void LongStringTests()
{
int length = 20000;
string json = @"[""" + new string(' ', length) + @"""]";
var o = SimpleJson.JsonDecode(json);
var a = (IList<object>)o;
Assert.IsInstanceOf<string>(a[0]);
Assert.AreEqual(20000, ((string)a[0]).Length);
} |
10 | public Task CaptureTransaction(string name, string type, Func<ITransaction, Task> func, DistributedTracingData distributedTracingData = null)
{
var transaction = StartTransaction(name, type, distributedTracingData);
var task = func(transaction);
RegisterContinuation(task, transaction);
return task;
} |
10 | [STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
} |
4 | @Test
public void parseXml() {
ICalParameters params = new ICalParameters();
Element element = xcalPropertyElement(marshaller, "<text>text</text>");
Result<TextPropertyImpl> result = marshaller.parseXml(element, params);
TextPropertyImpl prop = result.getValue();
assertEquals("text", prop.getValue());
assertWarnings(0, result.getWarnings());
} |
10 | [TestMethod]
public void IsValidPositionOnZeroSizeTest()
{
// arrange
var chunk = new Chunk(0, -1) { Position = 0, Storage = (new MemoryStorage()) };
// act
bool isValidPosition = chunk.IsValidPosition();
// assert
Assert.IsTrue(isValidPosition);
} |
2 | public static Database create(int maxSize, boolean big, Scheduler scheduler) {
return Database.from(Pools.nonBlocking() //
.connectionProvider(connectionProvider(nextUrl(), big)) //
.maxPoolSize(maxSize) //
.scheduler(scheduler) //
.build(), () -> scheduler.shutdown());
} |
2 | public MetadataBuilder addFile(@NotNull File source) {
sources.add(new Source(source));
return this;
} |
2 | @Test public void readerUnquotedLongValue() throws Exception {
JsonReader reader = newReader("{5:1}");
reader.setLenient(true);
reader.beginObject();
reader.promoteNameToValue();
assertThat(reader.nextLong()).isEqualTo(5L);
assertThat(reader.nextInt()).isEqualTo(1);
reader.endObject();
} |
4 | public void testPrefixedUnwrapping() throws Exception
{
PrefixUnwrap bean = mapper.readValue("{\"name\":\"Axel\",\"_x\":4,\"_y\":7}", PrefixUnwrap.class);
assertNotNull(bean);
assertEquals("Axel", bean.name);
assertNotNull(bean.location);
assertEquals(4, bean.location.x);
assertEquals(7, bean.location.y);
} |
3 | @Override
@SuppressWarnings("unchecked")
public boolean removeAll(Collection<?> c) {
Iterator<? extends Model> iterator = (Iterator<? extends Model>) c
.iterator();
boolean success = true;
while (iterator.hasNext()) {
T element = (T) iterator.next();
success &= internalRemove(element, false);
}
refreshStorage(true);
return success;
} |
2 | public boolean applied(final String uid) throws IOException {
if (!this.exists(uid)) {
throw new IllegalArgumentException(
new Par("Person @%s doesn't exist").say(uid)
);
}
try (final Item item = this.item()) {
return !new Xocument(item).nodes(
String.format("//people/person[@id ='%s']/applied", uid)
).isEmpty();
}
} |
4 | @Test
public void testDecode() throws IOException {
Packet packet = decoder.decodePacket("3:::woot", null);
Assert.assertEquals(PacketType.MESSAGE, packet.getType());
Assert.assertEquals("woot", packet.getData());
} |
10 | [Test]
public void CreateScopeWithResolveSingleton()
{
var builder = new ContainerBuilder();
builder.Register<NoDependencyServiceA>(Lifetime.Singleton);
var container = builder.Build();
var scopedContainer = container.CreateScope();
var singleton = scopedContainer.Resolve<NoDependencyServiceA>();
Assert.That(singleton, Is.InstanceOf<NoDependencyServiceA>());
} |
3 | public void run() throws IOException {
hostConfig.setState(HostState.IDLE);
if (hostConfig.getCurrentCommand() != null) {
processCurrentCommand(hostConfig, hostConfig.getCurrentCommand());
}
while (!goingDown) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
LOG.debug("Interrupted in run loop. Exiting.");
break;
}
}
hostConfig.setState(HostState.OFFLINE);
} |
4 | public void testNext() {
Iterator iter = new ResultSetIterator(this.rs);
int rowCount = 0;
Object[] row = null;
while (iter.hasNext()) {
rowCount++;
row = (Object[]) iter.next();
assertNotNull(row);
assertEquals(COLS, row.length);
}
assertEquals(ROWS, rowCount);
assertEquals("4", row[0]);
assertEquals("5", row[1]);
assertEquals("6", row[2]);
} |
2 | @Override
public Collection<Injectable<?>> start(GraphDatabaseService graphDatabaseService, Configuration config) {
EmbeddedDriver embeddedDriver = new EmbeddedDriver(graphDatabaseService);
sessionFactory = new SessionFactory(packages);
return Arrays.asList(new OgmInjectable<>(sessionFactory, SessionFactory.class));
} |
4 | [Fact]
public void WritesInheritance() {
var declaration = parentClass.StartBlock as CodeClass.Declaration;
declaration.Inherits = new (){
Name = "someParent"
};
codeElementWriter.WriteCodeElement(declaration, writer);
var result = tw.ToString();
Assert.Contains("SomeParent", result);
} |
2 | public static void readBySax(String path, int sheetIndex, RowHandler rowHandler) {
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(path);
readBySax(in, sheetIndex, rowHandler);
} finally {
IoUtil.close(in);
}
} |
2 | @Benchmark
public void jsoniter() throws IOException {
Jsoniter iter = Jsoniter.parseBytes(JsoniterBenchmarkState.inputBytes);
while (iter.ReadArray()) {
iter.ReadUnsignedInt();
}
} |
4 | @Test
public void whenDesiredStateIsAdmin_serverStartupAddsToJavaOptionsEnvironment() {
configureServer("ms1")
.withDesiredState(ADMIN_STATE)
.withEnvironmentVariable("JAVA_OPTIONS", "value1");
addWlsServer("ms1");
invokeStep();
assertThat(
getServerStartupInfo("ms1").getEnvironment(),
hasItem(envVar("JAVA_OPTIONS", "-Dweblogic.management.startupMode=ADMIN value1")));
} |
10 | [Fact]
public void SetInfoLogLevelTest()
{
var agent = new ApmAgent(new TestAgentComponents("Information"));
agent.ConfigurationReader.LogLevel.Should().Be(LogLevel.Information);
agent.Logger.Level.Should().Be(LogLevel.Information);
} |
2 | @Test
public void initializer_called() {
App app = new App();
final AtomicBoolean called = new AtomicBoolean(false);
assertThat(called.get(), is(false));
app.initializer("foo", (theApp) -> {
called.set(true);
});
app.initialize();
assertThat(called.get(), is(true));
} |
10 | private (IDisposable, MockPayloadSender, ApmAgent) RegisterListenerAndStartTransaction()
{
var payloadSender = new MockPayloadSender();
var agent = new ApmAgent(new TestAgentComponents(payloadSender: payloadSender));
var subscriber = new HttpDiagnosticsSubscriber();
var sub = agent.Subscribe(subscriber);
StartTransaction(agent);
return (sub, payloadSender, agent);
} |
4 | public override bool Equals(PrtValue val)
{
PrtEnumValue enumVal = val as PrtEnumValue;
if (val == null) return false;
return this.enumConstant == enumVal.enumConstant;
} |
2 | @Test
public void testCarriageReturnEndings() throws IOException {
final String code = "foo\rbaar,\rhello,world\r,kanu";
final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT);
final List<CSVRecord> records = parser.getRecords();
assertEquals(4, records.size());
} |
2 | @Test
public void test() throws Exception {
for (int i = 0; i < 100; i++) {
SpecCaptcha specCaptcha = new SpecCaptcha();
specCaptcha.setCharType(Captcha.TYPE_ONLY_NUMBER);
System.out.println(specCaptcha.text());
specCaptcha.out(new FileOutputStream(new File("D:/a/aa" + i + ".png")));
}
} |
3 | void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
} |
3 | String getProperty(String key) {
if (syncHotReload != null)
syncHotReload.checkAndReload(lastLoadTime);
readLock.lock();
try {
return properties.getProperty(key);
} finally {
readLock.unlock();
}
} |
4 | [Fact]
public void WritesInheritance() {
var declaration = parentClass.StartBlock as CodeClass.Declaration;
declaration.Inherits = new (){
Name = "someInterface"
};
codeElementWriter.WriteCodeElement(declaration, writer);
var result = tw.ToString();
Assert.Contains("<", result);
} |
2 | @Test
public void testLastEndpoint()
{
// Create the infrastructure
Ctx ctx = ZMQ.init(1);
assertThat(ctx, notNullValue());
SocketBase sb = ZMQ.socket(ctx, ZMQ.ZMQ_ROUTER);
assertThat(sb, notNullValue());
bindAndVerify(sb, "tcp://127.0.0.1:5560");
bindAndVerify(sb, "tcp://127.0.0.1:5561");
bindAndVerify(sb, "ipc:///tmp/testep");
sb.close();
ctx.terminate();
} |
2 | @Test
public void testParse_Integer1() {
BEParser parser = new BEParser("i1e");
assertEquals(BEType.INTEGER, parser.readType());
assertEquals(BigInteger.ONE, parser.readInteger());
} |
2 | private String getGeneratedManifestAttribute(final String key)
throws IOException, FileNotFoundException {
final Option<String> actual = this.testee.getJarLocation();
final File f = new File(actual.value());
final JarInputStream jis = new JarInputStream(new FileInputStream(f));
final Manifest m = jis.getManifest();
final Attributes a = m.getMainAttributes();
final String am = a.getValue(key);
return am;
} |
7 | public override string ToString()
{
CqlQueryEvaluator eval = new CqlQueryEvaluator(table as ICqlTable);
eval.Evaluate(Expression);
var cqlQuery = eval.DeleteQuery;
return cqlQuery;
} |
2 | @org.junit.Test
public void test() throws InterruptedException, IOException {
Node node = new StandbyNode(new Configuration("com.zuoxiaolong.niubi.job.jobs"), "localhost:2181,localhost:3181,localhost:4181");
node.join();
new BufferedReader(new InputStreamReader(System.in)).readLine();
} |
10 | [Fact]
public void NonValidEntitiesAreIgnored()
{
InitializeContext();
LuceneIndexerOptions options = new LuceneIndexerOptions()
{
Path = "lucene"
};
SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
searchProvider.CreateIndex();
Assert.True(searchProvider.IndexCount > 0);
} |
10 | [OneTimeSetUp]
public void Setup()
{
PusherClient.Pusher.Trace.Listeners.Add(new ConsoleTraceListener(true));
_pusher = new Pusher(Config.AppId, Config.AppKey, Config.AppSecret, new PusherOptions()
{
Encrypted = true,
HostName = Config.HttpHost
});
} |
2 | public static void main(String[] args) throws Exception{
final String data = "博主邮箱:zou90512@126.com";
byte[] bytes = data.getBytes(Charset.forName("UTF-8"));
InetSocketAddress targetHost = new InetSocketAddress("127.0.0.1", 9999);
// 发送udp内容
DatagramSocket socket = new DatagramSocket();
socket.send(new DatagramPacket(bytes, 0, bytes.length, targetHost));
} |
4 | @Test
public void gitColonUrlOtherHostNoSuffix() {
GitHubRepositoryName repo = GitHubRepositoryName
.create("git://company.net/jenkinsci/jenkins");
assertNotNull(repo);
assertEquals("jenkinsci", repo.userName);
assertEquals("jenkins", repo.repositoryName);
assertEquals("company.net", repo.host);
} |
3 | protected void reset() {
config().reset();
mirrorLog = false;
listVersions = null;
versionToDownload = null;
forcedArch = false;
retry = true;
isLatest = true;
browserBinaryPath = null;
} |
3 | public void destroy() {
System.out.println("---------peer destory:" + this.getIp());
lock.lock();
try {
this.status = Peer.CLOSE;
if (this.writeTarget != null) {
this.writeTarget.closeConnection();
this.writeTarget = null;
}
} finally {
lock.unlock();
}
//todo check failCount and save or remove from database
//this.failCount ++;
} |
2 | @Test
public void testPrinter5() throws IOException {
final StringWriter sw = new StringWriter();
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
printer.printRecord("a", "b\nc");
assertEquals("a,\"b\nc\"" + recordSeparator, sw.toString());
} |
3 | protected List<File> getFilesInCache() {
List<File> listFiles = (List<File>) listFiles(
new File(downloader.getTargetPath()), null, true);
sort(listFiles);
return listFiles;
} |
4 | public void load_torrent_created_by_utorrent() throws IOException, NoSuchAlgorithmException, URISyntaxException {
Torrent t = Torrent.load(new File("src/test/resources/torrents/file1.jar.torrent"));
assertEquals(new URI("http://localhost:6969/announce"), t.getAnnounceList().get(0).get(0));
assertEquals("B92D38046C76D73948E14C42DF992CAF25489D08", t.getHexInfoHash());
assertEquals("uTorrent/3130", t.getCreatedBy());
} |
4 | protected override Variable Evaluate(ParsingScript script)
{
ParserFunction.CleanUpVariables();
return Variable.EmptyInstance;
} |
10 | [Fact]
public void ExtractAudio()
{
FileInfo fileInfo = SampleVideoWithAudio;
string output = Path.ChangeExtension(Path.GetTempFileName(), ".mp3");
bool result = new VideoInfo(fileInfo).ExtractAudio(output);
Assert.True(result);
} |
4 | @Override
public void onPageLoad() {
System.err.println("new page loaded");
pageLoaded = true;
reset();
try {
Thread.sleep(5000);
System.out.println(
"on page load:" + session.getWebInspector().getProtocol().sendCommand(DOM.getDocument())
.optJSONObject("root").optString("documentURL"));
} catch (Exception e) {
e.printStackTrace();
}
} |
4 | @Test
public void definition_callee_symbol() {
FileInput tree = parse(
"def fn(): pass",
"fn('foo')"
);
// TODO: create a symbol for function declaration
CallExpression callExpression = getCallExpression(tree);
assertThat(callExpression.calleeSymbol()).isNull();
} |
2 | @Test
public void testMarkSupported() throws Exception {
byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE);
ByteArrayInputStream bin = new ByteArrayInputStream(decoded);
Base32InputStream in = new Base32InputStream(bin, true, 4, new byte[] { 0, 0, 0 });
// Always returns false for now.
assertFalse("Base32InputStream.markSupported() is false", in.markSupported());
} |
10 | [Fact]
public void ToTs()
{
FileInfo fileInfo = SampleVideoWithAudio;
var output = Path.ChangeExtension(Path.GetTempFileName(), ".ts");
VideoInfo outputVideo = new VideoInfo(fileInfo).ToTs(output);
Assert.True(File.Exists(outputVideo.FilePath));
Assert.Equal(TimeSpan.FromSeconds(13), outputVideo.Duration);
} |
2 | public static void main(String[] args) throws IOException {
logger.info(">>>>> goodsKill-rpc-service 正在启动 <<<<<");
ClassPathXmlApplicationContext context= new ClassPathXmlApplicationContext(
"classpath*:META-INF/spring/spring-*.xml");
context.start();
System.in.read();
logger.info(">>>>> goodsKill-rpc-service 启动完成 <<<<<");
} |
5 | @Override
public float getCovariance(float scale) {
assert (num_updates > 0) : num_updates;
return (sum_inv_covar * scale) * num_updates; // Harmonic mean
} |
3 | public ObjectGraph plus(Object... modules) {
linker.linkAll();
return makeGraph(this, plugin, modules);
} |
4 | private Designer getDesigner(Object adaptable) {
return getResourceResolver(adaptable).adaptTo(Designer.class);
} |
4 | public List<M> getListCache(Object key, IDataLoader dataloader) {
return Jboot.getJbootCache().get(tableName(), key, dataloader);
} |
3 | StringInterner stringInterner() {
if (stringInterner == null)
stringInterner = new StringInterner(8 * 1024);
return stringInterner;
} |
4 | boolean verifyPublicKey(){
//verify the public-KEY-hashes are the same
byte[] publicKey = scriptSig.getPublicKey();
NulsDigestData digestData = NulsDigestData.calcDigestData(publicKey,NulsDigestData.DIGEST_ALG_SHA160);
if(Arrays.equals(digestData.getDigestBytes(),script.getPublicKeyDigest().getDigestBytes())){
return true;
}
return false;
} |
3 | public static Func<TextReader, T> Get()
{
if (Thunk != null) return Thunk;
lock (InitLock)
{
if (Thunk != null) return Thunk;
Thunk = InlineDeserializerHelper.Build<T>(typeof(NewtonsoftStyleTypeCache<>), DateTimeFormat.NewtonsoftStyleMillisecondsSinceUnixEpoch, allowHashing: true, exceptionDuringBuild: out ExceptionDuringBuild);
return Thunk;
}
} |
10 | public Task Handle(IHttpContext context, Func<Task> next)
{
context.Response = HttpResponse.CreateWithMessage(HttpResponseCode.Ok, "Sample http-request-handler");
return Task.Factory.GetCompleted();
} |
4 | @Override
public int getNumberOfFeatures(){
return (Integer)get("n_features");
} |
4 | @Override
public SymbolReference<MethodDeclaration> solveMethod(String name, List<Type> parameterTypes) {
return getContext().solveMethod(name, parameterTypes, typeSolver());
} |
10 | protected override IDatabaseModelFactory CreateDatabaseModelFactory(ILoggerFactory loggerFactory)
=> new MySqlDatabaseModelFactory(
new DiagnosticsLogger<DbLoggerCategory.Scaffolding>(
loggerFactory,
new LoggingOptions(),
new DiagnosticListener("Fake"),
new MySqlLoggingDefinitions(),
new NullDbContextLogger()),
_options); |
2 | @Test
public void testExcelPrinter2() throws IOException {
final StringWriter sw = new StringWriter();
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);
printer.printRecord("a,b", "b");
assertEquals("\"a,b\",b" + recordSeparator, sw.toString());
} |
10 | public Task Start()
{
return connection.Start(new WebsocketCustomTransport());
} |
2 | public void dump()
{
dump(new PrintWriter(new OutputStreamWriter(System.out)));
} |
3 | public static void clearCache(int maxSize) {
Image first;
while (images.size() > 0 && currentMemory > maxSize) {
first = images.remove(0);
first.bimg = null;
currentMemory -= first.bsize;
}
if (maxSize == 0) {
currentMemory = 0;
} else {
currentMemory = Math.max(0, currentMemory);
}
} |
10 | public static void Run()
{
string tableName = "";
DataTable dt = new DataTable();
SqlBulkCopyByDatatable(tableName, dt);
} |
10 | protected static IReadSession CreateReadSession(string directory, long version)
{
return new ReadSessionFactory(directory).OpenReadSession(version);
} |
4 | private void execute() {
Helper helper = new HelperImpl();
RequestContext ctx = RequestContext.getCurrentContext();
HttpServletRequest request = ctx.getRequest();
RequestResponseParser r = new RequestResponseParser();
r.setHeaders(getRequestHeadersInfo(request));
r.setBody(helper.call().request().getBody());
r.setUri(UrlUtil.getCurrentUrl(request));
TraceContextHolder.getInstance().getActualTrace().setRequest(r);
} |
2 | public void testWrite() throws Exception {
final File out1 = File.createTempFile("jdeb", ".ar");
final ArOutputStream os = new ArOutputStream(new FileOutputStream(out1));
os.putNextEntry(new ArEntry("data", 4));
os.write("data".getBytes());
os.close();
assertTrue(out1.delete());
} |
3 | long cleanUpCount()
{
return cleanUpCount;
} |
2 | private ParseResult parseSample(String sampleName) {
InputStream is = this.getClass().getResourceAsStream(
"/com/github/javaparser/issue_samples/" + sampleName + ".java.txt");
Provider p = Providers.provider(is, Charsets.UTF_8);
return new JavaParser().parse(ParseStart.COMPILATION_UNIT, p);
} |
2 | public boolean createQueue(String queueName, long maxSize, int latelySecond) {
try {
InchainFQueue queue = new InchainFQueue(queueName, maxSize);
QueueManager.initQueue(queueName, queue, latelySecond);
return true;
} catch (Exception e) {
Log.error("", e);
return false;
}
} |
3 | void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
} |
4 | private void checkDockerLogin(File homeDir,String configRegistry, String lookupRegistry) throws IOException,
MojoExecutionException {
createDockerConfig(homeDir, "roland", "secret", "roland@jolokia.org", configRegistry);
AuthConfig config = factory.createAuthConfig(null, settings, "roland", lookupRegistry);
verifyAuthConfig(config,"roland","secret","roland@jolokia.org");
} |
4 | static
public List<?> getArray(ClassDict dict, String name, String key){
NDArrayWrapper nodes = (NDArrayWrapper)dict.get(name);
Map<String, ?> content = (Map<String, ?>)nodes.getContent();
return toArray(content.get(key));
} |
3 | protected void reset() {
useBetaVersions = getBoolean("wdm.useBetaVersions");
mirrorLog = false;
isForcingCache = false;
isForcingDownload = false;
listVersions = null;
architecture = null;
driverUrl = null;
versionToDownload = null;
version = null;
proxyValue = null;
binaryPath = null;
proxyUser = null;
proxyPass = null;
ignoredVersions = null;
} |
4 | public override DurabilityProvider GetDurabilityProvider()
{
AzureStorageDurabilityProvider provider = base.GetDurabilityProvider() as AzureStorageDurabilityProvider;
provider.MaximumDelayTime = TimeSpan.FromMinutes(1);
provider.LongRunningTimerIntervalLength = TimeSpan.FromSeconds(25);
return provider;
} |
3 | @Override
public String authority() {
return delegate.authority();
} |
3 | boolean isAvailable() {
return state != HostConnectionState.STANDBY;
} |
3 | @Test
public void testSyncRefresh() throws IOException {
initialize(HeaderCacheElement.TOKEN_STALENESS_MS + 1);
Assert.assertEquals(CacheState.Good, underTest.headerCache.getCacheState());
} |
1 | public TypeDef FindDeclaringType() {
return new MetadataRecord(
new MetadataToken(MetadataTokenType.TypeDef, m_record.Import.PropertyMapTable.FindTypeContainingProperty(m_record.Rid, m_record.Import.PropertyTable.NumberOfRows)),
m_record.Tables
).TypeDef;
} |
3 | public void clear() {
if (staticResourceHandlers != null) {
staticResourceHandlers.clear();
staticResourceHandlers = null;
}
if (jarResourceHandlers != null) {
jarResourceHandlers.clear();
jarResourceHandlers = null;
}
staticResourcesSet = false;
externalStaticResourcesSet = false;
} |
4 | public RawFetchResponse fetch(String bucket, String key) {
return fetch(bucket, key, null);
} |
3 | public boolean contains(String name) {
if (name == null) {
throw new IllegalArgumentException("Other cannot be null");
}
if (this.name.equals(name)) {
return true;
}
if (hasReferences()) {
for (int i = 0; i < refereceList.size(); i++) {
Marker ref = (Marker) refereceList.get(i);
if (ref.contains(name)) {
return true;
}
}
}
return false;
} |
3 | public WriteBucket enableForSearch() {
httpOnly(client.getTransport(), Constants.FL_SCHEMA_SEARCH);
builder.addPrecommitHook(NamedErlangFunction.SEARCH_PRECOMMIT_HOOK).search(true);
return this;
} |
2 | public static void useDefaultEngines() {
useEngine(new GraphvizCmdLineEngine(), new GraphvizV8Engine(),
new GraphvizServerEngine(), new GraphvizJdkEngine());
} |
4 | protected override Variable Evaluate(ParsingScript script)
{
ParserFunction.CleanUpVariables();
return Variable.EmptyInstance;
} |
4 | public <T> List<T> fetch(final JsonObject criteria, final String pojo) {
return this.reader.fetch(criteria, JqFlow.create(this.analyzer, pojo));
} |
10 | public void LogServiceHeartbeat()
{
JsonStruct jsonStruct = new JsonStruct(SERVICE_HEARTBEAT_EVENT, null);
// Run in the background without blocking
this.httpClient.PostAsync(this.PrepareRequest(this.diagnosticsEndpoint, jsonStruct));
} |
4 | @Test
public void testLoadingDatasourceFromJndi() throws Exception {
SqlgGraph g = SqlgGraph.open(configuration);
assertNotNull(g.getSqlDialect());
assertNotNull(g.getSqlgDataSource().get(configuration.getString("jdbc.url")));
} |
3 | protected void callOnError(final ExecutionError error) {
if (onError != null) {
onError.call(error);
}
synchronized (error.getContext()) {
callOnTerminate((C) error.getContext());
error.getContext().notifyAll();
}
} |
3 | @Override
public void receiveResponse(CoapResponse coapResponse) {
if (receiveEnabled) {
receivedResponses.put(System.currentTimeMillis(), coapResponse);
}
} |
3 | @Override
public void add(int index, T element) {
internalIndexedAdd(index, element, true);
} |
4 | @Override
public void performAction() {
AbstractFile targetFile = mainFrame.getActiveTable().getSelectedFile();
if (targetFile == null) {
targetFile = mainFrame.getInactiveTable().getFileTableModel().getFileAt(0).getParent();
}
AbstractFile linkPath = mainFrame.getActivePanel().getCurrentFolder();
new CreateSymLinkDialog(mainFrame, linkPath, targetFile).showDialog();
} |
10 | [TestMethod]
public void SetValidPositionOnOverflowTest()
{
// arrange
var chunk = new Chunk(0, 1023) {
Position = 1024,
Storage = new MemoryStorage() // overflowed
};
// act
chunk.SetValidPosition();
// assert
Assert.AreEqual(0, chunk.Position);
} |
3 | public void completeResponse() {
long wrote = output().size() - bodyPos;
U.must(wrote <= Integer.MAX_VALUE, "Response too big!");
int pos = startingPos + getResp(responseCode).contentLengthPos + 10;
output().putNumAsText(pos, wrote, false);
} |
2 | @Test
public void shouldPrintScoresFourToALine() {
final ByteArrayOutputStream s = new ByteArrayOutputStream();
final PrintStream out = new PrintStream(s);
this.testee.report(out);
final String actual = new String(s.toByteArray());
final String[] ss = actual.split(StringUtil.newLine());
assertEquals("> foo", ss[0]);
assertEquals("> KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 ", ss[1]);
} |
3 | @Override
public void printStackTrace(PrintWriter writer) {
if (borrowedBy != null) {
borrowedBy.printStackTrace(writer);
}
if (usedBy != null) {
usedBy.printStackTrace(writer);
}
} |