max_stars_count
int64 301
224k
| text
stringlengths 6
1.05M
| token_count
int64 3
727k
|
---|---|---|
559 | /**
* Copyright (c) 2016-2017 Netflix, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <MslCryptoException.h>
#include <MslEncodingException.h>
#include <MslEntityAuthException.h>
#include <MslError.h>
#include <crypto/ICryptoContext.h>
#include <entityauth/UnauthenticatedAuthenticationData.h>
#include <entityauth/UnauthenticatedAuthenticationFactory.h>
#include <io/MslEncoderException.h>
#include <io/MslEncoderFactory.h>
#include <io/MslEncoderFormat.h>
#include <io/MslEncoderUtils.h>
#include <io/MslObject.h>
#include <memory>
#include <gtest/gtest.h>
#include <util/MockAuthenticationUtils.h>
#include <util/MockMslContext.h>
#include <util/MslTestUtils.h>
using namespace std;
using namespace testing;
using namespace netflix::msl::crypto;
using namespace netflix::msl::io;
using namespace netflix::msl::util;
namespace netflix {
namespace msl {
typedef vector<uint8_t> ByteArray;
namespace entityauth {
namespace {
/** Key entity identity. */
const string KEY_IDENTITY = "identity";
const string UNAUTHENTICATED_ESN = "MOCKUNAUTH-ESN";
} // namespace anonymous
/**
* Unauthenticated authentication factory unit tests.
*
* @author <NAME> <<EMAIL>.com>
*/
class UnauthenticatedAuthenticationFactoryTest : public ::testing::Test
{
public:
UnauthenticatedAuthenticationFactoryTest()
: ctx(make_shared<MockMslContext>(EntityAuthenticationScheme::NONE, false))
, encoder(ctx->getMslEncoderFactory())
, format(MslEncoderFormat::JSON)
, authutils(make_shared<MockAuthenticationUtils>())
, factory(make_shared<UnauthenticatedAuthenticationFactory>(authutils))
{
ctx->addEntityAuthenticationFactory(factory);
}
protected:
/** MSL context. */
shared_ptr<MockMslContext> ctx;
/** MSL encoder factory. */
shared_ptr<MslEncoderFactory> encoder;
/** MSL encoder format. */
const MslEncoderFormat format;
/** Authentication utilities. */
shared_ptr<MockAuthenticationUtils> authutils;
/** Entity authentication factory. */
shared_ptr<EntityAuthenticationFactory> factory;
};
TEST_F(UnauthenticatedAuthenticationFactoryTest, createData)
{
shared_ptr<UnauthenticatedAuthenticationData> data = make_shared<UnauthenticatedAuthenticationData>(UNAUTHENTICATED_ESN);
shared_ptr<MslObject> entityAuthMo = data->getAuthData(encoder, format);
shared_ptr<EntityAuthenticationData> authdata = factory->createData(ctx, entityAuthMo);
EXPECT_TRUE(authdata);
EXPECT_TRUE(instanceof<UnauthenticatedAuthenticationData>(authdata.get()));
shared_ptr<MslObject> dataMo = MslTestUtils::toMslObject(encoder, data);
shared_ptr<MslObject> authdataMo = MslTestUtils::toMslObject(encoder, authdata);
EXPECT_TRUE(MslEncoderUtils::equalObjects(dataMo, authdataMo));
}
TEST_F(UnauthenticatedAuthenticationFactoryTest, encodeException)
{
shared_ptr<UnauthenticatedAuthenticationData> data = make_shared<UnauthenticatedAuthenticationData>(UNAUTHENTICATED_ESN);
shared_ptr<MslObject> entityAuthMo = data->getAuthData(encoder, format);
EXPECT_FALSE(entityAuthMo->remove(KEY_IDENTITY).isNull());
try {
factory->createData(ctx, entityAuthMo);
ADD_FAILURE() << "Should have thrown";
} catch (const MslEncodingException& e) {
EXPECT_EQ(MslError::MSL_PARSE_ERROR, e.getError());
}
}
TEST_F(UnauthenticatedAuthenticationFactoryTest, cryptoContext)
{
shared_ptr<UnauthenticatedAuthenticationData> data = make_shared<UnauthenticatedAuthenticationData>(UNAUTHENTICATED_ESN);
shared_ptr<ICryptoContext> cryptoContext = factory->getCryptoContext(ctx, data);
EXPECT_TRUE(cryptoContext);
}
TEST_F(UnauthenticatedAuthenticationFactoryTest, notPermitted)
{
authutils->disallowScheme(UNAUTHENTICATED_ESN, EntityAuthenticationScheme::NONE);
shared_ptr<UnauthenticatedAuthenticationData> data = make_shared<UnauthenticatedAuthenticationData>(UNAUTHENTICATED_ESN);
try {
factory->getCryptoContext(ctx, data);
ADD_FAILURE() << "Should have thrown";
} catch (const MslEntityAuthException& e) {
EXPECT_EQ(MslError::INCORRECT_ENTITYAUTH_DATA, e.getError());
}
}
TEST_F(UnauthenticatedAuthenticationFactoryTest, revoked)
{
authutils->revokeEntity(UNAUTHENTICATED_ESN);
shared_ptr<UnauthenticatedAuthenticationData> data = make_shared<UnauthenticatedAuthenticationData>(UNAUTHENTICATED_ESN);
try {
factory->getCryptoContext(ctx, data);
ADD_FAILURE() << "Should have thrown";
} catch (const MslEntityAuthException& e) {
EXPECT_EQ(MslError::ENTITY_REVOKED, e.getError());
}
}
}}} // namespace netflix::msl::entityauth
| 1,670 |
579 | /**
* @file rpc_connect_handlers.cc
* @brief Handlers for session management connect requests and responses.
*/
#include "rpc.h"
namespace erpc {
// We need to handle all types of errors in remote arguments that the client can
// make when calling create_session(), which cannot check for such errors.
template <class TTr>
void Rpc<TTr>::handle_connect_req_st(const SmPkt &sm_pkt) {
assert(in_dispatch());
assert(sm_pkt.pkt_type_ == SmPktType::kConnectReq &&
sm_pkt.server_.rpc_id_ == rpc_id_);
char issue_msg[kMaxIssueMsgLen]; // The basic issue message
sprintf(issue_msg, "Rpc %u: Received connect request from %s. Issue", rpc_id_,
sm_pkt.client_.name().c_str());
// Handle duplicate session connect requests
if (conn_req_token_map_.count(sm_pkt.uniq_token_) > 0) {
uint16_t srv_session_num = conn_req_token_map_[sm_pkt.uniq_token_];
assert(session_vec_.size() > srv_session_num);
const Session *session = session_vec_[srv_session_num];
if (session == nullptr || session->state_ != SessionState::kConnected) {
ERPC_INFO("%s: Duplicate request, and response is unneeded.\n",
issue_msg);
return;
} else {
SmPkt resp_sm_pkt = sm_construct_resp(sm_pkt, SmErrType::kNoError);
resp_sm_pkt.server_ = session->server_; // Re-send server endpoint info
ERPC_INFO("%s: Duplicate request. Re-sending response.\n", issue_msg);
sm_pkt_udp_tx_st(resp_sm_pkt);
return;
}
}
// If we're here, this is the first time we're receiving this connect request
// Check that the transport matches
if (sm_pkt.server_.transport_type_ != transport_->transport_type_) {
ERPC_WARN("%s: Invalid transport %s. Sending response.\n", issue_msg,
Transport::get_name(sm_pkt.server_.transport_type_).c_str());
sm_pkt_udp_tx_st(sm_construct_resp(sm_pkt, SmErrType::kInvalidTransport));
return;
}
// Check if we are allowed to create another session
if (!have_ring_entries()) {
ERPC_WARN("%s: Ring buffers exhausted. Sending response.\n", issue_msg);
sm_pkt_udp_tx_st(sm_construct_resp(sm_pkt, SmErrType::kRingExhausted));
return;
}
// Try to resolve the client-provided routing info. If session creation
// succeeds, we'll copy it to the server's session endpoint.
Transport::routing_info_t client_rinfo = sm_pkt.client_.routing_info_;
bool resolve_success;
if (kTesting && faults_.fail_resolve_rinfo_) {
resolve_success = false;
} else {
resolve_success = transport_->resolve_remote_routing_info(&client_rinfo);
}
if (!resolve_success) {
std::string routing_info_str = TTr::routing_info_str(&client_rinfo);
ERPC_WARN("%s: Unable to resolve routing info %s. Sending response.\n",
issue_msg, routing_info_str.c_str());
sm_pkt_udp_tx_st(
sm_construct_resp(sm_pkt, SmErrType::kRoutingResolutionFailure));
return;
}
// If we are here, create a new session and fill preallocated MsgBuffers
auto *session = new Session(Session::Role::kServer, sm_pkt.uniq_token_,
get_freq_ghz(), transport_->get_bandwidth());
session->state_ = SessionState::kConnected;
for (size_t i = 0; i < kSessionReqWindow; i++) {
MsgBuffer &msgbuf_i = session->sslot_arr_[i].pre_resp_msgbuf_;
msgbuf_i = alloc_msg_buffer(pre_resp_msgbuf_size_);
if (msgbuf_i.buf_ == nullptr) {
// Cleanup everything allocated for this session
for (size_t j = 0; j < i; j++) {
MsgBuffer &msgbuf_j = session->sslot_arr_[j].pre_resp_msgbuf_;
assert(msgbuf_j.buf_ != nullptr);
free_msg_buffer(msgbuf_j);
}
free(session);
ERPC_WARN("%s: Failed to allocate prealloc MsgBuffer.\n", issue_msg);
sm_pkt_udp_tx_st(sm_construct_resp(sm_pkt, SmErrType::kOutOfMemory));
return;
}
}
// Fill-in the server endpoint
session->server_ = sm_pkt.server_;
session->server_.session_num_ = session_vec_.size();
transport_->fill_local_routing_info(&session->server_.routing_info_);
conn_req_token_map_[session->uniq_token_] = session->server_.session_num_;
// Fill-in the client endpoint
session->client_ = sm_pkt.client_;
session->client_.routing_info_ = client_rinfo;
session->local_session_num_ = session->server_.session_num_;
session->remote_session_num_ = session->client_.session_num_;
alloc_ring_entries();
session_vec_.push_back(session); // Add to list of all sessions
// Add server endpoint info created above to resp. No need to add client info.
SmPkt resp_sm_pkt = sm_construct_resp(sm_pkt, SmErrType::kNoError);
resp_sm_pkt.server_ = session->server_;
ERPC_INFO("%s: None. Sending response.\n", issue_msg);
sm_pkt_udp_tx_st(resp_sm_pkt);
return;
}
template <class TTr>
void Rpc<TTr>::handle_connect_resp_st(const SmPkt &sm_pkt) {
assert(in_dispatch());
assert(sm_pkt.pkt_type_ == SmPktType::kConnectResp &&
sm_pkt.client_.rpc_id_ == rpc_id_);
// Create the basic issue message using only the packet
char issue_msg[kMaxIssueMsgLen];
sprintf(issue_msg,
"Rpc %u: Received connect response from %s for session %u. Issue",
rpc_id_, sm_pkt.server_.name().c_str(), sm_pkt.client_.session_num_);
uint16_t session_num = sm_pkt.client_.session_num_;
assert(session_num < session_vec_.size());
// Handle reordering. We don't need the session token for this.
Session *session = session_vec_[session_num];
if (session == nullptr ||
session->state_ != SessionState::kConnectInProgress) {
ERPC_INFO("%s: Duplicate response. Ignoring.\n", issue_msg);
return;
}
assert(session->is_client() && session->client_ == sm_pkt.client_);
// We don't have the server's session number locally yet, so we cannot use
// SessionEndpoint comparator to compare server endpoint metadata.
assert(strcmp(session->server_.hostname_, sm_pkt.server_.hostname_) == 0);
assert(session->server_.rpc_id_ == sm_pkt.server_.rpc_id_);
assert(session->server_.session_num_ == kInvalidSessionNum);
// Handle special error cases for which we retry the connect request
if (sm_pkt.err_type_ == SmErrType::kInvalidRemoteRpcId) {
if (retry_connect_on_invalid_rpc_id_) {
ERPC_INFO("%s: Invalid remote Rpc ID. Dropping. Scan will retry later.\n",
issue_msg);
sm_pending_reqs_.insert(session->local_session_num_); // Duplicates fine
return;
}
}
if (sm_pkt.err_type_ != SmErrType::kNoError) {
// The server didn't allocate session resources, so we can just destroy
ERPC_WARN("%s: Error %s.\n", issue_msg,
sm_err_type_str(sm_pkt.err_type_).c_str());
free_ring_entries(); // Free before callback to allow creating new session
sm_handler_(session->local_session_num_, SmEventType::kConnectFailed,
sm_pkt.err_type_, context_);
bury_session_st(session);
return;
}
// If we are here, the server has created a session endpoint
// Try to resolve the server-provided routing info
Transport::routing_info_t srv_routing_info = sm_pkt.server_.routing_info_;
bool resolve_success;
if (kTesting && faults_.fail_resolve_rinfo_) {
resolve_success = false; // Inject fault
} else {
resolve_success =
transport_->resolve_remote_routing_info(&srv_routing_info);
}
if (!resolve_success) {
// Free server resources by disconnecting. No connected (with error)
// callback will be invoked.
ERPC_WARN("%s: Failed to resolve server routing info. Disconnecting.\n",
issue_msg);
session->server_ = sm_pkt.server_; // Needed for disconnect response later
// Do what destroy_session() does with a connected session
session->state_ = SessionState::kDisconnectInProgress;
send_sm_req_st(session);
return;
}
// Save server endpoint metadata
session->server_ = sm_pkt.server_; // This fills most fields
session->server_.routing_info_ = srv_routing_info;
session->remote_session_num_ = session->server_.session_num_;
session->state_ = SessionState::kConnected;
session->client_info_.cc_.prev_desired_tx_tsc_ = rdtsc();
ERPC_INFO("%s: None. Session connected.\n", issue_msg);
sm_handler_(session->local_session_num_, SmEventType::kConnected,
SmErrType::kNoError, context_);
}
FORCE_COMPILE_TRANSPORTS
} // namespace erpc
| 3,200 |
562 | from datetime import datetime
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
from sqlalchemy.schema import Index
from freight.config import db
from freight.db.types.json import JSONEncodedDict
DEFAULT_REF = "master"
class App(db.Model):
"""
Example App configuration:
{
"environments": {
"production": {
"default_ref": "master"
}
}
}
"""
__tablename__ = "app"
__table_args__ = (Index("idx_app_repository_id", "repository_id"),)
id = Column(Integer, primary_key=True)
repository_id = Column(
Integer, ForeignKey("repository.id", ondelete="CASCADE"), nullable=False
)
name = Column(String(200), nullable=False, unique=True)
provider = Column(String(64))
data = Column(JSONEncodedDict)
date_created = Column(DateTime, default=datetime.utcnow, nullable=False)
@property
def environments(self):
return self.data.get("environments", {})
@property
def deploy_config(self):
from freight.models import TaskConfig, TaskConfigType
return TaskConfig.query.filter(
TaskConfig.app_id == self.id, TaskConfig.type == TaskConfigType.deploy
).first()
def get_default_ref(self, env):
data = self.environments.get(env)
if not data:
return DEFAULT_REF
return data.get("default_ref", DEFAULT_REF)
def get_current_sha(self, env):
from freight.models import Task, Deploy, TaskStatus
return (
db.session.query(Task.sha)
.filter(
Deploy.task_id == Task.id,
Task.app_id == self.id,
Deploy.environment == env,
Task.status == TaskStatus.finished,
)
.order_by(Deploy.number.desc())
.limit(1)
.scalar()
)
def get_previous_sha(self, env, current_sha=None):
from freight.models import Task, Deploy, TaskStatus
if current_sha is None:
current_sha = self.get_current_sha(env)
if current_sha is None:
return None
return (
db.session.query(Task.sha)
.filter(
Deploy.task_id == Task.id,
Task.app_id == self.id,
Deploy.environment == env,
Task.status == TaskStatus.finished,
Task.sha != current_sha,
)
.order_by(Deploy.number.desc())
.limit(1)
.scalar()
)
| 1,195 |
556 | <gh_stars>100-1000
//////////////////////////////////////////////////////////
// GENERATED BY FLUTTIFY. DO NOT EDIT IT.
//////////////////////////////////////////////////////////
package me.yohom.amap_map_fluttify.sub_handler;
import android.os.Bundle;
import android.util.Log;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.plugin.common.StandardMethodCodec;
import io.flutter.plugin.platform.PlatformViewRegistry;
import me.yohom.amap_map_fluttify.AmapMapFluttifyPlugin.Handler;
import me.yohom.foundation_fluttify.core.FluttifyMessageCodec;
import static me.yohom.foundation_fluttify.FoundationFluttifyPluginKt.getEnableLog;
import static me.yohom.foundation_fluttify.FoundationFluttifyPluginKt.getHEAP;
@SuppressWarnings("ALL")
public class SubHandler2 {
public static Map<String, Handler> getSubHandler(BinaryMessenger messenger) {
return new HashMap<String, Handler>() {{
// method
put("com.amap.api.maps.model.CircleHoleOptions::radius", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.CircleHoleOptions __this__ = (com.amap.api.maps.model.CircleHoleOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.CircleHoleOptions@" + __this__ + "::radius(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.CircleHoleOptions __result__ = null;
try {
__result__ = __this__.radius(var1.doubleValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.CircleHoleOptions::getCenter", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.CircleHoleOptions __this__ = (com.amap.api.maps.model.CircleHoleOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.CircleHoleOptions@" + __this__ + "::getCenter(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLng __result__ = null;
try {
__result__ = __this__.getCenter();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.CircleHoleOptions::getRadius", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.CircleHoleOptions __this__ = (com.amap.api.maps.model.CircleHoleOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.CircleHoleOptions@" + __this__ + "::getRadius(" + "" + ")");
}
// invoke native method
Double __result__ = null;
try {
__result__ = __this__.getRadius();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::remove", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::remove(" + "" + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.remove();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::destroy", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::destroy(" + "" + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.destroy();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getId", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getId(" + "" + ")");
}
// invoke native method
String __result__ = null;
try {
__result__ = __this__.getId();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setPosition", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setPosition(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setPosition(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getPosition", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getPosition(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLng __result__ = null;
try {
__result__ = __this__.getPosition();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setText", (__args__, __methodResult__) -> {
// args
// ref arg
String var1 = (String) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setText(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setText(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getText", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getText(" + "" + ")");
}
// invoke native method
String __result__ = null;
try {
__result__ = __this__.getText();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setBackgroundColor", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setBackgroundColor(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setBackgroundColor(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getBackgroundColor", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getBackgroundColor(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getBackgroundColor();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setFontColor", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setFontColor(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setFontColor(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getFontColor", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getFontColor(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getFontColor();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setFontSize", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setFontSize(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setFontSize(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getFontSize", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getFontSize(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getFontSize();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setAlign", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setAlign(" + var1 + var2 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setAlign(var1.intValue(), var2.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getAlignX", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getAlignX(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getAlignX();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getAlignY", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getAlignY(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getAlignY();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setVisible", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setVisible(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setVisible(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::isVisible", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::isVisible(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isVisible();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setObject", (__args__, __methodResult__) -> {
// args
// ref arg
java.lang.Object var1 = (java.lang.Object) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setObject(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setObject(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getObject", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getObject(" + "" + ")");
}
// invoke native method
java.lang.Object __result__ = null;
try {
__result__ = __this__.getObject();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setRotate", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setRotate(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setRotate(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getRotate", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getRotate(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getRotate();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::setZIndex", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::setZIndex(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setZIndex(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Text::getZIndex", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Text __this__ = (com.amap.api.maps.model.Text) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Text@" + __this__ + "::getZIndex(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getZIndex();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.LatLngBounds.Builder::include", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.LatLngBounds.Builder __this__ = (com.amap.api.maps.model.LatLngBounds.Builder) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.LatLngBounds.Builder@" + __this__ + "::include(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.LatLngBounds.Builder __result__ = null;
try {
__result__ = __this__.include(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.LatLngBounds.Builder::build", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.LatLngBounds.Builder __this__ = (com.amap.api.maps.model.LatLngBounds.Builder) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.LatLngBounds.Builder@" + __this__ + "::build(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLngBounds __result__ = null;
try {
__result__ = __this__.build();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapLayer::destroy", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.HeatMapLayer __this__ = (com.amap.api.maps.model.HeatMapLayer) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapLayer@" + __this__ + "::destroy(" + "" + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.destroy();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapLayer::getId", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.HeatMapLayer __this__ = (com.amap.api.maps.model.HeatMapLayer) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapLayer@" + __this__ + "::getId(" + "" + ")");
}
// invoke native method
String __result__ = null;
try {
__result__ = __this__.getId();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapLayer::setZIndex", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.HeatMapLayer __this__ = (com.amap.api.maps.model.HeatMapLayer) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapLayer@" + __this__ + "::setZIndex(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setZIndex(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapLayer::getZIndex", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.HeatMapLayer __this__ = (com.amap.api.maps.model.HeatMapLayer) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapLayer@" + __this__ + "::getZIndex(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getZIndex();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapLayer::setVisible", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.HeatMapLayer __this__ = (com.amap.api.maps.model.HeatMapLayer) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapLayer@" + __this__ + "::setVisible(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setVisible(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapLayer::isVisible", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.HeatMapLayer __this__ = (com.amap.api.maps.model.HeatMapLayer) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapLayer@" + __this__ + "::isVisible(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isVisible();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapLayer::getHeatMapItem", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.HeatMapLayer __this__ = (com.amap.api.maps.model.HeatMapLayer) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapLayer@" + __this__ + "::getHeatMapItem(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.HeatMapItem __result__ = null;
try {
__result__ = __this__.getHeatMapItem(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapLayer::getOptions", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.HeatMapLayer __this__ = (com.amap.api.maps.model.HeatMapLayer) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapLayer@" + __this__ + "::getOptions(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.HeatMapLayerOptions __result__ = null;
try {
__result__ = __this__.getOptions();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapLayer::setOptions", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.HeatMapLayerOptions var1 = (com.amap.api.maps.model.HeatMapLayerOptions) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.HeatMapLayer __this__ = (com.amap.api.maps.model.HeatMapLayer) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapLayer@" + __this__ + "::setOptions(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setOptions(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::add__com_amap_api_maps_model_LatLng", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::add(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.NavigateArrowOptions __result__ = null;
try {
__result__ = __this__.add(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::addAll", (__args__, __methodResult__) -> {
// args
// ref arg
java.lang.Iterable<com.amap.api.maps.model.LatLng> var1 = (java.lang.Iterable<com.amap.api.maps.model.LatLng>) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::addAll(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.NavigateArrowOptions __result__ = null;
try {
__result__ = __this__.addAll(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::width", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::width(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.NavigateArrowOptions __result__ = null;
try {
__result__ = __this__.width(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::topColor", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::topColor(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.NavigateArrowOptions __result__ = null;
try {
__result__ = __this__.topColor(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::sideColor", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::sideColor(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.NavigateArrowOptions __result__ = null;
try {
__result__ = __this__.sideColor(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::zIndex", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::zIndex(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.NavigateArrowOptions __result__ = null;
try {
__result__ = __this__.zIndex(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::visible", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::visible(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.NavigateArrowOptions __result__ = null;
try {
__result__ = __this__.visible(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::set3DModel", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::set3DModel(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.NavigateArrowOptions __result__ = null;
try {
__result__ = __this__.set3DModel(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::getPoints", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::getPoints(" + "" + ")");
}
// invoke native method
java.util.List<com.amap.api.maps.model.LatLng> __result__ = null;
try {
__result__ = __this__.getPoints();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::getWidth", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::getWidth(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getWidth();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::getTopColor", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::getTopColor(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getTopColor();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::getSideColor", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::getSideColor(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getSideColor();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::getZIndex", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::getZIndex(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getZIndex();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::isVisible", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::isVisible(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isVisible();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::is3DModel", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::is3DModel(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.is3DModel();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NavigateArrowOptions::setPoints", (__args__, __methodResult__) -> {
// args
// ref arg
java.util.List<com.amap.api.maps.model.LatLng> var1 = (java.util.List<com.amap.api.maps.model.LatLng>) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NavigateArrowOptions __this__ = (com.amap.api.maps.model.NavigateArrowOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NavigateArrowOptions@" + __this__ + "::setPoints(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setPoints(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.BitmapDescriptorFactory::fromResource", (__args__, __methodResult__) -> {
// args
// ref arg
Number var0 = (Number) ((Map<String, Object>) __args__).get("var0");
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.BitmapDescriptorFactory::fromResource(" + var0 + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = com.amap.api.maps.model.BitmapDescriptorFactory.fromResource(var0.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.BitmapDescriptorFactory::fromView", (__args__, __methodResult__) -> {
// args
// ref arg
android.view.View var0 = (android.view.View) ((Map<String, Object>) __args__).get("var0");
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.BitmapDescriptorFactory::fromView(" + var0 + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = com.amap.api.maps.model.BitmapDescriptorFactory.fromView(var0);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.BitmapDescriptorFactory::fromPath", (__args__, __methodResult__) -> {
// args
// ref arg
String var0 = (String) ((Map<String, Object>) __args__).get("var0");
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.BitmapDescriptorFactory::fromPath(" + var0 + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = com.amap.api.maps.model.BitmapDescriptorFactory.fromPath(var0);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.BitmapDescriptorFactory::fromAsset", (__args__, __methodResult__) -> {
// args
// ref arg
String var0 = (String) ((Map<String, Object>) __args__).get("var0");
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.BitmapDescriptorFactory::fromAsset(" + var0 + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = com.amap.api.maps.model.BitmapDescriptorFactory.fromAsset(var0);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.BitmapDescriptorFactory::fromFile", (__args__, __methodResult__) -> {
// args
// ref arg
String var0 = (String) ((Map<String, Object>) __args__).get("var0");
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.BitmapDescriptorFactory::fromFile(" + var0 + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = com.amap.api.maps.model.BitmapDescriptorFactory.fromFile(var0);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.BitmapDescriptorFactory::defaultMarker", (__args__, __methodResult__) -> {
// args
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.BitmapDescriptorFactory::defaultMarker(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = com.amap.api.maps.model.BitmapDescriptorFactory.defaultMarker();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.BitmapDescriptorFactory::defaultMarker__double", (__args__, __methodResult__) -> {
// args
// ref arg
Number var0 = (Number) ((Map<String, Object>) __args__).get("var0");
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.BitmapDescriptorFactory::defaultMarker(" + var0 + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = com.amap.api.maps.model.BitmapDescriptorFactory.defaultMarker(var0.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.BitmapDescriptorFactory::fromBitmap", (__args__, __methodResult__) -> {
// args
// ref arg
android.graphics.Bitmap var0 = (android.graphics.Bitmap) ((Map<String, Object>) __args__).get("var0");
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.BitmapDescriptorFactory::fromBitmap(" + var0 + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = com.amap.api.maps.model.BitmapDescriptorFactory.fromBitmap(var0);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.BitmapDescriptorFactory::getContext", (__args__, __methodResult__) -> {
// args
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.BitmapDescriptorFactory::getContext(" + "" + ")");
}
// invoke native method
android.content.Context __result__ = null;
try {
__result__ = com.amap.api.maps.model.BitmapDescriptorFactory.getContext();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.AMapPara.LineJoinType::getTypeValue", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.AMapPara.LineJoinType __this__ = (com.amap.api.maps.model.AMapPara.LineJoinType) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.AMapPara.LineJoinType@" + __this__ + "::getTypeValue(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getTypeValue();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.AMapPara.LineJoinType::valueOf", (__args__, __methodResult__) -> {
// args
// ref arg
Number var0 = (Number) ((Map<String, Object>) __args__).get("var0");
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.AMapPara.LineJoinType::valueOf(" + var0 + ")");
}
// invoke native method
com.amap.api.maps.model.AMapPara.LineJoinType __result__ = null;
try {
__result__ = com.amap.api.maps.model.AMapPara.LineJoinType.valueOf(var0.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.MultiPointOverlayOptions::anchor", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.MultiPointOverlayOptions __this__ = (com.amap.api.maps.model.MultiPointOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.MultiPointOverlayOptions@" + __this__ + "::anchor(" + var1 + var2 + ")");
}
// invoke native method
com.amap.api.maps.model.MultiPointOverlayOptions __result__ = null;
try {
__result__ = __this__.anchor(var1.floatValue(), var2.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.MultiPointOverlayOptions::getAnchorU", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.MultiPointOverlayOptions __this__ = (com.amap.api.maps.model.MultiPointOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.MultiPointOverlayOptions@" + __this__ + "::getAnchorU(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getAnchorU();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.MultiPointOverlayOptions::getAnchorV", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.MultiPointOverlayOptions __this__ = (com.amap.api.maps.model.MultiPointOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.MultiPointOverlayOptions@" + __this__ + "::getAnchorV(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getAnchorV();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.MultiPointOverlayOptions::icon", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.BitmapDescriptor var1 = (com.amap.api.maps.model.BitmapDescriptor) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.MultiPointOverlayOptions __this__ = (com.amap.api.maps.model.MultiPointOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.MultiPointOverlayOptions@" + __this__ + "::icon(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.MultiPointOverlayOptions __result__ = null;
try {
__result__ = __this__.icon(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.MultiPointOverlayOptions::getIcon", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.MultiPointOverlayOptions __this__ = (com.amap.api.maps.model.MultiPointOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.MultiPointOverlayOptions@" + __this__ + "::getIcon(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = __this__.getIcon();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setUseTexture", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setUseTexture(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setUseTexture(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setCustomTexture", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.BitmapDescriptor var1 = (com.amap.api.maps.model.BitmapDescriptor) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setCustomTexture(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setCustomTexture(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getCustomTexture", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getCustomTexture(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = __this__.getCustomTexture();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setCustomTextureList", (__args__, __methodResult__) -> {
// args
// ref arg
java.util.List<com.amap.api.maps.model.BitmapDescriptor> var1 = (java.util.List<com.amap.api.maps.model.BitmapDescriptor>) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setCustomTextureList(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setCustomTextureList(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getCustomTextureList", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getCustomTextureList(" + "" + ")");
}
// invoke native method
java.util.List<com.amap.api.maps.model.BitmapDescriptor> __result__ = null;
try {
__result__ = __this__.getCustomTextureList();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setCustomTextureIndex", (__args__, __methodResult__) -> {
// args
// ref arg
java.util.List<Integer> var1 = (java.util.List<Integer>) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setCustomTextureIndex(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setCustomTextureIndex(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getCustomTextureIndex", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getCustomTextureIndex(" + "" + ")");
}
// invoke native method
java.util.List<Integer> __result__ = null;
try {
__result__ = __this__.getCustomTextureIndex();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::colorValues", (__args__, __methodResult__) -> {
// args
// ref arg
java.util.List<Integer> var1 = (java.util.List<Integer>) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::colorValues(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.colorValues(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getColorValues", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getColorValues(" + "" + ")");
}
// invoke native method
java.util.List<Integer> __result__ = null;
try {
__result__ = __this__.getColorValues();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::useGradient", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::useGradient(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.useGradient(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::isUseGradient", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::isUseGradient(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isUseGradient();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::isUseTexture", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::isUseTexture(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isUseTexture();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::isGeodesic", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::isGeodesic(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isGeodesic();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::add__com_amap_api_maps_model_LatLng", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::add(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.add(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::addAll", (__args__, __methodResult__) -> {
// args
// ref arg
java.lang.Iterable<com.amap.api.maps.model.LatLng> var1 = (java.lang.Iterable<com.amap.api.maps.model.LatLng>) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::addAll(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.addAll(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::width", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::width(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.width(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::color", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::color(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.color(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::zIndex", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::zIndex(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.zIndex(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::visible", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::visible(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.visible(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::geodesic", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::geodesic(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.geodesic(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setDottedLine", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setDottedLine(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setDottedLine(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::isDottedLine", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::isDottedLine(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isDottedLine();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setDottedLineType", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setDottedLineType(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setDottedLineType(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::lineCapType", (__args__, __methodResult__) -> {
// args
// enum arg
com.amap.api.maps.model.PolylineOptions.LineCapType var1 = com.amap.api.maps.model.PolylineOptions.LineCapType.values()[(int) ((Map<String, Object>) __args__).get("var1")];
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::lineCapType(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.lineCapType(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::lineJoinType", (__args__, __methodResult__) -> {
// args
// enum arg
com.amap.api.maps.model.PolylineOptions.LineJoinType var1 = com.amap.api.maps.model.PolylineOptions.LineJoinType.values()[(int) ((Map<String, Object>) __args__).get("var1")];
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::lineJoinType(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.lineJoinType(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getLineCapType", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getLineCapType(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions.LineCapType __result__ = null;
try {
__result__ = __this__.getLineCapType();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getLineJoinType", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getLineJoinType(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions.LineJoinType __result__ = null;
try {
__result__ = __this__.getLineJoinType();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getDottedLineType", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getDottedLineType(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getDottedLineType();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getPoints", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getPoints(" + "" + ")");
}
// invoke native method
java.util.List<com.amap.api.maps.model.LatLng> __result__ = null;
try {
__result__ = __this__.getPoints();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getWidth", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getWidth(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getWidth();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getColor", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getColor(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getColor();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getZIndex", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getZIndex(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getZIndex();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::isVisible", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::isVisible(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isVisible();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::transparency", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::transparency(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.transparency(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getTransparency", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getTransparency(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getTransparency();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::aboveMaskLayer", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::aboveMaskLayer(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.aboveMaskLayer(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::isAboveMaskLayer", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::isAboveMaskLayer(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isAboveMaskLayer();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setPoints", (__args__, __methodResult__) -> {
// args
// ref arg
java.util.List<com.amap.api.maps.model.LatLng> var1 = (java.util.List<com.amap.api.maps.model.LatLng>) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setPoints(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setPoints(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getShownRatio", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getShownRatio(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getShownRatio();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setShownRatio", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setShownRatio(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setShownRatio(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setShownRange", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setShownRange(" + var1 + var2 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setShownRange(var1.floatValue(), var2.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getShownRangeBegin", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getShownRangeBegin(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getShownRangeBegin();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getShownRangeEnd", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getShownRangeEnd(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getShownRangeEnd();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::showPolylineRangeEnabled", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::showPolylineRangeEnabled(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.showPolylineRangeEnabled(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::isShowPolylineRangeEnable", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::isShowPolylineRangeEnable(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isShowPolylineRangeEnable();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setPolylineShowRange", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setPolylineShowRange(" + var1 + var2 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setPolylineShowRange(var1.floatValue(), var2.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getPolylineShownRangeBegin", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getPolylineShownRangeBegin(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getPolylineShownRangeBegin();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getPolylineShownRangeEnd", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getPolylineShownRangeEnd(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getPolylineShownRangeEnd();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setFootPrintTexture", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.BitmapDescriptor var1 = (com.amap.api.maps.model.BitmapDescriptor) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setFootPrintTexture(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setFootPrintTexture(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getFootPrintTexture", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getFootPrintTexture(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = __this__.getFootPrintTexture();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setFootPrintGap", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setFootPrintGap(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setFootPrintGap(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getFootPrintGap", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getFootPrintGap(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getFootPrintGap();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setEraseTexture", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref arg
com.amap.api.maps.model.BitmapDescriptor var2 = (com.amap.api.maps.model.BitmapDescriptor) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setEraseTexture(" + var1 + var2 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setEraseTexture(var1, var2);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getEraseTexture", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getEraseTexture(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = __this__.getEraseTexture();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getEraseVisible", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getEraseVisible(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.getEraseVisible();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::setEraseColor", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::setEraseColor(" + var1 + var2 + ")");
}
// invoke native method
com.amap.api.maps.model.PolylineOptions __result__ = null;
try {
__result__ = __this__.setEraseColor(var1, var2.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.PolylineOptions::getEraseColor", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.PolylineOptions __this__ = (com.amap.api.maps.model.PolylineOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.PolylineOptions@" + __this__ + "::getEraseColor(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getEraseColor();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Tile::obtain", (__args__, __methodResult__) -> {
// args
// ref arg
Number var0 = (Number) ((Map<String, Object>) __args__).get("var0");
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref arg
byte[] var2 = (byte[]) ((Map<String, Object>) __args__).get("var2");
// ref
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Tile::obtain(" + var0 + var1 + var2 + ")");
}
// invoke native method
com.amap.api.maps.model.Tile __result__ = null;
try {
__result__ = com.amap.api.maps.model.Tile.obtain(var0.intValue(), var1.intValue(), var2);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModel::setAngle", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GL3DModel __this__ = (com.amap.api.maps.model.GL3DModel) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModel@" + __this__ + "::setAngle(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setAngle(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModel::getAngle", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GL3DModel __this__ = (com.amap.api.maps.model.GL3DModel) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModel@" + __this__ + "::getAngle(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getAngle();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModel::setModelFixedLength", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GL3DModel __this__ = (com.amap.api.maps.model.GL3DModel) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModel@" + __this__ + "::setModelFixedLength(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setModelFixedLength(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModel::setZoomLimit", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GL3DModel __this__ = (com.amap.api.maps.model.GL3DModel) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModel@" + __this__ + "::setZoomLimit(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setZoomLimit(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Gradient::getColors", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Gradient __this__ = (com.amap.api.maps.model.Gradient) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Gradient@" + __this__ + "::getColors(" + "" + ")");
}
// invoke native method
int[] __result__ = null;
try {
__result__ = __this__.getColors();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.Gradient::getStartPoints", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.Gradient __this__ = (com.amap.api.maps.model.Gradient) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.Gradient@" + __this__ + "::getStartPoints(" + "" + ")");
}
// invoke native method
float[] __result__ = null;
try {
__result__ = __this__.getStartPoints();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.TileProvider::getTile", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref arg
Number var3 = (Number) ((Map<String, Object>) __args__).get("var3");
// ref
com.amap.api.maps.model.TileProvider __this__ = (com.amap.api.maps.model.TileProvider) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.TileProvider@" + __this__ + "::getTile(" + var1 + var2 + var3 + ")");
}
// invoke native method
com.amap.api.maps.model.Tile __result__ = null;
try {
__result__ = __this__.getTile(var1.intValue(), var2.intValue(), var3.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.TileProvider::getTileWidth", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.TileProvider __this__ = (com.amap.api.maps.model.TileProvider) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.TileProvider@" + __this__ + "::getTileWidth(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getTileWidth();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.TileProvider::getTileHeight", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.TileProvider __this__ = (com.amap.api.maps.model.TileProvider) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.TileProvider@" + __this__ + "::getTileHeight(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getTileHeight();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapItem::getCenter", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.HeatMapItem __this__ = (com.amap.api.maps.model.HeatMapItem) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapItem@" + __this__ + "::getCenter(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLng __result__ = null;
try {
__result__ = __this__.getCenter();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapItem::setCenter", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var3 = (Number) ((Map<String, Object>) __args__).get("var3");
// ref
com.amap.api.maps.model.HeatMapItem __this__ = (com.amap.api.maps.model.HeatMapItem) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapItem@" + __this__ + "::setCenter(" + var1 + var3 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setCenter(var1.doubleValue(), var3.doubleValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapItem::getIntensity", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.HeatMapItem __this__ = (com.amap.api.maps.model.HeatMapItem) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapItem@" + __this__ + "::getIntensity(" + "" + ")");
}
// invoke native method
Double __result__ = null;
try {
__result__ = __this__.getIntensity();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapItem::setIntensity", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.HeatMapItem __this__ = (com.amap.api.maps.model.HeatMapItem) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapItem@" + __this__ + "::setIntensity(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setIntensity(var1.doubleValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapItem::getIndexes", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.HeatMapItem __this__ = (com.amap.api.maps.model.HeatMapItem) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapItem@" + __this__ + "::getIndexes(" + "" + ")");
}
// invoke native method
int[] __result__ = null;
try {
__result__ = __this__.getIndexes();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.HeatMapItem::setIndexes", (__args__, __methodResult__) -> {
// args
// ref arg
int[] var1 = (int[]) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.HeatMapItem __this__ = (com.amap.api.maps.model.HeatMapItem) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.HeatMapItem@" + __this__ + "::setIndexes(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setIndexes(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NaviPara::setTargetPoint", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NaviPara __this__ = (com.amap.api.maps.model.NaviPara) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NaviPara@" + __this__ + "::setTargetPoint(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setTargetPoint(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NaviPara::setNaviStyle", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.NaviPara __this__ = (com.amap.api.maps.model.NaviPara) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NaviPara@" + __this__ + "::setNaviStyle(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setNaviStyle(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NaviPara::getTargetPoint", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.NaviPara __this__ = (com.amap.api.maps.model.NaviPara) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NaviPara@" + __this__ + "::getTargetPoint(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLng __result__ = null;
try {
__result__ = __this__.getTargetPoint();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.NaviPara::getNaviStyle", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.NaviPara __this__ = (com.amap.api.maps.model.NaviPara) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.NaviPara@" + __this__ + "::getNaviStyle(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getNaviStyle();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::image", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.BitmapDescriptor var1 = (com.amap.api.maps.model.BitmapDescriptor) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::image(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GroundOverlayOptions __result__ = null;
try {
__result__ = __this__.image(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::anchor", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::anchor(" + var1 + var2 + ")");
}
// invoke native method
com.amap.api.maps.model.GroundOverlayOptions __result__ = null;
try {
__result__ = __this__.anchor(var1.floatValue(), var2.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::position__com_amap_api_maps_model_LatLng__double", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::position(" + var1 + var2 + ")");
}
// invoke native method
com.amap.api.maps.model.GroundOverlayOptions __result__ = null;
try {
__result__ = __this__.position(var1, var2.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::position__com_amap_api_maps_model_LatLng__double__double", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref arg
Number var3 = (Number) ((Map<String, Object>) __args__).get("var3");
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::position(" + var1 + var2 + var3 + ")");
}
// invoke native method
com.amap.api.maps.model.GroundOverlayOptions __result__ = null;
try {
__result__ = __this__.position(var1, var2.floatValue(), var3.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::positionFromBounds", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLngBounds var1 = (com.amap.api.maps.model.LatLngBounds) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::positionFromBounds(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GroundOverlayOptions __result__ = null;
try {
__result__ = __this__.positionFromBounds(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::bearing", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::bearing(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GroundOverlayOptions __result__ = null;
try {
__result__ = __this__.bearing(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::zIndex", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::zIndex(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GroundOverlayOptions __result__ = null;
try {
__result__ = __this__.zIndex(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::visible", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::visible(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GroundOverlayOptions __result__ = null;
try {
__result__ = __this__.visible(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::transparency", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::transparency(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GroundOverlayOptions __result__ = null;
try {
__result__ = __this__.transparency(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getImage", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getImage(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = __this__.getImage();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getLocation", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getLocation(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLng __result__ = null;
try {
__result__ = __this__.getLocation();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getWidth", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getWidth(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getWidth();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getHeight", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getHeight(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getHeight();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getBounds", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getBounds(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLngBounds __result__ = null;
try {
__result__ = __this__.getBounds();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getBearing", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getBearing(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getBearing();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getZIndex", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getZIndex(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getZIndex();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getTransparency", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getTransparency(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getTransparency();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getAnchorU", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getAnchorU(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getAnchorU();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::getAnchorV", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::getAnchorV(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getAnchorV();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlayOptions::isVisible", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlayOptions __this__ = (com.amap.api.maps.model.GroundOverlayOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlayOptions@" + __this__ + "::isVisible(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isVisible();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::textureDrawable", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.BitmapDescriptor var1 = (com.amap.api.maps.model.BitmapDescriptor) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::textureDrawable(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GL3DModelOptions __result__ = null;
try {
__result__ = __this__.textureDrawable(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::vertexData", (__args__, __methodResult__) -> {
// args
// ref arg
java.util.List<Float> var1 = (java.util.List<Float>) ((Map<String, Object>) __args__).get("var1");
// ref arg
java.util.List<Float> var2 = (java.util.List<Float>) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::vertexData(" + var1 + var2 + ")");
}
// invoke native method
com.amap.api.maps.model.GL3DModelOptions __result__ = null;
try {
__result__ = __this__.vertexData(var1, var2);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::position", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::position(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GL3DModelOptions __result__ = null;
try {
__result__ = __this__.position(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::angle", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::angle(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GL3DModelOptions __result__ = null;
try {
__result__ = __this__.angle(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::getVertext", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::getVertext(" + "" + ")");
}
// invoke native method
java.util.List<Float> __result__ = null;
try {
__result__ = __this__.getVertext();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::getTextrue", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::getTextrue(" + "" + ")");
}
// invoke native method
java.util.List<Float> __result__ = null;
try {
__result__ = __this__.getTextrue();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::getAngle", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::getAngle(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getAngle();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::getLatLng", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::getLatLng(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLng __result__ = null;
try {
__result__ = __this__.getLatLng();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::getBitmapDescriptor", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::getBitmapDescriptor(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.BitmapDescriptor __result__ = null;
try {
__result__ = __this__.getBitmapDescriptor();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::setModelFixedLength", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::setModelFixedLength(" + var1 + ")");
}
// invoke native method
com.amap.api.maps.model.GL3DModelOptions __result__ = null;
try {
__result__ = __this__.setModelFixedLength(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GL3DModelOptions::getModelFixedLength", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GL3DModelOptions __this__ = (com.amap.api.maps.model.GL3DModelOptions) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GL3DModelOptions@" + __this__ + "::getModelFixedLength(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getModelFixedLength();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::remove", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::remove(" + "" + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.remove();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::getId", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::getId(" + "" + ")");
}
// invoke native method
String __result__ = null;
try {
__result__ = __this__.getId();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::setPosition", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLng var1 = (com.amap.api.maps.model.LatLng) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::setPosition(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setPosition(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::getPosition", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::getPosition(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLng __result__ = null;
try {
__result__ = __this__.getPosition();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::setDimensions__double", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::setDimensions(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setDimensions(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::setImage", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.BitmapDescriptor var1 = (com.amap.api.maps.model.BitmapDescriptor) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::setImage(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setImage(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::setDimensions__double__double", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref arg
Number var2 = (Number) ((Map<String, Object>) __args__).get("var2");
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::setDimensions(" + var1 + var2 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setDimensions(var1.floatValue(), var2.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::getWidth", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::getWidth(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getWidth();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::getHeight", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::getHeight(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getHeight();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::setPositionFromBounds", (__args__, __methodResult__) -> {
// args
// ref arg
com.amap.api.maps.model.LatLngBounds var1 = (com.amap.api.maps.model.LatLngBounds) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::setPositionFromBounds(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setPositionFromBounds(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::getBounds", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::getBounds(" + "" + ")");
}
// invoke native method
com.amap.api.maps.model.LatLngBounds __result__ = null;
try {
__result__ = __this__.getBounds();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::setBearing", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::setBearing(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setBearing(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::getBearing", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::getBearing(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getBearing();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::setZIndex", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::setZIndex(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setZIndex(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::getZIndex", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::getZIndex(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getZIndex();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::setVisible", (__args__, __methodResult__) -> {
// args
// ref arg
boolean var1 = (boolean) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::setVisible(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setVisible(var1);
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::isVisible", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::isVisible(" + "" + ")");
}
// invoke native method
Boolean __result__ = null;
try {
__result__ = __this__.isVisible();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::setTransparency", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::setTransparency(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setTransparency(var1.floatValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::getTransparency", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::getTransparency(" + "" + ")");
}
// invoke native method
Float __result__ = null;
try {
__result__ = __this__.getTransparency();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.GroundOverlay::destroy", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.GroundOverlay __this__ = (com.amap.api.maps.model.GroundOverlay) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.GroundOverlay@" + __this__ + "::destroy(" + "" + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.destroy();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.MyTrafficStyle::getSmoothColor", (__args__, __methodResult__) -> {
// args
// ref
com.amap.api.maps.model.MyTrafficStyle __this__ = (com.amap.api.maps.model.MyTrafficStyle) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.MyTrafficStyle@" + __this__ + "::getSmoothColor(" + "" + ")");
}
// invoke native method
Integer __result__ = null;
try {
__result__ = __this__.getSmoothColor();
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
// method
put("com.amap.api.maps.model.MyTrafficStyle::setSmoothColor", (__args__, __methodResult__) -> {
// args
// ref arg
Number var1 = (Number) ((Map<String, Object>) __args__).get("var1");
// ref
com.amap.api.maps.model.MyTrafficStyle __this__ = (com.amap.api.maps.model.MyTrafficStyle) ((Map<String, Object>) __args__).get("__this__");
// print log
if (getEnableLog()) {
Log.d("fluttify-java", "fluttify-java: com.amap.api.maps.model.MyTrafficStyle@" + __this__ + "::setSmoothColor(" + var1 + ")");
}
// invoke native method
Void __result__ = null;
try {
__this__.setSmoothColor(var1.intValue());
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
__methodResult__.error(throwable.getMessage(), null, null);
return;
}
__methodResult__.success(__result__);
});
}};
}
}
| 149,497 |
348 | {"nom":"Merry-Sec","circ":"1ère circonscription","dpt":"Yonne","inscrits":149,"abs":73,"votants":76,"blancs":3,"nuls":2,"exp":71,"res":[{"nuance":"LR","nom":"<NAME>","voix":39},{"nuance":"REM","nom":"<NAME>","voix":32}]} | 88 |
407 | <reponame>choleece/nacos<filename>api/src/main/java/com/alibaba/nacos/api/config/convert/NacosConfigConverter.java
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.api.config.convert;
/**
* Nacos Config Converter
*
* @param <T> the target type that wanted
* @author <a href="mailto:<EMAIL>">Mercy</a>
* @since 0.2.0
*/
public interface NacosConfigConverter<T> {
/**
* can convert to be target type or not
*
* @param targetType the type of target
* @return If can , return <code>true</code>, or <code>false</code>
*/
boolean canConvert(Class<T> targetType);
/**
* convert the Naocs's config of type S to target type T.
*
* @param config the Naocs's config to convert, which must be an instance of S (never {@code null})
* @return the converted object, which must be an instance of T (potentially {@code null})
*/
T convert(String config);
}
| 495 |
522 | /**
* Copyright (C) 2004-2011 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.sparkimpl.plugin.phone;
import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.resource.Res;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
public class IncomingCall extends JPanel {
private static final long serialVersionUID = -5840942759253687771L;
private JLabel callerNameLabel;
private JLabel callerNumberLabel;
public IncomingCall() {
setLayout(new GridBagLayout());
setBackground(Color.white);
callerNameLabel = new JLabel();
callerNameLabel.setFont(new Font("Dialog", Font.BOLD, 13));
callerNameLabel.setHorizontalAlignment(JLabel.CENTER);
callerNumberLabel = new JLabel();
callerNumberLabel.setFont(new Font("Dialog", Font.PLAIN, 12));
callerNumberLabel.setHorizontalAlignment(JLabel.CENTER);
final JLabel phoneImage = new JLabel(SparkRes.getImageIcon(SparkRes.TELEPHONE_24x24));
phoneImage.setHorizontalAlignment(JLabel.CENTER);
phoneImage.setVerticalTextPosition(JLabel.BOTTOM);
phoneImage.setHorizontalTextPosition(JLabel.CENTER);
phoneImage.setText(Res.getString("title.incoming.call"));
phoneImage.setFont(new Font("Dialog", Font.BOLD, 16));
add(phoneImage, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 10), 0, 0));
add(callerNameLabel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0));
add(callerNumberLabel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 10, 0), 0, 0));
}
public void setCallerName(String user) {
callerNameLabel.setText(user);
}
public void setCallerNumber(String number) {
final StringBuilder buf = new StringBuilder();
if (number == null) {
return;
}
if (number.trim().length() == 10) {
buf.append("(");
String areaCode = number.substring(0, 3);
buf.append(areaCode);
buf.append(") ");
String nextThree = number.substring(3, 6);
buf.append(" ");
buf.append(nextThree);
buf.append("-");
String lastThree = number.substring(6, 10);
buf.append(lastThree);
}
callerNumberLabel.setText(buf.toString());
}
}
| 1,288 |
6,989 | <reponame>HeyLey/catboost<filename>contrib/libs/lz4/generated/lz4_12.cpp
#define LZ4_MEMORY_USAGE 12
#define LZ4_NAMESPACE lz4_12
#include "lz4_ns.h"
| 76 |
394 | package net.earthcomputer.multiconnect.protocols.v1_8.mixin;
import net.earthcomputer.multiconnect.impl.MixinHelper;
import net.minecraft.entity.data.TrackedData;
import net.minecraft.entity.passive.BatEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(BatEntity.class)
public interface BatEntityAccessor {
@Accessor("BAT_FLAGS")
static TrackedData<Byte> getBatFlags() {
return MixinHelper.fakeInstance();
}
}
| 174 |
313 | from sql_metadata import Parser
def test_fully_qualified_select_and_condition():
query = """
select dbo.a.col, b.col from dbo.a, db_two.dbo.b
where dbo.a.col = b.col
"""
parser = Parser(query)
assert parser.columns == ["dbo.a.col", "b.col"]
assert parser.tables == ["dbo.a", "db_two.dbo.b"]
def test_fully_qualified_with_db_name():
query = """
select dbo.a.col, db_two.dbo.b.col as b_col from dbo.a, db_two.dbo.b
where dbo.a.col = db_two.dbo.b.col
"""
parser = Parser(query)
assert parser.columns == ["dbo.a.col", "db_two.dbo.b.col"]
assert parser.tables == ["dbo.a", "db_two.dbo.b"]
assert parser.columns_aliases == {"b_col": "db_two.dbo.b.col"}
| 325 |
335 | {
"word": "Sentimentality",
"definitions": [
"Exaggerated and self-indulgent tenderness, sadness, or nostalgia."
],
"parts-of-speech": "Noun"
} | 70 |
682 | <reponame>HackerFoo/vtr-verilog-to-routing<filename>libs/EXTERNAL/libtatum/libtatumparse/tatumparse/tatumparse_common.hpp<gh_stars>100-1000
#ifndef TATUMPARSE_COMMON_HPP
#define TATUMPARSE_COMMON_HPP
#include "tatumparse.hpp"
namespace tatumparse {
struct NodeTag {
NodeTag(int domain, float arr_val, float req_val)
: domain_id(domain), arr(arr_val), req(req_val) {}
int domain_id;
float arr;
float req;
};
struct NodeResult {
int id;
std::vector<NodeTag> tags;
};
}
#endif
| 268 |
305 | <gh_stars>100-1000
#ifndef BOXES_H_
#define BOXES_H_
#include "game/camera.h"
#include "game/level/platforms.h"
#include "lava.h"
typedef struct Boxes Boxes;
typedef struct Player Player;
typedef struct Player Player;
typedef struct RectLayer RectLayer;
Boxes *create_boxes_from_rect_layer(const RectLayer *layer, RigidBodies *rigid_bodies);
void destroy_boxes(Boxes *boxes);
int boxes_render(Boxes *boxes, const Camera *camera);
int boxes_update(Boxes *boxes, float delta_time);
void boxes_float_in_lava(Boxes *boxes, Lava *lava);
int boxes_add_box(Boxes *boxes, Rect rect, Color color);
int boxes_delete_at(Boxes *boxes, Vec2f position);
#endif // BOXES_H_
| 245 |
398 | package io.joyrpc.exception;
/*-
* #%L
* joyrpc
* %%
* Copyright (C) 2019 joyrpc.io
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
/**
* 过载异常
*/
public class OverloadException extends RejectException {
private static final long serialVersionUID = 8092542592823750863L;
//期望降到的目标TPS
protected int tps;
protected boolean isServer;
public OverloadException() {
super(null, null, false, false, null, true);
}
public OverloadException(String message) {
super(message, null, false, false, null, true);
}
public OverloadException(String message, int tps, boolean isServer) {
super(message, null, false, false, null, true);
this.tps = tps;
this.isServer = isServer;
}
public OverloadException(String message, String errorCode, int tps, boolean isServer) {
//不输出堆栈,减少限流造成的CPU过高
super(message, null, false, false, errorCode, true);
this.tps = tps;
this.isServer = isServer;
}
public int getTps() {
return tps;
}
public void setTps(int tps) {
this.tps = tps;
}
public boolean isServer() {
return isServer;
}
public void setServer(boolean server) {
isServer = server;
}
}
| 688 |
348 | {"nom":"Rousset","circ":"14ème circonscription","dpt":"Bouches-du-Rhône","inscrits":3664,"abs":1964,"votants":1700,"blancs":210,"nuls":85,"exp":1405,"res":[{"nuance":"REM","nom":"<NAME>-<NAME>","voix":928},{"nuance":"LR","nom":"<NAME>","voix":477}]} | 103 |
379 | package org.datavec.api.records.reader.impl.transform;
import lombok.AllArgsConstructor;
import org.datavec.api.conf.Configuration;
import org.datavec.api.records.Record;
import org.datavec.api.records.SequenceRecord;
import org.datavec.api.records.listener.RecordListener;
import org.datavec.api.records.metadata.RecordMetaData;
import org.datavec.api.records.reader.SequenceRecordReader;
import org.datavec.api.split.InputSplit;
import org.datavec.api.transform.TransformProcess;
import org.datavec.api.writable.Writable;
import java.io.DataInputStream;
import java.io.IOException;
import java.net.URI;
import java.util.Collection;
import java.util.List;
/**
* This wraps a {@link SequenceRecordReader} with a {@link TransformProcess}
* which will allow every {@link Record} returned from the {@link SequenceRecordReader}
* to be transformed before being returned.
*
* @author <NAME>
*/
@AllArgsConstructor
public class TransformProcessSequenceRecordReader implements SequenceRecordReader {
protected SequenceRecordReader sequenceRecordReader;
protected TransformProcess transformProcess;
/**
* Set the configuration to be used by this object.
*
* @param conf
*/
@Override
public void setConf(Configuration conf) {
sequenceRecordReader.setConf(conf);
}
/**
* Return the configuration used by this object.
*/
@Override
public Configuration getConf() {
return sequenceRecordReader.getConf();
}
/**
* Returns a sequence record.
*
* @return a sequence of records
*/
@Override
public List<List<Writable>> sequenceRecord() {
return transformProcess.executeSequence(sequenceRecordReader.sequenceRecord());
}
@Override
public boolean batchesSupported() {
return false;
}
@Override
public List<List<Writable>> next(int num) {
throw new UnsupportedOperationException();
}
/**
* Load a sequence record from the given DataInputStream
* Unlike {@link #next()} the internal state of the RecordReader is not modified
* Implementations of this method should not close the DataInputStream
*
* @param uri
* @param dataInputStream
* @throws IOException if error occurs during reading from the input stream
*/
@Override
public List<List<Writable>> sequenceRecord(URI uri, DataInputStream dataInputStream) throws IOException {
return transformProcess.executeSequence(sequenceRecordReader.sequenceRecord(uri, dataInputStream));
}
/**
* Similar to {@link #sequenceRecord()}, but returns a {@link Record} object, that may include metadata such as the source
* of the data
*
* @return next sequence record
*/
@Override
public SequenceRecord nextSequence() {
SequenceRecord next = sequenceRecordReader.nextSequence();
next.setSequenceRecord(transformProcess.executeSequence(next.getSequenceRecord()));
return next;
}
/**
* Load a single sequence record from the given {@link RecordMetaData} instance<br>
* Note: that for data that isn't splittable (i.e., text data that needs to be scanned/split), it is more efficient to
* load multiple records at once using {@link #loadSequenceFromMetaData(List)}
*
* @param recordMetaData Metadata for the sequence record that we want to load from
* @return Single sequence record for the given RecordMetaData instance
* @throws IOException If I/O error occurs during loading
*/
@Override
public SequenceRecord loadSequenceFromMetaData(RecordMetaData recordMetaData) throws IOException {
SequenceRecord next = sequenceRecordReader.loadSequenceFromMetaData(recordMetaData);
next.setSequenceRecord(transformProcess.executeSequence(next.getSequenceRecord()));
return next;
}
/**
* Load multiple sequence records from the given a list of {@link RecordMetaData} instances<br>
*
* @param recordMetaDatas Metadata for the records that we want to load from
* @return Multiple sequence record for the given RecordMetaData instances
* @throws IOException If I/O error occurs during loading
*/
@Override
public List<SequenceRecord> loadSequenceFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException {
return null;
}
/**
* Called once at initialization.
*
* @param split the split that defines the range of records to read
* @throws IOException
* @throws InterruptedException
*/
@Override
public void initialize(InputSplit split) throws IOException, InterruptedException {
}
/**
* Called once at initialization.
*
* @param conf a configuration for initialization
* @param split the split that defines the range of records to read
* @throws IOException
* @throws InterruptedException
*/
@Override
public void initialize(Configuration conf, InputSplit split) throws IOException, InterruptedException {
}
/**
* Get the next record
*
* @return
*/
@Override
public List<Writable> next() {
return transformProcess.execute(sequenceRecordReader.next());
}
/**
* Whether there are anymore records
*
* @return
*/
@Override
public boolean hasNext() {
return sequenceRecordReader.hasNext();
}
/**
* List of label strings
*
* @return
*/
@Override
public List<String> getLabels() {
return sequenceRecordReader.getLabels();
}
/**
* Reset record reader iterator
*
* @return
*/
@Override
public void reset() {
sequenceRecordReader.reset();
}
@Override
public boolean resetSupported() {
return sequenceRecordReader.resetSupported();
}
/**
* Load the record from the given DataInputStream
* Unlike {@link #next()} the internal state of the RecordReader is not modified
* Implementations of this method should not close the DataInputStream
*
* @param uri
* @param dataInputStream
* @throws IOException if error occurs during reading from the input stream
*/
@Override
public List<Writable> record(URI uri, DataInputStream dataInputStream) throws IOException {
return transformProcess.execute(sequenceRecordReader.record(uri, dataInputStream));
}
/**
* Similar to {@link #next()}, but returns a {@link Record} object, that may include metadata such as the source
* of the data
*
* @return next record
*/
@Override
public Record nextRecord() {
Record next = sequenceRecordReader.nextRecord();
next.setRecord(transformProcess.execute(next.getRecord()));
return next;
}
/**
* Load a single record from the given {@link RecordMetaData} instance<br>
* Note: that for data that isn't splittable (i.e., text data that needs to be scanned/split), it is more efficient to
* load multiple records at once using {@link #loadFromMetaData(List)}
*
* @param recordMetaData Metadata for the record that we want to load from
* @return Single record for the given RecordMetaData instance
* @throws IOException If I/O error occurs during loading
*/
@Override
public Record loadFromMetaData(RecordMetaData recordMetaData) throws IOException {
Record load = sequenceRecordReader.loadFromMetaData(recordMetaData);
load.setRecord(transformProcess.execute(load.getRecord()));
return load;
}
/**
* Load multiple records from the given a list of {@link RecordMetaData} instances<br>
*
* @param recordMetaDatas Metadata for the records that we want to load from
* @return Multiple records for the given RecordMetaData instances
* @throws IOException If I/O error occurs during loading
*/
@Override
public List<Record> loadFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException {
List<Record> records = sequenceRecordReader.loadFromMetaData(recordMetaDatas);
for (Record record : records)
record.setRecord(transformProcess.execute(record.getRecord()));
return records;
}
/**
* Get the record listeners for this record reader.
*/
@Override
public List<RecordListener> getListeners() {
return sequenceRecordReader.getListeners();
}
/**
* Set the record listeners for this record reader.
*
* @param listeners
*/
@Override
public void setListeners(RecordListener... listeners) {
sequenceRecordReader.setListeners(listeners);
}
/**
* Set the record listeners for this record reader.
*
* @param listeners
*/
@Override
public void setListeners(Collection<RecordListener> listeners) {
sequenceRecordReader.setListeners(listeners);
}
/**
* Closes this stream and releases any system resources associated
* with it. If the stream is already closed then invoking this
* method has no effect.
* <p>
* <p> As noted in {@link AutoCloseable#close()}, cases where the
* close may fail require careful attention. It is strongly advised
* to relinquish the underlying resources and to internally
* <em>mark</em> the {@code Closeable} as closed, prior to throwing
* the {@code IOException}.
*
* @throws IOException if an I/O error occurs
*/
@Override
public void close() throws IOException {
sequenceRecordReader.close();
}
}
| 3,231 |
584 | package com.mercury.platform.ui.adr.components.panel.ui.impl;
import com.mercury.platform.shared.config.descriptor.adr.AdrProgressBarDescriptor;
public interface ProgressBarUIFactory {
boolean isSuitable(AdrProgressBarDescriptor descriptor);
MercuryProgressBarTrackerUI getUI();
}
| 94 |
1,609 | <filename>rdkit/ML/KNN/UnitTestKNN.py
#
# Copyright (C) 2003 Rational Discovery LLC
# All Rights Reserved
""" unit testing code for knn models """
import doctest
import os.path
import unittest
from rdkit import RDConfig
from rdkit import RDRandom
from rdkit.ML.Data import DataUtils
from rdkit.ML.KNN import CrossValidate, DistFunctions
from rdkit.ML.KNN import KNNModel, KNNRegressionModel
def feq(a, b, tol=1e-4):
return abs(a - b) < tol
def load_tests(loader, tests, ignore):
""" Add the Doctests from the module """
tests.addTests(doctest.DocTestSuite(DistFunctions, optionflags=doctest.ELLIPSIS))
return tests
class TestCase(unittest.TestCase):
def setUp(self):
RDRandom.seed(25)
def test1Neighbors(self):
fName = os.path.join(RDConfig.RDCodeDir, 'ML', 'KNN', 'test_data', 'random_pts.csv')
data = DataUtils.TextFileToData(fName)
examples = data.GetNamedData()
npvals = data.GetNPossibleVals()
nvars = data.GetNVars()
attrs = list(range(1, nvars + 1))
numNeigh = 11
metric = DistFunctions.EuclideanDist
mdl = KNNModel.KNNModel(numNeigh, attrs, metric)
pt = examples.pop(0)
tgt = [(metric(pt, ex, attrs), ex) for ex in examples]
tgt.sort()
mdl.SetTrainingExamples(examples)
neighbors = mdl.GetNeighbors(pt)
for i in range(numNeigh):
assert feq(-tgt[i][0], neighbors[i][0])
assert tgt[i][1][0] == neighbors[i][1][0]
def test2XValClass(self):
fName = os.path.join(RDConfig.RDCodeDir, 'ML', 'KNN', 'test_data', 'random_pts.csv')
data = DataUtils.TextFileToData(fName)
examples = data.GetNamedData()
npvals = data.GetNPossibleVals()
nvars = data.GetNVars()
attrs = list(range(1, nvars + 1))
numNeigh = 11
mod, err = CrossValidate.CrossValidationDriver(examples, attrs, npvals, numNeigh, silent=1)
self.assertAlmostEqual(err, 0.01075, 4)
neighborList = []
res = mod.ClassifyExample(examples[0], neighborList=neighborList)
self.assertEqual(res, 1)
self.assertEqual(neighborList[0][1], examples[0])
self.assertEqual(mod.GetName(), '')
mod.SetName('name')
self.assertEqual(mod.GetName(), 'name')
self.assertEqual(mod.type(), 'Classification Model')
mod.NameModel('this argument is ignored')
self.assertEqual(mod.GetName(), 'Classification Model')
def test3Regress(self):
# """ a carefully laid out regression data set where the results are clear: """
fName = os.path.join(RDConfig.RDCodeDir, 'ML', 'KNN', 'test_data', 'sample_pts.csv')
data = DataUtils.TextFileToData(fName)
examples = data.GetNamedData()
nvars = data.GetNVars()
attrs = list(range(1, nvars + 1))
numNeigh = 4
metric = DistFunctions.EuclideanDist
mdl = KNNRegressionModel.KNNRegressionModel(numNeigh, attrs, metric)
mdl.SetTrainingExamples(examples)
res = mdl.PredictExample([4, -3.5, 2.5, 0])
assert feq(res, 1.25)
res = mdl.PredictExample([4, 3, 2, 0])
assert feq(res, 1.5)
res = mdl.PredictExample([4, 3, -2.5, 0])
assert feq(res, -1.5)
# Use a distance dependent weight for the neighbours
res = mdl.PredictExample([4, 3, -2.5, 0], weightedAverage=True)
self.assertAlmostEqual(res, -1.6)
# Check the case that the example is identical to one of the neighbours (distance = 0)
neighborList = []
res = mdl.PredictExample(examples[0], weightedAverage=True, neighborList=neighborList)
self.assertAlmostEqual(res, 1.5857864)
self.assertEqual(neighborList[0][1], examples[0])
self.assertEqual(mdl.GetBadExamples(), [])
self.assertEqual(mdl.GetName(), '')
mdl.SetName('name')
self.assertEqual(mdl.GetName(), 'name')
self.assertEqual(mdl.type(), 'Regression Model')
mdl.NameModel('this argument is ignored')
self.assertEqual(mdl.GetName(), 'Regression Model')
self.assertEqual(sorted(mdl.GetTrainingExamples() + mdl.GetTestExamples()), sorted(examples))
def test4XValRegress(self):
fName = os.path.join(RDConfig.RDCodeDir, 'ML', 'KNN', 'test_data', 'random_pts.csv')
data = DataUtils.TextFileToData(fName)
examples = data.GetNamedData()
npvals = data.GetNPossibleVals()
nvars = data.GetNVars()
attrs = list(range(1, nvars + 1))
numNeigh = 11
_, err = CrossValidate.CrossValidationDriver(examples, attrs, npvals, numNeigh, silent=1,
modelBuilder=CrossValidate.makeRegressionModel)
# NOTE: this number hasn't been extensively checked
self.assertAlmostEqual(err, 0.0777, 4)
if __name__ == '__main__': # pragma: nocover
unittest.main()
| 1,858 |
1,520 | package org.cnodejs.android.md.model.entity;
import android.support.annotation.NonNull;
import com.google.gson.annotations.SerializedName;
import org.cnodejs.android.md.model.api.ApiDefine;
import org.cnodejs.android.md.util.FormatUtils;
import org.joda.time.DateTime;
import org.jsoup.nodes.Document;
public class Topic extends TopicSimple {
@SerializedName("author_id")
private String authorId;
private Tab tab;
private String content;
private boolean good;
private boolean top;
@SerializedName("reply_count")
private int replyCount;
@SerializedName("visit_count")
private int visitCount;
@SerializedName("create_at")
private DateTime createAt;
public String getAuthorId() {
return authorId;
}
public void setAuthorId(String authorId) {
this.authorId = authorId;
}
@NonNull
public Tab getTab() {
return tab == null ? Tab.unknown : tab; // 接口中有些话题没有 Tab 属性,这里保证 Tab 不为空
}
public void setTab(Tab tab) {
this.tab = tab;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
cleanContentCache();
}
public boolean isGood() {
return good;
}
public void setGood(boolean good) {
this.good = good;
}
public boolean isTop() {
return top;
}
public void setTop(boolean top) {
this.top = top;
}
public int getReplyCount() {
return replyCount;
}
public void setReplyCount(int replyCount) {
this.replyCount = replyCount;
}
public int getVisitCount() {
return visitCount;
}
public void setVisitCount(int visitCount) {
this.visitCount = visitCount;
}
public DateTime getCreateAt() {
return createAt;
}
public void setCreateAt(DateTime createAt) {
this.createAt = createAt;
}
/**
* Html渲染缓存
*/
@SerializedName("content_html")
private String contentHtml;
@SerializedName("content_summary")
private String contentSummary;
public void markSureHandleContent() {
if (contentHtml == null || contentSummary == null) {
Document document;
if (ApiDefine.MD_RENDER) {
document = FormatUtils.handleHtml(content);
} else {
document = FormatUtils.handleHtml(FormatUtils.renderMarkdown(content));
}
if (contentHtml == null) {
contentHtml = document.body().html();
}
if (contentSummary == null) {
contentSummary = document.body().text().trim();
}
}
}
public void cleanContentCache() {
contentHtml = null;
contentSummary = null;
}
public String getContentHtml() {
markSureHandleContent();
return contentHtml;
}
public String getContentSummary() {
markSureHandleContent();
return contentSummary;
}
}
| 1,314 |
1,510 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.drill.exec.store.parquet.columnreaders;
import org.apache.drill.common.exceptions.DrillRuntimeException;
import org.apache.drill.common.exceptions.UserException;
import org.apache.drill.exec.store.parquet.DataPageHeaderInfoProvider;
import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
import org.apache.drill.shaded.guava.com.google.common.base.Stopwatch;
import io.netty.buffer.ByteBufUtil;
import org.apache.drill.exec.util.filereader.BufferedDirectBufInputStream;
import io.netty.buffer.DrillBuf;
import org.apache.drill.common.exceptions.ExecutionSetupException;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.store.parquet.ParquetFormatPlugin;
import org.apache.drill.exec.store.parquet.ParquetReaderStats;
import org.apache.drill.exec.util.filereader.DirectBufInputStream;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.parquet.bytes.ByteBufferInputStream;
import org.apache.parquet.bytes.BytesInput;
import org.apache.parquet.bytes.BytesUtils;
import org.apache.parquet.column.ColumnDescriptor;
import org.apache.parquet.column.Dictionary;
import org.apache.parquet.column.Encoding;
import org.apache.parquet.column.ValuesType;
import org.apache.parquet.column.page.DictionaryPage;
import org.apache.parquet.column.values.ValuesReader;
import org.apache.parquet.column.values.dictionary.DictionaryValuesReader;
import org.apache.parquet.column.values.rle.RunLengthBitPackingHybridDecoder;
import org.apache.parquet.compression.CompressionCodecFactory;
import org.apache.parquet.compression.CompressionCodecFactory.BytesInputDecompressor;
import org.apache.parquet.format.PageHeader;
import org.apache.parquet.format.PageType;
import org.apache.parquet.format.Util;
import org.apache.parquet.format.converter.ParquetMetadataConverter;
import org.apache.parquet.hadoop.metadata.ColumnChunkMetaData;
import org.apache.parquet.hadoop.metadata.CompressionCodecName;
import org.apache.parquet.io.ParquetDecodingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.concurrent.TimeUnit;
import static org.apache.parquet.column.Encoding.valueOf;
// class to keep track of the read position of variable length columns
class PageReader {
static final Logger logger = LoggerFactory.getLogger(PageReader.class);
public static final ParquetMetadataConverter METADATA_CONVERTER = ParquetFormatPlugin.parquetMetadataConverter;
protected final org.apache.drill.exec.store.parquet.columnreaders.ColumnReader<?> parentColumnReader;
protected final DirectBufInputStream dataReader;
//buffer to store bytes of current page
protected DrillBuf pageData;
// for variable length data we need to keep track of our current position in the page data
// as the values and lengths are intermixed, making random access to the length data impossible
long readyToReadPosInBytes;
// read position in the current page, stored in the ByteBuf in ParquetRecordReader called bufferWithAllData
long readPosInBytes;
// storage space for extra bits at the end of a page if they did not line up with a byte boundary
// prevents the need to keep the entire last page, as these pageDataByteArray need to be added to the next batch
//byte extraBits;
// used for columns where the number of values that will fit in a vector is unknown
// currently used for variable length
// TODO - reuse this when compressed vectors are added, where fixed length values will take up a
// variable amount of space
// For example: if nulls are stored without extra space left in the data vector
// (this is currently simplifying random access to the data during processing, but increases the size of the vectors)
int valuesReadyToRead;
// the number of values read out of the last page
int valuesRead;
int byteLength;
//int rowGroupIndex;
IntIterator definitionLevels;
IntIterator repetitionLevels;
private ValuesReader valueReader;
private ValuesReader dictionaryLengthDeterminingReader;
private ValuesReader dictionaryValueReader;
Dictionary dictionary;
PageHeader pageHeader;
int pageValueCount = -1;
protected FSDataInputStream inputStream;
// This needs to be held throughout reading of the entire column chunk
DrillBuf dictData;
protected final CompressionCodecFactory codecFactory;
protected final CompressionCodecName codecName;
protected final BufferAllocator allocator;
protected final ColumnDescriptor columnDescriptor;
protected final ColumnChunkMetaData columnChunkMetaData;
protected final String fileName;
protected final ParquetReaderStats stats;
private final boolean useBufferedReader;
private final int scanBufferSize;
private final boolean useFadvise;
private final boolean enforceTotalSize;
protected final String debugName;
private DataPageHeaderInfoProvider dataPageInfo;
PageReader(ColumnReader<?> columnReader, FileSystem fs, Path path)
throws ExecutionSetupException {
this.parentColumnReader = columnReader;
this.columnDescriptor = parentColumnReader.getColumnDescriptor();
this.columnChunkMetaData = columnReader.columnChunkMetaData;
this.codecFactory = parentColumnReader.parentReader.getCodecFactory();
this.codecName = parentColumnReader.columnChunkMetaData.getCodec();
this.allocator = parentColumnReader.parentReader.getOperatorContext().getAllocator();
this.stats = parentColumnReader.parentReader.parquetReaderStats;
this.fileName = path.toString();
debugName = new StringBuilder()
.append(this.parentColumnReader.parentReader.getFragmentContext().getFragIdString())
.append(":")
.append(this.parentColumnReader.parentReader.getOperatorContext().getStats().getId() )
.append(this.parentColumnReader.columnChunkMetaData.toString() )
.toString();
try {
inputStream = fs.open(path);
useBufferedReader = parentColumnReader.parentReader.useBufferedReader;
scanBufferSize = parentColumnReader.parentReader.bufferedReadSize;
useFadvise = parentColumnReader.parentReader.useFadvise;
enforceTotalSize = parentColumnReader.parentReader.enforceTotalSize;
if (useBufferedReader) {
this.dataReader = new BufferedDirectBufInputStream(inputStream, allocator, path.getName(),
columnChunkMetaData.getStartingPos(), columnChunkMetaData.getTotalSize(), scanBufferSize,
enforceTotalSize, useFadvise);
} else {
this.dataReader = new DirectBufInputStream(inputStream, allocator, path.getName(),
columnChunkMetaData.getStartingPos(), columnChunkMetaData.getTotalSize(), enforceTotalSize,
useFadvise);
}
} catch (IOException e) {
throw new ExecutionSetupException("Error opening or reading metadata for parquet file at location: "
+ path.getName(), e);
}
}
protected void throwUserException(Exception e, String msg) throws UserException {
UserException ex = UserException.dataReadError(e).message(msg)
.pushContext("Row Group Start: ", columnChunkMetaData.getStartingPos())
.pushContext("Column: ", this.parentColumnReader.schemaElement.getName())
.pushContext("File: ", this.fileName).build(logger);
throw ex;
}
protected void init() throws IOException{
dataReader.init();
// If getDictionaryPageOffset() was reliable we could read the dictionary page once
// and for all here. Instead we must encounter the dictionary page during calls to next()
// and the code that follows remains commented out.
/*
long dictPageOffset = columnChunkMetaData.getDictionaryPageOffset();
if (dictPageOffset < dataReader.getPos()) {
return; // this column chunk has no dictionary page
}
// advance to the start of the dictionary page
skip(dictPageOffset - dataReader.getPos());
nextPageHeader();
loadDictionary();
*/
}
/**
* Skip over n bytes of column data
* @param n number of bytes to skip
* @throws IOException
*/
protected void skip(long n) throws IOException {
assert n >= 0;
while (n > 0) {
long skipped = dataReader.skip(n);
if (skipped > 0) {
n -= skipped;
} else {
// no good way to handle this. Guava uses InputStream.available to check
// if EOF is reached and because available is not reliable,
// tries to read the rest of the data.
DrillBuf skipBuf = dataReader.getNext((int) n);
if (skipBuf != null) {
skipBuf.release();
} else {
throw new EOFException("End of file reached.");
}
}
}
}
/**
* Reads and stores this column chunk's dictionary.
* @throws IOException
*/
protected void loadDictionary() throws IOException {
assert pageHeader.getType() == PageType.DICTIONARY_PAGE;
assert this.dictionary == null;
// dictData is not a local because we need to release it later.
this.dictData = codecName == CompressionCodecName.UNCOMPRESSED
? readUncompressedPage()
: readCompressedPageV1();
DictionaryPage page = new DictionaryPage(
asBytesInput(dictData, 0, pageHeader.uncompressed_page_size),
pageHeader.uncompressed_page_size,
pageHeader.dictionary_page_header.num_values,
valueOf(pageHeader.dictionary_page_header.encoding.name())
);
this.dictionary = page.getEncoding().initDictionary(columnDescriptor, page);
}
/**
* Reads an uncompressed Parquet page without copying the buffer returned by the backing input stream.
* @return uncompressed Parquet page data
* @throws IOException
*/
protected DrillBuf readUncompressedPage() throws IOException {
int outputSize = pageHeader.getUncompressed_page_size();
long start = dataReader.getPos();
Stopwatch timer = Stopwatch.createStarted();
DrillBuf outputPageData = dataReader.getNext(outputSize);
long timeToRead = timer.elapsed(TimeUnit.NANOSECONDS);
if (logger.isTraceEnabled()) {
logger.trace(
"Col: {} readPos: {} Uncompressed_size: {} pageData: {}",
columnChunkMetaData.toString(),
dataReader.getPos(),
outputSize,
ByteBufUtil.hexDump(outputPageData)
);
}
this.updateStats(pageHeader, "Page Read", start, timeToRead, outputSize, outputSize);
return outputPageData;
}
/**
* Reads a compressed v1 data page or a dictionary page, both of which are compressed
* in their entirety.
* @return decompressed Parquet page data
* @throws IOException
*/
protected DrillBuf readCompressedPageV1() throws IOException {
Stopwatch timer = Stopwatch.createUnstarted();
int inputSize = pageHeader.getCompressed_page_size();
int outputSize = pageHeader.getUncompressed_page_size();
long start = dataReader.getPos();
long timeToRead;
DrillBuf inputPageData = null;
DrillBuf outputPageData = this.allocator.buffer(outputSize);
try {
timer.start();
inputPageData = dataReader.getNext(inputSize);
timeToRead = timer.elapsed(TimeUnit.NANOSECONDS);
this.updateStats(pageHeader, "Page Read", start, timeToRead, inputSize, inputSize);
timer.reset();
timer.start();
start = dataReader.getPos();
CompressionCodecName codecName = columnChunkMetaData.getCodec();
BytesInputDecompressor decomp = codecFactory.getDecompressor(codecName);
ByteBuffer input = inputPageData.nioBuffer(0, inputSize);
ByteBuffer output = outputPageData.nioBuffer(0, outputSize);
decomp.decompress(input, inputSize, output, outputSize);
outputPageData.writerIndex(outputSize);
timeToRead = timer.elapsed(TimeUnit.NANOSECONDS);
if (logger.isTraceEnabled()) {
logger.trace(
"Col: {} readPos: {} Uncompressed_size: {} pageData: {}",
columnChunkMetaData.toString(),
dataReader.getPos(),
outputSize,
ByteBufUtil.hexDump(outputPageData)
);
}
this.updateStats(pageHeader, "Decompress", start, timeToRead, inputSize, outputSize);
} finally {
if (inputPageData != null) {
inputPageData.release();
}
}
return outputPageData;
}
/**
* Reads a compressed v2 data page which excluded the repetition and definition level
* sections from compression.
* @return decompressed Parquet page data
* @throws IOException
*/
protected DrillBuf readCompressedPageV2() throws IOException {
Stopwatch timer = Stopwatch.createUnstarted();
int inputSize = pageHeader.getCompressed_page_size();
int repLevelSize = pageHeader.data_page_header_v2.getRepetition_levels_byte_length();
int defLevelSize = pageHeader.data_page_header_v2.getDefinition_levels_byte_length();
int compDataOffset = repLevelSize + defLevelSize;
int outputSize = pageHeader.uncompressed_page_size;
long start = dataReader.getPos();
long timeToRead;
DrillBuf inputPageData = null;
DrillBuf outputPageData = this.allocator.buffer(outputSize);
try {
timer.start();
// Read in both the uncompressed and compressed sections
inputPageData = dataReader.getNext(inputSize);
timeToRead = timer.elapsed(TimeUnit.NANOSECONDS);
this.updateStats(pageHeader, "Page Read", start, timeToRead, inputSize, inputSize);
timer.reset();
timer.start();
start = dataReader.getPos();
// Write out the uncompressed section
// Note that the following setBytes call to read the repetition and definition level sections
// advances readerIndex in inputPageData but not writerIndex in outputPageData.
outputPageData.setBytes(0, inputPageData, compDataOffset);
// decompress from the start of compressed data to the end of the input buffer
CompressionCodecName codecName = columnChunkMetaData.getCodec();
BytesInputDecompressor decomp = codecFactory.getDecompressor(codecName);
ByteBuffer input = inputPageData.nioBuffer(compDataOffset, inputSize - compDataOffset);
ByteBuffer output = outputPageData.nioBuffer(compDataOffset, outputSize - compDataOffset);
decomp.decompress(
input,
inputSize - compDataOffset,
output,
outputSize - compDataOffset
);
outputPageData.writerIndex(outputSize);
timeToRead = timer.elapsed(TimeUnit.NANOSECONDS);
if (logger.isTraceEnabled()) {
logger.trace(
"Col: {} readPos: {} Uncompressed_size: {} pageData: {}",
columnChunkMetaData.toString(),
dataReader.getPos(),
outputSize,
ByteBufUtil.hexDump(outputPageData)
);
}
this.updateStats(pageHeader, "Decompress", start, timeToRead, inputSize, outputSize);
} finally {
if (inputPageData != null) {
inputPageData.release();
}
}
return outputPageData;
}
/**
* Reads the next page header available in the backing input stream.
* @throws IOException
*/
protected void readPageHeader() throws IOException {
long start = dataReader.getPos();
Stopwatch timer = Stopwatch.createStarted();
this.pageHeader = Util.readPageHeader(dataReader);
long timeToRead = timer.elapsed(TimeUnit.NANOSECONDS);
long pageHeaderBytes = dataReader.getPos() - start;
this.updateStats(pageHeader, "Page Header", start, timeToRead, pageHeaderBytes, pageHeaderBytes);
if (logger.isTraceEnabled()) {
logger.trace(
"ParquetTrace,{},{},{},{},{},{},{},{}", "Page Header Read", "",
this.parentColumnReader.parentReader.getHadoopPath(),
this.columnDescriptor.toString(),
start,
0,
0,
timeToRead
);
}
}
/**
* Inspects the type of the next page and dispatches it for dictionary loading
* or data decompression accordingly.
* @throws IOException
*/
protected void nextInternal() throws IOException {
readPageHeader();
if (pageHeader.getType() == PageType.DICTIONARY_PAGE) {
loadDictionary();
// callers expect us to have a data page after next(), so we start over
readPageHeader();
}
switch (pageHeader.getType()) {
case DATA_PAGE:
pageData = codecName == CompressionCodecName.UNCOMPRESSED
? readUncompressedPage()
: readCompressedPageV1();
break;
case DATA_PAGE_V2:
pageData = codecName == CompressionCodecName.UNCOMPRESSED
? readUncompressedPage()
: readCompressedPageV2();
break;
default:
logger.info("skipping a {} of size {}", pageHeader.getType(), pageHeader.compressed_page_size);
skip(pageHeader.compressed_page_size);
}
}
/**
* Decodes any repetition and definition level data in this page
* @returns the offset into the page buffer after any levels have been decoded.
*/
protected int decodeLevels() throws IOException {
int maxRepLevel = columnDescriptor.getMaxRepetitionLevel();
int maxDefLevel = columnDescriptor.getMaxDefinitionLevel();
int dataOffset;
switch (pageHeader.getType()) {
case DATA_PAGE:
ByteBufferInputStream dataStream = ByteBufferInputStream.wrap(pageData.nioBuffer(0, byteLength));
if (maxRepLevel > 0) {
Encoding rlEncoding = METADATA_CONVERTER.getEncoding(dataPageInfo.getRepetitionLevelEncoding());
ValuesReader rlReader = rlEncoding.getValuesReader(columnDescriptor, ValuesType.REPETITION_LEVEL);
rlReader.initFromPage(pageValueCount, dataStream);
this.repetitionLevels = new ValuesReaderIntIterator(rlReader);
// we know that the first value will be a 0, at the end of each list of repeated values we will hit another 0 indicating
// a new record, although we don't know the length until we hit it (and this is a one way stream of integers) so we
// read the first zero here to simplify the reading processes, and start reading the first value the same as all
// of the rest. Effectively we are 'reading' the non-existent value in front of the first allowing direct access to
// the first list of repetition levels
this.repetitionLevels.nextInt();
}
if (maxDefLevel > 0) {
Encoding dlEncoding = METADATA_CONVERTER.getEncoding(dataPageInfo.getDefinitionLevelEncoding());
ValuesReader dlReader = dlEncoding.getValuesReader(columnDescriptor, ValuesType.DEFINITION_LEVEL);
dlReader.initFromPage(pageValueCount, dataStream);
this.definitionLevels = new ValuesReaderIntIterator(dlReader);
}
dataOffset = (int) dataStream.position();
break;
case DATA_PAGE_V2:
int repLevelLen = pageHeader.data_page_header_v2.repetition_levels_byte_length;
int defLevelLen = pageHeader.data_page_header_v2.definition_levels_byte_length;
if (maxRepLevel > 0) {
this.repetitionLevels = newRLEIterator(
maxRepLevel,
BytesInput.from(pageData.nioBuffer(0, repLevelLen))
);
// See earlier comment.
this.repetitionLevels.nextInt();
}
if (maxDefLevel > 0) {
this.definitionLevels = newRLEIterator(
maxDefLevel,
BytesInput.from(pageData.nioBuffer(repLevelLen, defLevelLen))
);
}
dataOffset = repLevelLen + defLevelLen;
break;
default:
throw new DrillRuntimeException(String.format(
"Did not expect to find a page of type %s now.",
pageHeader.getType()
));
}
return dataOffset;
}
/**
* Read the next page in the parent column chunk
*
* @return true if a page was found to read
* @throws IOException
*/
public boolean next() throws IOException {
this.pageValueCount = -1;
this.valuesRead = this.valuesReadyToRead = 0;
this.parentColumnReader.currDefLevel = -1;
long totalValueCount = columnChunkMetaData.getValueCount();
if (parentColumnReader.totalValuesRead >= totalValueCount) {
return false;
}
clearDataBufferAndReaders();
nextInternal();
if (pageData == null || pageHeader == null) {
throw new DrillRuntimeException(String.format(
"Failed to read another page having read %d of %d values from its column chunk.",
parentColumnReader.totalValuesRead,
totalValueCount
));
}
dataPageInfo = DataPageHeaderInfoProvider.builder(this.pageHeader);
this.byteLength = this.pageHeader.uncompressed_page_size;
this.pageValueCount = dataPageInfo.getNumValues();
Stopwatch timer = Stopwatch.createStarted();
// readPosInBytes is used for actually reading the values after we determine how many will fit in the vector
// readyToReadPosInBytes serves a similar purpose for the vector types where we must count up the values that will
// fit one record at a time, such as for variable length data. Both operations must start in the same location after the
// definition and repetition level data which is stored alongside the page data itself
this.readyToReadPosInBytes = this.readPosInBytes = decodeLevels();
Encoding valueEncoding = METADATA_CONVERTER.getEncoding(dataPageInfo.getEncoding());
parentColumnReader.usingDictionary = valueEncoding.usesDictionary();
long timeDecode = timer.elapsed(TimeUnit.NANOSECONDS);
stats.numDataPagesDecoded.incrementAndGet();
stats.timeDataPageDecode.addAndGet(timeDecode);
return true;
}
/**
* Lazily creates a ValuesReader for when use in the cases when the data type
* or encoding requires it.
* @return an existing or new ValuesReader
*/
public ValuesReader getValueReader() {
if (valueReader == null) {
Encoding valueEncoding = METADATA_CONVERTER.getEncoding(dataPageInfo.getEncoding());
ByteBuffer dataBuffer = pageData.nioBuffer((int)readPosInBytes, byteLength-(int)readPosInBytes);
this.valueReader = valueEncoding.getValuesReader(columnDescriptor, ValuesType.VALUES);
try {
this.valueReader.initFromPage(pageValueCount, ByteBufferInputStream.wrap(dataBuffer));
} catch (IOException e) {
throw new DrillRuntimeException("Error initialising a ValuesReader for this page.", e);
}
}
return valueReader;
}
/**
* Lazily creates a dictionary length determining ValuesReader for when use when this column chunk
* is dictionary encoded.
* @return an existing or new ValuesReader
*/
public ValuesReader getDictionaryLengthDeterminingReader() {
if (dictionaryLengthDeterminingReader == null) {
ByteBuffer dataBuffer = pageData.nioBuffer((int)readPosInBytes, byteLength-(int)readPosInBytes);
dictionaryLengthDeterminingReader = new DictionaryValuesReader(dictionary);
try {
dictionaryLengthDeterminingReader.initFromPage(pageValueCount, ByteBufferInputStream.wrap(dataBuffer));
} catch (IOException e) {
throw new DrillRuntimeException(
"Error initialising a dictionary length determining ValuesReader for this page.",
e
);
}
}
return dictionaryLengthDeterminingReader;
}
/**
* Lazily creates a dictionary ValuesReader for when use when this column chunk is dictionary encoded.
* @return an existing or new ValuesReader
*/
public ValuesReader getDictionaryValueReader() {
if (dictionaryValueReader == null) {
ByteBuffer dataBuffer = pageData.nioBuffer((int)readPosInBytes, byteLength-(int)readPosInBytes);
dictionaryValueReader = new DictionaryValuesReader(dictionary);
try {
dictionaryValueReader.initFromPage(pageValueCount, ByteBufferInputStream.wrap(dataBuffer));
} catch (IOException e) {
throw new DrillRuntimeException(
"Error initialising a dictionary ValuesReader for this page.",
e
);
}
}
return dictionaryValueReader;
}
/**
*
* @return true if the previous call to next() read a page.
*/
protected boolean hasPage() {
return pageValueCount != -1;
}
protected void updateStats(PageHeader pageHeader, String op, long start, long time, long bytesin, long bytesout) {
if (logger.isTraceEnabled()) {
logger.trace("ParquetTrace,{},{},{},{},{},{},{},{}",
op,
pageHeader.type == PageType.DICTIONARY_PAGE ? "Dictionary Page" : "Data Page",
this.parentColumnReader.parentReader.getHadoopPath(),
this.columnDescriptor.toString(),
start,
bytesin,
bytesout,
time
);
}
if (pageHeader.type == PageType.DICTIONARY_PAGE) {
if (bytesin == bytesout) {
this.stats.timeDictPageLoads.addAndGet(time);
this.stats.numDictPageLoads.incrementAndGet();
this.stats.totalDictPageReadBytes.addAndGet(bytesin);
} else {
this.stats.timeDictPagesDecompressed.addAndGet(time);
this.stats.numDictPagesDecompressed.incrementAndGet();
this.stats.totalDictDecompressedBytes.addAndGet(bytesin);
}
} else {
if (bytesin == bytesout) {
this.stats.timeDataPageLoads.addAndGet(time);
this.stats.numDataPageLoads.incrementAndGet();
this.stats.totalDataPageReadBytes.addAndGet(bytesin);
} else {
this.stats.timeDataPagesDecompressed.addAndGet(time);
this.stats.numDataPagesDecompressed.incrementAndGet();
this.stats.totalDataDecompressedBytes.addAndGet(bytesin);
}
}
}
/**
* Clear buffers and readers between pages of a column chunk
*/
protected void clearDataBufferAndReaders() {
if (pageData != null) {
pageData.release();
pageData = null;
}
this.dictionaryValueReader = this.dictionaryLengthDeterminingReader = this.valueReader = null;
}
/**
* Clear buffers between column chunks
*/
protected void clearDictionaryBuffer() {
if (dictData != null) {
dictData.release();
dictData = null;
}
}
/**
* Closes the backing input stream and frees all allocated buffers.
*/
public void clear() {
try {
// data reader also owns the input stream and will close it.
this.dataReader.close();
} catch (IOException e) {
//Swallow the exception which is OK for input streams
logger.warn("encountered an error when it tried to close its input stream: {}", e);
}
// Free all memory, including fixed length types. (Data is being copied for all types not just var length types)
clearDataBufferAndReaders();
clearDictionaryBuffer();
}
/**
* Enables Parquet column readers to reset the definition level reader to a specific state.
* @param skipCount the number of rows to skip (optional)
*
* @throws IOException
*/
void resetDefinitionLevelReader(int skipCount) throws IOException {
Preconditions.checkState(columnDescriptor.getMaxDefinitionLevel() == 1);
Preconditions.checkState(pageValueCount > 0);
decodeLevels();
// Skip values if requested by caller
for (int idx = 0; idx < skipCount; ++idx) {
definitionLevels.nextInt();
}
}
public static BytesInput asBytesInput(DrillBuf buf, int offset, int length) throws IOException {
return BytesInput.from(buf.nioBuffer(offset, length));
}
private IntIterator newRLEIterator(int maxLevel, BytesInput bytes) throws IOException {
if (maxLevel == 0) {
return new NullIntIterator();
}
return new RLEIntIterator(
new RunLengthBitPackingHybridDecoder(
BytesUtils.getWidthFromMaxInt(maxLevel),
bytes.toInputStream()));
}
interface IntIterator {
int nextInt();
}
/**
* Provides an iterator interface that delegates to a ValuesReader on the
* repetition or definition levels of a Parquert v1 page.
*/
static class ValuesReaderIntIterator implements IntIterator {
ValuesReader delegate;
public ValuesReaderIntIterator(ValuesReader delegate) {
super();
this.delegate = delegate;
}
@Override
public int nextInt() {
return delegate.readInteger();
}
}
/**
* Provides an interator interface to the RLE/bitpacked repetition or definition
* levels of a Parquet v2 page
*/
private static class RLEIntIterator implements IntIterator {
RunLengthBitPackingHybridDecoder delegate;
public RLEIntIterator(RunLengthBitPackingHybridDecoder delegate) {
this.delegate = delegate;
}
@Override
public int nextInt() {
try {
return delegate.readInt();
} catch (IOException e) {
throw new ParquetDecodingException(e);
}
}
}
/**
* Provides an interator interface to the nonexistent repetition or definition
* levels of a page that has none.
*/
private static final class NullIntIterator implements IntIterator {
@Override
public int nextInt() {
return 0;
}
}
}
| 10,245 |
324 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.openstack.keystone.v2_0.domain;
import java.beans.ConstructorProperties;
import java.net.URI;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.base.Objects;
/**
* An network-accessible address, usually described by URL, where a service may
* be accessed. If using an extension for templates, you can create an endpoint
* template, which represents the templates of all the consumable services that
* are available across the regions.
*
* @see <a href=
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Identity-Endpoint-Concepts-e1362.html"
* />
*/
public class Endpoint {
public static Builder<?> builder() {
return new ConcreteBuilder();
}
public Builder<?> toBuilder() {
return new ConcreteBuilder().fromEndpoint(this);
}
public abstract static class Builder<T extends Builder<T>> {
protected abstract T self();
protected String id;
protected String versionId;
protected String region;
protected URI publicURL;
protected URI internalURL;
protected URI adminURL;
protected String tenantId;
protected URI versionInfo;
protected URI versionList;
/**
* @see Endpoint#getId()
*/
public T id(String id) {
this.id = id;
return self();
}
/**
* @see Endpoint#getVersionId()
*/
public T versionId(String versionId) {
this.versionId = versionId;
return self();
}
/**
* @see Endpoint#getRegion()
*/
public T region(String region) {
this.region = region;
return self();
}
/**
* @see Endpoint#getPublicURL()
*/
public T publicURL(URI publicURL) {
this.publicURL = publicURL;
return self();
}
/**
* @see Endpoint#getInternalURL()
*/
public T internalURL(URI internalURL) {
this.internalURL = internalURL;
return self();
}
/**
* @see Endpoint#getAdminURL()
*/
public T adminURL(URI adminURL) {
this.adminURL = adminURL;
return self();
}
/**
* @see Endpoint#getVersionInfo()
*/
public T versionInfo(URI versionInfo) {
this.versionInfo = versionInfo;
return self();
}
/**
* @see Endpoint#getVersionList()
*/
public T versionList(URI versionList) {
this.versionList = versionList;
return self();
}
/**
* @see Endpoint#getPublicURL()
*/
public T publicURL(String publicURL) {
return publicURL(URI.create(publicURL));
}
/**
* @see Endpoint#getInternalURL()
*/
public T internalURL(String internalURL) {
return internalURL(URI.create(internalURL));
}
/**
* @see Endpoint#getAdminURL()
*/
public T adminURL(String adminURL) {
return adminURL(URI.create(adminURL));
}
/**
* @see Endpoint#getVersionInfo()
*/
public T versionInfo(String versionInfo) {
return versionInfo(URI.create(versionInfo));
}
/**
* @see Endpoint#getVersionList()
*/
public T versionList(String versionList) {
return versionList(URI.create(versionList));
}
/**
* @see Endpoint#getTenantId()
*/
public T tenantId(String tenantId) {
this.tenantId = tenantId;
return self();
}
public Endpoint build() {
return new Endpoint(id, versionId, region, publicURL, internalURL, adminURL, versionInfo, versionList, null,
tenantId);
}
public T fromEndpoint(Endpoint in) {
return this.versionId(in.getVersionId()).region(in.getRegion()).publicURL(in.getPublicURL())
.internalURL(in.getInternalURL()).adminURL(in.getAdminURL()).versionInfo(in.getVersionInfo())
.versionList(in.getVersionList()).tenantId(in.getTenantId());
}
}
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
@Override
protected ConcreteBuilder self() {
return this;
}
}
private final String id;
private final String tenantId;
private final String region;
private final URI publicURL;
private final URI internalURL;
private final URI adminURL;
// fields not defined in
// https://github.com/openstack/keystone/blob/master/keystone/service.py
private final String versionId;
private final URI versionInfo;
private final URI versionList;
@ConstructorProperties({ "id", "versionId", "region", "publicURL", "internalURL", "adminURL", "versionInfo",
"versionList", "tenantName", "tenantId" })
protected Endpoint(@Nullable String id, @Nullable String versionId, @Nullable String region,
@Nullable URI publicURL, @Nullable URI internalURL, @Nullable URI adminURL, @Nullable URI versionInfo,
@Nullable URI versionList, @Nullable String tenantName, @Nullable String tenantId) {
this.id = id;
this.versionId = versionId;
this.tenantId = tenantId != null ? tenantId : tenantName;
this.region = region;
this.publicURL = publicURL;
this.internalURL = internalURL;
this.adminURL = adminURL;
this.versionInfo = versionInfo;
this.versionList = versionList;
}
/**
* When providing an ID, it is assumed that the endpoint exists in the
* current OpenStack deployment
*
* @return the id of the endpoint in the current OpenStack deployment, or
* null if not specified
*/
@Nullable
public String getId() {
return this.id;
}
/**
*
* <h4>Note</h4>
*
* This is not defined in <a href=
* "https://github.com/openstack/keystone/blob/master/keystone/service.py"
* >KeyStone</a>, rather only in <a href=
* "http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Release_Notes-d1e140.html"
* >Rackspace</a>
*/
@Nullable
public String getVersionId() {
return this.versionId;
}
/**
* @return the region of the endpoint, or null if not specified
*/
@Nullable
public String getRegion() {
return this.region;
}
/**
* @return the public url of the endpoint
*/
@Nullable
public URI getPublicURL() {
return this.publicURL;
}
/**
* @return the internal url of the endpoint
*/
@Nullable
public URI getInternalURL() {
return this.internalURL;
}
/**
* @return the admin url of the endpoint
*/
@Nullable
public URI getAdminURL() {
return this.adminURL;
}
/**
*
* <h4>Note</h4>
*
* This is not defined in <a href=
* "https://github.com/openstack/keystone/blob/master/keystone/service.py"
* >KeyStone</a>, rather only in <a href=
* "http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Release_Notes-d1e140.html"
* >Rackspace</a>
*/
@Nullable
public URI getVersionInfo() {
return this.versionInfo;
}
/**
*
* <h4>Note</h4>
*
* This is not defined in <a href=
* "https://github.com/openstack/keystone/blob/master/keystone/service.py"
* >KeyStone</a>, rather only in <a href=
* "http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Release_Notes-d1e140.html"
* >Rackspace</a>
*/
@Nullable
public URI getVersionList() {
return this.versionList;
}
/**
* @return the tenant versionId of the endpoint or null
*/
@Nullable
public String getTenantId() {
return this.tenantId;
}
@Override
public int hashCode() {
return Objects.hashCode(id, versionId, region, publicURL, internalURL, adminURL, versionInfo, versionList,
tenantId);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
Endpoint that = Endpoint.class.cast(obj);
return Objects.equal(this.id, that.id) && Objects.equal(this.versionId, that.versionId)
&& Objects.equal(this.region, that.region) && Objects.equal(this.publicURL, that.publicURL)
&& Objects.equal(this.internalURL, that.internalURL) && Objects.equal(this.adminURL, that.adminURL)
&& Objects.equal(this.versionInfo, that.versionInfo) && Objects.equal(this.versionList, that.versionList)
&& Objects.equal(this.tenantId, that.tenantId);
}
protected ToStringHelper string() {
return MoreObjects.toStringHelper(this).omitNullValues().add("id", id).add("versionId", versionId)
.add("region", region).add("publicURL", publicURL).add("internalURL", internalURL)
.add("adminURL", adminURL).add("versionInfo", versionInfo).add("versionList", versionList)
.add("tenantId", tenantId);
}
@Override
public String toString() {
return string().toString();
}
}
| 3,891 |
9,321 | <reponame>cfeibiao/chinese-xinhua
# -*- coding: utf-8 -*-
"""
author: pwxcoo
date: 2018-02-04
description: 抓取下载歇后语并保存
"""
import requests, json
from bs4 import BeautifulSoup
destination_site = ['http://xhy.5156edu.com/html2/xhy.html', 'http://xhy.5156edu.com/html2/xhy_2.html']
def downloader(url):
"""
下载歇后语并保存
"""
response = requests.get(url)
if response.status_code != 200:
print(f'{url} is failed!')
return
print(f'{url} is parsing')
html = BeautifulSoup(response.content.decode('gbk'), "lxml")
tr = html.find('table', style='word-break:break-all').find_all('tr')
return [{'riddle':t.find_all('td')[0].text, 'answer':t.find_all('td')[1].text} for t in tr][1:]
if __name__ == '__main__':
res = downloader('http://xhy.5156edu.com/html2/xhy.html')
for i in range(2, 282):
res += downloader(f'http://xhy.5156edu.com/html2/xhy_{i}.html')
print(len(res))
with open('xiehouyu.json', mode='w+', encoding='utf-8') as json_file:
json.dump(res, json_file, ensure_ascii=False)
| 504 |
2,830 | // Copyright 2018 Twitter, Inc.
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
package com.twitter.twittertext;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.twitter.twittertext.Extractor.Entity.Type;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class ExtractorTest extends TestCase {
protected Extractor extractor;
public static Test suite() {
final Class<?>[] testClasses = {OffsetConversionTest.class, ReplyTest.class,
MentionTest.class, HashtagTest.class, URLTest.class};
return new TestSuite(testClasses);
}
public void setUp() throws Exception {
extractor = new Extractor();
}
public static class OffsetConversionTest extends ExtractorTest {
public void testConvertIndices() {
assertOffsetConversionOk("abc", "abc");
assertOffsetConversionOk("\ud83d\ude02abc", "abc");
assertOffsetConversionOk("\ud83d\ude02abc\ud83d\ude02", "abc");
assertOffsetConversionOk("\ud83d\ude02abc\ud838\ude02abc", "abc");
assertOffsetConversionOk("\ud83d\ude02abc\ud838\ude02abc\ud83d\ude02", "abc");
assertOffsetConversionOk("\ud83d\ude02\ud83d\ude02abc", "abc");
assertOffsetConversionOk("\ud83d\ude02\ud83d\ude02\ud83d\ude02abc", "abc");
assertOffsetConversionOk("\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d\ude02", "abc");
// Several surrogate pairs following the entity
assertOffsetConversionOk("\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d\ude02\ud83d" +
"\ude02\ud83d\ude02", "abc");
// Several surrogate pairs surrounding multiple entities
assertOffsetConversionOk("\ud83d\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d" +
"\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d" +
"\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02", "abc");
// unpaired low surrogate (at start)
assertOffsetConversionOk("\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d" +
"\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d" +
"\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02", "abc");
// unpaired low surrogate (at end)
assertOffsetConversionOk("\ud83d\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d" +
"\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d" +
"\ude02\ud83d\ude02\ud83d\ude02\ude02", "abc");
// unpaired low and high surrogates (at end)
assertOffsetConversionOk("\ud83d\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d" +
"\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02abc\ud83d" +
"\ude02\ud83d\ude02\ud83d\ud83d\ude02\ude02", "abc");
assertOffsetConversionOk("\ud83dabc\ud83d", "abc");
assertOffsetConversionOk("\ude02abc\ude02", "abc");
assertOffsetConversionOk("\ude02\ude02abc\ude02\ude02", "abc");
assertOffsetConversionOk("abcabc", "abc");
assertOffsetConversionOk("abc\ud83d\ude02abc", "abc");
assertOffsetConversionOk("aa", "a");
assertOffsetConversionOk("\ud83d\ude02a\ud83d\ude02a\ud83d\ude02", "a");
}
private void assertOffsetConversionOk(String testData, String patStr) {
// Build an entity at the location of patStr
final Pattern pat = Pattern.compile(patStr);
final Matcher matcher = pat.matcher(testData);
final List<Extractor.Entity> entities = new ArrayList<>();
final List<Integer> codePointOffsets = new ArrayList<>();
final List<Integer> charOffsets = new ArrayList<>();
while (matcher.find()) {
final int charOffset = matcher.start();
charOffsets.add(charOffset);
codePointOffsets.add(testData.codePointCount(0, charOffset));
entities.add(new Extractor.Entity(matcher, Type.HASHTAG, 0, 0));
}
extractor.modifyIndicesFromUTF16ToUnicode(testData, entities);
for (int i = 0; i < entities.size(); i++) {
assertEquals(codePointOffsets.get(i), entities.get(i).getStart());
}
extractor.modifyIndicesFromUnicodeToUTF16(testData, entities);
for (int i = 0; i < entities.size(); i++) {
// This assertion could fail if the entity location is in the middle
// of a surrogate pair, since there is no equivalent code point
// offset to that location. It would be pathological for an entity to
// start at that point, so we can just let the test fail in that case.
assertEquals(charOffsets.get(i), entities.get(i).getStart());
}
}
}
/**
* Tests for the extractReplyScreenname method
*/
public static class ReplyTest extends ExtractorTest {
public void testReplyAtTheStart() {
final String extracted = extractor.extractReplyScreenname("@user reply");
assertEquals("Failed to extract reply at the start", "user", extracted);
}
public void testReplyWithLeadingSpace() {
final String extracted = extractor.extractReplyScreenname(" @user reply");
assertEquals("Failed to extract reply with leading space", "user", extracted);
}
}
/**
* Tests for the extractMentionedScreennames{WithIndices} methods
*/
public static class MentionTest extends ExtractorTest {
public void testMentionAtTheBeginning() {
final List<String> extracted = extractor.extractMentionedScreennames("@user mention");
assertList("Failed to extract mention at the beginning", new String[]{"user"}, extracted);
}
public void testMentionWithLeadingSpace() {
final List<String> extracted =
extractor.extractMentionedScreennames(" @user mention");
assertList("Failed to extract mention with leading space", new String[]{"user"}, extracted);
}
public void testMentionInMidText() {
final List<String> extracted =
extractor.extractMentionedScreennames("mention @user here");
assertList("Failed to extract mention in mid text", new String[]{"user"}, extracted);
}
public void testMultipleMentions() {
final List<String> extracted =
extractor.extractMentionedScreennames("mention @user1 here and @user2 here");
assertList("Failed to extract multiple mentioned users", new String[]{"user1", "user2"},
extracted);
}
public void testMentionWithIndices() {
final List<Extractor.Entity> extracted =
extractor.extractMentionedScreennamesWithIndices(" @user1 mention @user2 here @user3 ");
assertEquals(extracted.size(), 3);
assertEquals(extracted.get(0).getStart().intValue(), 1);
assertEquals(extracted.get(0).getEnd().intValue(), 7);
assertEquals(extracted.get(1).getStart().intValue(), 16);
assertEquals(extracted.get(1).getEnd().intValue(), 22);
assertEquals(extracted.get(2).getStart().intValue(), 28);
assertEquals(extracted.get(2).getEnd().intValue(), 34);
}
public void testMentionWithSupplementaryCharacters() {
// insert U+10400 before " @mention"
final String text = String.format("%c @mention %c @mention", 0x00010400, 0x00010400);
// count U+10400 as 2 characters (as in UTF-16)
final List<Extractor.Entity> extracted =
extractor.extractMentionedScreennamesWithIndices(text);
assertEquals(extracted.size(), 2);
assertEquals(extracted.get(0).value, "mention");
assertEquals(extracted.get(0).start, 3);
assertEquals(extracted.get(0).end, 11);
assertEquals(extracted.get(1).value, "mention");
assertEquals(extracted.get(1).start, 15);
assertEquals(extracted.get(1).end, 23);
// count U+10400 as single character
extractor.modifyIndicesFromUTF16ToUnicode(text, extracted);
assertEquals(extracted.size(), 2);
assertEquals(extracted.get(0).start, 2);
assertEquals(extracted.get(0).end, 10);
assertEquals(extracted.get(1).start, 13);
assertEquals(extracted.get(1).end, 21);
// count U+10400 as 2 characters (as in UTF-16)
extractor.modifyIndicesFromUnicodeToUTF16(text, extracted);
assertEquals(2, extracted.size());
assertEquals(3, extracted.get(0).start);
assertEquals(11, extracted.get(0).end);
assertEquals(15, extracted.get(1).start);
assertEquals(23, extracted.get(1).end);
}
}
/**
* Tests for the extractHashtags method
*/
public static class HashtagTest extends ExtractorTest {
public void testHashtagAtTheBeginning() {
final List<String> extracted = extractor.extractHashtags("#hashtag mention");
assertList("Failed to extract hashtag at the beginning", new String[]{"hashtag"}, extracted);
}
public void testHashtagWithLeadingSpace() {
final List<String> extracted = extractor.extractHashtags(" #hashtag mention");
assertList("Failed to extract hashtag with leading space", new String[]{"hashtag"},
extracted);
}
public void testHashtagInMidText() {
final List<String> extracted = extractor.extractHashtags("mention #hashtag here");
assertList("Failed to extract hashtag in mid text", new String[]{"hashtag"}, extracted);
}
public void testMultipleHashtags() {
final List<String> extracted = extractor.extractHashtags("text #hashtag1 #hashtag2");
assertList("Failed to extract multiple hashtags", new String[]{"hashtag1", "hashtag2"},
extracted);
}
public void testHashtagWithIndices() {
final List<Extractor.Entity> extracted =
extractor.extractHashtagsWithIndices(" #user1 mention #user2 here #user3 ");
assertEquals(extracted.size(), 3);
assertEquals(extracted.get(0).getStart().intValue(), 1);
assertEquals(extracted.get(0).getEnd().intValue(), 7);
assertEquals(extracted.get(1).getStart().intValue(), 16);
assertEquals(extracted.get(1).getEnd().intValue(), 22);
assertEquals(extracted.get(2).getStart().intValue(), 28);
assertEquals(extracted.get(2).getEnd().intValue(), 34);
}
public void testHashtagWithSupplementaryCharacters() {
// insert U+10400 before " #hashtag"
final String text = String.format("%c #hashtag %c #hashtag", 0x00010400, 0x00010400);
// count U+10400 as 2 characters (as in UTF-16)
final List<Extractor.Entity> extracted = extractor.extractHashtagsWithIndices(text);
assertEquals(extracted.size(), 2);
assertEquals(extracted.get(0).value, "hashtag");
assertEquals(extracted.get(0).start, 3);
assertEquals(extracted.get(0).end, 11);
assertEquals(extracted.get(1).value, "hashtag");
assertEquals(extracted.get(1).start, 15);
assertEquals(extracted.get(1).end, 23);
// count U+10400 as single character
extractor.modifyIndicesFromUTF16ToUnicode(text, extracted);
assertEquals(extracted.size(), 2);
assertEquals(extracted.get(0).start, 2);
assertEquals(extracted.get(0).end, 10);
assertEquals(extracted.get(1).start, 13);
assertEquals(extracted.get(1).end, 21);
// count U+10400 as 2 characters (as in UTF-16)
extractor.modifyIndicesFromUnicodeToUTF16(text, extracted);
assertEquals(extracted.size(), 2);
assertEquals(extracted.get(0).start, 3);
assertEquals(extracted.get(0).end, 11);
assertEquals(extracted.get(1).start, 15);
assertEquals(extracted.get(1).end, 23);
}
}
/**
* Tests for the extractURLsWithIndices method
*/
public static class URLTest extends ExtractorTest {
public void testUrlWithIndices() {
final List<Extractor.Entity> extracted =
extractor.extractURLsWithIndices("http://t.co url https://www.twitter.com ");
assertEquals(extracted.get(0).getStart().intValue(), 0);
assertEquals(extracted.get(0).getEnd().intValue(), 11);
assertEquals(extracted.get(1).getStart().intValue(), 16);
assertEquals(extracted.get(1).getEnd().intValue(), 39);
}
public void testUrlWithoutProtocol() {
final String text = "www.twitter.com, www.yahoo.co.jp, t.co/blahblah, www.poloshirts.uk.com";
assertList("Failed to extract URLs without protocol",
new String[]{"www.twitter.com", "www.yahoo.co.jp", "t.co/blahblah",
"www.poloshirts.uk.com"},
extractor.extractURLs(text));
final List<Extractor.Entity> extracted = extractor.extractURLsWithIndices(text);
assertEquals(extracted.get(0).getStart().intValue(), 0);
assertEquals(extracted.get(0).getEnd().intValue(), 15);
assertEquals(extracted.get(1).getStart().intValue(), 17);
assertEquals(extracted.get(1).getEnd().intValue(), 32);
assertEquals(extracted.get(2).getStart().intValue(), 34);
assertEquals(extracted.get(2).getEnd().intValue(), 47);
extractor.setExtractURLWithoutProtocol(false);
assertTrue("Should not extract URLs w/o protocol", extractor.extractURLs(text).isEmpty());
}
public void testURLFollowedByPunctuations() {
final String text = "http://games.aarp.org/games/mahjongg-dimensions.aspx!!!!!!";
assertList("Failed to extract URLs followed by punctuations",
new String[]{"http://games.aarp.org/games/mahjongg-dimensions.aspx"},
extractor.extractURLs(text));
}
public void testUrlWithPunctuation() {
final String[] urls = new String[]{
"http://www.foo.com/foo/path-with-period./",
"http://www.foo.org.za/foo/bar/688.1",
"http://www.foo.com/bar-path/some.stm?param1=foo;param2=P1|0||P2|0",
"http://foo.com/bar/123/foo_&_bar/",
"http://foo.com/bar(test)bar(test)bar(test)",
"www.foo.com/foo/path-with-period./",
"www.foo.org.za/foo/bar/688.1",
"www.foo.com/bar-path/some.stm?param1=foo;param2=P1|0||P2|0",
"foo.com/bar/123/foo_&_bar/"
};
for (String url : urls) {
assertEquals(url, extractor.extractURLs(url).get(0));
}
}
public void testUrlnWithSupplementaryCharacters() {
// insert U+10400 before " http://twitter.com"
final String text = String.format("%c http://twitter.com %c http://twitter.com", 0x00010400,
0x00010400);
// count U+10400 as 2 characters (as in UTF-16)
final List<Extractor.Entity> extracted = extractor.extractURLsWithIndices(text);
assertEquals(extracted.size(), 2);
assertEquals(extracted.get(0).value, "http://twitter.com");
assertEquals(extracted.get(0).start, 3);
assertEquals(extracted.get(0).end, 21);
assertEquals(extracted.get(1).value, "http://twitter.com");
assertEquals(extracted.get(1).start, 25);
assertEquals(extracted.get(1).end, 43);
// count U+10400 as single character
extractor.modifyIndicesFromUTF16ToUnicode(text, extracted);
assertEquals(extracted.size(), 2);
assertEquals(extracted.get(0).start, 2);
assertEquals(extracted.get(0).end, 20);
assertEquals(extracted.get(1).start, 23);
assertEquals(extracted.get(1).end, 41);
// count U+10400 as 2 characters (as in UTF-16)
extractor.modifyIndicesFromUnicodeToUTF16(text, extracted);
assertEquals(extracted.size(), 2);
assertEquals(extracted.get(0).start, 3);
assertEquals(extracted.get(0).end, 21);
assertEquals(extracted.get(1).start, 25);
assertEquals(extracted.get(1).end, 43);
}
}
public void testUrlWithSpecialCCTLDWithoutProtocol() {
final String text = "MLB.tv vine.co";
assertList("Failed to extract URLs without protocol",
new String[]{"MLB.tv", "vine.co"}, extractor.extractURLs(text));
final List<Extractor.Entity> extracted = extractor.extractURLsWithIndices(text);
assertEquals(extracted.get(0).getStart().intValue(), 0);
assertEquals(extracted.get(0).getEnd().intValue(), 6);
assertEquals(extracted.get(1).getStart().intValue(), 7);
assertEquals(extracted.get(1).getEnd().intValue(), 14);
extractor.setExtractURLWithoutProtocol(false);
assertTrue("Should not extract URLs w/o protocol", extractor.extractURLs(text).isEmpty());
}
/**
* Helper method for asserting that the List of extracted Strings match the expected values.
*
* @param message to display on failure
* @param expected Array of Strings that were expected to be extracted
* @param actual List of Strings that were extracted
*/
protected void assertList(String message, String[] expected, List<String> actual) {
final List<String> expectedList = Arrays.asList(expected);
if (expectedList.size() != actual.size()) {
fail(message + "\n\nExpected list and extracted list are differnt sizes:\n" +
" Expected (" + expectedList.size() + "): " + expectedList + "\n" +
" Actual (" + actual.size() + "): " + actual);
} else {
for (int i = 0; i < expectedList.size(); i++) {
assertEquals(expectedList.get(i), actual.get(i));
}
}
}
}
| 6,635 |
5,447 | <reponame>RafLit/gluon-cv<filename>gluoncv/auto/estimators/torch_image_classification/utils/metrics.py
import torch
from torch.nn.functional import softmax
def rmse(outputs, target):
return torch.sqrt(torch.mean((softmax(outputs, dim=0)-target)**2))
| 98 |
14,668 | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_MOCK_FILE_CHOOSER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_MOCK_FILE_CHOOSER_H_
#include <utility>
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/choosers/file_chooser.mojom-blink-forward.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
class MockFileChooser : public mojom::blink::FileChooser {
using FileChooser = mojom::blink::FileChooser;
using FileChooserParamsPtr = mojom::blink::FileChooserParamsPtr;
public:
// |reached_callback| is called when OpenFileChooser() or
// |EnumerateChosenDirectory() is called.
MockFileChooser(blink::BrowserInterfaceBrokerProxy& broker,
base::OnceClosure reached_callback)
: broker_(broker), reached_callback_(std::move(reached_callback)) {
broker.SetBinderForTesting(
FileChooser::Name_,
WTF::BindRepeating(&MockFileChooser::BindFileChooserReceiver,
WTF::Unretained(this)));
}
~MockFileChooser() override {
broker_.SetBinderForTesting(FileChooser::Name_, {});
}
void SetQuitClosure(base::OnceClosure reached_callback) {
reached_callback_ = std::move(reached_callback);
}
void ResponseOnOpenFileChooser(FileChooserFileInfoList files) {
DCHECK(callback_)
<< "OpenFileChooser() or EnumerateChosenDirectory() should "
"be called beforehand.";
std::move(callback_).Run(mojom::blink::FileChooserResult::New(
std::move(files), base::FilePath()));
receivers_.FlushForTesting();
}
private:
void BindFileChooserReceiver(mojo::ScopedMessagePipeHandle handle) {
receivers_.Add(this, mojo::PendingReceiver<FileChooser>(std::move(handle)));
}
void OpenFileChooser(FileChooserParamsPtr params,
OpenFileChooserCallback callback) override {
DCHECK(!callback_);
callback_ = std::move(callback);
if (reached_callback_)
std::move(reached_callback_).Run();
}
void EnumerateChosenDirectory(
const base::FilePath& directory_path,
EnumerateChosenDirectoryCallback callback) override {
DCHECK(!callback_);
callback_ = std::move(callback);
if (reached_callback_)
std::move(reached_callback_).Run();
}
blink::BrowserInterfaceBrokerProxy& broker_;
mojo::ReceiverSet<FileChooser> receivers_;
OpenFileChooserCallback callback_;
FileChooserParamsPtr params_;
base::OnceClosure reached_callback_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_MOCK_FILE_CHOOSER_H_
| 1,116 |
1,198 | /*
Copyright 2017-2019 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "lullaby/systems/name/name_system.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "lullaby/generated/name_def_generated.h"
#include "lullaby/modules/dispatcher/dispatcher.h"
#include "lullaby/modules/ecs/blueprint.h"
#include "lullaby/systems/transform/transform_system.h"
#include "lullaby/tests/portable_test_macros.h"
namespace lull {
namespace {
using ::testing::Eq;
class NameSystemTest : public ::testing::Test {
protected:
Registry registry_;
};
using NameSystemDeathTest = NameSystemTest;
TEST_F(NameSystemDeathTest, InvalidCreate) {
NameDefT name;
name.name = "left_button";
const Blueprint blueprint(&name);
NameSystem* name_system = registry_.Create<NameSystem>(®istry_);
PORT_EXPECT_DEBUG_DEATH(name_system->Create(kNullEntity, 0, nullptr), "");
PORT_EXPECT_DEBUG_DEATH(
name_system->CreateComponent(kNullEntity, blueprint), "");
PORT_EXPECT_DEBUG_DEATH(name_system->SetName(kNullEntity, "left_button"), "");
}
TEST_F(NameSystemTest, CreateName) {
NameDefT name;
name.name = "left_button";
const Blueprint blueprint(&name);
const Entity kTestEntity = 1;
NameSystem* name_system = registry_.Create<NameSystem>(®istry_);
name_system->CreateComponent(kTestEntity, blueprint);
EXPECT_THAT(name_system->FindEntity("left_button"), Eq(kTestEntity));
}
TEST_F(NameSystemTest, SetAndGetByName) {
const Entity kTestEntity = 1;
NameSystem* name_system = registry_.Create<NameSystem>(®istry_);
name_system->SetName(kTestEntity, "left_button");
EXPECT_THAT(name_system->FindEntity("left_button"), Eq(kTestEntity));
EXPECT_THAT(name_system->GetName(kTestEntity), Eq("left_button"));
}
TEST_F(NameSystemTest, SetDuplicateNames) {
const bool kAllowDuplicateNames = true;
const Entity kTestEntity1 = 1;
const Entity kTestEntity2 = 2;
NameSystem* name_system =
registry_.Create<NameSystem>(®istry_, kAllowDuplicateNames);
name_system->SetName(kTestEntity1, "left_button");
name_system->SetName(kTestEntity2, "left_button");
EXPECT_THAT(name_system->GetName(kTestEntity1), Eq("left_button"));
EXPECT_THAT(name_system->GetName(kTestEntity2), Eq("left_button"));
}
TEST_F(NameSystemTest, OverwriteName) {
const Entity kTestEntity = 1;
auto* dispatcher = registry_.Create<Dispatcher>();
NameSystem* name_system = registry_.Create<NameSystem>(®istry_);
name_system->SetName(kTestEntity, "left_button");
name_system->SetName(kTestEntity, "right_button");
EXPECT_THAT(name_system->FindEntity("left_button"), Eq(kNullEntity));
EXPECT_THAT(name_system->FindEntity("right_button"), Eq(kTestEntity));
SetNameEvent event;
event.entity = kTestEntity;
event.name = "left_button";
dispatcher->SendImmediately(event);
EXPECT_THAT(name_system->FindEntity("left_button"), Eq(kTestEntity));
EXPECT_THAT(name_system->FindEntity("right_button"), Eq(kNullEntity));
}
TEST_F(NameSystemTest, OverwriteSameName) {
const Entity kTestEntity = 1;
NameSystem* name_system = registry_.Create<NameSystem>(®istry_);
name_system->SetName(kTestEntity, "left_button");
EXPECT_THAT(name_system->FindEntity("left_button"), Eq(kTestEntity));
name_system->SetName(kTestEntity, "left_button");
EXPECT_THAT(name_system->FindEntity("left_button"), Eq(kTestEntity));
}
TEST_F(NameSystemDeathTest, ReassignName) {
const Entity kTestEntity1 = 1;
const Entity kTestEntity2 = 2;
NameSystem* name_system = registry_.Create<NameSystem>(®istry_);
name_system->SetName(kTestEntity1, "left_button");
PORT_EXPECT_DEBUG_DEATH(name_system->SetName(kTestEntity2, "left_button"),
"");
EXPECT_THAT(name_system->FindEntity("left_button"), Eq(kTestEntity1));
EXPECT_THAT(name_system->GetName(kTestEntity1), Eq("left_button"));
EXPECT_THAT(name_system->GetName(kTestEntity2), Eq(""));
}
TEST_F(NameSystemTest, FindDescendant) {
const Entity kRootEntity = 1;
const Entity kParentEntity1 = 2;
const Entity kParentEntity2 = 3;
const Entity kChildEntity1 = 4;
Sqt sqt;
auto* transform_system = registry_.Create<TransformSystem>(®istry_);
transform_system->Create(kRootEntity, sqt);
transform_system->Create(kParentEntity1, sqt);
transform_system->Create(kParentEntity2, sqt);
transform_system->Create(kChildEntity1, sqt);
transform_system->AddChild(kRootEntity, kParentEntity1);
transform_system->AddChild(kRootEntity, kParentEntity2);
transform_system->AddChild(kParentEntity1, kChildEntity1);
NameSystem* name_system = registry_.Create<NameSystem>(®istry_);
name_system->SetName(kChildEntity1, "child1");
name_system->SetName(kParentEntity1, "parent1");
EXPECT_THAT(name_system->FindDescendant(kRootEntity, "parent1"),
Eq(kParentEntity1));
EXPECT_THAT(name_system->FindDescendant(kRootEntity, "child1"),
Eq(kChildEntity1));
EXPECT_THAT(name_system->FindDescendant(kParentEntity1, "child1"),
Eq(kChildEntity1));
EXPECT_THAT(name_system->FindDescendant(kParentEntity2, "child1"),
Eq(kNullEntity));
}
TEST_F(NameSystemTest, FindDescendantWithDuplicateNames) {
const bool kAllowDuplicateNames = true;
const Entity kRootEntity = 1;
const Entity kParentEntity1 = 2;
const Entity kParentEntity2 = 3;
const Entity kChildEntity1 = 4;
const Entity kChildEntity2 = 5;
const Entity kChildEntity3 = 6;
Sqt sqt;
auto* transform_system = registry_.Create<TransformSystem>(®istry_);
transform_system->Create(kRootEntity, sqt);
transform_system->Create(kParentEntity1, sqt);
transform_system->Create(kParentEntity2, sqt);
transform_system->Create(kChildEntity1, sqt);
transform_system->Create(kChildEntity2, sqt);
transform_system->Create(kChildEntity3, sqt);
transform_system->AddChild(kRootEntity, kParentEntity1);
transform_system->AddChild(kRootEntity, kParentEntity2);
transform_system->AddChild(kRootEntity, kChildEntity3);
transform_system->AddChild(kParentEntity1, kChildEntity1);
transform_system->AddChild(kParentEntity2, kChildEntity2);
auto* name_system =
registry_.Create<NameSystem>(®istry_, kAllowDuplicateNames);
name_system->SetName(kChildEntity1, "left_button");
name_system->SetName(kChildEntity2, "left_button");
name_system->SetName(kChildEntity3, "child3");
name_system->SetName(kParentEntity1, "parent1");
EXPECT_THAT(name_system->FindDescendant(kRootEntity, "parent1"),
Eq(kParentEntity1));
EXPECT_THAT(name_system->FindDescendant(kRootEntity, "child3"),
Eq(kChildEntity3));
EXPECT_THAT(name_system->FindDescendant(kParentEntity1, "child3"),
Eq(kNullEntity));
EXPECT_THAT(name_system->FindDescendant(kParentEntity1, "left_button"),
Eq(kChildEntity1));
EXPECT_THAT(name_system->FindDescendant(kParentEntity2, "left_button"),
Eq(kChildEntity2));
}
} // namespace
} // namespace lull
| 2,641 |
348 | <reponame>chamberone/Leaflet.PixiOverlay
{"nom":"Mittainvilliers-Vérigny","dpt":"Eure-et-Loir","inscrits":571,"abs":119,"votants":452,"blancs":45,"nuls":6,"exp":401,"res":[{"panneau":"1","voix":229},{"panneau":"2","voix":172}]} | 98 |
571 | from pyfora.algorithms.LinearRegression import linearRegression
from pyfora.algorithms.logistic.BinaryLogisticRegressionFitter import BinaryLogisticRegressionFitter
from pyfora.algorithms.regressionTrees.RegressionTree import RegressionTreeBuilder
from pyfora.algorithms.regressionTrees.GradientBoostedClassifierBuilder import GradientBoostedClassifierBuilder
from pyfora.algorithms.regressionTrees.GradientBoostedRegressorBuilder import GradientBoostedRegressorBuilder
| 130 |
312 | <reponame>BulkSecurityGeneratorProject/alchemy
package com.dfire.platform.alchemy.descriptor;
import com.dfire.platform.alchemy.common.Constants;
import java.util.Optional;
import java.util.Properties;
import org.apache.flink.api.common.serialization.SerializationSchema;
import org.apache.flink.streaming.connectors.kafka.KafkaTableSink;
import org.apache.flink.streaming.connectors.kafka.KafkaTableSinkBase;
import org.apache.flink.streaming.connectors.kafka.partitioner.FlinkKafkaPartitioner;
import org.apache.flink.table.api.TableSchema;
import org.apache.flink.types.Row;
/**
* @author congbai
*/
public class KafkaSinkDescriptor extends KafkaBaseSinkDescriptor {
@Override KafkaTableSinkBase newTableSink(TableSchema schema, String topic, Properties properties,
Optional<FlinkKafkaPartitioner<Row>> partitioner, SerializationSchema<Row> serializationSchema) {
return new KafkaTableSink(
schema,
topic,
properties,
partitioner,
serializationSchema
);
}
@Override
public String type() {
return Constants.SINK_TYPE_VALUE_KAFKA;
}
}
| 443 |
329 | from collections import OrderedDict
import unittest
from unittest.mock import patch, call
from homu import action
from homu.action import LabelEvent
TRY_CHOOSER_CONFIG = {
"buildbot": {
"builders": ["mac-rel", "mac-wpt", "linux-wpt-1", "linux-wpt-2"],
# keeps the order for testing output
"try_choosers": OrderedDict([
("mac", ["mac-rel", "mac-wpt"]),
("wpt", ["linux-wpt-1", "linux-wpt-2"])
])
},
"try_choosers": [
"taskcluster"
],
}
TRY_CHOOSER_WITHOUT_BUILDBOT_CONFIG = {
"try_choosers": [
"taskcluster"
],
}
class TestAction(unittest.TestCase):
@patch('homu.main.PullReqState')
@patch('homu.action.get_portal_turret_dialog', return_value='message')
def test_still_here(self, mock_message, MockPullReqState):
state = MockPullReqState()
action.still_here(state)
state.add_comment.assert_called_once_with(':cake: message\n\n')
@patch('homu.main.PullReqState')
def test_set_treeclosed(self, MockPullReqState):
state = MockPullReqState()
action.set_treeclosed(state, '123')
state.change_treeclosed.assert_called_once_with(123)
state.save.assert_called_once_with()
@patch('homu.main.PullReqState')
def test_delegate_to(self, MockPullReqState):
state = MockPullReqState()
action.delegate_to(state, True, 'user')
self.assertEqual(state.delegate, 'user')
state.save.assert_called_once_with()
state.add_comment.assert_called_once_with(
':v: @user can now approve this pull request'
)
@patch('homu.main.PullReqState')
def test_hello_or_ping(self, MockPullReqState):
state = MockPullReqState()
action.hello_or_ping(state)
state.add_comment.assert_called_once_with(":sleepy: I'm awake I'm awake")
@patch('homu.main.PullReqState')
def test_rollup_positive(self, MockPullReqState):
state = MockPullReqState()
action.rollup(state, 'rollup')
self.assertTrue(state.rollup)
state.save.assert_called_once_with()
@patch('homu.main.PullReqState')
def test_rollup_negative(self, MockPullReqState):
state = MockPullReqState()
action.rollup(state, 'rollup-')
self.assertFalse(state.rollup)
state.save.assert_called_once_with()
@patch('homu.main.PullReqState')
def test_try_positive(self, MockPullReqState):
state = MockPullReqState()
action._try(state, 'try', False, {})
self.assertTrue(state.try_)
state.init_build_res.assert_called_once_with([])
state.save.assert_called_once_with()
state.change_labels.assert_called_once_with(LabelEvent.TRY)
@patch('homu.main.PullReqState')
def test_try_negative(self, MockPullReqState):
state = MockPullReqState()
action._try(state, 'try-', False, {})
self.assertFalse(state.try_)
state.init_build_res.assert_called_once_with([])
state.save.assert_called_once_with()
assert not state.change_labels.called, 'change_labels was called and should never be.'
@patch('homu.main.PullReqState')
def test_try_chooser_no_setup(self, MockPullReqState):
state = MockPullReqState()
action._try(state, 'try', True, {}, choose="foo")
self.assertTrue(state.try_)
state.init_build_res.assert_called_once_with([])
state.save.assert_called_once_with()
state.change_labels.assert_called_once_with(LabelEvent.TRY)
state.add_comment.assert_called_once_with(":slightly_frowning_face: This repo does not have try choosers set up")
@patch('homu.main.PullReqState')
def test_try_chooser_not_found(self, MockPullReqState):
state = MockPullReqState()
action._try(state, 'try', True, TRY_CHOOSER_CONFIG, choose="foo")
self.assertEqual(state.try_choose, None)
state.init_build_res.assert_not_called()
state.save.assert_not_called()
state.change_labels.assert_not_called()
state.add_comment.assert_called_once_with(":slightly_frowning_face: There is no try chooser foo for this repo, try one of: taskcluster, mac, wpt")
@patch('homu.main.PullReqState')
def test_try_chooser_found(self, MockPullReqState):
state = MockPullReqState()
action._try(state, 'try', True, TRY_CHOOSER_CONFIG, choose="mac")
self.assertTrue(state.try_)
self.assertEqual(state.try_choose, "mac")
state.init_build_res.assert_called_once_with([])
state.save.assert_called_once_with()
state.change_labels.assert_called_once_with(LabelEvent.TRY)
@patch('homu.main.PullReqState')
def test_try_chooser_non_buildbot_found(self, MockPullReqState):
state = MockPullReqState()
action._try(state, 'try', True, TRY_CHOOSER_CONFIG, choose="taskcluster")
self.assertTrue(state.try_)
self.assertEqual(state.try_choose, "taskcluster")
state.init_build_res.assert_called_once_with([])
state.save.assert_called_once_with()
state.change_labels.assert_called_once_with(LabelEvent.TRY)
@patch('homu.main.PullReqState')
def test_try_chooser_without_buildbot_found(self, MockPullReqState):
state = MockPullReqState()
action._try(state, 'try', True, TRY_CHOOSER_WITHOUT_BUILDBOT_CONFIG, choose="taskcluster")
self.assertTrue(state.try_)
self.assertEqual(state.try_choose, "taskcluster")
state.init_build_res.assert_called_once_with([])
state.save.assert_called_once_with()
state.change_labels.assert_called_once_with(LabelEvent.TRY)
@patch('homu.main.PullReqState')
def test_clean(self, MockPullReqState):
state = MockPullReqState()
action.clean(state)
self.assertEqual(state.merge_sha, '')
state.init_build_res.assert_called_once_with([])
state.save.assert_called_once_with()
@patch('homu.main.PullReqState')
def test_retry_try(self, MockPullReqState):
state = MockPullReqState()
state.try_ = True
action.retry(state)
state.set_status.assert_called_once_with('')
state.change_labels.assert_called_once_with(LabelEvent.TRY)
@patch('homu.main.PullReqState')
def test_treeclosed_negative(self, MockPullReqState):
state = MockPullReqState()
action.treeclosed_negative(state)
state.change_treeclosed.assert_called_once_with(-1)
state.save.assert_called_once_with()
@patch('homu.main.PullReqState')
def test_retry_approved(self, MockPullReqState):
state = MockPullReqState()
state.try_ = False
action.retry(state)
state.set_status.assert_called_once_with('')
state.change_labels.assert_called_once_with(LabelEvent.APPROVED)
@patch('homu.main.PullReqState')
def test_delegate_negative(self, MockPullReqState):
state = MockPullReqState()
state.delegate = 'delegate'
action.delegate_negative(state)
self.assertEqual(state.delegate, '')
state.save.assert_called_once_with()
@patch('homu.main.PullReqState')
def test_delegate_positive_realtime(self, MockPullReqState):
state = MockPullReqState()
action.delegate_positive(state, 'delegate', True)
self.assertEqual(state.delegate, 'delegate')
state.add_comment.assert_called_once_with(':v: @delegate can now approve this pull request')
state.save.assert_called_once_with()
@patch('homu.main.PullReqState')
def test_delegate_positive_not_realtime(self, MockPullReqState):
state = MockPullReqState()
action.delegate_positive(state, 'delegate', False)
self.assertEqual(state.delegate, 'delegate')
state.save.assert_called_once_with()
assert not state.add_comment.called, 'state.save was called and should never be.'
@patch('homu.main.PullReqState')
def test_set_priority_not_priority_less_than_max_priority(self, MockPullReqState):
state = MockPullReqState()
action.set_priority(state, True, '1', {'max_priority': 3})
self.assertEqual(state.priority, 1)
state.save.assert_called_once_with()
@patch('homu.main.PullReqState')
def test_set_priority_not_priority_more_than_max_priority(self, MockPullReqState):
state = MockPullReqState()
state.priority = 2
self.assertFalse(action.set_priority(state, True, '5', {'max_priority': 3}))
self.assertEqual(state.priority, 2)
state.add_comment.assert_called_once_with(':stop_sign: Priority higher than 3 is ignored.')
assert not state.save.called, 'state.save was called and should never be.'
@patch('homu.main.PullReqState')
def test_review_approved_approver_me(self, MockPullReqState):
state = MockPullReqState()
self.assertFalse(action.review_approved(state, True, 'me', 'user', 'user', '', []))
@patch('homu.main.PullReqState')
def test_review_approved_wip_todo_realtime(self, MockPullReqState):
state = MockPullReqState()
state.title = 'WIP work in progress'
self.assertFalse(action.review_approved(state, True, 'user', 'user', 'user', '', []))
state.add_comment.assert_called_once_with(':clipboard: Looks like this PR is still in progress, ignoring approval')
@patch('homu.main.PullReqState')
def test_review_approved_wip_not_realtime(self, MockPullReqState):
state = MockPullReqState()
state.title = 'WIP work in progress'
self.assertFalse(action.review_approved(state, False, 'user', 'user', 'user', '', []))
assert not state.add_comment.called, 'state.add_comment was called and should never be.'
@patch('homu.main.PullReqState')
def test_review_approved_equal_usernames(self, MockPullReqState):
state = MockPullReqState()
state.head_sha = 'abcd123'
state.title = "My pull request"
self.assertTrue(action.review_approved(state, True, 'user' ,'user', 'user', 'abcd123', []))
self.assertEqual(state.approved_by, 'user')
self.assertFalse(state.try_)
state.set_status.assert_called_once_with('')
state.save.assert_called_once_with()
@patch('homu.main.PullReqState')
def test_review_approved_different_usernames_sha_equals_head_sha(self, MockPullReqState):
state = MockPullReqState()
state.head_sha = '<PASSWORD>23'
state.title = "My pull request"
state.repo_label = 'label'
state.status = 'pending'
states = {}
states[state.repo_label] = {'label': state}
self.assertTrue(action.review_approved(state, True, 'user1' ,'user1', 'user2', 'abcd123', states))
self.assertEqual(state.approved_by, 'user1')
self.assertFalse(state.try_)
state.set_status.assert_called_once_with('')
state.save.assert_called_once_with()
state.add_comment.assert_called_once_with(":bulb: This pull request was already approved, no need to approve it again.\n\n- This pull request is currently being tested. If there's no response from the continuous integration service, you may use `retry` to trigger a build again.")
@patch('homu.main.PullReqState')
def test_review_approved_different_usernames_sha_different_head_sha(self, MockPullReqState):
state = MockPullReqState()
state.head_sha = 'sdf456'
state.title = "My pull request"
state.repo_label = 'label'
state.status = 'pending'
state.num = 1
states = {}
states[state.repo_label] = {'label': state}
self.assertTrue(action.review_approved(state, True, 'user1', 'user1', 'user2', 'abcd123', states))
state.add_comment.assert_has_calls([call(":bulb: This pull request was already approved, no need to approve it again.\n\n- This pull request is currently being tested. If there's no response from the continuous integration service, you may use `retry` to trigger a build again."),
call(':scream_cat: `abcd123` is not a valid commit SHA. Please try again with `sdf456`.')])
@patch('homu.main.PullReqState')
def test_review_approved_different_usernames_blank_sha_not_blocked_by_closed_tree(self, MockPullReqState):
state = MockPullReqState()
state.blocked_by_closed_tree.return_value = 0
state.head_sha = 'sdf456'
state.title = "My pull request"
state.repo_label = 'label'
state.status = 'pending'
states = {}
states[state.repo_label] = {'label': state}
self.assertTrue(action.review_approved(state, True, 'user1', 'user1', 'user2', '', states))
state.add_comment.assert_has_calls([call(":bulb: This pull request was already approved, no need to approve it again.\n\n- This pull request is currently being tested. If there's no response from the continuous integration service, you may use `retry` to trigger a build again."),
call(':pushpin: Commit sdf456 has been approved by `user1`\n\n<!-- @user2 r=user1 sdf456 -->')])
@patch('homu.main.PullReqState')
def test_review_approved_different_usernames_blank_sha_blocked_by_closed_tree(self, MockPullReqState):
state = MockPullReqState()
state.blocked_by_closed_tree.return_value = 1
state.head_sha = 'sdf456'
state.title = "My pull request"
state.repo_label = 'label'
state.status = 'pending'
states = {}
states[state.repo_label] = {'label': state}
self.assertTrue(action.review_approved(state, True, 'user1', 'user1', 'user2', '', states))
state.add_comment.assert_has_calls([call(":bulb: This pull request was already approved, no need to approve it again.\n\n- This pull request is currently being tested. If there's no response from the continuous integration service, you may use `retry` to trigger a build again."),
call(':pushpin: Commit sdf456 has been approved by `user1`\n\n<!-- @user2 r=user1 sdf456 -->'),
call(':evergreen_tree: The tree is currently closed for pull requests below priority 1, this pull request will be tested once the tree is reopened')])
state.change_labels.assert_called_once_with(LabelEvent.APPROVED)
@patch('homu.main.PullReqState')
def test_review_approved_same_usernames_sha_different_head_sha(self, MockPullReqState):
state = MockPullReqState()
state.head_sha = 'sdf456'
state.title = "My pull request"
state.repo_label = 'label'
state.status = 'pending'
states = {}
states[state.repo_label] = {'label': state}
self.assertTrue(action.review_approved(state, True, 'user', 'user', 'user', 'abcd123', states))
@patch('homu.main.PullReqState')
def test_review_rejected(self, MockPullReqState):
state = MockPullReqState()
action.review_rejected(state, True)
self.assertEqual(state.approved_by, '')
state.save.assert_called_once_with()
state.change_labels.assert_called_once_with(LabelEvent.REJECTED)
def test_sha_cmp_equal(self):
self.assertTrue(action.sha_cmp('f259660', 'f259660b128ae59133dff123998ee9b643aff050'))
def test_sha_cmp_not_equal(self):
self.assertFalse(action.sha_cmp('aaabbb12', 'f259660b128ae59133dff123998ee9b643aff050'))
def test_sha_cmp_short_length(self):
self.assertFalse(action.sha_cmp('f25', 'f259660b128ae59133dff123998ee9b643aff050'))
if __name__ == '__main__':
unittest.main()
| 6,645 |
1,837 | package com.dianping.zebra.shard.util;
import org.junit.Assert;
import org.junit.Test;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
* Created by wxl on 17/4/13.
*/
public class ShardDateParseUtilTest {
@Test
public void testParseDate() throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
ShardDateParseUtil.ShardDate sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", format.parse("2017-02-28"));
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 1, 27), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", format.parse("2017-03-01"));
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 2, 0), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", format.parse("2016-02-29"));
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2016, 1, 28), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", format.parse("2017-03-31"));
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 2, 30), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", format.parse("2017-12-31"));
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 11, 30), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", format.parse("2017-01-01"));
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 0, 0), sd);
}
@Test
public void testParseStr() {
ShardDateParseUtil.ShardDate sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", "2017-02-28");
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 1, 27), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", "2017-03-01");
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 2, 0), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", "2016-02-29");
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2016, 1, 28), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", "2017-03-31");
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 2, 30), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", "2017-12-31");
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 11, 30), sd);
sd = ShardDateParseUtil.parseToYMD("yyyy-MM-dd", "2017-01-01");
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 0, 0), sd);
}
// @Test
// public void testTime() throws ParseException {
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// Date date = format.parse("2017-02-28");
// ShardDateParseUtil.ShardDate sd = null;
// int loop = 1000000;
//// ShardDateParseUtil.ShardDate sd = ShardDateParseUtil.parseToYMD(format.parse("2017-02-28"));
//
// long s = System.currentTimeMillis();
// for(int i = 0; i < loop; ++i) {
// sd = ShardDateParseUtil.parseToYMD("2017-02-28", "yyyy-MM-dd");
// }
// long e = System.currentTimeMillis();
// System.out.println("t = "+(e-s)+"ms");
//
// s = System.currentTimeMillis();
// for(int i = 0; i < loop; ++i) {
// sd = ShardDateParseUtil.parseToYMD(new Date());
// }
// e = System.currentTimeMillis();
// System.out.println("t = "+(e-s)+"ms");
// }
@Test
public void testAddDay() {
ShardDateParseUtil.ShardDate sd = ShardDateParseUtil.addDay("yyyy-MM-dd", "2016-02-28", 1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2016, 1, 28), sd);
sd = ShardDateParseUtil.addDay("yyyy-MM-dd", "2017-02-28", 1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 2, 0), sd);
sd = ShardDateParseUtil.addDay("yyyy-MM-dd", "2016-12-31", 1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 0, 0), sd);
sd = ShardDateParseUtil.addDay("yyyy-MM-dd", "2016-09-30", 1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2016, 9, 0), sd);
sd = ShardDateParseUtil.addDay("yyyy-MM-dd", "2016-03-01", -1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2016, 1, 28), sd);
sd = ShardDateParseUtil.addDay("yyyy-MM-dd", "2017-03-01", -1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 1, 27), sd);
sd = ShardDateParseUtil.addDay("yyyy-MM-dd", "2016-01-01", -1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2015, 11, 30), sd);
sd = ShardDateParseUtil.addDay("yyyy-MM-dd", "2016-12-01", -1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2016, 10, 29), sd);
}
@Test
public void testAddMonth() {
ShardDateParseUtil.ShardDate sd = ShardDateParseUtil.addMonth("yyyy-MM-dd", "2016-02-28", 1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2016, 2, 27), sd);
sd = ShardDateParseUtil.addMonth("yyyy-MM-dd", "2016-03-31", 1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2016, 3, 29), sd);
sd = ShardDateParseUtil.addMonth("yyyy-MM-dd", "2016-03-01", -1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2016, 1, 0), sd);
sd = ShardDateParseUtil.addMonth("yyyy-MM-dd", "2016-01-01", -1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2015, 11, 0), sd);
sd = ShardDateParseUtil.addMonth("yyyy-MM-dd", "2016-01-31", -1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2015, 11, 30), sd);
sd = ShardDateParseUtil.addMonth("yyyy-MM-dd", "2016-12-31", 1);
Assert.assertEquals(new ShardDateParseUtil.ShardDate(2017, 0, 30), sd);
}
}
| 2,555 |
1,072 | import torch
from .. import ModelWrapper, register_model_wrapper
@register_model_wrapper("sagn_mw")
class SagnModelWrapper(ModelWrapper):
def __init__(self, model, optimizer_config):
super(SagnModelWrapper, self).__init__()
self.model = model
self.optimizer_config = optimizer_config
def train_step(self, batch):
batch_x, batch_y_emb, y = batch
pred = self.model(batch_x, batch_y_emb)
loss = self.default_loss_fn(pred, y)
return loss
def val_step(self, batch):
batch_x, batch_y_emb, y = batch
# print(batch_x.device, batch_y_emb.devce, y.device, next(self.parameters()).device)
pred = self.model(batch_x, batch_y_emb)
metric = self.evaluate(pred, y, metric="auto")
self.note("val_loss", self.default_loss_fn(pred, y))
self.note("val_metric", metric)
def test_step(self, batch):
batch_x, batch_y_emb, y = batch
pred = self.model(batch_x, batch_y_emb)
metric = self.evaluate(pred, y, metric="auto")
self.note("test_loss", self.default_loss_fn(pred, y))
self.note("test_metric", metric)
def pre_stage(self, stage, data_w):
device = next(self.model.parameters()).device
if stage == 0:
return None
self.model.eval()
preds = []
eval_loader = data_w.post_stage_wrapper()
with torch.no_grad():
for batch in eval_loader:
batch_x, batch_y_emb, _ = data_w.pre_stage_transform(batch)
batch_x = batch_x.to(device)
batch_y_emb = batch_y_emb.to(device) if batch_y_emb is not None else batch_y_emb
pred = self.model(batch_x, batch_y_emb)
preds.append(pred.to("cpu"))
probs = torch.cat(preds, dim=0)
return probs
def setup_optimizer(self):
cfg = self.optimizer_config
return torch.optim.Adam(self.model.parameters(), lr=cfg["lr"], weight_decay=cfg["weight_decay"])
| 925 |
950 | #include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
struct stu{
string id;
int sco;
};
struct site{
string siteId;
int cnt;
};
bool cmp1(stu a, stu b) {
return a.sco == b.sco ? a.id < b.id : a.sco > b.sco;
}
bool cmp2(site a, site b) {
return a.cnt == b.cnt ? a.siteId < b.siteId : a.cnt > b.cnt;
}
int main(){
int n, k;
cin >> n >> k;
vector<stu> v(n);
for(int i = 0; i < n; i++)
cin >> v[i].id >> v[i].sco;
for(int i = 1; i <= k; i++){
int num;
cin >> num;
if(num == 1){
string level;
cin >> level;
printf("Case %d: %d %s\n", i, num, level.c_str());
vector<stu> ans;
for(int j = 0; j < n; j++){
if(v[j].id[0] == level[0])
ans.push_back(v[j]);
}
sort(ans.begin(), ans.end(), cmp1);
for(int j = 0; j < ans.size(); j++)
printf("%s %d\n", ans[j].id.c_str(), ans[j].sco);
if(ans.size() == 0) printf("NA\n");
}else if(num == 2){
int cnt = 0, sum = 0;
int siteId;
cin >> siteId;
printf("Case %d: %d %d\n", i, num, siteId);
vector<stu> ans;
for(int j = 0; j < n; j++){
if(v[j].id.substr(1, 3) == to_string(siteId)){
cnt++;
sum += v[j].sco;
}
}
if(cnt != 0) printf("%d %d\n", cnt, sum);
else printf("NA\n");
}else if(num == 3){
string data;
cin >> data;
printf("Case %d: %d %s\n", i, num, data.c_str());
vector<site> ans;
unordered_map<string, int> m;
for(int j = 0; j < n; j++){
if(v[j].id.substr(4, 6) == data){
string tt = v[j].id.substr(1, 3);
m[tt]++;
}
}
for(auto it : m)
ans.push_back({it.first, it.second});
sort(ans.begin(), ans.end(), cmp2);
for(int j = 0; j < ans.size(); j++)
printf("%s %d\n", ans[j].siteId.c_str(), ans[j].cnt);
if(ans.size() == 0) printf("NA\n");
}
}
return 0;
}
| 965 |
335 | <gh_stars>100-1000
{
"word": "Hummingbird",
"definitions": [
"A small nectar-feeding tropical American bird that is able to hover and fly backwards, and typically has colourful iridescent plumage."
],
"parts-of-speech": "Noun"
} | 90 |
578 | // Copyright (c) 2019 <NAME> <EMAIL>
// This software is provided 'as-is' under the zlib License, see the LICENSE.txt file.
// This notice and the license may not be removed or altered from any source distribution.
#ifdef TWO_MODULES
module;
#include <infra/Cpp20.h>
module TWO(ui);
#else
#include <infra/ToString.h>
#include <math/Vec.hpp>
#include <ui/Slider.h>
#include <ui/Button.h>
#include <ui/Style/Styles.h>
#include <ui/WidgetStruct.h>
#include <ctx/InputDevice.h>
#endif
namespace two
{
namespace ui
{
SliderMetrics::SliderMetrics(float min, float max, float step_length, float knob_length)
: m_min(min)
, m_max(max)
, m_step_length(step_length)
, m_knob_length(knob_length)
{
m_range = m_max + m_knob_length - m_min;
m_num_steps = m_range / m_step_length + 1;
}
float SliderMetrics::offset(float cursor) const
{
return cursor / m_range;
}
float SliderMetrics::cursor(float value, float offset) const
{
int prev_step = int((value - m_min) / m_step_length);
int step = int(round(offset * (m_num_steps - 1.f)));
if(step != prev_step)
return m_min + step * m_step_length;
return value;
}
SliderState SliderMetrics::compute(float value)
{
SliderState state;
state.m_knob_span = m_knob_length / m_range;
state.m_pre_span = (value - m_min) / m_range;
state.m_post_span = 1.f - state.m_pre_span - state.m_knob_span;
return state;
}
bool slider_cursor(Frame& slider, Frame& knob, Axis dim, const MouseEvent& event, float& value, const SliderMetrics& metrics, bool relative)
{
if(relative)
{
float delta = event.m_delta[dim] / slider.m_size[dim];
float cursor = min(1.f, max(0.f, metrics.offset(value) + delta));
value = metrics.cursor(value, cursor);
}
else
{
vec2 position = slider.local_position(event.m_pos);
float offset = -knob.m_size[dim] / 2.f;
float cursor = min(slider.m_size[dim]/* - knob.m_size[dim]*/, max(0.f, position[dim] + offset)) / slider.m_size[dim];
value = metrics.cursor(value, cursor);
}
return true;
}
bool slider_logic(Widget& self, Frame& slider, Frame& filler, Frame& knob, float& value, const SliderMetrics& metrics, Axis dim, bool relative)
{
UNUSED(filler);
bool changed = false;
if(MouseEvent event = self.mouse_event(DeviceType::MouseLeft, EventType::Stroked))
changed |= slider_cursor(slider, knob, dim, event, value, metrics, relative);
if(MouseEvent event = self.mouse_event(DeviceType::MouseLeft, EventType::DragStarted))
self.enable_state(PRESSED);
if(MouseEvent event = self.mouse_event(DeviceType::MouseLeft, EventType::Dragged))
changed |= slider_cursor(slider, knob, dim, event, value, metrics, relative);
if(MouseEvent event = self.mouse_event(DeviceType::MouseLeft, EventType::DragEnded))
self.disable_state(PRESSED);
return changed;
}
bool slider(Widget& parent, Style& style, float& value, SliderMetrics metrics, Axis dim, bool relative, bool fill, Style* knob_style)
{
Widget& self = widget(parent, style, false, dim);
SliderState state = metrics.compute(value);
Widget& filler = spanner(self, fill ? styles().filler : styles().spacer, dim, state.m_pre_span);
Widget& button = spanner(self, knob_style ? *knob_style : styles().slider_knob, dim, state.m_knob_span);
spanner(self, styles().spacer, dim, state.m_post_span);
bool changed = false;
changed |= slider_logic(self, self.m_frame, filler.m_frame, button.m_frame, value, metrics, dim, false);
changed |= slider_logic(button, self.m_frame, filler.m_frame, button.m_frame, value, metrics, dim, relative);
return changed;
}
bool slider(Widget& parent, float& value, SliderMetrics metrics, Axis dim, bool relative, bool fill, Style* knob_style)
{
return slider(parent, styles().slider, value, metrics, dim, relative, fill, knob_style);
}
}
}
| 1,432 |
4,054 | <reponame>Anlon-Burke/vespa
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "attribute_resource_usage.h"
#include <iostream>
namespace storage::spi {
std::ostream& operator<<(std::ostream& out, const AttributeResourceUsage& attribute_resource_usage)
{
out << "{usage=" << attribute_resource_usage.get_usage() <<
", name=" << attribute_resource_usage.get_name() << "}";
return out;
}
}
| 159 |
5,169 | {
"name": "AFOFoundation",
"version": "1.0.7",
"summary": "This library is for extending Foundation libraries.",
"description": "Inherit and system classes, compile extensions, and reuse.",
"homepage": "https://github.com/PangDuTechnology/AFOFoundation.git",
"license": "MIT",
"authors": {
"PangDu": "<EMAIL>"
},
"platforms": {
"ios": "8.0"
},
"source": {
"git": "https://github.com/PangDuTechnology/AFOFoundation.git",
"tag": "1.0.7"
},
"source_files": "AFOFoundation/*.h",
"public_header_files": "AFOFoundation/*.h",
"requires_arc": true,
"subspecs": [
{
"name": "string",
"source_files": "AFOFoundation/string/*.{h,m}",
"public_header_files": "AFOFoundation/string/*.h"
},
{
"name": "define",
"source_files": "AFOFoundation/define/*.{h,m}",
"public_header_files": "AFOFoundation/define/*.h"
},
{
"name": "bundle",
"source_files": "AFOFoundation/bundle/*.{h,m}",
"public_header_files": "AFOFoundation/bundle/*.h"
},
{
"name": "weak",
"source_files": "AFOFoundation/weak/*.{h,m}",
"public_header_files": "AFOFoundation/weak/*.h"
},
{
"name": "sandbox",
"source_files": "AFOFoundation/sandbox/*.{h,m}",
"public_header_files": "AFOFoundation/sandbox/*.h"
},
{
"name": "array",
"source_files": "AFOFoundation/array/*.{h,m}",
"public_header_files": "AFOFoundation/array/*.h"
},
{
"name": "dictionary",
"source_files": "AFOFoundation/dictionary/*.{h,m}",
"public_header_files": "AFOFoundation/dictionary/*.h"
}
]
}
| 753 |
375 | <reponame>spirentitestdevter/RED<filename>src/Eclipse-IDE/org.robotframework.ide.eclipse.main.plugin/src/org/robotframework/ide/eclipse/main/plugin/views/debugshell/ShellTokensScanner.java
/*
* Copyright 2019 Nokia Solutions and Networks
* Licensed under the Apache License, Version 2.0,
* see license.txt file for details.
*/
package org.robotframework.ide.eclipse.main.plugin.views.debugshell;
import static com.google.common.collect.Lists.newArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.jface.text.rules.IToken;
import org.rf.ide.core.execution.server.response.EvaluateExpression.ExpressionType;
import org.rf.ide.core.testdata.model.FilePosition;
import org.rf.ide.core.testdata.text.read.EndOfLineBuilder;
import org.rf.ide.core.testdata.text.read.IRobotLineElement;
import org.rf.ide.core.testdata.text.read.IRobotTokenType;
import org.rf.ide.core.testdata.text.read.LineReader.Constant;
import org.rf.ide.core.testdata.text.read.RobotLine;
import org.rf.ide.core.testdata.text.read.recognizer.RobotToken;
import org.rf.ide.core.testdata.text.read.recognizer.RobotTokenType;
import org.rf.ide.core.testdata.text.read.separators.Separator;
import org.robotframework.ide.eclipse.main.plugin.tableeditor.source.colouring.ISyntaxColouringRule;
import org.robotframework.ide.eclipse.main.plugin.tableeditor.source.colouring.RedTokenScanner;
import org.robotframework.ide.eclipse.main.plugin.tableeditor.source.colouring.RedTokensQueueBuilder;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Range;
import com.google.common.collect.RangeMap;
public class ShellTokensScanner extends RedTokenScanner {
public ShellTokensScanner(final ISyntaxColouringRule... rules) {
super(rules);
}
@Override
public IToken nextToken() {
return nextToken(() -> {
lines = getLines((ShellDocument) document);
return new RedTokensQueueBuilder().buildQueue(rangeOffset, rangeLength, lines, rangeLine);
});
}
@VisibleForTesting
List<RobotLine> getLines(final ShellDocument shellDocument) {
final RangeMap<Integer, String> positions = shellDocument.getPositionsRanges();
final List<RobotLine> lines = new ArrayList<>();
ExpressionType currentType = null;
for (int i = 0; i < shellDocument.getNumberOfLines(); i++) {
final int offset = shellDocument.getLineInformation(i).getOffset();
final String line = shellDocument.getLine(i);
if (ShellDocument.isModePromptCategory(positions.get(offset))) {
currentType = getType(line);
} else if (!ShellDocument.isPromptContinuationCategory(positions.get(offset))) {
currentType = null;
}
final RobotLine parsedLine = parseLine(line, i + 1, offset, currentType, positions);
addLineEnding(parsedLine, shellDocument.getLineDelimiter(i), offset);
lines.add(parsedLine);
}
return lines;
}
private RobotLine parseLine(final String line, final int lineNumber, final int offset,
final ExpressionType currentType, final RangeMap<Integer, String> positions) {
final RobotLine robotLine = new RobotLine(lineNumber, null);
if (currentType != null) {
final boolean isContinuation = ShellDocument.isPromptContinuationCategory(positions.get(offset));
parseExpressionLine(robotLine, line, offset, currentType, isContinuation);
} else {
parseResultLine(robotLine, line, offset, positions);
}
return robotLine;
}
private void parseExpressionLine(final RobotLine robotLine, final String line, final int offset,
final ExpressionType currentType, final boolean isContinuation) {
final Pattern pattern = Pattern.compile(" +");
final int prefixSplitIndex = currentType.name().length() + 2;
final String prefix = line.substring(0, prefixSplitIndex);
final String expression = line.substring(prefixSplitIndex);
final IRobotTokenType modeType = isContinuation ? ShellTokenType.MODE_CONTINUATION : ShellTokenType.MODE_FLAG;
addToken(robotLine, RobotToken.create(prefix, modeType), offset);
if (currentType == ExpressionType.ROBOT) {
final Matcher matcher = pattern.matcher(expression);
int i = 0;
while (matcher.find()) {
final int j = matcher.start();
final boolean isFirst = robotLine.getLineElements().size() == 1;
final IRobotTokenType mainType = isFirst && !isContinuation ? ShellTokenType.CALL_KW
: ShellTokenType.CALL_ARG;
addToken(robotLine,
createTokenWithPossibleVariables(expression.substring(i, j), mainType), offset);
i = matcher.end();
addSeparator(robotLine, Separator.spacesSeparator(i - j), offset);
}
if (i < expression.length()) {
final boolean isFirst = robotLine.getLineElements().size() == 1;
final IRobotTokenType mainType = isFirst && !isContinuation ? ShellTokenType.CALL_KW
: ShellTokenType.CALL_ARG;
addToken(robotLine, createTokenWithPossibleVariables(expression.substring(i), mainType), offset);
}
} else if (!expression.isEmpty()) {
final IRobotTokenType tokenType = currentType == ExpressionType.VARIABLE ? RobotTokenType.VARIABLE_USAGE
: RobotTokenType.UNKNOWN;
addToken(robotLine, RobotToken.create(expression, tokenType), offset);
}
}
private static RobotToken createTokenWithPossibleVariables(final String text,
final IRobotTokenType mainType) {
final List<IRobotTokenType> types = newArrayList(mainType);
if (text.contains("$") || text.contains("@") || text.contains("&") || text.contains("%")) {
types.add(RobotTokenType.VARIABLE_USAGE);
}
return RobotToken.create(text, types);
}
private void parseResultLine(final RobotLine robotLine, final String line, final int offset,
final RangeMap<Integer, String> positions) {
final RangeMap<Integer, String> thisLineRanges = positions
.subRangeMap(Range.closedOpen(offset, offset + line.length()));
final Map<Range<Integer>, String> thisLineRangesMap = thisLineRanges.asMapOfRanges();
if (thisLineRangesMap.isEmpty()) {
addToken(robotLine, RobotToken.create(line, RobotTokenType.UNKNOWN), offset);
} else {
int start = offset;
for (final Range<Integer> range : thisLineRangesMap.keySet()) {
final String partBeforeRange = line.substring(start - offset, range.lowerEndpoint() - offset);
final String partInRange = line.substring(range.lowerEndpoint() - offset,
range.upperEndpoint() - offset);
if (!partBeforeRange.isEmpty()) {
addToken(robotLine, RobotToken.create(partBeforeRange, RobotTokenType.UNKNOWN), start);
}
IRobotTokenType type;
if (ShellDocument.isResultPassCategory(thisLineRangesMap.get(range))) {
type = ShellTokenType.PASS;
} else if (ShellDocument.isResultFailCategory(thisLineRangesMap.get(range))) {
type = ShellTokenType.FAIL;
} else {
type = null;
}
addToken(robotLine, RobotToken.create(partInRange, type), range.lowerEndpoint());
start = range.upperEndpoint();
}
if (start < offset + line.length()) {
addToken(robotLine, RobotToken.create(line.substring(start - offset), RobotTokenType.UNKNOWN), offset);
}
}
}
private static void addToken(final RobotLine line, final RobotToken token, final int lineStartOffset) {
final int column = getEndColumn(line);
final FilePosition position = new FilePosition(line.getLineNumber(), column, lineStartOffset + column);
token.setFilePosition(position);
line.addLineElement(token);
}
private static void addSeparator(final RobotLine line, final Separator separator, final int lineStartOffset) {
final int column = getEndColumn(line);
separator.setLineNumber(line.getLineNumber());
separator.setStartColumn(column);
separator.setStartOffset(lineStartOffset + column);
line.addLineElement(separator);
}
private static void addLineEnding(final RobotLine line, final String delimiter, final int lineStartOffset) {
final int column = getEndColumn(line);
final IRobotLineElement lineEnding = EndOfLineBuilder.newInstance()
.setEndOfLines(Constant.get(delimiter == null ? "" : delimiter))
.setLineNumber(line.getLineNumber())
.setStartColumn(column)
.setStartOffset(lineStartOffset + column)
.buildEOL();
line.addLineElement(lineEnding);
}
private static int getEndColumn(final RobotLine line) {
final List<IRobotLineElement> elements = line.getLineElements();
return elements.isEmpty() ? 0 : elements.get(elements.size() - 1).getEndColumn();
}
private ExpressionType getType(final String line) {
return ExpressionType.valueOf(line.substring(0, line.indexOf('>')).toUpperCase());
}
}
| 4,118 |
848 | /*
* Copyright 2019 Xilinx Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <vector>
#include <memory>
#include <map>
#include <utility>
#include "vitis/ai/nnpp/tfssd.hpp"
namespace vitis {
namespace ai {
using ai::TFSSDResult;
namespace dptfssd {
enum SCORE_CONVERTER { SOFTMAX=0, SIGMOID=1 };
class TFSSDdetector {
public:
enum CodeType {
CORNER,
CENTER_SIZE,
CORNER_SIZE
};
TFSSDdetector(unsigned int num_classes,
CodeType code_type, bool variance_encoded_in_target,
unsigned int keep_top_k,
const std::vector<float>& confidence_threshold,
unsigned int nms_top_k, float nms_threshold, float eta,
const std::vector<std::shared_ptr<std::vector<float> > >& priors,
const short* &fx_priors,
float y_scale,
float x_scale,
float height_scale,
float width_scale,
SCORE_CONVERTER score_converter,
float scale_score = 1.f,
float scale_loc = 1.f,
bool clip = false);
template <typename T>
void Detect(const T* loc_data, const T* conf_data, TFSSDResult* result, bool en_hwpost);
unsigned int num_classes() const { return num_classes_; }
unsigned int num_priors() const { return priors_.size(); }
protected:
template <typename T>
void ApplyOneClassNMS(
const T (*bboxes)[4], int label,
const std::vector<std::pair<float, int> >& score_index_vec,
std::vector<std::pair<float,int>>* indices);
void GetOneClassMaxScoreIndex(
const int8_t* conf_data, int label,
std::vector<std::pair<float, int> >* score_index_vec);
void GetMultiClassMaxScoreIndex(
const int8_t* conf_data, int start_label, int num_classes,
std::vector<std::vector<std::pair<float, int> > >* score_index_vec);
void GetMultiClassMaxScoreIndexMT(
const int8_t* conf_data, int start_label, int num_classes,
std::vector<std::vector<std::pair<float, int> > >* score_index_vec,
int threads = 1);
template <typename T>
float JaccardOverlap(const T (*bboxes)[4], int idx, int kept_idx,
bool normalized = true);
template <typename T>
void DecodeBBox(const T (*bboxes)[4], int idx, bool normalized);
std::map<int, std::vector<float> > decoded_bboxes_;
const unsigned int num_classes_;
CodeType code_type_;
bool variance_encoded_in_target_;
unsigned int keep_top_k_;
std::vector<float> confidence_threshold_;
float nms_confidence_;
unsigned int nms_top_k_;
float nms_threshold_;
float eta_;
const std::vector<std::shared_ptr<std::vector<float> > >& priors_;
const short* &fx_priors_;
float y_scale_;
float x_scale_;
float height_scale_;
float width_scale_;
SCORE_CONVERTER score_converter_;
float scale_score_;
float scale_loc_;
bool clip_;
int num_priors_;
};
} // namespace dpssd
} // namespace ai
} // namespace vitis
| 1,376 |
1,138 | import ssg.utils
def preprocess(data, lang):
data["sysctlid"] = ssg.utils.escape_id(data["sysctlvar"])
if not data.get("sysctlval"):
data["sysctlval"] = ""
ipv6_flag = "P"
if data["sysctlid"].find("ipv6") >= 0:
ipv6_flag = "I"
data["flags"] = "SR" + ipv6_flag
if "operation" not in data:
data["operation"] = "equals"
return data
| 179 |
1,125 | <filename>third_party/libigl/include/igl/unproject_in_mesh.cpp<gh_stars>1000+
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2015 <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "unproject_in_mesh.h"
#include "unproject_ray.h"
#include "ray_mesh_intersect.h"
template < typename Derivedobj>
IGL_INLINE int igl::unproject_in_mesh(
const Eigen::Vector2f& pos,
const Eigen::Matrix4f& model,
const Eigen::Matrix4f& proj,
const Eigen::Vector4f& viewport,
const std::function<
void(
const Eigen::Vector3f&,
const Eigen::Vector3f&,
std::vector<igl::Hit> &)
> & shoot_ray,
Eigen::PlainObjectBase<Derivedobj> & obj,
std::vector<igl::Hit > & hits)
{
using namespace std;
using namespace Eigen;
Vector3f s,dir;
unproject_ray(pos,model,proj,viewport,s,dir);
shoot_ray(s,dir,hits);
switch(hits.size())
{
case 0:
break;
case 1:
{
obj = (s + dir*hits[0].t).cast<typename Derivedobj::Scalar>();
break;
}
case 2:
default:
{
obj = 0.5*((s + dir*hits[0].t) + (s + dir*hits[1].t)).cast<typename Derivedobj::Scalar>();
break;
}
}
return hits.size();
}
extern "C"
{
#include "raytri.c"
}
template < typename DerivedV, typename DerivedF, typename Derivedobj>
IGL_INLINE int igl::unproject_in_mesh(
const Eigen::Vector2f& pos,
const Eigen::Matrix4f& model,
const Eigen::Matrix4f& proj,
const Eigen::Vector4f& viewport,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<Derivedobj> & obj,
std::vector<igl::Hit > & hits)
{
using namespace std;
using namespace Eigen;
const auto & shoot_ray = [&V,&F](
const Eigen::Vector3f& s,
const Eigen::Vector3f& dir,
std::vector<igl::Hit> & hits)
{
ray_mesh_intersect(s,dir,V,F,hits);
};
return unproject_in_mesh(pos,model,proj,viewport,shoot_ray,obj,hits);
}
template < typename DerivedV, typename DerivedF, typename Derivedobj>
IGL_INLINE int igl::unproject_in_mesh(
const Eigen::Vector2f& pos,
const Eigen::Matrix4f& model,
const Eigen::Matrix4f& proj,
const Eigen::Vector4f& viewport,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<Derivedobj> & obj)
{
std::vector<igl::Hit> hits;
return unproject_in_mesh(pos,model,proj,viewport,V,F,obj,hits);
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template int igl::unproject_in_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 1, 3, 1, 1, 3> >(Eigen::Matrix<float, 2, 1, 0, 2, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&, std::vector<igl::Hit, std::allocator<igl::Hit> >&);
template int igl::unproject_in_mesh<Eigen::Matrix<double, 1, 3, 1, 1, 3> >(Eigen::Matrix<float, 2, 1, 0, 2, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, std::function<void (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, std::vector<igl::Hit, std::allocator<igl::Hit> >&)> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&, std::vector<igl::Hit, std::allocator<igl::Hit> >&);
template int igl::unproject_in_mesh<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(Eigen::Matrix<float, 2, 1, 0, 2, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, std::function<void (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, std::vector<igl::Hit, std::allocator<igl::Hit> >&)> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&, std::vector<igl::Hit, std::allocator<igl::Hit> >&);
template int igl::unproject_in_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::Matrix<float, 2, 1, 0, 2, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, std::function<void (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, std::vector<igl::Hit, std::allocator<igl::Hit> >&)> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, std::vector<igl::Hit, std::allocator<igl::Hit> >&);
template int igl::unproject_in_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 3, 1, 0, 3, 1> >(Eigen::Matrix<float, 2, 1, 0, 2, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
#endif
| 2,426 |
346 | <gh_stars>100-1000
from django.conf import settings
from django.db import models
from field_history.tracker import FieldHistoryTracker
class Pet(models.Model):
name = models.CharField(max_length=255)
class Person(models.Model):
name = models.CharField(max_length=255)
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True, on_delete=models.CASCADE)
field_history = FieldHistoryTracker(['name'])
@property
def _field_history_user(self):
return self.created_by
class Owner(Person):
pet = models.ForeignKey(Pet, blank=True, null=True, on_delete=models.CASCADE)
field_history = FieldHistoryTracker(['name', 'pet'])
class Human(models.Model):
age = models.IntegerField(blank=True, null=True)
is_female = models.BooleanField(default=True)
body_temp = models.DecimalField(max_digits=15, decimal_places=2, blank=True, null=True)
birth_date = models.DateField(blank=True, null=True)
field_history = FieldHistoryTracker(['age', 'is_female',
'body_temp', 'birth_date'])
class PizzaOrder(models.Model):
STATUS_ORDERED = 'ORDERED'
STATUS_COOKING = 'COOKING'
STATUS_COMPLETE = 'COMPLETE'
STATUS_CHOICES = (
(STATUS_ORDERED, 'Ordered'),
(STATUS_COOKING, 'Cooking'),
(STATUS_COMPLETE, 'Complete'),
)
status = models.CharField(max_length=64, choices=STATUS_CHOICES)
field_history = FieldHistoryTracker(['status'])
| 583 |
3,269 | # Time: O(n)
# Space: O(h)
# Definition for a Node.
class Node(object):
def __init__(self, val=None, children=None):
self.val = val
self.children = children if children is not None else []
# one pass solution without recursion
class Solution(object):
def moveSubTree(self, root, p, q):
"""
:type root: Node
:type p: Node
:type q: Node
:rtype: Node
"""
def iter_find_parents(node, parent, p, q, is_ancestor, lookup):
stk = [(1, [node, None, False])]
while stk:
step, params = stk.pop()
if step == 1:
node, parent, is_ancestor = params
if node in (p, q):
lookup[node] = parent
if len(lookup) == 2:
return is_ancestor
stk.append((2, [node, is_ancestor, reversed(node.children)]))
else:
node, is_ancestor, it = params
child = next(it, None)
if not child:
continue
stk.append((2, [node, is_ancestor, it]))
stk.append((1, [child, node, is_ancestor or node == p]))
assert(False)
return False
lookup = {}
is_ancestor = iter_find_parents(root, None, p, q, False, lookup)
if p in lookup and lookup[p] == q:
return root
q.children.append(p)
if not is_ancestor:
lookup[p].children.remove(p)
else:
lookup[q].children.remove(q)
if p == root:
root = q
else:
lookup[p].children[lookup[p].children.index(p)] = q
return root
# Time: O(n)
# Space: O(h)
# one pass solution with recursion (bad in deep tree)
class Solution_Recu(object):
def moveSubTree(self, root, p, q):
"""
:type root: Node
:type p: Node
:type q: Node
:rtype: Node
"""
def find_parents(node, parent, p, q, is_ancestor, lookup):
if node in (p, q):
lookup[node] = parent
if len(lookup) == 2:
return True, is_ancestor
for child in node.children:
found, new_is_ancestor = find_parents(child, node, p, q, is_ancestor or node == p, lookup)
if found:
return True, new_is_ancestor
return False, False
lookup = {}
is_ancestor = find_parents(root, None, p, q, False, lookup)[1]
if p in lookup and lookup[p] == q:
return root
q.children.append(p)
if not is_ancestor:
lookup[p].children.remove(p)
else:
lookup[q].children.remove(q)
if p == root:
root = q
else:
lookup[p].children[lookup[p].children.index(p)] = q
return root
# Time: O(n)
# Space: O(h)
# two pass solution without recursion
class Solution2(object):
def moveSubTree(self, root, p, q):
"""
:type root: Node
:type p: Node
:type q: Node
:rtype: Node
"""
def iter_find_parents(node, parent, p, q, lookup):
stk = [(1, [node, None])]
while stk:
step, params = stk.pop()
if step == 1:
node, parent = params
if node in (p, q):
lookup[node] = parent
if len(lookup) == 2:
return
stk.append((2, [node, reversed(node.children)]))
else:
node, it = params
child = next(it, None)
if not child:
continue
stk.append((2, [node, it]))
stk.append((1, [child, node]))
def iter_is_ancestor(node, q):
stk = [(1, [node])]
while stk:
step, params = stk.pop()
if step == 1:
node = params[0]
stk.append((2, [reversed(node.children)]))
else:
it = params[0]
child = next(it, None)
if not child:
continue
if child == q:
return True
stk.append((2, [it]))
stk.append((1, [child]))
return False
lookup = {}
iter_find_parents(root, None, p, q, lookup)
if p in lookup and lookup[p] == q:
return root
q.children.append(p)
if not iter_is_ancestor(p, q):
lookup[p].children.remove(p)
else:
lookup[q].children.remove(q)
if p == root:
root = q
else:
lookup[p].children[lookup[p].children.index(p)] = q
return root
# Time: O(n)
# Space: O(h)
# two pass solution with recursion (bad in deep tree)
class Solution2_Recu(object):
def moveSubTree(self, root, p, q):
"""
:type root: Node
:type p: Node
:type q: Node
:rtype: Node
"""
def find_parents(node, parent, p, q, lookup):
if node in (p, q):
lookup[node] = parent
if len(lookup) == 2:
return True
for child in node.children:
if find_parents(child, node, p, q, lookup):
return True
return False
def is_ancestor(node, q):
for child in node.children:
if node == q or is_ancestor(child, q):
return True
return False
lookup = {}
find_parents(root, None, p, q, lookup)
if p in lookup and lookup[p] == q:
return root
q.children.append(p)
if not is_ancestor(p, q):
lookup[p].children.remove(p)
else:
lookup[q].children.remove(q)
if p == root:
root = q
else:
lookup[p].children[lookup[p].children.index(p)] = q
return root
| 3,598 |
312 |
#include <occa/internal/modes/dpcpp/utils.hpp>
#include <occa/internal/modes/dpcpp/device.hpp>
#include <occa/internal/modes/dpcpp/buffer.hpp>
#include <occa/internal/modes/dpcpp/memory.hpp>
#include <occa/internal/utils/sys.hpp>
namespace occa {
namespace dpcpp {
buffer::buffer(modeDevice_t *modeDevice_,
udim_t size_,
const occa::json &properties_) :
occa::modeBuffer_t(modeDevice_, size_, properties_) {}
buffer::~buffer() {
if (!isWrapped && ptr) {
auto& dpcpp_device = getDpcppDevice(modeDevice);
OCCA_DPCPP_ERROR("Memory: Freeing SYCL alloc'd memory",
::sycl::free(ptr,dpcpp_device.dpcppContext));
}
ptr = nullptr;
size = 0;
}
void buffer::malloc(udim_t bytes) {
dpcpp::device *device = reinterpret_cast<dpcpp::device*>(modeDevice);
if (properties.get("host", false)) {
ptr = static_cast<char *>(::sycl::malloc_host(bytes,
device->dpcppContext));
OCCA_ERROR("DPCPP: malloc_host failed!", nullptr != ptr);
} else if (properties.get("unified", false)) {
ptr = static_cast<char *>(::sycl::malloc_shared(bytes,
device->dpcppDevice,
device->dpcppContext));
OCCA_ERROR("DPCPP: malloc_shared failed!", nullptr != ptr);
} else {
ptr = static_cast<char *>(::sycl::malloc_device(bytes,
device->dpcppDevice,
device->dpcppContext));
OCCA_ERROR("DPCPP: malloc_device failed!", nullptr != ptr);
}
size = bytes;
}
void buffer::wrapMemory(const void *ptr_,
const udim_t bytes) {
ptr = (char*) const_cast<void*>(ptr_);
size = bytes;
isWrapped = true;
}
modeMemory_t* buffer::slice(const dim_t offset,
const udim_t bytes) {
return new dpcpp::memory(this, bytes, offset);
}
void buffer::detach() {
ptr = nullptr;
size = 0;
isWrapped = false;
}
} // namespace dpcpp
} // namespace occa
| 1,212 |
537 | <filename>external/flatcc/flatcc_epilogue.h
/* Include guard intentionally left out. */
#ifdef __cplusplus
}
#endif
#include "flatcc/portable/pdiagnostic_pop.h"
| 59 |
567 | <filename>client/java/src/test/java/org/jolokia/client/request/JsonSerializationTest.java
package org.jolokia.client.request;
/*
* Copyright 2009-2013 <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.File;
import java.util.*;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
* @author roland
* @since 27.03.11
*/
public class JsonSerializationTest {
@Test
public void nullSerialization() {
Object result = serialize(null);
assertNull(result);
}
@Test
public void jsonAwareSerialization() {
JSONObject arg = new JSONObject();
Object result = serialize(arg);
assertTrue(arg == result);
}
@Test
public void arraySerialization() {
int[] arg = new int[] { 1,2,3 };
Object result = serialize(arg);
assertTrue(result instanceof JSONArray);
JSONArray res = (JSONArray) result;
assertEquals(res.get(0),1);
assertEquals(res.size(),3);
}
@Test
public void mapSerialization() {
Map arg = new HashMap();
arg.put("arg",10.0);
Object result = serialize(arg);
assertTrue(result instanceof JSONObject);;
JSONObject res = (JSONObject) result;
assertEquals(res.get("arg"),10.0);
}
@Test
public void collectionSerialization() {
Set arg = new HashSet();
arg.add(true);
Object result = serialize(arg);
assertTrue(result instanceof JSONArray);
JSONArray res = (JSONArray) result;
assertEquals(res.size(),1);
assertEquals(res.get(0),true);
}
@Test
public void complexSerialization() throws ParseException {
Map arg = new HashMap();
List inner = new ArrayList();
inner.add(null);
inner.add(new File("tmp"));
inner.add(10);
inner.add(42.0);
inner.add(false);
arg.put("first","fcn");
arg.put("second",inner);
Object result = serialize(arg);
assertTrue(result instanceof JSONObject);
JSONObject res = (JSONObject) result;
assertEquals(res.get("first"),"fcn");
assertTrue(res.get("second") instanceof JSONArray);
JSONArray arr = (JSONArray) res.get("second");
assertEquals(arr.size(),5);
assertNull(arr.get(0));
assertEquals(arr.get(1), "tmp");
assertEquals(arr.get(2),10);
assertEquals(arr.get(3),42.0);
assertEquals(arr.get(4),false);
String json = res.toJSONString();
assertNotNull(json);
JSONObject reparsed = (JSONObject) new JSONParser().parse(json);
assertNotNull(reparsed);
assertEquals(((List) reparsed.get("second")).get(1),"tmp");
}
// =====================================================================================================
private Object serialize(Object o) {
J4pRequest req = new J4pRequest(J4pType.VERSION,null) {
@Override
List<String> getRequestParts() {
return null;
}
@Override
<R extends J4pResponse<? extends J4pRequest>> R createResponse(JSONObject pResponse) {
return null;
}
};
return req.serializeArgumentToJson(o);
}
}
| 1,590 |
319 | <gh_stars>100-1000
// sgmmbin/sgmm-rescore-lattice.cc
// Copyright 2009-2011 Saarland University (Author: <NAME>)
// Cisco Systems (Author: <NAME>)
// See ../../COPYING for clarification regarding multiple authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing permissions and
// limitations under the License.
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "util/stl-utils.h"
#include "sgmm/am-sgmm.h"
#include "hmm/transition-model.h"
#include "fstext/fstext-lib.h"
#include "lat/kaldi-lattice.h"
#include "lat/lattice-functions.h"
#include "sgmm/decodable-am-sgmm.h"
int main(int argc, char *argv[]) {
try {
using namespace kaldi;
typedef kaldi::int32 int32;
typedef kaldi::int64 int64;
using fst::SymbolTable;
using fst::VectorFst;
using fst::StdArc;
const char *usage =
"Replace the acoustic scores on a lattice using a new model.\n"
"Usage: sgmm-rescore-lattice [options] <model-in> <lattice-rspecifier> "
"<feature-rspecifier> <lattice-wspecifier>\n"
" e.g.: sgmm-rescore-lattice 1.mdl ark:1.lats scp:trn.scp ark:2.lats\n";
kaldi::BaseFloat old_acoustic_scale = 0.0;
bool speedup = false;
BaseFloat log_prune = 5.0;
std::string gselect_rspecifier, spkvecs_rspecifier, utt2spk_rspecifier;
SgmmGselectConfig sgmm_opts;
kaldi::ParseOptions po(usage);
po.Register("old-acoustic-scale", &old_acoustic_scale,
"Add the current acoustic scores with some scale.");
po.Register("log-prune", &log_prune,
"Pruning beam used to reduce number of exp() evaluations.");
po.Register("spk-vecs", &spkvecs_rspecifier, "Speaker vectors (rspecifier)");
po.Register("utt2spk", &utt2spk_rspecifier,
"rspecifier for utterance to speaker map");
po.Register("gselect", &gselect_rspecifier,
"Precomputed Gaussian indices (rspecifier)");
po.Register("speedup", &speedup,
"If true, enable a faster version of the computation that "
"saves times when there is only one pdf-id on a single frame "
"by only sometimes (randomly) computing the probabilities, and "
"then scaling them up to preserve corpus-level diagnostics.");
sgmm_opts.Register(&po);
po.Read(argc, argv);
if (po.NumArgs() != 4) {
po.PrintUsage();
exit(1);
}
std::string model_filename = po.GetArg(1),
lats_rspecifier = po.GetArg(2),
feature_rspecifier = po.GetArg(3),
lats_wspecifier = po.GetArg(4);
AmSgmm am_sgmm;
TransitionModel trans_model;
{
bool binary;
Input ki(model_filename, &binary);
trans_model.Read(ki.Stream(), binary);
am_sgmm.Read(ki.Stream(), binary);
}
RandomAccessInt32VectorVectorReader gselect_reader(gselect_rspecifier);
RandomAccessBaseFloatVectorReaderMapped spkvecs_reader(spkvecs_rspecifier,
utt2spk_rspecifier);
RandomAccessBaseFloatMatrixReader feature_reader(feature_rspecifier);
// Read as regular lattice
SequentialCompactLatticeReader compact_lattice_reader(lats_rspecifier);
// Write as compact lattice.
CompactLatticeWriter compact_lattice_writer(lats_wspecifier);
int32 num_done = 0, num_err = 0;
for (; !compact_lattice_reader.Done(); compact_lattice_reader.Next()) {
std::string utt = compact_lattice_reader.Key();
if (!feature_reader.HasKey(utt)) {
KALDI_WARN << "No feature found for utterance " << utt << ". Skipping";
num_err++;
continue;
}
CompactLattice clat = compact_lattice_reader.Value();
compact_lattice_reader.FreeCurrent();
if (old_acoustic_scale != 1.0)
fst::ScaleLattice(fst::AcousticLatticeScale(old_acoustic_scale), &clat);
const Matrix<BaseFloat> &feats = feature_reader.Value(utt);
// Get speaker vectors
SgmmPerSpkDerivedVars spk_vars;
if (spkvecs_reader.IsOpen()) {
if (spkvecs_reader.HasKey(utt)) {
spk_vars.v_s = spkvecs_reader.Value(utt);
am_sgmm.ComputePerSpkDerivedVars(&spk_vars);
} else {
KALDI_WARN << "Cannot find speaker vector for " << utt;
num_err++;
continue;
}
} // else spk_vars is "empty"
bool have_gselect = !gselect_rspecifier.empty()
&& gselect_reader.HasKey(utt)
&& gselect_reader.Value(utt).size() == feats.NumRows();
if (!gselect_rspecifier.empty() && !have_gselect)
KALDI_WARN << "No Gaussian-selection info available for utterance "
<< utt << " (or wrong size)";
std::vector<std::vector<int32> > empty_gselect;
const std::vector<std::vector<int32> > *gselect =
(have_gselect ? &gselect_reader.Value(utt) : &empty_gselect);
DecodableAmSgmm sgmm_decodable(sgmm_opts, am_sgmm, spk_vars,
trans_model, feats, *gselect,
log_prune);
if (!speedup) {
if (kaldi::RescoreCompactLattice(&sgmm_decodable, &clat)) {
compact_lattice_writer.Write(utt, clat);
num_done++;
} else num_err++;
} else {
BaseFloat speedup_factor = 100.0;
if (kaldi::RescoreCompactLatticeSpeedup(trans_model, speedup_factor,
&sgmm_decodable,
&clat)) {
compact_lattice_writer.Write(utt, clat);
num_done++;
} else num_err++;
}
}
KALDI_LOG << "Done " << num_done << " lattices, errors on "
<< num_err;
return (num_done != 0 ? 0 : 1);
} catch(const std::exception &e) {
std::cerr << e.what();
return -1;
}
}
| 2,891 |
2,151 | <reponame>zipated/src<gh_stars>1000+
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.widget.selection;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.graphics.drawable.AnimatedVectorDrawableCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.Checkable;
import android.widget.FrameLayout;
import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.browser.widget.TintedDrawable;
import org.chromium.chrome.browser.widget.TintedImageView;
import org.chromium.chrome.browser.widget.selection.SelectionDelegate.SelectionObserver;
import java.util.List;
/**
* An item that can be selected. When selected, the item will be highlighted. A selection is
* initially established via long-press. If a selection is already established, clicking on the item
* will toggle its selection.
*
* @param <E> The type of the item associated with this SelectableItemView.
*/
public abstract class SelectableItemView<E> extends FrameLayout implements Checkable,
OnClickListener, OnLongClickListener, SelectionObserver<E> {
protected final int mDefaultLevel;
protected final int mSelectedLevel;
protected final AnimatedVectorDrawableCompat mCheckDrawable;
protected TintedImageView mIconView;
protected TextView mTitleView;
protected TextView mDescriptionView;
protected ColorStateList mIconColorList;
private SelectionDelegate<E> mSelectionDelegate;
private E mItem;
private boolean mIsChecked;
private Drawable mIconDrawable;
/**
* Constructor for inflating from XML.
*/
public SelectableItemView(Context context, AttributeSet attrs) {
super(context, attrs);
mIconColorList =
ApiCompatibilityUtils.getColorStateList(getResources(), R.color.white_mode_tint);
mDefaultLevel = getResources().getInteger(R.integer.list_item_level_default);
mSelectedLevel = getResources().getInteger(R.integer.list_item_level_selected);
mCheckDrawable = AnimatedVectorDrawableCompat.create(
getContext(), R.drawable.ic_check_googblue_24dp_animated);
}
/**
* Destroys and cleans up itself.
*/
public void destroy() {
if (mSelectionDelegate != null) {
mSelectionDelegate.removeObserver(this);
}
}
/**
* Sets the SelectionDelegate and registers this object as an observer. The SelectionDelegate
* must be set before the item can respond to click events.
* @param delegate The SelectionDelegate that will inform this item of selection changes.
*/
public void setSelectionDelegate(SelectionDelegate<E> delegate) {
if (mSelectionDelegate != delegate) {
if (mSelectionDelegate != null) mSelectionDelegate.removeObserver(this);
mSelectionDelegate = delegate;
mSelectionDelegate.addObserver(this);
}
}
/**
* @param item The item associated with this SelectableItemView.
*/
public void setItem(E item) {
mItem = item;
setChecked(mSelectionDelegate.isItemSelected(item));
}
/**
* @return The item associated with this SelectableItemView.
*/
public E getItem() {
return mItem;
}
// FrameLayout implementations.
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mIconView = findViewById(R.id.icon_view);
mTitleView = findViewById(R.id.title);
mDescriptionView = findViewById(R.id.description);
if (mIconView != null) {
mIconView.setBackgroundResource(R.drawable.list_item_icon_modern_bg);
mIconView.setTint(getDefaultIconTint());
if (!FeatureUtilities.isChromeModernDesignEnabled()) {
mIconView.getBackground().setAlpha(0);
}
}
setOnClickListener(this);
setOnLongClickListener(this);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mSelectionDelegate != null) {
setChecked(mSelectionDelegate.isItemSelected(mItem));
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
setChecked(false);
}
// OnClickListener implementation.
@Override
public final void onClick(View view) {
assert view == this;
if (isSelectionModeActive()) {
onLongClick(view);
} else {
onClick();
}
}
// OnLongClickListener implementation.
@Override
public boolean onLongClick(View view) {
assert view == this;
boolean checked = toggleSelectionForItem(mItem);
setChecked(checked);
return true;
}
/**
* @return Whether we are currently in selection mode.
*/
protected boolean isSelectionModeActive() {
return mSelectionDelegate.isSelectionEnabled();
}
/**
* Toggles the selection state for a given item.
* @param item The given item.
* @return Whether the item was in selected state after the toggle.
*/
protected boolean toggleSelectionForItem(E item) {
return mSelectionDelegate.toggleSelectionForItem(item);
}
// Checkable implementations.
@Override
public boolean isChecked() {
return mIsChecked;
}
@Override
public void toggle() {
setChecked(!isChecked());
}
@Override
public void setChecked(boolean checked) {
if (checked == mIsChecked) return;
mIsChecked = checked;
updateIconView();
}
// SelectionObserver implementation.
@Override
public void onSelectionStateChange(List<E> selectedItems) {
setChecked(mSelectionDelegate.isItemSelected(mItem));
}
/**
* Set drawable for the icon view. Note that you may need to use this method instead of
* mIconView#setImageDrawable to ensure icon view is correctly set in selection mode.
*/
protected void setIconDrawable(Drawable iconDrawable) {
mIconDrawable = iconDrawable;
updateIconView();
}
/**
* Update icon image and background based on whether this item is selected.
*/
protected void updateIconView() {
// TODO(huayinz): Refactor this method so that mIconView is not exposed to subclass.
if (mIconView == null) return;
if (isChecked()) {
mIconView.getBackground().setLevel(mSelectedLevel);
mIconView.setImageDrawable(mCheckDrawable);
mIconView.setTint(mIconColorList);
mCheckDrawable.start();
} else {
mIconView.getBackground().setLevel(mDefaultLevel);
mIconView.setImageDrawable(mIconDrawable);
mIconView.setTint(getDefaultIconTint());
}
if (!FeatureUtilities.isChromeModernDesignEnabled()) {
mIconView.getBackground().setAlpha(isChecked() ? 255 : 0);
}
}
/**
* @return The {@link ColorStateList} used to tint the icon drawable set via
* {@link #setIconDrawable(Drawable)} when the item is not selected.
*/
protected @Nullable ColorStateList getDefaultIconTint() {
return null;
}
/**
* Same as {@link OnClickListener#onClick(View)} on this.
* Subclasses should override this instead of setting their own OnClickListener because this
* class handles onClick events in selection mode, and won't forward events to subclasses in
* that case.
*/
protected abstract void onClick();
@VisibleForTesting
public void endAnimationsForTests() {
mCheckDrawable.stop();
}
/**
* Sets the icon for the image view: the default icon if unselected, the check mark if selected.
*
* @param imageView The image view in which the icon will be presented.
* @param defaultIcon The default icon that will be displayed if not selected.
* @param isSelected Whether the item is selected or not.
*/
public static void applyModernIconStyle(
TintedImageView imageView, Drawable defaultIcon, boolean isSelected) {
imageView.setBackgroundResource(R.drawable.list_item_icon_modern_bg);
imageView.setImageDrawable(isSelected
? TintedDrawable.constructTintedDrawable(imageView.getResources(),
R.drawable.ic_check_googblue_24dp, R.color.white_mode_tint)
: defaultIcon);
imageView.getBackground().setLevel(isSelected
? imageView.getResources().getInteger(R.integer.list_item_level_selected)
: imageView.getResources().getInteger(R.integer.list_item_level_default));
}
}
| 3,512 |
2,053 | /*
* Copyright 2015 the original author or authors.
* @https://github.com/scouter-project/scouter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package scouter.client.xlog.views;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import scouter.client.Images;
import scouter.client.model.AgentDailyListProxy;
import scouter.client.model.XLogData;
import scouter.client.net.INetReader;
import scouter.client.net.TcpProxy;
import scouter.client.popup.CalendarDialog;
import scouter.client.popup.TimeRangeDialog;
import scouter.client.preferences.PManager;
import scouter.client.preferences.PreferenceConstants;
import scouter.client.server.Server;
import scouter.client.server.ServerManager;
import scouter.client.util.ConsoleProxy;
import scouter.client.util.ExUtil;
import scouter.client.util.ImageUtil;
import scouter.client.xlog.XLogUtil;
import scouter.client.xlog.actions.OpenXLogLoadTimeAction;
import scouter.io.DataInputX;
import scouter.lang.pack.MapPack;
import scouter.lang.pack.Pack;
import scouter.lang.pack.XLogPack;
import scouter.lang.value.BooleanValue;
import scouter.lang.value.DecimalValue;
import scouter.net.RequestCmd;
import scouter.util.DateUtil;
import scouter.util.FormatUtil;
import scouter.util.ThreadUtil;
import java.io.IOException;
import java.util.Date;
public class XLogLoadTimeView extends XLogViewCommon implements TimeRangeDialog.ITimeRange, CalendarDialog.ILoadCalendarDialog {
public static final String ID = XLogLoadTimeView.class.getName();
long stime, etime;
private int serverId;
LoadXLogJob loadJob;
@Override
protected void openInExternalLink() {
Program.launch(makeExternalUrl(serverId));
}
@Override
protected void clipboardOfExternalLink() {
Clipboard clipboard = new Clipboard(getViewSite().getShell().getDisplay());
String linkUrl = makeExternalUrl(serverId);
clipboard.setContents(new String[]{linkUrl}, new Transfer[]{TextTransfer.getInstance()});
clipboard.dispose();
}
public void createPartControl(Composite parent) {
display = Display.getCurrent();
shell = new Shell(display);
IToolBarManager man = getViewSite().getActionBars().getToolBarManager();
create(parent, man);
man.add(new Action("zoom in", ImageUtil.getImageDescriptor(Images.zoomin)) {
public void run() {
TimeRangeDialog dialog = new TimeRangeDialog(display, XLogLoadTimeView.this, DateUtil.yyyymmdd(stime));
dialog.show(stime, etime);
}
});
man.add(new Action("zoom out", ImageUtil.getImageDescriptor(Images.zoomout)) {
public void run() {
if (viewPainter.isZoomMode()) {
viewPainter.endZoom();
} else {
viewPainter.keyPressed(16777261);
viewPainter.build();
}
canvas.redraw();
}
});
man.add(new Separator());
// Add context menu
new MenuItem(contextMenu, SWT.SEPARATOR);
MenuItem loadXLogItem = new MenuItem(contextMenu, SWT.PUSH);
loadXLogItem.setText("Load History");
loadXLogItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
new OpenXLogLoadTimeAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), objType, Images.server, serverId, stime, etime).run();
}
});
canvas.addControlListener(new ControlListener() {
public void controlResized(ControlEvent e) {
viewPainter.set(canvas.getClientArea());
viewPainter.build();
}
public void controlMoved(ControlEvent e) {
}
});
}
private void createContextMenu(Composite parent, IMenuListener listener){
MenuManager contextMenu = new MenuManager();
contextMenu.setRemoveAllWhenShown(true);
contextMenu.addMenuListener(listener);
Menu menu = contextMenu.createContextMenu(parent);
canvas.setMenu(menu);
}
public void refresh(){
viewPainter.build();
ExUtil.exec(canvas, new Runnable() {
public void run() {
canvas.redraw();
}
});
}
public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento);
}
public void setInput(long stime, long etime, String objType, int serverId) {
this.stime = stime;
this.etime = etime;
this.objType = objType;
this.serverId = serverId;
setObjType(objType);
viewPainter.setEndTime(etime);
viewPainter.setTimeRange(etime - stime);
String svrName = "";
String objTypeDisplay = "";
Server server = ServerManager.getInstance().getServer(serverId);
if(server != null){
svrName = server.getName();
objTypeDisplay = server.getCounterEngine().getDisplayNameObjectType(objType);
}
this.setPartName("XLog - " + objTypeDisplay);
setContentDescription("ⓢ"+svrName+" | "+objTypeDisplay+"\'s "+"XLog Pasttime"
+ " | " + DateUtil.format(stime, "yyyy-MM-dd") + "(" + DateUtil.format(stime, "HH:mm")
+ "~" + DateUtil.format(etime, "HH:mm") + ")");
setDate(DateUtil.yyyymmdd(stime));
try {
loadJob = new LoadXLogJob();
loadJob.schedule();
} catch (Exception e) {
MessageDialog.openError(shell, "Error", e.getMessage());
}
}
public void setTimeRange(long stime, long etime) {
if (viewPainter.zoomIn(stime, etime)) {
canvas.redraw();
}
}
public void setFocus() {
super.setFocus();
String statusMessage = "setInput(objType:"+objType+", serverId:"+serverId+ ", twdata size(): " + twdata.size() +")";
IStatusLineManager slManager= getViewSite().getActionBars().getStatusLineManager();
slManager.setMessage(statusMessage);
}
public void loadAdditinalData(long stime, long etime, final boolean reverse) {
int max = getMaxCount();
TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
try {
MapPack param = new MapPack();
String date = DateUtil.yyyymmdd(stime);
param.put("date", date);
param.put("stime", stime);
param.put("etime", etime);
param.put("objHash", agnetProxy.getObjHashLv(date, serverId, objType));
param.put("reverse", new BooleanValue(reverse));
int limit = PManager.getInstance().getInt(PreferenceConstants.P_XLOG_IGNORE_TIME);
if (limit > 0) {
param.put("limit", limit);
}
if (max > 0) {
param.put("max", max);
}
twdata.setMax(max);
tcp.process(RequestCmd.TRANX_LOAD_TIME_GROUP, param, new INetReader() {
public void process(DataInputX in) throws IOException {
Pack p = in.readPack();
XLogPack x = XLogUtil.toXLogPack(p);
if (reverse) {
twdata.putFirst(x.txid, new XLogData(x, serverId));
} else {
twdata.putLast(x.txid, new XLogData(x, serverId));
}
}
});
} catch (Throwable t) {
ConsoleProxy.errorSafe(t.toString());
} finally {
TcpProxy.putTcpProxy(tcp);
}
}
public void saveState(IMemento memento) {
super.saveState(memento);
memento = memento.createChild(ID);
memento.putString("stime", String.valueOf(this.stime));
memento.putString("etime", String.valueOf(this.etime));
memento.putString("objType", objType);
}
AgentDailyListProxy agnetProxy = new AgentDailyListProxy();
class LoadXLogJob extends Job{
public LoadXLogJob() {
super("XLog Loading...("
+ DateUtil.format(stime, "yyyy-MM-dd")
+ " "
+ DateUtil.format(stime, "HH:mm")
+ "~"
+ DateUtil.format(etime, "HH:mm") + ")");
}
protected IStatus run(final IProgressMonitor monitor) {
monitor.beginTask(ServerManager.getInstance().getServer(serverId).getName() + "....", IProgressMonitor.UNKNOWN);
int limit = PManager.getInstance().getInt(PreferenceConstants.P_XLOG_IGNORE_TIME);
int max = getMaxCount();
TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
try {
twdata.clear();
MapPack param = new MapPack();
String date = DateUtil.yyyymmdd(stime);
param.put("date", date);
param.put("stime", stime);
param.put("etime", etime);
param.put("objHash", agnetProxy.getObjHashLv(date, serverId, objType));
if (limit > 0) {
param.put("limit", limit);
}
if (max > 0) {
param.put("max", max);
}
ConsoleProxy.infoSafe("Load old XLog data");
ConsoleProxy.infoSafe("stime :" + FormatUtil.print(new Date(stime), "yyyyMMdd HH:mm:ss.SSS"));
ConsoleProxy.infoSafe("etime :" + FormatUtil.print(new Date(etime), "yyyyMMdd HH:mm:ss.SSS"));
ConsoleProxy.infoSafe("objType :" + objType);
ConsoleProxy.infoSafe("limit :" + limit + " max:"+max);
twdata.setMax(max);
final BooleanValue refreshFlag = new BooleanValue(true);
new Thread(new Runnable(){
public void run() {
while(refreshFlag.value){
refresh();
ThreadUtil.sleep(2000);
}
}
}).start();
final DecimalValue count = new DecimalValue();
tcp.process(RequestCmd.TRANX_LOAD_TIME_GROUP, param, new INetReader() {
public void process(DataInputX in) throws IOException {
Pack p = in.readPack();
if (monitor.isCanceled()) {
throw new IOException("User cancelled");
}
XLogPack x = XLogUtil.toXLogPack(p);
twdata.putLast(x.txid, new XLogData(x, serverId));
count.value++;
if (count.value % 10000 == 0) {
// refresh();
monitor.subTask(count.value + " XLog data received.");
}
}
});
refreshFlag.value=false;
} catch (Throwable t) {
ConsoleProxy.errorSafe(t.toString());
} finally {
TcpProxy.putTcpProxy(tcp);
monitor.done();
}
refresh();
return Status.OK_STATUS;
}
}
public void onPressedOk(long startTime, long endTime) {
setInput(startTime, endTime, objType, serverId);
}
public void onPressedOk(String date) {}
public void onPressedCancel() {}
public void dispose() {
super.dispose();
if (loadJob != null && (loadJob.getState() == Job.WAITING || loadJob.getState() == Job.RUNNING)) {
loadJob.cancel();
}
}
}
| 4,439 |
836 | """A rule wrapper for an instrumentation test for an android library."""
load(
"//build_extensions:generate_instrumentation_tests.bzl",
"generate_instrumentation_tests",
)
load(
"//build_extensions:infer_java_package_name.bzl",
"infer_java_package_name",
)
load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library")
def android_library_instrumentation_tests(name, srcs, deps, target_devices,
test_java_package = None, library_args = {},
binary_args = {}, **kwargs):
"""A macro for an instrumentation test whose target under test is an android_library.
Will generate a 'self-instrumentating' test binary and other associated rules
The intent of this wrapper is to simplify the build API for creating instrumentation test rules
for simple cases, while still supporting build_cleaner for automatic dependency management.
This will generate:
- an unused stub android_binary under test, to placate bazel
- a test_lib android_library, containing all sources and dependencies
- a test_binary android_binary (soon to be android_application)
- the manifest to use for the test library.
- for each device combination:
- an android_instrumentation_test rule)
Args:
name: the name to use for the generated android_library rule. This is needed for build_cleaner to
manage dependencies
srcs: the test sources to generate rules for
deps: the build dependencies to use for the generated test binary
target_devices: array of device targets to execute on
test_java_package: Optional. A custom root package name to use for the tests. If unset
will be derived based on current path to a java source root
library_args: additional arguments to pass to generated android_library
binary_args: additional arguments to pass to generated android_binary
**kwargs: arguments to pass to generated android_instrumentation_test rules
"""
library_name = "%s_library" % name
test_java_package_name = test_java_package if test_java_package else infer_java_package_name()
native.android_binary(
name = "target_stub_binary",
manifest = "//build_extensions:AndroidManifest_target_stub.xml",
# use the same package name as the test package, so it gets overridden
manifest_values = {"applicationId": test_java_package_name},
testonly = 1,
)
kt_android_library(
name = library_name,
srcs = srcs,
testonly = 1,
deps = deps,
**library_args
)
generate_instrumentation_tests(
name = name,
srcs = srcs,
deps = [library_name],
target_devices = target_devices,
test_java_package_name = test_java_package_name,
test_android_package_name = test_java_package_name,
instrumentation_target_package = test_java_package_name,
instruments = ":target_stub_binary",
binary_args = binary_args,
**kwargs
)
| 1,125 |
3,857 | <gh_stars>1000+
package dev.skidfuscator.obf.utils;
import lombok.experimental.UtilityClass;
import java.util.Random;
@UtilityClass
public class RandomUtil {
private final Random random = new Random();
public int nextInt() {
return nextInt(Integer.MAX_VALUE);
}
public int nextInt(int bound) {
return random.nextInt(bound);
}
public double nextDouble(int bound) {
return nextInt(bound) + random.nextDouble();
}
}
| 177 |
32,544 | <reponame>DBatOWL/tutorials
package com.baeldung.password;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
/**
* Examples of passwords conforming to various specifications, using different libraries.
*
*/
public class StringPasswordUnitTest {
RandomPasswordGenerator passGen = new RandomPasswordGenerator();
@Test
public void whenPasswordGeneratedUsingPassay_thenSuccessful() {
String password = passGen.generatePassayPassword();
int specialCharCount = 0;
for (char c : password.toCharArray()) {
if (c >= 33 || c <= 47) {
specialCharCount++;
}
}
assertTrue("Password validation failed in Passay", specialCharCount >= 2);
}
@Test
public void whenPasswordGeneratedUsingCommonsText_thenSuccessful() {
RandomPasswordGenerator passGen = new RandomPasswordGenerator();
String password = passGen.generateCommonTextPassword();
int lowerCaseCount = 0;
for (char c : password.toCharArray()) {
if (c >= 97 || c <= 122) {
lowerCaseCount++;
}
}
assertTrue("Password validation failed in commons-text ", lowerCaseCount >= 2);
}
@Test
public void whenPasswordGeneratedUsingCommonsLang3_thenSuccessful() {
String password = passGen.generateCommonsLang3Password();
int numCount = 0;
for (char c : password.toCharArray()) {
if (c >= 48 || c <= 57) {
numCount++;
}
}
assertTrue("Password validation failed in commons-lang3", numCount >= 2);
}
@Test
public void whenPasswordGeneratedUsingSecureRandom_thenSuccessful() {
String password = passGen.generateSecureRandomPassword();
int specialCharCount = 0;
for (char c : password.toCharArray()) {
if (c >= 33 || c <= 47) {
specialCharCount++;
}
}
assertTrue("Password validation failed in Secure Random", specialCharCount >= 2);
}
}
| 825 |
1,253 | <filename>src/nu/validator/xml/SystemErrErrorHandler.java
/*
* Copyright (c) 2005 <NAME>
* Copyright (c) 2013 Mozilla Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package nu.validator.xml;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/**
* @version $Id$
* @author hsivonen
*/
public class SystemErrErrorHandler implements ErrorHandler {
private Writer out;
private boolean inError = false;
public SystemErrErrorHandler() {
try {
out = new OutputStreamWriter(System.err, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
private void emitMessage(SAXParseException e, String messageType)
throws SAXException {
try {
String systemId = e.getSystemId();
out.write((systemId == null) ? "" : '\"' + systemId + '\"');
out.write(":");
out.write(Integer.toString(e.getLineNumber()));
out.write(":");
out.write(Integer.toString(e.getColumnNumber()));
out.write(": ");
out.write(messageType);
out.write(": ");
out.write(e.getMessage());
out.write("\n");
out.flush();
} catch (IOException e1) {
throw new SAXException(e1);
}
}
/**
* @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
*/
@Override
public void warning(SAXParseException e) throws SAXException {
emitMessage(e, "warning");
}
/**
* @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
*/
@Override
public void error(SAXParseException e) throws SAXException {
inError = true;
emitMessage(e, "error");
}
/**
* @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
*/
@Override
public void fatalError(SAXParseException e) throws SAXException {
inError = true;
emitMessage(e, "fatal error");
}
/**
* Returns the inError.
*
* @return the inError
*/
public boolean isInError() {
return inError;
}
public void reset() {
inError = false;
}
}
| 1,357 |
2,059 | <filename>src/wrapped/wrappedgtk3.c
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include "wrappedlibs.h"
#include "debug.h"
#include "wrapper.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x86emu.h"
#include "emu/x86emu_private.h"
#include "callback.h"
#include "librarian.h"
#include "box86context.h"
#include "emu/x86emu_private.h"
#include "myalign.h"
#include "gtkclass.h"
const char* gtk3Name = "libgtk-3.so.0";
static char* libname = NULL;
#define LIBNAME gtk3
static library_t* my_lib = NULL;
typedef int (*iFv_t)(void);
typedef void (*vFp_t)(void*);
typedef double (*dFp_t)(void*);
typedef void* (*pFi_t)(int);
typedef int (*iFpp_t)(void*, void*);
typedef void* (*pFpp_t)(void*, void*);
typedef void* (*pFpu_t)(void*, uint32_t);
typedef void* (*pFppi_t)(void*, void*, int);
typedef void* (*pFppp_t)(void*, void*, void*);
typedef int (*iFppp_t)(void*, void*, void*);
typedef void (*vFpipV_t)(void*, int, void*, ...);
#define ADDED_FUNCTIONS() \
GO(gtk_object_get_type, iFv_t) \
GO(gtk_dialog_add_button, pFppi_t) \
GO(gtk_bin_get_type, iFv_t) \
GO(gtk_widget_get_type, iFv_t) \
GO(gtk_button_get_type, iFv_t) \
GO(gtk_container_get_type, iFv_t) \
GO(gtk_label_get_type, iFv_t) \
GO(gtk_tree_view_get_type, iFv_t) \
GO(gtk_action_get_type, iFv_t) \
GO(g_type_class_ref, pFi_t) \
GO(g_type_class_unref, vFp_t) \
GO(gtk_spin_button_get_value, dFp_t) \
GO(gtk_builder_lookup_callback_symbol, pFpp_t) \
GO(g_module_symbol, iFppp_t) \
GO(g_log, vFpipV_t) \
GO(g_module_open, pFpu_t) \
GO(g_module_close, vFp_t) \
#include "generated/wrappedgtk3types.h"
typedef struct gtk3_my_s {
// functions
#define GO(A, B) B A;
SUPER()
#undef GO
} gtk3_my_t;
static void* getGtk3My(library_t* lib)
{
my_lib = lib;
gtk3_my_t* my = (gtk3_my_t*)calloc(1, sizeof(gtk3_my_t));
#define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
SUPER()
#undef GO
return my;
}
#undef SUPER
static void freeGtk3My(void* lib)
{
my_lib = NULL;
//gtk3_my_t *my = (gtk3_my_t *)lib;
}
static box86context_t* context = NULL;
EXPORT uintptr_t my3_gtk_signal_connect_full(x86emu_t* emu, void* object, void* name, void* c_handler, void* unsupported, void* data, void* closure, uint32_t signal, int after)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
if(!context)
context = emu->context;
my_signal_t *sig = new_mysignal(c_handler, data, closure);
uintptr_t ret = my->gtk_signal_connect_full(object, name, my_signal_cb, NULL, sig, my_signal_delete, signal, after);
printf_log(LOG_DEBUG, "Connecting gtk signal \"%s\" with cb=%p\n", (char*)name, sig);
return ret;
}
#define SUPER() \
GO(0) \
GO(1) \
GO(2) \
GO(3)
// GtkMenuDetachFunc
#define GO(A) \
static uintptr_t my_menudetach_fct_##A = 0; \
static void my_menudetach_##A(void* widget, void* menu) \
{ \
RunFunction(my_context, my_menudetach_fct_##A, 2, widget, menu);\
}
SUPER()
#undef GO
static void* findMenuDetachFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_menudetach_fct_##A == (uintptr_t)fct) return my_menudetach_##A;
SUPER()
#undef GO
#define GO(A) if(my_menudetach_fct_##A == 0) {my_menudetach_fct_##A = (uintptr_t)fct; return my_menudetach_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GMenuDetachFunc callback\n");
return NULL;
}
// GtkMenuPositionFunc
#define GO(A) \
static uintptr_t my_menuposition_fct_##A = 0; \
static void my_menuposition_##A(void* menu, void* x, void* y, void* push_in, void* data) \
{ \
RunFunction(my_context, my_menuposition_fct_##A, 5, menu, x, y, push_in, data);\
}
SUPER()
#undef GO
static void* findMenuPositionFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_menuposition_fct_##A == (uintptr_t)fct) return my_menuposition_##A;
SUPER()
#undef GO
#define GO(A) if(my_menuposition_fct_##A == 0) {my_menuposition_fct_##A = (uintptr_t)fct; return my_menuposition_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GtkMenuPositionFunc callback\n");
return NULL;
}
// GtkFunction
#define GO(A) \
static uintptr_t my3_gtkfunction_fct_##A = 0; \
static int my3_gtkfunction_##A(void* data) \
{ \
return RunFunction(my_context, my3_gtkfunction_fct_##A, 1, data);\
}
SUPER()
#undef GO
static void* findGtkFunctionFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my3_gtkfunction_fct_##A == (uintptr_t)fct) return my3_gtkfunction_##A;
SUPER()
#undef GO
#define GO(A) if(my3_gtkfunction_fct_##A == 0) {my3_gtkfunction_fct_##A = (uintptr_t)fct; return my3_gtkfunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GtkFunction callback\n");
return NULL;
}
// GtkClipboardGetFunc
#define GO(A) \
static uintptr_t my_clipboardget_fct_##A = 0; \
static void my_clipboardget_##A(void* clipboard, void* selection, uint32_t info, void* data) \
{ \
RunFunction(my_context, my_clipboardget_fct_##A, 4, clipboard, selection, info, data);\
}
SUPER()
#undef GO
static void* findClipboadGetFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_clipboardget_fct_##A == (uintptr_t)fct) return my_clipboardget_##A;
SUPER()
#undef GO
#define GO(A) if(my_clipboardget_fct_##A == 0) {my_clipboardget_fct_##A = (uintptr_t)fct; return my_clipboardget_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GtkClipboardGetFunc callback\n");
return NULL;
}
// GtkClipboardClearFunc
#define GO(A) \
static uintptr_t my_clipboardclear_fct_##A = 0; \
static void my_clipboardclear_##A(void* clipboard, void* data) \
{ \
RunFunction(my_context, my_clipboardclear_fct_##A, 2, clipboard, data);\
}
SUPER()
#undef GO
static void* findClipboadClearFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_clipboardclear_fct_##A == (uintptr_t)fct) return my_clipboardclear_##A;
SUPER()
#undef GO
#define GO(A) if(my_clipboardclear_fct_##A == 0) {my_clipboardclear_fct_##A = (uintptr_t)fct; return my_clipboardclear_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GtkClipboardClearFunc callback\n");
return NULL;
}
// GtkCallback
#define GO(A) \
static uintptr_t my3_gtkcallback_fct_##A = 0; \
static void my3_gtkcallback_##A(void* widget, void* data) \
{ \
RunFunction(my_context, my3_gtkcallback_fct_##A, 2, widget, data);\
}
SUPER()
#undef GO
static void* findGtkCallbackFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my3_gtkcallback_fct_##A == (uintptr_t)fct) return my3_gtkcallback_##A;
SUPER()
#undef GO
#define GO(A) if(my3_gtkcallback_fct_##A == 0) {my3_gtkcallback_fct_##A = (uintptr_t)fct; return my3_gtkcallback_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GtkCallback callback\n");
return NULL;
}
// GtkTextCharPredicate
#define GO(A) \
static uintptr_t my_textcharpredicate_fct_##A = 0; \
static int my_textcharpredicate_##A(uint32_t ch, void* data) \
{ \
return (int)RunFunction(my_context, my_textcharpredicate_fct_##A, 2, ch, data);\
}
SUPER()
#undef GO
static void* findGtkTextCharPredicateFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_textcharpredicate_fct_##A == (uintptr_t)fct) return my_textcharpredicate_##A;
SUPER()
#undef GO
#define GO(A) if(my_textcharpredicate_fct_##A == 0) {my_textcharpredicate_fct_##A = (uintptr_t)fct; return my_textcharpredicate_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GtkTextCharPredicate callback\n");
return NULL;
}
// Toolbar
#define GO(A) \
static uintptr_t my_toolbar_fct_##A = 0; \
static void my_toolbar_##A(void* widget, void* data) \
{ \
RunFunction(my_context, my_toolbar_fct_##A, 2, widget, data);\
}
SUPER()
#undef GO
static void* findToolbarFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_toolbar_fct_##A == (uintptr_t)fct) return my_toolbar_##A;
SUPER()
#undef GO
#define GO(A) if(my_toolbar_fct_##A == 0) {my_toolbar_fct_##A = (uintptr_t)fct; return my_toolbar_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 Toolbar callback\n");
return NULL;
}
// Builder
#define GO(A) \
static uintptr_t my_builderconnect_fct_##A = 0; \
static void my_builderconnect_##A(void* builder, void* object, void* signal, void* handler, void* connect, int flags, void* data) \
{ \
RunFunction(my_context, my_builderconnect_fct_##A, 7, builder, object, signal, handler, connect, flags, data);\
}
SUPER()
#undef GO
static void* findBuilderConnectFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_builderconnect_fct_##A == (uintptr_t)fct) return my_builderconnect_##A;
SUPER()
#undef GO
#define GO(A) if(my_builderconnect_fct_##A == 0) {my_builderconnect_fct_##A = (uintptr_t)fct; return my_builderconnect_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 BuilderConnect callback\n");
return NULL;
}
// GtkTreeViewSearchEqualFunc
#define GO(A) \
static uintptr_t my_GtkTreeViewSearchEqualFunc_fct_##A = 0; \
static int my_GtkTreeViewSearchEqualFunc_##A(void* model, int column, void* key, void* iter, void* data) \
{ \
return RunFunction(my_context, my_GtkTreeViewSearchEqualFunc_fct_##A, 5, model, column, key, iter, data); \
}
SUPER()
#undef GO
static void* findGtkTreeViewSearchEqualFuncFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_GtkTreeViewSearchEqualFunc_fct_##A == (uintptr_t)fct) return my_GtkTreeViewSearchEqualFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GtkTreeViewSearchEqualFunc_fct_##A == 0) {my_GtkTreeViewSearchEqualFunc_fct_##A = (uintptr_t)fct; return my_GtkTreeViewSearchEqualFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GtkTreeViewSearchEqualFunc callback\n");
return NULL;
}
// GtkTreeCellDataFunc
#define GO(A) \
static uintptr_t my_GtkTreeCellDataFunc_fct_##A = 0; \
static void my_GtkTreeCellDataFunc_##A(void* tree, void* cell, void* model, void* iter, void* data) \
{ \
RunFunction(my_context, my_GtkTreeCellDataFunc_fct_##A, 5, tree, cell, model, iter, data); \
}
SUPER()
#undef GO
static void* findGtkTreeCellDataFuncFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_GtkTreeCellDataFunc_fct_##A == (uintptr_t)fct) return my_GtkTreeCellDataFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GtkTreeCellDataFunc_fct_##A == 0) {my_GtkTreeCellDataFunc_fct_##A = (uintptr_t)fct; return my_GtkTreeCellDataFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GtkTreeCellDataFunc callback\n");
return NULL;
}
// GDestroyNotify
#define GO(A) \
static uintptr_t my_GDestroyNotify_fct_##A = 0; \
static void my_GDestroyNotify_##A(void* data) \
{ \
RunFunction(my_context, my_GDestroyNotify_fct_##A, 1, data); \
}
SUPER()
#undef GO
static void* findGDestroyNotifyFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_GDestroyNotify_fct_##A == (uintptr_t)fct) return my_GDestroyNotify_##A;
SUPER()
#undef GO
#define GO(A) if(my_GDestroyNotify_fct_##A == 0) {my_GDestroyNotify_fct_##A = (uintptr_t)fct; return my_GDestroyNotify_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GDestroyNotify callback\n");
return NULL;
}
// GtkTreeIterCompareFunc
#define GO(A) \
static uintptr_t my_GtkTreeIterCompareFunc_fct_##A = 0; \
static int my_GtkTreeIterCompareFunc_##A(void* model, void* a, void* b, void* data) \
{ \
return RunFunction(my_context, my_GtkTreeIterCompareFunc_fct_##A, 4, model, a, b, data); \
}
SUPER()
#undef GO
static void* findGtkTreeIterCompareFuncFct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_GtkTreeIterCompareFunc_fct_##A == (uintptr_t)fct) return my_GtkTreeIterCompareFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GtkTreeIterCompareFunc_fct_##A == 0) {my_GtkTreeIterCompareFunc_fct_##A = (uintptr_t)fct; return my_GtkTreeIterCompareFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gtk-3 GtkTreeIterCompareFunc callback\n");
return NULL;
}
#undef SUPER
EXPORT void my3_gtk_dialog_add_buttons(x86emu_t* emu, void* dialog, void* first, uintptr_t* b)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
void* btn = first;
while(btn) {
int id = (int)*(b++);
my->gtk_dialog_add_button(dialog, btn, id);
btn = (void*)*(b++);
}
}
EXPORT void my3_gtk_message_dialog_format_secondary_text(x86emu_t* emu, void* dialog, void* fmt, void* b)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
char* buf = NULL;
#ifndef NOALIGN
myStackAlign((const char*)fmt, b, emu->scratch);
PREPARE_VALIST;
iFppp_t f = (iFppp_t)vasprintf;
f(&buf, fmt, VARARGS);
#else
iFppp_t f = (iFppp_t)vasprintf;
f(&buf, fmt, b);
#endif
// pre-bake the fmt/vaarg, because there is no "va_list" version of this function
my->gtk_message_dialog_format_secondary_text(dialog, buf);
free(buf);
}
EXPORT void my3_gtk_message_dialog_format_secondary_markup(x86emu_t* emu, void* dialog, void* fmt, void* b)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
char* buf = NULL;
#ifndef NOALIGN
myStackAlign((const char*)fmt, b, emu->scratch);
PREPARE_VALIST;
iFppp_t f = (iFppp_t)vasprintf;
f(&buf, fmt, VARARGS);
#else
iFppp_t f = (iFppp_t)vasprintf;
f(&buf, fmt, b);
#endif
// pre-bake the fmt/vaarg, because there is no "va_list" version of this function
my->gtk_message_dialog_format_secondary_markup(dialog, buf);
free(buf);
}
EXPORT void* my3_gtk_type_class(x86emu_t* emu, int type)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
void* class = my->gtk_type_class(type);
return wrapCopyGTKClass(class, type);
}
EXPORT void my3_gtk_init(x86emu_t* emu, void* argc, void* argv)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_init(argc, argv);
my_checkGlobalGdkDisplay();
AutoBridgeGtk(my->g_type_class_ref, my->g_type_class_unref);
}
EXPORT int my3_gtk_init_check(x86emu_t* emu, void* argc, void* argv)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
int ret = my->gtk_init_check(argc, argv);
my_checkGlobalGdkDisplay();
AutoBridgeGtk(my->g_type_class_ref, my->g_type_class_unref);
return ret;
}
EXPORT int my3_gtk_init_with_args(x86emu_t* emu, void* argc, void* argv, void* param, void* entries, void* trans, void* error)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
int ret = my->gtk_init_with_args(argc, argv, param, entries, trans, error);
my_checkGlobalGdkDisplay();
AutoBridgeGtk(my->g_type_class_ref, my->g_type_class_unref);
return ret;
}
EXPORT void my3_gtk_menu_attach_to_widget(x86emu_t* emu, void* menu, void* widget, void* f)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_menu_attach_to_widget(menu, widget, findMenuDetachFct(f));
}
EXPORT void my3_gtk_menu_popup(x86emu_t* emu, void* menu, void* shell, void* item, void* f, void* data, uint32_t button, uint32_t time_)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_menu_popup(menu, shell, item, findMenuPositionFct(f), data, button, time_);
}
EXPORT uint32_t my3_gtk_timeout_add(x86emu_t* emu, uint32_t interval, void* f, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_timeout_add(interval, findGtkFunctionFct(f), data);
}
EXPORT int my3_gtk_clipboard_set_with_data(x86emu_t* emu, void* clipboard, void* target, uint32_t n, void* f_get, void* f_clear, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_clipboard_set_with_data(clipboard, target, n, findClipboadGetFct(f_get), findClipboadClearFct(f_clear), data);
}
EXPORT int my3_gtk_clipboard_set_with_owner(x86emu_t* emu, void* clipboard, void* target, uint32_t n, void* f_get, void* f_clear, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_clipboard_set_with_owner(clipboard, target, n, findClipboadGetFct(f_get), findClipboadClearFct(f_clear), data);
}
static void* my_translate_func(void* path, my_signal_t* sig)
{
return (void*)RunFunction(my_context, sig->c_handler, 2, path, sig->data);
}
EXPORT void my3_gtk_stock_set_translate_func(x86emu_t* emu, void* domain, void* f, void* data, void* notify)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my_signal_t *sig = new_mysignal(f, data, notify);
my->gtk_stock_set_translate_func(domain, my_translate_func, sig, my_signal_delete);
}
EXPORT void my3_gtk_container_forall(x86emu_t* emu, void* container, void* f, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_container_forall(container, findGtkCallbackFct(f), data);
}
EXPORT void my3_gtk_tree_view_set_search_equal_func(x86emu_t* emu, void* tree_view, void* f, void* data, void* notify)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_tree_view_set_search_equal_func(tree_view, findGtkTreeViewSearchEqualFuncFct(f), data, findGDestroyNotifyFct(notify));
}
EXPORT int my3_gtk_text_iter_backward_find_char(x86emu_t* emu, void* iter, void* f, void* data, void* limit)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_text_iter_backward_find_char(iter, findGtkTextCharPredicateFct(f), data, limit);
}
EXPORT int my3_gtk_text_iter_forward_find_char(x86emu_t* emu, void* iter, void* f, void* data, void* limit)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_text_iter_forward_find_char(iter, findGtkTextCharPredicateFct(f), data, limit);
}
EXPORT void* my3_gtk_toolbar_append_item(x86emu_t* emu, void* toolbar, void* text, void* tooltip_text, void* tooltip_private, void* icon, void* f, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_toolbar_append_item(toolbar, text, tooltip_text, tooltip_private, icon, findToolbarFct(f), data);
}
EXPORT void* my3_gtk_toolbar_prepend_item(x86emu_t* emu, void* toolbar, void* text, void* tooltip_text, void* tooltip_private, void* icon, void* f, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_toolbar_prepend_item(toolbar, text, tooltip_text, tooltip_private, icon, findToolbarFct(f), data);
}
EXPORT void* my3_gtk_toolbar_insert_item(x86emu_t* emu, void* toolbar, void* text, void* tooltip_text, void* tooltip_private, void* icon, void* f, void* data, int position)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_toolbar_insert_item(toolbar, text, tooltip_text, tooltip_private, icon, findToolbarFct(f), data, position);
}
EXPORT void* my3_gtk_toolbar_append_element(x86emu_t* emu, void* toolbar, int type, void* widget, void* text, void* tooltip_text, void* tooltip_private, void* icon, void* f, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_toolbar_append_element(toolbar, type, widget, text, tooltip_text, tooltip_private, icon, findToolbarFct(f), data);
}
EXPORT void* my3_gtk_toolbar_prepend_element(x86emu_t* emu, void* toolbar, int type, void* widget, void* text, void* tooltip_text, void* tooltip_private, void* icon, void* f, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_toolbar_prepend_element(toolbar, type, widget, text, tooltip_text, tooltip_private, icon, findToolbarFct(f), data);
}
EXPORT void* my3_gtk_toolbar_insert_element(x86emu_t* emu, void* toolbar, int type, void* widget, void* text, void* tooltip_text, void* tooltip_private, void* icon, void* f, void* data, int position)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_toolbar_insert_element(toolbar, type, widget, text, tooltip_text, tooltip_private, icon, findToolbarFct(f), data, position);
}
EXPORT void* my3_gtk_toolbar_insert_stock(x86emu_t* emu, void* toolbar, void* stock_id, void* tooltip_text, void* tooltip_private, void* f, void* data, int position)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_toolbar_insert_stock(toolbar, stock_id, tooltip_text, tooltip_private, findToolbarFct(f), data, position);
}
EXPORT void my3_gtk_tree_sortable_set_sort_func(x86emu_t* emu, void* sortable, int id, void* f, void* data, void* notify)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_tree_sortable_set_sort_func(sortable, id, findGtkTreeIterCompareFuncFct(f), data, findGDestroyNotifyFct(notify));
}
EXPORT void my3_gtk_tree_sortable_set_default_sort_func(x86emu_t* emu, void* sortable, void* f, void* data, void* notify)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_tree_sortable_set_default_sort_func(sortable, findGtkTreeIterCompareFuncFct(f), data, findGDestroyNotifyFct(notify));
}
EXPORT int my3_gtk_type_unique(x86emu_t* emu, size_t parent, my_GtkTypeInfo_t* gtkinfo)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_type_unique(parent, findFreeGtkTypeInfo(gtkinfo, parent));
}
EXPORT unsigned long my3_gtk_signal_connect(x86emu_t* emu, void* object, void* name, void* func, void* data)
{
return my3_gtk_signal_connect_full(emu, object, name, func, NULL, data, NULL, 0, 0);
}
EXPORT void my3_gtk_object_set_data_full(x86emu_t* emu, void* object, void* key, void* data, void* notify)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_object_set_data_full(object, key, data, findGDestroyNotifyFct(notify));
}
EXPORT float my3_gtk_spin_button_get_value_as_float(x86emu_t* emu, void* spinner)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
return my->gtk_spin_button_get_value(spinner);
}
EXPORT void my3_gtk_builder_connect_signals_full(x86emu_t* emu, void* builder, void* f, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_builder_connect_signals_full(builder, findBuilderConnectFct(f), data);
}
typedef struct my_connectargs_s {
void* module;
void* data;
} my_connectargs_t;
//defined in gobject2...
uintptr_t my_g_signal_connect_object(x86emu_t* emu, void* instance, void* detailed, void* c_handler, void* object, uint32_t flags);
uintptr_t my_g_signal_connect_data(x86emu_t* emu, void* instance, void* detailed, void* c_handler, void* data, void* closure, uint32_t flags);
static void my3_gtk_builder_connect_signals_default(void* builder, void* object,
char* signal_name, char* handler_name,
void* connect_object, uint32_t flags, my_connectargs_t* args)
{
void* func;
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
func = my->gtk_builder_lookup_callback_symbol(builder, handler_name);
if (!func && args && args->module) {
my->g_module_symbol(args->module, handler_name, &func);
}
// Mixing Native and emulated code... the my_g_signal_* function will handle that (GetNativeFnc does)
if(!func)
func = (void*)FindGlobalSymbol(my_context->maplib, handler_name, 0, NULL);
if(!func) {
my->g_log("Gtk", 1<<4, "Could not find signal handler '%s'.", handler_name);
return;
}
if (connect_object)
my_g_signal_connect_object(thread_get_emu(), object, signal_name, func, connect_object, flags);
else
my_g_signal_connect_data(thread_get_emu(), object, signal_name, func, args->data, NULL, flags);
}
EXPORT void my3_gtk_builder_connect_signals(x86emu_t* emu, void* builder, void* data)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my_connectargs_t args = {0};
args.data = data;
if(my->g_module_open && my->g_module_close)
args.module = my->g_module_open(NULL, 1);
my->gtk_builder_connect_signals_full(builder, my3_gtk_builder_connect_signals_default, &args);
if(args.module)
my->g_module_close(args.module);
}
EXPORT void my3_gtk_tree_view_column_set_cell_data_func(x86emu_t* emu, void* tree, void* cell, void* f, void* data, void* destroy)
{
gtk3_my_t *my = (gtk3_my_t*)my_lib->priv.w.p2;
my->gtk_tree_view_column_set_cell_data_func(tree, cell, findGtkTreeCellDataFuncFct(f), data, findGDestroyNotifyFct(destroy));
}
#define PRE_INIT \
if(box86_nogtk) \
return -1;
#define CUSTOM_INIT \
libname = lib->name; \
lib->priv.w.p2 = getGtk3My(lib); \
lib->altmy = strdup("my3_"); \
SetGtkWidgetID(((gtk3_my_t*)lib->priv.w.p2)->gtk_widget_get_type()); \
SetGtkContainerID(((gtk3_my_t*)lib->priv.w.p2)->gtk_container_get_type()); \
SetGtkActionID(((gtk3_my_t*)lib->priv.w.p2)->gtk_action_get_type()); \
SetGtkMiscID(((gtk3_my_t*)lib->priv.w.p2)->gtk_widget_get_type()); \
SetGtkLabelID(((gtk3_my_t*)lib->priv.w.p2)->gtk_label_get_type()); \
SetGtkTreeViewID(((gtk3_my_t*)lib->priv.w.p2)->gtk_tree_view_get_type()); \
lib->priv.w.needed = 2; \
lib->priv.w.neededlibs = (char**)calloc(lib->priv.w.needed, sizeof(char*)); \
lib->priv.w.neededlibs[0] = strdup("libgdk-3.so.0"); \
lib->priv.w.neededlibs[1] = strdup("libpangocairo-1.0.so.0");
#define CUSTOM_FINI \
freeGtk3My(lib->priv.w.p2); \
free(lib->priv.w.p2);
#include "wrappedlib_init.h"
| 13,428 |
498 | <filename>OCRunner/RunEnv/MFPropertyMapTable.h
//
// MFPropertyMapTable.h
// MangoFix
//
// Created by yongpengliang on 2019/4/26.
// Copyright © 2019 yongpengliang. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RunnerClasses+Execute.h"
NS_ASSUME_NONNULL_BEGIN
@interface MFPropertyMapTableItem:NSObject
@property (strong, nonatomic) Class clazz;
@property (strong, nonatomic) ORPropertyDeclare *property;
- (instancetype)initWithClass:(Class)clazz property:(ORPropertyDeclare *)property;
@end
@interface MFPropertyMapTable : NSObject
{
@public
NSMutableDictionary<NSString *, MFPropertyMapTableItem *> *_dic;
}
+ (instancetype)shareInstance;
- (void)addPropertyMapTableItem:(MFPropertyMapTableItem *)propertyMapTableItem;
- (nullable MFPropertyMapTableItem *)getPropertyMapTableItemWith:(Class)clazz name:(NSString *)name;
- (void)removePropertiesForClass:(Class)clazz;
@end
NS_ASSUME_NONNULL_END
| 321 |
1,541 | <filename>src/main/java/com/bwssystems/HABridge/api/SuccessUserResponse.java<gh_stars>1000+
package com.bwssystems.HABridge.api;
public class SuccessUserResponse {
private UserCreateResponse success;
public UserCreateResponse getSuccess() {
return success;
}
public void setSuccess(UserCreateResponse success) {
this.success = success;
}
}
| 129 |
543 | <reponame>sanmusane/AIGames
'''
Function:
show the effect of trained model used in game
Author:
Charles
微信公众号:
Charles的皮卡丘
'''
import torch
import config
from nets.nets import DQNet, DQNAgent
from gameAPI.game import GamePacmanAgent
'''run demo'''
def runDemo():
if config.operator == 'ai':
game_pacman_agent = GamePacmanAgent(config)
dqn_net = DQNet(config)
dqn_net.load_state_dict(torch.load(config.weightspath))
dqn_agent = DQNAgent(game_pacman_agent, dqn_net, config)
dqn_agent.test()
elif config.operator == 'person':
GamePacmanAgent(config).runGame()
else:
raise ValueError('config.operator should be <ai> or <person>...')
'''run'''
if __name__ == '__main__':
runDemo() | 281 |
660 | <reponame>ashakhno/media-driver
/*
* Copyright (c) 2011-2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
//!
//! \file codechal_fei_avc_g9.h
//! \brief This file defines the C++ class/interface for Gen9 SKL platform's
//! AVC FEI encoding to be used across CODECHAL components.
//!
#ifndef __CODECHAL_FEI_AVC_G9_SKL_H__
#define __CODECHAL_FEI_AVC_G9_SKL_H__
#include "codechal_fei_avc_g9.h"
class CodechalEncodeAvcEncFeiG9Skl : public CodechalEncodeAvcEncFeiG9
{
public:
//!
//! \brief Constructor
//!
CodechalEncodeAvcEncFeiG9Skl(
CodechalHwInterface * hwInterface,
CodechalDebugInterface *debugInterface,
PCODECHAL_STANDARD_INFO standardInfo) : CodechalEncodeAvcEncFeiG9(hwInterface, debugInterface, standardInfo){};
//!
//! \brief Destructor
//!
~CodechalEncodeAvcEncFeiG9Skl() {};
//!
//! \brief Update the slice count according to the DymanicSliceShutdown policy
//!
void UpdateSSDSliceCount();
};
#endif
| 712 |
1,444 | <filename>Mage.Sets/src/mage/cards/i/IndrikStomphowler.java
package mage.cards.i;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author Loki
*/
public final class IndrikStomphowler extends CardImpl {
public IndrikStomphowler(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}");
this.subtype.add(SubType.BEAST);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false);
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
this.addAbility(ability);
}
private IndrikStomphowler(final IndrikStomphowler card) {
super(card);
}
@Override
public IndrikStomphowler copy() {
return new IndrikStomphowler(this);
}
}
| 465 |
950 | #include <iostream>
using namespace std;
int main() {
string s;
getline(cin, s);
int maxvalue = 0, temp;
int len = s.length();
for(int i = 0; i < len; i++) {
temp = 1;
for(int j = 1; j < len; j++) {
if(i - j < 0 || i + j >= len || s[i - j] != s[i + j])
break;
temp += 2;
}
maxvalue = temp > maxvalue ? temp : maxvalue;
temp = 0;
for(int j = 1; j < len; j++) {
if(i - j + 1 < 0 || i + j >= len || s[i - j + 1] != s[i + j])
break;
temp += 2;
}
maxvalue = temp > maxvalue ? temp : maxvalue;
}
cout << maxvalue;
return 0;
}
| 378 |
979 | #pragma once
const char* hello_message();
| 15 |
542 | <filename>porter/porter-cluster/src/main/java/cn/vbill/middleware/porter/cluster/standalone/StandaloneClusterNodeListener.java<gh_stars>100-1000
/*
* Copyright ©2018 vbill.cn.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package cn.vbill.middleware.porter.cluster.standalone;
import cn.vbill.middleware.porter.cluster.CommonCodeBlock;
import cn.vbill.middleware.porter.common.cluster.client.ClusterClient;
import cn.vbill.middleware.porter.common.cluster.ClusterListenerFilter;
import cn.vbill.middleware.porter.common.cluster.event.ClusterListenerEventExecutor;
import cn.vbill.middleware.porter.common.cluster.event.ClusterListenerEventType;
import cn.vbill.middleware.porter.common.cluster.event.command.*;
import cn.vbill.middleware.porter.common.statistics.DNode;
import cn.vbill.middleware.porter.common.cluster.event.ClusterTreeNodeEvent;
import cn.vbill.middleware.porter.common.cluster.event.executor.NodeStopTaskEventExecutor;
import cn.vbill.middleware.porter.common.cluster.event.executor.NodeTaskAssignedEventExecutor;
import cn.vbill.middleware.porter.common.cluster.impl.standalone.StandaloneListener;
import cn.vbill.middleware.porter.common.node.dic.NodeHealthLevel;
import cn.vbill.middleware.porter.common.node.dic.NodeStatusType;
import cn.vbill.middleware.porter.common.util.DefaultNamedThreadFactory;
import cn.vbill.middleware.porter.common.util.MachineUtils;
import cn.vbill.middleware.porter.core.NodeContext;
import lombok.SneakyThrows;
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
/**
* 节点监听
*
* @author: zhangkewei[<EMAIL>]
* @date: 2017年12月15日 10:09
* @version: V1.0
* @review: zhangkewei[<EMAIL>]/2017年12月15日 10:09
*/
public class StandaloneClusterNodeListener extends StandaloneListener {
private static final String ZK_PATH = BASE_CATALOG + "/node";
private final ScheduledExecutorService heartbeatWorker =
Executors.newSingleThreadScheduledExecutor(new DefaultNamedThreadFactory("node-heartbeat"));
private static final String STAT_PATH = "/stat";
private static final String TASK_PATH = "/task/";
private CommonCodeBlock blockProxy;
@Override
public void setClient(ClusterClient client) {
super.setClient(client);
blockProxy = new CommonCodeBlock(client);
}
@Override
public String listenPath() {
return ZK_PATH;
}
@Override
public void onEvent(ClusterTreeNodeEvent event) {
}
@Override
public ClusterListenerFilter filter() {
return new ClusterListenerFilter() {
@Override
public String getPath() {
return listenPath();
}
@Override
public boolean doFilter(ClusterTreeNodeEvent event) {
return false;
}
};
}
@Override
public List<ClusterListenerEventExecutor> watchedEvents() {
List<ClusterListenerEventExecutor> executors = new ArrayList<>();
//任务上传事件
executors.add(new NodeStopTaskEventExecutor(this.getClass(), NodeContext.INSTANCE.getNodeId(), listenPath()));
//任务已经被分配
executors.add(new NodeTaskAssignedEventExecutor(this.getClass(), NodeContext.INSTANCE.getNodeId(), listenPath()));
//节点停止
executors.add(new ClusterListenerEventExecutor(this.getClass(), ClusterListenerEventType.Shutdown).bind((clusterCommand, client) -> {
NodeContext.INSTANCE.syncNodeStatus(NodeStatusType.SUSPEND);
client.delete(listenPath() + "/" + NodeContext.INSTANCE.getNodeId() + "/lock");
heartbeatWorker.shutdownNow();
}, client));
//节点注册
executors.add(new ClusterListenerEventExecutor(this.getClass(), ClusterListenerEventType.NodeRegister).bind(new BiConsumer<ClusterCommand, ClusterClient>() {
@SneakyThrows
public void accept(ClusterCommand clusterCommand, ClusterClient client) {
NodeRegisterCommand nrCommend = (NodeRegisterCommand) clusterCommand;
NodeContext.INSTANCE.syncUploadStatistic(nrCommend.isUploadStatistic());
//重置任务状态
NodeContext.INSTANCE.resetHealthLevel();
String nodePath = listenPath() + "/" + nrCommend.getId();
String lockPath = nodePath + "/lock";
String statPath = nodePath + STAT_PATH;
client.createRoot(nodePath, false);
if (!client.isExists(lockPath, false)) {
client.create(lockPath, false, new DNode(NodeContext.INSTANCE.getNodeId()).toString());
client.create(statPath, new DNode(NodeContext.INSTANCE.getNodeId()).toString(), false, false);
/**
* 定时一分钟上传一次心跳
*/
heartbeatWorker.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
synchronized (statPath.intern()) {
ClusterClient.TreeNode node = client.isExists(statPath, false) ? client.getData(statPath) : null;
if (null != node && null != node.getVersion()) {
DNode nodeData = DNode.fromString(node.getData(), DNode.class);
//设置心跳时间
nodeData.setHeartbeat(new Date());
//设置节点工作状态
nodeData.setStatus(NodeContext.INSTANCE.getNodeStatus());
//设置节点健康状态
Pair<NodeHealthLevel, String> level = NodeContext.INSTANCE.getHealthLevel();
nodeData.setHealthLevel(level.getLeft());
nodeData.setHealthLevelDesc(level.getRight());
//设置机器信息
nodeData.setAddress(MachineUtils.IP_ADDRESS);
nodeData.setProcessId(MachineUtils.CURRENT_JVM_PID + "");
nodeData.setHostName(MachineUtils.HOST_NAME);
NodeContext.INSTANCE.flushClusterNode(nodeData);
//通知数据到zookeeper
client.setData(statPath, nodeData.toString(), client.exists(statPath, false));
}
}
} catch (Exception e) {
logger.warn("上传节点心跳出错", e);
}
}
}, 10, 30, TimeUnit.SECONDS);
} else {
if (blockProxy.nodeAssignCheck(lockPath)) {
this.accept(clusterCommand, client);
} else {
String lockPathMsg = lockPath + ",节点已注册";
logger.error(lockPathMsg);
throw new Exception(lockPathMsg);
}
}
}
}, client));
return executors;
}
} | 3,907 |
4,036 | #include "a.h"
#include <a.h>
#include "b.h"
static int has_angle_b = __has_include(<b.h>);
// semmle-extractor-options: -I${testdir}/dir2 -iquote ${testdir}/dir1 --edg --clang
| 81 |
13,111 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.oap.server.core.analysis.worker;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import org.apache.skywalking.oap.server.core.CoreModule;
import org.apache.skywalking.oap.server.core.UnexpectedException;
import org.apache.skywalking.oap.server.core.analysis.DownSampling;
import org.apache.skywalking.oap.server.core.analysis.Stream;
import org.apache.skywalking.oap.server.core.analysis.StreamProcessor;
import org.apache.skywalking.oap.server.core.analysis.management.ManagementData;
import org.apache.skywalking.oap.server.core.storage.IManagementDAO;
import org.apache.skywalking.oap.server.core.storage.StorageBuilderFactory;
import org.apache.skywalking.oap.server.core.storage.StorageDAO;
import org.apache.skywalking.oap.server.core.storage.StorageException;
import org.apache.skywalking.oap.server.core.storage.StorageModule;
import org.apache.skywalking.oap.server.core.storage.annotation.Storage;
import org.apache.skywalking.oap.server.core.storage.model.Model;
import org.apache.skywalking.oap.server.core.storage.model.ModelCreator;
import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
import org.apache.skywalking.oap.server.library.module.ModuleDefineHolder;
/**
* ManagementProcessor represents the UI/CLI interactive process. They are management data, which size is not huge and
* time serious.
*
* @since 8.0.0
*/
public class ManagementStreamProcessor implements StreamProcessor<ManagementData> {
private static final ManagementStreamProcessor PROCESSOR = new ManagementStreamProcessor();
private Map<Class<? extends ManagementData>, ManagementPersistentWorker> workers = new HashMap<>();
public static ManagementStreamProcessor getInstance() {
return PROCESSOR;
}
@Override
public void in(final ManagementData managementData) {
final ManagementPersistentWorker worker = workers.get(managementData.getClass());
if (worker != null) {
worker.in(managementData);
}
}
@Override
public void create(final ModuleDefineHolder moduleDefineHolder, final Stream stream, final Class<? extends ManagementData> streamClass) throws StorageException {
final StorageBuilderFactory storageBuilderFactory = moduleDefineHolder.find(StorageModule.NAME)
.provider()
.getService(StorageBuilderFactory.class);
final Class<? extends StorageBuilder> builder = storageBuilderFactory.builderOf(streamClass, stream.builder());
StorageDAO storageDAO = moduleDefineHolder.find(StorageModule.NAME).provider().getService(StorageDAO.class);
IManagementDAO managementDAO;
try {
managementDAO = storageDAO.newManagementDao(builder.getDeclaredConstructor().newInstance());
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
throw new UnexpectedException("Create " + stream.builder()
.getSimpleName() + " none stream record DAO failure.", e);
}
ModelCreator modelSetter = moduleDefineHolder.find(CoreModule.NAME).provider().getService(ModelCreator.class);
// Management stream doesn't read data from database during the persistent process. Keep the timeRelativeID == false always.
Model model = modelSetter.add(streamClass, stream.scopeId(), new Storage(stream.name(), false, DownSampling.None), false);
final ManagementPersistentWorker persistentWorker = new ManagementPersistentWorker(moduleDefineHolder, model, managementDAO);
workers.put(streamClass, persistentWorker);
}
}
| 1,489 |
1,403 | /*
* IA32Opcode.h
*
* This file is part of the "LLGL" project (Copyright (c) 2015-2019 by <NAME>)
* See "LICENSE.txt" for license information.
*/
#ifndef LLGL_IA32_OPCODE_H
#define LLGL_IA32_OPCODE_H
#include <LLGL/Export.h>
#include <vector>
#include <cstdint>
namespace LLGL
{
namespace JIT
{
enum Opcode : std::uint8_t
{
Opcode_PushReg = 0x50,
Opcode_PopReg = 0x58,
Opcode_PushImm32 = 0x68,
Opcode_MovRegImm32 = 0xB8, // B8+ rd id
Opcode_RetNear = 0xC3, // C3
Opcode_RetFar = 0xCB, // CB
Opcode_RetNearImm16 = 0xC2, // C2 iw
Opcode_RetFarImm16 = 0xCA, // CA iw
Opcode_CallNear = 0xD0,
//OpCode_CallFar = 0xE0,
};
} // /namespace JIT
} // /namespace LLGL
#endif
// ================================================================================
| 383 |
778 | <filename>applications/HDF5Application/custom_io/hdf5_container_gauss_point_output.cpp<gh_stars>100-1000
// | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// license: HDF5Application/license.txt
//
// Main author: <NAME>, https://github.com/sunethwarna
//
// System includes
#include <tuple>
// External includes
// Project includes
#include "includes/communicator.h"
#include "includes/kratos_parameters.h"
#include "utilities/parallel_utilities.h"
// Application includes
#include "custom_utilities/hdf5_data_set_partition_utility.h"
#include "custom_utilities/local_ghost_splitting_utility.h"
#include "custom_utilities/registered_component_lookup.h"
// Include base h
#include "custom_io/hdf5_container_gauss_point_output.h"
namespace Kratos
{
namespace HDF5
{
namespace
{
template<typename TDataType>
std::size_t GetSize(std::vector<TDataType>& rData);
template<typename TDataType>
void FlattenData(
Vector<double>& rFlattedData,
const std::vector<TDataType>& rData);
template <typename TContainerType, typename TDataType>
void SetDataBuffer(Variable<TDataType> const&,
TContainerType&,
Matrix<double>&,
int&,
const DataCommunicator& rDataCommunicator,
const ProcessInfo&);
template <typename TContainerType>
class ContainerItemGaussPointValuesOutput
{
public:
template <typename TVariableType>
class WriteGaussPointValuesFunctor
{
public:
void operator()(TVariableType const& rVariable,
TContainerType& rContainer,
File& rFile,
std::string const& rPath,
WriteInfo& rInfo,
const DataCommunicator& rDataCommunicator,
const ProcessInfo& rProcessInfo)
{
Matrix<double> data;
int number_of_gauss_points;
SetDataBuffer<TContainerType, typename TVariableType::Type>(rVariable, rContainer, data, number_of_gauss_points, rDataCommunicator, rProcessInfo);
KRATOS_WARNING_IF("WriteGaussPointValuesFunctor", number_of_gauss_points == 0) << "No integration point values were found for " << rVariable.Name() << ".\n";
rFile.WriteDataSet(rPath + "/" + rVariable.Name(), data, rInfo);
rFile.WriteAttribute(rPath + "/" + rVariable.Name(), "NumberOfGaussPoints", number_of_gauss_points);
}
};
};
template <typename TVariableType>
class WriteElementGaussPointValues
: public ContainerItemGaussPointValuesOutput<ElementsContainerType>::WriteGaussPointValuesFunctor<TVariableType>
{
};
template <typename TVariableType>
class WriteConditionGaussPointValues
: public ContainerItemGaussPointValuesOutput<ConditionsContainerType>::WriteGaussPointValuesFunctor<TVariableType>
{
};
} // unnamed namespace
template <typename TContainerType, typename... TComponents>
ContainerGaussPointOutput<TContainerType, TComponents...>::ContainerGaussPointOutput(
Parameters Settings, File::Pointer pFile, const std::string& rPath)
: mpFile(pFile)
{
KRATOS_TRY;
Parameters default_params(R"(
{
"prefix": "",
"list_of_variables": []
})");
Settings.ValidateAndAssignDefaults(default_params);
mVariablePath = Settings["prefix"].GetString() + rPath;
const std::size_t num_components = Settings["list_of_variables"].size();
if (mVariableNames.size() != num_components)
mVariableNames.resize(num_components);
for (std::size_t i = 0; i < num_components; ++i)
mVariableNames[i] = Settings["list_of_variables"].GetArrayItem(i).GetString();
KRATOS_CATCH("");
}
// Adding element other variable WriteRegisteredGaussPointValues template definition
template <>
template <typename... Targs>
void ContainerGaussPointOutput<ElementsContainerType,
Variable<array_1d<double, 3>>,
Variable<double>,
Variable<int>,
Variable<Vector<double>>,
Variable<Matrix<double>>>::WriteRegisteredGaussPointValues(
const std::string& rComponentName,
Targs&... args)
{
RegisteredComponentLookup<Variable<array_1d<double, 3>>, Variable<double>, Variable<int>,
Variable<Vector<double>>, Variable<Matrix<double>>>(rComponentName)
.Execute<WriteElementGaussPointValues>(args...);
}
// Adding condition other variable WriteRegisteredGaussPointValues template definition
template <>
template <typename... Targs>
void ContainerGaussPointOutput<ConditionsContainerType,
Variable<array_1d<double, 3>>,
Variable<double>,
Variable<int>,
Variable<Vector<double>>,
Variable<Matrix<double>>>::WriteRegisteredGaussPointValues(
const std::string& rComponentName,
Targs&... args)
{
RegisteredComponentLookup<Variable<array_1d<double, 3>>, Variable<double>, Variable<int>,
Variable<Vector<double>>, Variable<Matrix<double>>>(rComponentName)
.Execute<WriteConditionGaussPointValues>(args...);
}
template <typename TContainerType, typename... TComponents>
void ContainerGaussPointOutput<TContainerType, TComponents...>::WriteContainerGaussPointsValues(
TContainerType& rContainer,
const DataCommunicator& rDataCommunicator,
const ProcessInfo& rProcessInfo)
{
KRATOS_TRY;
if (mVariableNames.size() == 0)
return;
WriteInfo info;
// Write each variable.
for (const std::string& r_component_name : mVariableNames)
WriteRegisteredGaussPointValues(
r_component_name, rContainer, *mpFile,
mVariablePath, info, rDataCommunicator, rProcessInfo);
// Write block partition.
WritePartitionTable(*mpFile, mVariablePath, info);
KRATOS_CATCH("");
}
namespace
{
template<typename TDataType>
std::size_t GetSize(std::vector<TDataType>& rData)
{
return rData.size();
}
template<>
std::size_t GetSize(std::vector<array_1d<double, 3>>& rData)
{
return rData.size() * 3;
}
template<>
std::size_t GetSize(std::vector<Vector<double>>& rData)
{
if (rData.size() > 0) {
return rData.size() * rData[0].size();
} else {
return 0;
}
}
template<>
std::size_t GetSize(std::vector<Matrix<double>>& rData)
{
if (rData.size() > 0) {
return rData.size() * rData[0].data().size();
} else {
return 0;
}
}
template<typename TDataType>
void FlattenData(
Vector<double>& rFlattedData,
const std::vector<TDataType>& rData)
{
KRATOS_TRY
KRATOS_DEBUG_ERROR_IF(rFlattedData.size() != rData.size())
<< "Size mismatch. [ rFlattedData.size() = " << rFlattedData.size()
<< ", rData.size() = " << rData.size() << " ].\n";
std::size_t local_index = 0;
for (const auto& r_data : rData) {
rFlattedData[local_index++] = r_data;
}
KRATOS_CATCH("");
}
template<>
void FlattenData(
Vector<double>& rFlattedData,
const std::vector<array_1d<double, 3>>& rData)
{
KRATOS_TRY
KRATOS_DEBUG_ERROR_IF(rFlattedData.size() != rData.size() * 3)
<< "Size mismatch. [ rFlattedData.size() = " << rFlattedData.size()
<< ", rData.size() * 3 = " << rData.size() * 3 << " ].\n";
std::size_t local_index = 0;
for (const auto& r_data : rData) {
rFlattedData[local_index++] = r_data[0];
rFlattedData[local_index++] = r_data[1];
rFlattedData[local_index++] = r_data[2];
}
KRATOS_CATCH("");
}
template<>
void FlattenData(
Vector<double>& rFlattedData,
const std::vector<Vector<double>>& rData)
{
KRATOS_TRY
KRATOS_DEBUG_ERROR_IF(rFlattedData.size() != rData.size() * rData[0].size())
<< "Size mismatch. [ rFlattedData.size() = " << rFlattedData.size()
<< ", rData.size() * rData[0].size() = " << rData.size() * rData[0].size() << " ].\n";
std::size_t local_index = 0;
for (const auto& r_data : rData) {
for (std::size_t i = 0; i < r_data.size(); ++i) {
rFlattedData[local_index++] = r_data[i];
}
}
KRATOS_CATCH("");
}
template<>
void FlattenData(
Vector<double>& rFlattedData,
const std::vector<Matrix<double>>& rData)
{
KRATOS_TRY
KRATOS_DEBUG_ERROR_IF(rFlattedData.size() != rData.size() * rData[0].data().size())
<< "Size mismatch. [ rFlattedData.size() = " << rFlattedData.size()
<< ", rData.size() * rData[0].data().size() = " << rData.size() * rData[0].data().size() << " ].\n";
std::size_t local_index = 0;
for (const auto& r_data : rData) {
for (std::size_t i = 0; i < r_data.data().size(); ++i) {
rFlattedData[local_index++] = r_data.data()[i];
}
}
KRATOS_CATCH("");
}
template <typename TContainerType, typename TDataType>
void SetDataBuffer(Variable<TDataType> const& rVariable,
TContainerType& rContainer,
Matrix<double>& rData,
int& NumberOfGaussPoints,
const DataCommunicator& rDataCommunicator,
const ProcessInfo& rProcessInfo)
{
KRATOS_TRY;
std::size_t flat_data_size = 0;
NumberOfGaussPoints = 0;
if (rContainer.size() > 0) {
std::vector<TDataType> values;
rContainer.begin()->CalculateOnIntegrationPoints(rVariable, values, rProcessInfo);
NumberOfGaussPoints = values.size();
flat_data_size = GetSize(values);
}
NumberOfGaussPoints = rDataCommunicator.MaxAll(NumberOfGaussPoints);
flat_data_size = rDataCommunicator.MaxAll(flat_data_size);
rData.resize(rContainer.size(), flat_data_size);
struct tls_type
{
explicit tls_type(const std::size_t FlatDataSize) : mFlattedGaussPointValues(FlatDataSize) {}
std::vector<TDataType> mGaussPointValues;
Vector<double> mFlattedGaussPointValues;
};
IndexPartition<int>(rContainer.size()).for_each(tls_type(flat_data_size), [&](const int ItemIndex, tls_type& rTLS){
(rContainer.begin() + ItemIndex)->CalculateOnIntegrationPoints(rVariable, rTLS.mGaussPointValues, rProcessInfo);
FlattenData(rTLS.mFlattedGaussPointValues, rTLS.mGaussPointValues);
row(rData, ItemIndex) = rTLS.mFlattedGaussPointValues;
});
KRATOS_CATCH("");
}
} // unnamed namespace.
// template instantiations
template class ContainerGaussPointOutput<ElementsContainerType,
Variable<array_1d<double, 3>>,
Variable<double>,
Variable<int>,
Variable<Vector<double>>,
Variable<Matrix<double>>>;
template class ContainerGaussPointOutput<ConditionsContainerType,
Variable<array_1d<double, 3>>,
Variable<double>,
Variable<int>,
Variable<Vector<double>>,
Variable<Matrix<double>>>;
} // namespace HDF5.
} // namespace Kratos.
| 5,181 |
2,177 | <reponame>denghuafeng/nutz<filename>test/org/nutz/ioc/json/pojo/JavaValueTest.java
package org.nutz.ioc.json.pojo;
public class JavaValueTest {
public static String abc(String path, int k) {
return path + "," + k;
}
}
| 101 |
2,151 | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_GOOGLE_ASSISTANT_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_GOOGLE_ASSISTANT_HANDLER_H_
#include "base/macros.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
class Profile;
namespace chromeos {
namespace settings {
class GoogleAssistantHandler : public ::settings::SettingsPageUIHandler {
public:
explicit GoogleAssistantHandler(Profile* profile);
~GoogleAssistantHandler() override;
void RegisterMessages() override;
void OnJavascriptAllowed() override;
void OnJavascriptDisallowed() override;
private:
// WebUI call to enable the Google Assistant.
void HandleSetGoogleAssistantEnabled(const base::ListValue* args);
// WebUI call to enable context for the Google Assistant.
void HandleSetGoogleAssistantContextEnabled(const base::ListValue* args);
// WebUI call to launch into the Google Assistant app settings.
void HandleShowGoogleAssistantSettings(const base::ListValue* args);
// WebUI call to launch assistant runtime flow.
void HandleTurnOnGoogleAssistant(const base::ListValue* args);
Profile* const profile_;
DISALLOW_COPY_AND_ASSIGN(GoogleAssistantHandler);
};
} // namespace settings
} // namespace chromeos
#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_GOOGLE_ASSISTANT_HANDLER_H_
| 456 |
345 | <reponame>cdoebler1/AIML2<gh_stars>100-1000
import os
import os.path
import re
import unittest
from programy.mappings.person import PersonCollection
from programy.storage.entities.store import Store
class PersonsStoreAsserts(unittest.TestCase):
def assert_lookup_storage(self, store):
store.empty()
store.add_to_lookup(" with you "," with me2 ")
store.add_to_lookup(" with me "," with you2 ")
store.commit()
lookups = store.get_lookup()
self.assertIsNotNone(lookups)
self.assertEqual(2, len(lookups.keys()))
store.remove_lookup_key(" with me ")
store.commit()
lookups = store.get_lookup()
self.assertIsNotNone(lookups)
self.assertEqual(1, len(lookups.keys()))
store.remove_lookup()
store.commit()
lookup = store.get_lookup()
self.assertEqual({}, lookup)
def assert_upload_from_text(self, store):
store.empty()
store.upload_from_text(None, """
" with you "," with me2 "
" with me "," with you2 "
" to you "," to me2 "
" to me "," to you2 "
" of you "," of me2 "
" of me "," of you2 "
" for you "," for me2 "
" for me "," for you2 "
" give you "," give me2 "
" give me "," give you2 "
""")
collection = PersonCollection()
store.load(collection)
self.assertEqual(collection.person(" WITH YOU "), [re.compile('(^WITH YOU | WITH YOU | WITH YOU$)', re.IGNORECASE), ' WITH ME2 '])
self.assertEqual(collection.personalise_string("This is with you "), "This is with me2")
def assert_upload_from_text_file(self, store):
store.empty()
store.upload_from_file(os.path.dirname(__file__) + os.sep + "data" + os.sep + "lookups" + os.sep + "text" + os.sep + "person.txt")
collection = PersonCollection()
store.load(collection)
self.assertEqual(collection.person(" WITH YOU "), [re.compile('(^WITH YOU | WITH YOU | WITH YOU$)', re.IGNORECASE), ' WITH ME2 '])
self.assertEqual(collection.personalise_string("This is with you "), "This is with me2")
def assert_upload_csv_file(self, store):
store.empty()
store.upload_from_file(os.path.dirname(__file__) + os.sep + "data" + os.sep + "lookups" + os.sep + "csv" + os.sep + "person.csv", fileformat=Store.CSV_FORMAT)
collection = PersonCollection()
store.load(collection)
self.assertEqual(collection.person(" WITH YOU "), [re.compile('(^WITH YOU | WITH YOU | WITH YOU$)', re.IGNORECASE), ' WITH ME2 '])
self.assertEqual(collection.personalise_string("This is with you "), "This is with me2")
| 1,395 |
435 | package datawave.query.jexl.visitors.validate;
import datawave.query.jexl.visitors.BaseVisitor;
import org.apache.commons.jexl2.parser.ASTAdditiveNode;
import org.apache.commons.jexl2.parser.ASTAdditiveOperator;
import org.apache.commons.jexl2.parser.ASTAmbiguous;
import org.apache.commons.jexl2.parser.ASTAndNode;
import org.apache.commons.jexl2.parser.ASTArrayAccess;
import org.apache.commons.jexl2.parser.ASTArrayLiteral;
import org.apache.commons.jexl2.parser.ASTAssignment;
import org.apache.commons.jexl2.parser.ASTBitwiseAndNode;
import org.apache.commons.jexl2.parser.ASTBitwiseComplNode;
import org.apache.commons.jexl2.parser.ASTBitwiseOrNode;
import org.apache.commons.jexl2.parser.ASTBitwiseXorNode;
import org.apache.commons.jexl2.parser.ASTBlock;
import org.apache.commons.jexl2.parser.ASTConstructorNode;
import org.apache.commons.jexl2.parser.ASTDivNode;
import org.apache.commons.jexl2.parser.ASTEQNode;
import org.apache.commons.jexl2.parser.ASTERNode;
import org.apache.commons.jexl2.parser.ASTEmptyFunction;
import org.apache.commons.jexl2.parser.ASTFalseNode;
import org.apache.commons.jexl2.parser.ASTFloatLiteral;
import org.apache.commons.jexl2.parser.ASTForeachStatement;
import org.apache.commons.jexl2.parser.ASTFunctionNode;
import org.apache.commons.jexl2.parser.ASTGENode;
import org.apache.commons.jexl2.parser.ASTGTNode;
import org.apache.commons.jexl2.parser.ASTIdentifier;
import org.apache.commons.jexl2.parser.ASTIfStatement;
import org.apache.commons.jexl2.parser.ASTIntegerLiteral;
import org.apache.commons.jexl2.parser.ASTLENode;
import org.apache.commons.jexl2.parser.ASTLTNode;
import org.apache.commons.jexl2.parser.ASTMapEntry;
import org.apache.commons.jexl2.parser.ASTMapLiteral;
import org.apache.commons.jexl2.parser.ASTMethodNode;
import org.apache.commons.jexl2.parser.ASTModNode;
import org.apache.commons.jexl2.parser.ASTMulNode;
import org.apache.commons.jexl2.parser.ASTNENode;
import org.apache.commons.jexl2.parser.ASTNRNode;
import org.apache.commons.jexl2.parser.ASTNotNode;
import org.apache.commons.jexl2.parser.ASTNullLiteral;
import org.apache.commons.jexl2.parser.ASTNumberLiteral;
import org.apache.commons.jexl2.parser.ASTOrNode;
import org.apache.commons.jexl2.parser.ASTReference;
import org.apache.commons.jexl2.parser.ASTReferenceExpression;
import org.apache.commons.jexl2.parser.ASTReturnStatement;
import org.apache.commons.jexl2.parser.ASTSizeFunction;
import org.apache.commons.jexl2.parser.ASTSizeMethod;
import org.apache.commons.jexl2.parser.ASTStringLiteral;
import org.apache.commons.jexl2.parser.ASTTernaryNode;
import org.apache.commons.jexl2.parser.ASTTrueNode;
import org.apache.commons.jexl2.parser.ASTUnaryMinusNode;
import org.apache.commons.jexl2.parser.ASTVar;
import org.apache.commons.jexl2.parser.ASTWhileStatement;
import org.apache.commons.jexl2.parser.JexlNode;
import org.apache.commons.jexl2.parser.SimpleNode;
/**
* Validates that every ASTAndNode and every ASTOrNode has more than one child
*/
public class JunctionValidatingVisitor extends BaseVisitor {
private boolean isValid = true;
public static boolean validate(JexlNode script) {
JunctionValidatingVisitor visitor = new JunctionValidatingVisitor();
script.jjtAccept(visitor, null);
return visitor.isValid();
}
private JunctionValidatingVisitor() {}
public boolean isValid() {
return this.isValid;
}
/*
* Pass through visit to ASTJexlScript
*
* Attempt to short circuit on ASTReference, ASTReferenceExpressions, SimpleNode, ASTFunctionNode, and ASTNotNode
*/
@Override
public Object visit(ASTReference node, Object data) {
if (isValid) {
node.childrenAccept(this, data);
}
return data;
}
@Override
public Object visit(ASTReferenceExpression node, Object data) {
if (isValid) {
node.childrenAccept(this, data);
}
return data;
}
@Override
public Object visit(SimpleNode node, Object data) {
if (isValid) {
node.childrenAccept(this, data);
}
return data;
}
// check the argument nodes of a function
@Override
public Object visit(ASTFunctionNode node, Object data) {
if (isValid) {
node.childrenAccept(this, data);
}
return data;
}
// descend into negated branches of the query
@Override
public Object visit(ASTNotNode node, Object data) {
if (isValid) {
node.childrenAccept(this, data);
}
return data;
}
/*
* Validation methods
*/
@Override
public Object visit(ASTOrNode node, Object data) {
return visitJunction(node, data);
}
@Override
public Object visit(ASTAndNode node, Object data) {
return visitJunction(node, data);
}
private Object visitJunction(JexlNode node, Object data) {
if (!isValid) {
return data;
} else if (!isJunctionValid(node)) {
isValid = false;
return data;
} else {
node.childrenAccept(this, data);
return data;
}
}
/**
* A junction is valid if it has two or more children
*
* @param node
* an ASTOrNode or ASTAndNode
* @return true if the junction is valid
*/
private boolean isJunctionValid(JexlNode node) {
return node.jjtGetNumChildren() >= 2;
}
/*
* Short circuits
*/
@Override
public Object visit(ASTBlock node, Object data) {
return data;
}
@Override
public Object visit(ASTAmbiguous node, Object data) {
return data;
}
@Override
public Object visit(ASTIfStatement node, Object data) {
return data;
}
@Override
public Object visit(ASTWhileStatement node, Object data) {
return data;
}
@Override
public Object visit(ASTForeachStatement node, Object data) {
return data;
}
@Override
public Object visit(ASTAssignment node, Object data) {
return data;
}
@Override
public Object visit(ASTTernaryNode node, Object data) {
return data;
}
@Override
public Object visit(ASTBitwiseOrNode node, Object data) {
return data;
}
@Override
public Object visit(ASTBitwiseXorNode node, Object data) {
return data;
}
@Override
public Object visit(ASTBitwiseAndNode node, Object data) {
return data;
}
@Override
public Object visit(ASTEQNode node, Object data) {
return data;
}
@Override
public Object visit(ASTNENode node, Object data) {
return data;
}
@Override
public Object visit(ASTLTNode node, Object data) {
return data;
}
@Override
public Object visit(ASTGTNode node, Object data) {
return data;
}
@Override
public Object visit(ASTLENode node, Object data) {
return data;
}
@Override
public Object visit(ASTGENode node, Object data) {
return data;
}
@Override
public Object visit(ASTERNode node, Object data) {
return data;
}
@Override
public Object visit(ASTNRNode node, Object data) {
return data;
}
@Override
public Object visit(ASTAdditiveNode node, Object data) {
return data;
}
@Override
public Object visit(ASTAdditiveOperator node, Object data) {
return data;
}
@Override
public Object visit(ASTMulNode node, Object data) {
return data;
}
@Override
public Object visit(ASTDivNode node, Object data) {
return data;
}
@Override
public Object visit(ASTModNode node, Object data) {
return data;
}
@Override
public Object visit(ASTUnaryMinusNode node, Object data) {
return data;
}
@Override
public Object visit(ASTBitwiseComplNode node, Object data) {
return data;
}
@Override
public Object visit(ASTIdentifier node, Object data) {
return data;
}
@Override
public Object visit(ASTNullLiteral node, Object data) {
return data;
}
@Override
public Object visit(ASTTrueNode node, Object data) {
return data;
}
@Override
public Object visit(ASTFalseNode node, Object data) {
return data;
}
public Object visit(ASTIntegerLiteral node, Object data) {
return data;
}
public Object visit(ASTFloatLiteral node, Object data) {
return data;
}
@Override
public Object visit(ASTStringLiteral node, Object data) {
return data;
}
@Override
public Object visit(ASTArrayLiteral node, Object data) {
return data;
}
@Override
public Object visit(ASTMapLiteral node, Object data) {
return data;
}
@Override
public Object visit(ASTMapEntry node, Object data) {
return data;
}
@Override
public Object visit(ASTEmptyFunction node, Object data) {
return data;
}
@Override
public Object visit(ASTSizeFunction node, Object data) {
return data;
}
@Override
public Object visit(ASTMethodNode node, Object data) {
return data;
}
@Override
public Object visit(ASTSizeMethod node, Object data) {
return data;
}
@Override
public Object visit(ASTConstructorNode node, Object data) {
return data;
}
@Override
public Object visit(ASTArrayAccess node, Object data) {
return data;
}
@Override
public Object visit(ASTReturnStatement node, Object data) {
return data;
}
@Override
public Object visit(ASTVar node, Object data) {
return data;
}
@Override
public Object visit(ASTNumberLiteral node, Object data) {
return data;
}
}
| 4,279 |
2,151 | <filename>ios/chrome/browser/ui/omnibox/popup/omnibox_popup_mediator.h
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MEDIATOR_H_
#define IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MEDIATOR_H_
#import <UIKit/UIKit.h>
#include "components/omnibox/browser/autocomplete_result.h"
#import "ios/chrome/browser/ui/omnibox/autocomplete_result_consumer.h"
#import "ios/chrome/browser/ui/omnibox/image_retriever.h"
@class OmniboxPopupPresenter;
namespace image_fetcher {
class IOSImageDataFetcherWrapper;
} // namespace
class OmniboxPopupMediatorDelegate {
public:
virtual bool IsStarredMatch(const AutocompleteMatch& match) const = 0;
virtual void OnMatchSelected(const AutocompleteMatch& match, size_t row) = 0;
virtual void OnMatchSelectedForAppending(const AutocompleteMatch& match) = 0;
virtual void OnMatchSelectedForDeletion(const AutocompleteMatch& match) = 0;
virtual void OnScroll() = 0;
virtual void OnMatchHighlighted(size_t row) = 0;
};
@interface OmniboxPopupMediator
: NSObject<AutocompleteResultConsumerDelegate, ImageRetriever>
// Designated initializer. Takes ownership of |imageFetcher|.
- (instancetype)initWithFetcher:
(std::unique_ptr<image_fetcher::IOSImageDataFetcherWrapper>)
imageFetcher
delegate:(OmniboxPopupMediatorDelegate*)delegate;
// Whether the mediator has results to show.
@property(nonatomic, assign) BOOL hasResults;
- (void)updateMatches:(const AutocompleteResult&)result
withAnimation:(BOOL)animated;
// Sets the text alignment of the popup content.
- (void)setTextAlignment:(NSTextAlignment)alignment;
// Updates the popup with the |results|.
- (void)updateWithResults:(const AutocompleteResult&)results;
@property(nonatomic, weak) id<AutocompleteResultConsumer> consumer;
@property(nonatomic, assign, getter=isIncognito) BOOL incognito;
// Whether the popup is open.
@property(nonatomic, assign, getter=isOpen) BOOL open;
// Presenter for the popup, handling the positioning and the presentation
// animations.
@property(nonatomic, strong) OmniboxPopupPresenter* presenter;
@end
#endif // IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MEDIATOR_H_
| 849 |
881 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""
import logging
import magic
import jsonschema
from django.http import JsonResponse
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import require_GET
from gcloud.conf import settings
from gcloud.contrib.appmaker.models import AppMaker
from gcloud.contrib.appmaker.schema import APP_MAKER_PARAMS_SCHEMA
from gcloud.utils.strings import check_and_rename_params
from gcloud.contrib.analysis.analyse_items import app_maker
logger = logging.getLogger("root")
def save(request, project_id):
"""
@summary: 创建或编辑app maker
@param:
id: id 判断是新建还是编辑
name: 名称
desc: 简介
template_id: 模板ID
template_scheme_id: 执行方案ID
"""
try:
params = request.POST.dict()
jsonschema.validate(params, APP_MAKER_PARAMS_SCHEMA)
except jsonschema.ValidationError as e:
logger.warning("APP_MAKER_PARAMS_SCHEMA raise error: %s" % e)
message = _("参数格式错误:%s" % e)
return JsonResponse({"result": False, "message": message})
logo_obj = request.FILES.get("logo")
if logo_obj:
valid_mime = {"image/png", "image/jpg", "image/jpeg"}
is_png_or_jpg = logo_obj.content_type in valid_mime
if not is_png_or_jpg:
return JsonResponse({"result": False, "message": _("请上传 jpg 或 png 格式的图片")})
file_size = logo_obj.size
# LOGO大小不能大于 100K
if file_size > 100 * 1024:
message = _("LOGO 文件大小必须小于 100K")
return JsonResponse({"result": False, "message": message})
logo_content = logo_obj.read()
real_mime = magic.from_buffer(logo_content, mime=True)
if real_mime not in valid_mime:
return JsonResponse({"result": False, "message": _("图片格式非法")})
else:
logo_content = None
params.update({"username": request.user.username, "logo_content": logo_content})
# 初始化描述
if not params.get("desc"):
params.update({"desc": "Standard OPS Mini-App"})
if settings.IS_LOCAL:
params["link_prefix"] = "%s/appmaker/" % request.get_host()
fake = True
else:
params["link_prefix"] = "%sappmaker/" % settings.APP_HOST
fake = False
result, data = AppMaker.objects.save_app_maker(project_id, params, fake)
if not result:
return JsonResponse({"result": False, "message": data})
data = {
"id": data.id,
"code": data.code,
"logo_url": data.logo_url,
}
return JsonResponse({"result": True, "data": data})
@require_GET
def get_appmaker_count(request, project_id):
group_by = request.GET.get("group_by", "category")
result_dict = check_and_rename_params({}, group_by)
if not result_dict["success"]:
return JsonResponse({"result": False, "message": result_dict["content"]})
filters = {"is_deleted": False, "project_id": project_id}
success, content = app_maker.dispatch(result_dict["group_by"], filters)
if not success:
return JsonResponse({"result": False, "message": content})
return JsonResponse({"result": True, "data": content})
| 1,611 |
2,360 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyTuiview(PythonPackage):
"""TuiView is a lightweight raster GIS with powerful raster attribute
table manipulation abilities.
"""
homepage = "https://github.com/ubarsc/tuiview"
url = "https://github.com/ubarsc/tuiview/releases/download/tuiview-1.2.6/tuiview-1.2.6.tar.gz"
version('1.2.6', sha256='61b136fa31c949d7a7a4dbf8562e6fc677d5b1845b152ec39e337f4eb2e91662')
version('1.1.7', sha256='fbf0bf29cc775357dad4f8a2f0c2ffa98bbf69d603a96353e75b321adef67573')
depends_on("py-pyqt4", type=('build', 'run'), when='@:1.1')
depends_on("py-pyqt5", type=('build', 'run'), when='@1.2.0:')
depends_on("py-numpy", type=('build', 'run'))
depends_on("[email protected]:+python")
| 398 |
856 | //
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include <string>
#include <utility>
namespace
{
struct LstmInput
{
LstmInput(const std::vector<float>& inputSeq,
const std::vector<float>& stateH,
const std::vector<float>& stateC)
: m_InputSeq(inputSeq)
, m_StateH(stateH)
, m_StateC(stateC)
{}
std::vector<float> m_InputSeq;
std::vector<float> m_StateH;
std::vector<float> m_StateC;
};
using LstmInputs = std::pair<std::string, std::vector<LstmInput>>;
} // anonymous namespace | 304 |
8,238 | /*
* %CopyrightBegin%
*
* Copyright Ericsson AB 2002-2016. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* %CopyrightEnd%
*/
#include "eidef.h"
#include "eiext.h"
#include "putget.h"
#ifdef EI_64BIT
int ei_decode_long(const char *buf, int *index, long *p)
{
return ei_decode_longlong(buf, index, (EI_LONGLONG *)p);
}
#endif
#ifdef _MSC_VER
#define MAX_TO_NEGATE 0x8000000000000000Ui64
#define MAX_TO_NOT_NEGATE 0x7FFFFFFFFFFFFFFFUi64
#else
#define MAX_TO_NEGATE 0x8000000000000000ULL
#define MAX_TO_NOT_NEGATE 0x7FFFFFFFFFFFFFFFULL
#endif
int ei_decode_longlong(const char *buf, int *index, EI_LONGLONG *p)
{
const char *s = buf + *index;
const char *s0 = s;
EI_LONGLONG n;
int arity;
switch (get8(s)) {
case ERL_SMALL_INTEGER_EXT:
n = get8(s);
break;
case ERL_INTEGER_EXT:
n = get32be(s);
break;
case ERL_SMALL_BIG_EXT:
arity = get8(s);
goto decode_big;
case ERL_LARGE_BIG_EXT:
arity = get32be(s);
decode_big:
{
int sign = get8(s);
int i;
EI_ULONGLONG u = 0;
/* Little Endian, and n always positive, except for LONG_MIN */
for (i = 0; i < arity; i++) {
if (i < 8) {
/* Use ULONGLONG not to get a negative integer if > 127 */
u |= ((EI_ULONGLONG)get8(s)) << (i * 8);
} else if (get8(s) != 0) {
return -1; /* All but first byte have to be 0 */
}
}
/* check for overflow */
if (sign) {
if (u > MAX_TO_NEGATE) {
return -1;
}
n = -((EI_LONGLONG) u);
} else {
if (u > MAX_TO_NOT_NEGATE) {
return -1;
}
n = (EI_LONGLONG) u;
}
}
break;
default:
return -1;
}
if (p) *p = n;
*index += s-s0;
return 0;
}
| 982 |
852 | #ifndef CommonTools_Utils_MethodStack_h
#define CommonTools_Utils_MethodStack_h
/* \class reco::parser::MethodStack
*
* Stack of methods
*
* \author <NAME>, INFN
*
*/
#include "CommonTools/Utils/interface/MethodInvoker.h"
#include <vector>
namespace reco {
namespace parser {
typedef std::vector<MethodInvoker> MethodStack;
typedef std::vector<LazyInvoker> LazyMethodStack;
} // namespace parser
} // namespace reco
#endif // CommonTools_Utils_MethodStack_h
| 167 |
369 | // Copyright (c) 2017-2021, Mudita <NAME>.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <catch2/catch.hpp>
#include "Device.hpp"
#include <btstack_util.h>
Devicei genDev()
{
Devicei from("from");
bd_addr_t addr{0, 1, 2, 3, 4, 5};
from.setAddress(&addr);
from.pageScanRepetitionMode = 1;
from.clockOffset = 1;
from.classOfDevice = 1;
from.state = DEVICE_STATE::REMOTE_NAME_REQUEST;
from.deviceState = DeviceState::Paired;
from.isPairingSSP = true;
return from;
}
TEST_CASE("Devicei - create copy and move")
{
Devicei from = genDev();
Devicei to;
SECTION("create - by copy")
{
SECTION("ctor")
{
to = Devicei(from);
}
SECTION("operator")
{
to.operator=(from);
}
}
SECTION("move")
{
// please see that that section depends on previous section working fine
Devicei base = from;
SECTION("ctor")
{
to = std::move(base);
}
SECTION("operator")
{
to.operator=(std::move(from));
}
}
REQUIRE(from == to);
REQUIRE(!(from != to));
REQUIRE(bd_addr_cmp(from.address, to.address) == 0);
REQUIRE(from.pageScanRepetitionMode == to.pageScanRepetitionMode);
REQUIRE(from.clockOffset == to.clockOffset);
REQUIRE(from.classOfDevice == to.classOfDevice);
REQUIRE(from.state == to.state);
REQUIRE(from.deviceState == to.deviceState);
REQUIRE(from.isPairingSSP == to.isPairingSSP);
}
| 766 |
624 | MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'solo-tests.db',
}
}
INSTALLED_APPS = (
'solo',
'solo.tests',
)
SECRET_KEY = 'any-key'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': '127.0.0.1:11211',
},
}
SOLO_CACHE = 'default'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
},
]
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
| 418 |
2,945 | <reponame>jie9808/IDDD_Samples<filename>iddd_agilepm/src/main/java/com/saasovation/agilepm/domain/model/product/backlogitem/StoryPoints.java
// Copyright 2012,2013 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.saasovation.agilepm.domain.model.product.backlogitem;
public enum StoryPoints {
ZERO {
public int pointValue() {
return 0;
}
},
ONE {
public int pointValue() {
return 1;
}
},
TWO {
public int pointValue() {
return 2;
}
},
THREE {
public int pointValue() {
return 3;
}
},
FIVE {
public int pointValue() {
return 5;
}
},
EIGHT {
public int pointValue() {
return 8;
}
},
THIRTEEN {
public int pointValue() {
return 13;
}
},
TWENTY {
public int pointValue() {
return 20;
}
},
FORTY {
public int pointValue() {
return 40;
}
},
ONE_HUNDRED {
public int pointValue() {
return 100;
}
};
public abstract int pointValue();
}
| 774 |
490 | <filename>package.json
{
"name": "p5ycho",
"version": "1.0.0",
"description": "Learning to master p5.js",
"repository": "https://github.com/kgolid/p5ycho.git",
"author": "<NAME>",
"license": "MIT",
"scripts": {
"watch": "webpack-dev-server --config webpack.config.js --hot",
"build": "webpack -d --config webpack.config.js"
},
"dependencies": {
"delaunay-triangulate": "^1.1.6",
"numeric": "^1.2.6",
"p5": "^0.5.11",
"perspective-transform": "^1.1.3",
"poisson-disc-sampler": "^1.1.0"
},
"devDependencies": {
"acorn": "^5.0.3",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5"
}
}
| 311 |
460 | #include "../../src/qt3support/painting/q3paintdevicemetrics.h"
| 27 |
25,073 | package cc.mrbird.batch.entity.job;
import cc.mrbird.batch.entity.TestData;
import cc.mrbird.batch.processor.TestDataFilterItemProcessor;
import cc.mrbird.batch.processor.TestDataTransformItemPorcessor;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.item.support.ListItemReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
/**
* @author MrBird
*/
@Component
public class TestDataTransformItemPorcessorDemo {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Autowired
private ListItemReader<TestData> simpleReader;
@Autowired
private TestDataTransformItemPorcessor testDataTransformItemPorcessor;
@Bean
public Job testDataTransformItemPorcessorJob() {
return jobBuilderFactory.get("testDataTransformItemPorcessorJob")
.start(step())
.build();
}
private Step step() {
return stepBuilderFactory.get("step")
.<TestData, TestData>chunk(2)
.reader(simpleReader)
.processor(testDataTransformItemPorcessor)
.writer(list -> list.forEach(System.out::println))
.build();
}
}
| 576 |
503 | /**
* Yobi, Project Hosting SW
*
* Copyright 2014 NAVER Corp.
* http://yobi.io
*
* @Author <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package utils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
abstract public class Diagnostic {
private final static List<Diagnostic> diagnostics = new CopyOnWriteArrayList<>();
/**
* Register a diagnostic.
*
* Registered diagnostics are run when someone open Site Management >
* Diagnostics page.
*
* @param diagnostic
*/
public static void register(@Nonnull Diagnostic diagnostic) {
diagnostics.add(diagnostic);
}
@Nonnull
public static List<String> checkAll() {
List<String> errors = new ArrayList<>();
for (Diagnostic diagnostic : diagnostics) {
try {
errors.addAll(diagnostic.check());
} catch (Exception e) {
errors.add("Failed to diagnose: "
+ ExceptionUtils.getStackTrace(e));
}
}
return errors;
}
@Nonnull
abstract public List<String> check();
}
| 631 |
794 | <filename>android/app/src/main/java/github/tornaco/android/thanos/settings/SettingsViewModel.java
package github.tornaco.android.thanos.settings;
import android.app.Application;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.UiThread;
import androidx.lifecycle.AndroidViewModel;
import com.elvishew.xlog.XLog;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import github.tornaco.android.thanos.core.app.ThanosManager;
import github.tornaco.android.thanos.core.backup.IBackupCallback;
import github.tornaco.android.thanos.core.backup.IFileDescriptorConsumer;
import github.tornaco.android.thanos.core.backup.IFileDescriptorInitializer;
import github.tornaco.android.thanos.core.util.DevNull;
import github.tornaco.android.thanos.core.util.FileUtils;
import io.reactivex.Observable;
import rx2.android.schedulers.AndroidSchedulers;
import util.IoUtils;
public class SettingsViewModel extends AndroidViewModel {
public SettingsViewModel(@NonNull Application application) {
super(application);
}
@SuppressWarnings("UnstableApiUsage")
void performRestore(RestoreListener listener, Uri uri) {
ThanosManager.from(getApplication())
.ifServiceInstalled(thanosManager -> {
File tmpDir = new File(getApplication().getCacheDir(), "restore_tmp");
try {
File tmpZipFile = new File(tmpDir,
String.format("tem_restore_%s.zip", System.currentTimeMillis()));
Files.createParentDirs(tmpZipFile);
InputStream inputStream = getApplication()
.getContentResolver()
.openInputStream(uri);
if (inputStream == null) {
listener.onFail("Input stream is null..." + uri);
return;
}
byte[] buffer = new byte[inputStream.available()];
inputStream.read(buffer);
Files.write(buffer, tmpZipFile);
ParcelFileDescriptor pfd = ParcelFileDescriptor.open(tmpZipFile, ParcelFileDescriptor.MODE_READ_ONLY);
thanosManager.getBackupAgent().performRestore(pfd, null, null, new IBackupCallback.Stub() {
@Override
public void onBackupFinished(String domain, String path) {
// Not for us.
}
@Override
public void onRestoreFinished(String domain, String path) {
listener.onSuccess();
XLog.d("onRestoreFinished: " + path);
}
@Override
public void onFail(String message) {
listener.onFail(message);
XLog.d("onFail: " + message);
}
@Override
public void onProgress(String progressMessage) {
}
});
} catch (Exception e) {
listener.onFail(Log.getStackTraceString(e));
} finally {
FileUtils.deleteDirQuiet(tmpDir);
}
});
}
@SuppressWarnings("UnstableApiUsage")
void performBackup(BackupListener listener, OutputStream externalBackupDirOs) {
File backupDir = new File(getApplication().getCacheDir(), "backup");
// File externalBackupDir = new File(getApplication().getExternalCacheDir(), "backup");
ThanosManager.from(getApplication())
.ifServiceInstalled(thanosManager -> thanosManager.getBackupAgent()
.performBackup(
new IFileDescriptorInitializer.Stub() {
@Override
public void initParcelFileDescriptor(String domain, String path,
IFileDescriptorConsumer consumer)
throws RemoteException {
File subFile = new File(backupDir, path);
XLog.d("create sub file: " + subFile);
try {
Files.createParentDirs(subFile);
if (subFile.createNewFile()) {
ParcelFileDescriptor pfd = ParcelFileDescriptor.open(subFile, ParcelFileDescriptor.MODE_READ_WRITE);
consumer.acceptAppParcelFileDescriptor(pfd);
} else {
consumer.acceptAppParcelFileDescriptor(null);
}
} catch (IOException e) {
XLog.e("createParentDirs fail: " + Log.getStackTraceString(e));
consumer.acceptAppParcelFileDescriptor(null);
}
}
},
null,
null,
new IBackupCallback.Stub() {
@Override
public void onBackupFinished(String domain, String path) {
XLog.d("onBackupFinished: " + path);
File subFile = new File(backupDir, path);
// Move it to dest.
try {
ByteStreams.copy(Files.asByteSource(subFile).openStream(), externalBackupDirOs);
DevNull.accept(Observable.just("Success...")
.observeOn(AndroidSchedulers.mainThread())
.subscribe(o -> listener.onSuccess()));
} catch (Throwable e) {
DevNull.accept(Observable.just(backupDir)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(file -> listener.onFail(e.getLocalizedMessage())));
XLog.e("move fail: " + Log.getStackTraceString(e));
} finally {
FileUtils.deleteDirQuiet(backupDir);
XLog.d("deleteDirQuiet cleanup: " + backupDir);
IoUtils.closeQuietly(externalBackupDirOs);
}
}
@Override
public void onRestoreFinished(String domain, String path) {
}
@Override
public void onFail(String message) {
DevNull.accept(Observable.just(backupDir)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(file -> listener.onFail(message)));
}
@Override
public void onProgress(String progressMessage) {
}
}));
}
interface BackupListener {
@UiThread
void onSuccess();
@UiThread
void onFail(String errMsg);
}
interface RestoreListener {
@UiThread
void onSuccess();
@UiThread
void onFail(String errMsg);
}
}
| 5,194 |
713 | package org.infinispan.server.core.dataconversion.xml;
import java.io.IOException;
import java.io.Reader;
import org.infinispan.commons.configuration.io.xml.MXParser;
import com.thoughtworks.xstream.converters.ErrorWriter;
import com.thoughtworks.xstream.io.StreamException;
import com.thoughtworks.xstream.io.naming.NameCoder;
import com.thoughtworks.xstream.io.xml.AbstractPullReader;
import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder;
public class MXParserReader extends AbstractPullReader {
private final MXParser parser;
private final Reader reader;
public MXParserReader(Reader reader, MXParser parser) {
this(reader, parser, new XmlFriendlyNameCoder());
}
public MXParserReader(Reader reader, MXParser parser, NameCoder nameCoder) {
super(nameCoder);
this.parser = parser;
this.reader = reader;
try {
parser.setInput(this.reader);
} catch (Exception e) {
throw new StreamException(e);
}
this.moveDown();
}
protected int pullNextEvent() {
try {
switch (this.parser.next()) {
case 0:
case 2:
return 1;
case 1:
case 3:
return 2;
case 4:
return 3;
case 9:
return 4;
default:
return 0;
}
} catch (Exception e) {
throw new StreamException(e);
}
}
protected String pullElementName() {
return this.parser.getName();
}
protected String pullText() {
return this.parser.getText();
}
public String getAttribute(String name) {
return this.parser.getAttributeValue(null, this.encodeAttribute(name));
}
public String getAttribute(int index) {
return this.parser.getAttributeValue(index);
}
public int getAttributeCount() {
return this.parser.getAttributeCount();
}
public String getAttributeName(int index) {
return this.decodeAttribute(this.parser.getAttributeName(index));
}
public void appendErrors(ErrorWriter errorWriter) {
errorWriter.add("line number", String.valueOf(this.parser.getLineNumber()));
}
public void close() {
try {
this.reader.close();
} catch (IOException var2) {
throw new StreamException(var2);
}
}
}
| 963 |
404 | <reponame>nrdxp/k<gh_stars>100-1000
// Copyright (c) 2015-2019 K Team. All Rights Reserved.
package org.kframework.compile;
import org.kframework.compile.ConfigurationInfo;
import org.kframework.compile.ConfigurationInfoFromModule;
import org.kframework.compile.LabelInfo;
import org.kframework.compile.LabelInfoFromModule;
import org.kframework.definition.*;
import org.kframework.definition.Module;
/**
* Apply the configuration concretization process.
* The implicit {@code <k>} cell is added by another stage, AddImplicitComputationCell.
* <p>
* The input may freely use various configuration abstractions
* and Full K flexibilites. See {@link IncompleteCellUtils} for a
* description of the expected term structure.
* The output will represent cells in
* strict accordance with their declared fixed-arity productions.
* <p>
* This is a simple composition of the
* {@link AddTopCellToRules}, {@link AddParentCells},
* {@link CloseCells}, and {@link SortCells} passes,
* see their documentation for details on the transformations.
*/
public class ConcretizeCells {
final ConfigurationInfo configurationInfo;
final LabelInfo labelInfo;
final SortInfo sortInfo;
final Module module;
final AddParentCells addParentCells;
final CloseCells closeCells;
final SortCells sortCells;
private final AddTopCellToRules addRootCell;
public static Definition transformDefinition(Definition input, boolean kore) {
ConfigurationInfoFromModule configInfo = new ConfigurationInfoFromModule(input.mainModule());
LabelInfo labelInfo = new LabelInfoFromModule(input.mainModule());
SortInfo sortInfo = SortInfo.fromModule(input.mainModule());
return DefinitionTransformer.fromSentenceTransformer(
new ConcretizeCells(configInfo, labelInfo, sortInfo, input.mainModule(), kore)::concretize,
"concretizing configuration"
).apply(input);
}
public static Module transformModule(Module mod, boolean kore) {
ConfigurationInfoFromModule configInfo = new ConfigurationInfoFromModule(mod);
LabelInfo labelInfo = new LabelInfoFromModule(mod);
SortInfo sortInfo = SortInfo.fromModule(mod);
return ModuleTransformer.fromSentenceTransformer(
new ConcretizeCells(configInfo, labelInfo, sortInfo, mod, kore)::concretize,
"concretizing configuration").apply(mod);
}
public ConcretizeCells(ConfigurationInfo configurationInfo, LabelInfo labelInfo, SortInfo sortInfo, Module module, boolean kore) {
this.configurationInfo = configurationInfo;
this.labelInfo = labelInfo;
this.sortInfo = sortInfo;
this.module = module;
addRootCell = new AddTopCellToRules(configurationInfo, labelInfo, kore);
addParentCells = new AddParentCells(configurationInfo, labelInfo);
closeCells = new CloseCells(configurationInfo, sortInfo, labelInfo);
sortCells = new SortCells(configurationInfo, labelInfo, module);
}
public Sentence concretize(Module m, Sentence s) {
s = addRootCell.addImplicitCells(s, m);
s = addParentCells.concretize(s);
s = closeCells.close(s);
s = sortCells.preprocess(s);
s = sortCells.sortCells(s);
s = sortCells.postprocess(s);
return s;
}
}
| 1,140 |
440 | <filename>src/main/java/com/yb/socket/listener/DefaultExceptionListener.java<gh_stars>100-1000
package com.yb.socket.listener;
import com.yb.socket.service.WrappedChannel;
import io.netty.channel.ChannelHandlerContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author <EMAIL>
* @date 2018/12/30 16:19
*/
public class DefaultExceptionListener implements ExceptionEventListener {
private static final Logger logger = LoggerFactory.getLogger(DefaultExceptionListener.class);
@Override
public EventBehavior exceptionCaught(ChannelHandlerContext ctx, WrappedChannel channel, Throwable cause) {
if (cause != null && channel.remoteAddress() != null) {
logger.warn("Exception caught on channel {}, caused by: '{}'.", channel.id().asShortText(), cause);
}
return EventBehavior.CONTINUE;
}
}
| 290 |
341 | <filename>src/main/java/com/aventstack/extentreports/model/NamedAttribute.java
package com.aventstack.extentreports.model;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
@Getter
@Setter
@SuperBuilder
@AllArgsConstructor
@EqualsAndHashCode
public abstract class NamedAttribute implements Serializable, BaseEntity {
private static final long serialVersionUID = -804568330360505098L;
private String name;
}
| 177 |
335 | <reponame>Safal08/Hacktoberfest-1<filename>G/G_noun.json
{
"word": "G",
"definitions": [
"The seventh letter of the alphabet.",
"Denoting the next after F in a set of items, categories, etc.",
"Denoting the seventh file from the left, as viewed from White's side of the board.",
"The fifth note in the diatonic scale of C major.",
"A key based on a scale with G as its keynote."
],
"parts-of-speech": "Noun"
} | 182 |
2,151 | <gh_stars>1000+
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <algorithm>
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/task_manager/mock_web_contents_task_manager.h"
#include "chrome/common/chrome_switches.h"
#include "extensions/browser/test_image_loader.h"
#include "extensions/common/constants.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/skia_util.h"
namespace task_manager {
class ExtensionTagsTest : public extensions::ExtensionBrowserTest {
public:
ExtensionTagsTest() {}
~ExtensionTagsTest() override {}
protected:
// extensions::ExtensionBrowserTest:
void SetUpCommandLine(base::CommandLine* command_line) override {
extensions::ExtensionBrowserTest::SetUpCommandLine(command_line);
// Do not launch device discovery process.
command_line->AppendSwitch(switches::kDisableDeviceDiscoveryNotifications);
}
// If no extension task was found, a nullptr will be returned.
Task* FindAndGetExtensionTask(
const MockWebContentsTaskManager& task_manager) {
auto itr = std::find_if(
task_manager.tasks().begin(), task_manager.tasks().end(),
[](Task* task) { return task->GetType() == Task::EXTENSION; });
return itr != task_manager.tasks().end() ? *itr : nullptr;
}
const std::vector<WebContentsTag*>& tracked_tags() const {
return WebContentsTagsManager::GetInstance()->tracked_tags();
}
private:
DISALLOW_COPY_AND_ASSIGN(ExtensionTagsTest);
};
// Tests loading, disabling, enabling and unloading extensions and how that will
// affect the recording of tags.
IN_PROC_BROWSER_TEST_F(ExtensionTagsTest, Basic) {
// Browser tests start with a single tab.
EXPECT_EQ(1U, tracked_tags().size());
const extensions::Extension* extension = LoadExtension(
test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
.AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
.AppendASCII("1.0.0.0"));
ASSERT_TRUE(extension);
EXPECT_EQ(2U, tracked_tags().size());
DisableExtension(extension->id());
EXPECT_EQ(1U, tracked_tags().size());
EnableExtension(extension->id());
EXPECT_EQ(2U, tracked_tags().size());
UnloadExtension(extension->id());
EXPECT_EQ(1U, tracked_tags().size());
}
// Disabled due to flakiness, see crbug.com/519333 and crbug.com/639185.
IN_PROC_BROWSER_TEST_F(ExtensionTagsTest,
DISABLED_PreAndPostExistingTaskProviding) {
// Browser tests start with a single tab.
EXPECT_EQ(1U, tracked_tags().size());
MockWebContentsTaskManager task_manager;
EXPECT_TRUE(task_manager.tasks().empty());
const extensions::Extension* extension = LoadExtension(
test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
.AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
.AppendASCII("1.0.0.0"));
ASSERT_TRUE(extension);
EXPECT_EQ(2U, tracked_tags().size());
EXPECT_TRUE(task_manager.tasks().empty());
// Start observing, pre-existing tasks will be provided.
task_manager.StartObserving();
base::RunLoop run_loop;
run_loop.RunUntilIdle();
ASSERT_EQ(2U, task_manager.tasks().size());
const Task* extension_task = FindAndGetExtensionTask(task_manager);
ASSERT_TRUE(extension_task);
SkBitmap expected_bitmap =
extensions::TestImageLoader::LoadAndGetExtensionBitmap(
extension,
"icon_128.png",
extension_misc::EXTENSION_ICON_SMALL);
ASSERT_FALSE(expected_bitmap.empty());
EXPECT_TRUE(gfx::BitmapsAreEqual(*extension_task->icon().bitmap(),
expected_bitmap));
// Unload the extension and expect that the task manager now shows only the
// about:blank tab.
UnloadExtension(extension->id());
EXPECT_EQ(1U, tracked_tags().size());
ASSERT_EQ(1U, task_manager.tasks().size());
const Task* about_blank_task = task_manager.tasks().back();
EXPECT_EQ(Task::RENDERER, about_blank_task->GetType());
EXPECT_EQ(base::UTF8ToUTF16("Tab: about:blank"), about_blank_task->title());
// Reload the extension, the task manager should show it again.
ReloadExtension(extension->id());
EXPECT_EQ(2U, tracked_tags().size());
ASSERT_EQ(2U, task_manager.tasks().size());
extension_task = FindAndGetExtensionTask(task_manager);
ASSERT_TRUE(extension_task);
}
} // namespace task_manager
| 1,670 |
403 | <reponame>guanzhongxing/craft-atom-rpc
package io.craft.atom.nio;
import io.craft.atom.io.AbstractIoHandler;
import io.craft.atom.io.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author mindwind
* @version 1.0, 2011-12-19
*/
public class NioAcceptorNapHandler extends AbstractIoHandler {
private static final Logger LOG = LoggerFactory.getLogger(NioAcceptorNapHandler.class);
private static final byte LF = 10 ;
private StringBuilder buf = new StringBuilder();
@Override
public void channelRead(Channel<byte[]> channel, byte[] bytes) {
LOG.debug("[CRAFT-ATOM-NIO] Channel read bytes size={}, is paused={}", bytes.length, channel.isPaused());
for (byte b : bytes) {
buf.append((char) b);
}
nap();
if (bytes[bytes.length - 1] == LF) {
byte[] echoBytes = buf.toString().getBytes();
LOG.debug("[CRAFT-ATOM-NIO] Echo bytes size={}, take a nap \n", echoBytes.length);
channel.write(echoBytes);
buf = new StringBuilder();
}
}
private void nap() {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
| 540 |
3,494 | <gh_stars>1000+
package org.libcinder.samples.getspecialdirs;
import org.libcinder.app.CinderNativeActivity;
public class GetSpecialDirsActivity extends CinderNativeActivity {
static final String TAG = "GetSpecialDirsActivity";
}
| 74 |
569 | <gh_stars>100-1000
package com.anarchy.classifyview.core;
/**
* <p/>
* Date: 16/6/7 16:41
* Author: <EMAIL>
* <p/>
*/
public class Bean {
}
| 64 |
1,953 | # Authors: <NAME> <<EMAIL>>
# License: BSD Style.
from .commands.utils import main
if __name__ == '__main__':
main()
| 47 |
2,151 | <reponame>zipated/src<filename>third_party/blink/renderer/core/editing/markers/grammar_marker_test.cc
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/editing/markers/grammar_marker.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace blink {
const char* const kDescription = "Test description";
class GrammarMarkerTest : public testing::Test {};
TEST_F(GrammarMarkerTest, MarkerType) {
DocumentMarker* marker = new GrammarMarker(0, 1, kDescription);
EXPECT_EQ(DocumentMarker::kGrammar, marker->GetType());
}
TEST_F(GrammarMarkerTest, IsSpellCheckMarker) {
DocumentMarker* marker = new GrammarMarker(0, 1, kDescription);
EXPECT_TRUE(IsSpellCheckMarker(*marker));
}
TEST_F(GrammarMarkerTest, ConstructorAndGetters) {
GrammarMarker* marker = new GrammarMarker(0, 1, kDescription);
EXPECT_EQ(kDescription, marker->Description());
}
} // namespace blink
| 358 |
1,089 | package org.zalando.logbook.json;
import java.util.function.Predicate;
final class JsonMediaType {
private JsonMediaType() {
}
static final Predicate<String> JSON = contentType -> {
if (contentType == null) {
return false;
}
// implementation note: manually coded for improved performance
if (contentType.startsWith("application/")) {
int index = contentType.indexOf(';', 12);
if (index != -1) {
if (index > 16) {
// application/some+json;charset=utf-8
return contentType.regionMatches(index - 5, "+json", 0, 5);
}
// application/json;charset=utf-8
return contentType.regionMatches(index - 4, "json", 0, 4);
} else {
// application/json
if (contentType.length() == 16) {
return contentType.endsWith("json");
}
// application/some+json
return contentType.endsWith("+json");
}
}
return false;
};
}
| 562 |
1,444 | <reponame>amc8391/mage
package mage.cards.f;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.counter.ProliferateEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FluxChanneler extends CardImpl {
public FluxChanneler(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever you cast a noncreature spell, proliferate. (Choose any number of permanents and/or players, then give each another counter of each kind already there.)
this.addAbility(new SpellCastControllerTriggeredAbility(
new ProliferateEffect(), StaticFilters.FILTER_SPELL_NON_CREATURE, false
));
}
private FluxChanneler(final FluxChanneler card) {
super(card);
}
@Override
public FluxChanneler copy() {
return new FluxChanneler(this);
}
}
| 480 |
879 | package org.zstack.compute.vm;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.zstack.core.cloudbus.CloudBus;
import org.zstack.core.cloudbus.CloudBusCallBack;
import org.zstack.core.componentloader.PluginRegistry;
import org.zstack.core.db.DatabaseFacade;
import org.zstack.header.core.workflow.FlowTrigger;
import org.zstack.header.core.workflow.NoRollbackFlow;
import org.zstack.header.message.MessageReply;
import org.zstack.header.network.l3.L3NetworkInventory;
import org.zstack.header.network.l3.UsedIpInventory;
import org.zstack.header.vm.*;
import org.zstack.utils.Utils;
import org.zstack.utils.logging.CLogger;
import java.util.Map;
@Configurable(preConstruction = true, autowire = Autowire.BY_TYPE)
public class DeleteL3NetworkFromVmNicFlow extends NoRollbackFlow {
private static final CLogger logger = Utils.getLogger(DeleteL3NetworkFromVmNicFlow.class);
@Autowired
protected DatabaseFacade dbf;
@Autowired
protected PluginRegistry pluginRgty;
@Autowired
protected CloudBus bus;
@Override
public void run(final FlowTrigger trigger, final Map data) {
final VmInstanceInventory vm = (VmInstanceInventory) data.get(VmInstanceConstant.Params.vmInventory.toString());
final VmNicInventory nic = (VmNicInventory) data.get(VmInstanceConstant.Params.VmNicInventory.toString());
final UsedIpInventory ip = (UsedIpInventory) data.get(VmInstanceConstant.Params.UsedIPInventory.toString());
if (!vm.getState().equals(VmInstanceState.Running.toString())) {
trigger.next();
return;
}
DeleteL3NetworkFromVmNicMsg msg = new DeleteL3NetworkFromVmNicMsg();
msg.setVmInstanceUuid(vm.getUuid());
msg.setVmNicUuid(nic.getUuid());
msg.setNewL3Uuid(ip.getL3NetworkUuid());
bus.makeTargetServiceIdByResourceUuid(msg, VmInstanceConstant.SERVICE_ID, vm.getUuid());
bus.send(msg, new CloudBusCallBack(trigger) {
@Override
public void run(MessageReply reply) {
if (reply.isSuccess()) {
trigger.next();
} else {
trigger.fail(reply.getError());
}
}
});
}
}
| 966 |
2,151 | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "printing/metafile_skia_wrapper.h"
#include "third_party/skia/include/core/SkMetaData.h"
#include "third_party/skia/include/core/SkRefCnt.h"
namespace printing {
namespace {
const char kMetafileKey[] = "CrMetafile";
} // namespace
// static
void MetafileSkiaWrapper::SetMetafileOnCanvas(cc::PaintCanvas* canvas,
PdfMetafileSkia* metafile) {
sk_sp<MetafileSkiaWrapper> wrapper;
// Can't use sk_make_sp<>() because the constructor is private.
if (metafile)
wrapper = sk_sp<MetafileSkiaWrapper>(new MetafileSkiaWrapper(metafile));
SkMetaData& meta = canvas->getMetaData();
meta.setRefCnt(kMetafileKey, wrapper.get());
}
// static
PdfMetafileSkia* MetafileSkiaWrapper::GetMetafileFromCanvas(
cc::PaintCanvas* canvas) {
SkMetaData& meta = canvas->getMetaData();
SkRefCnt* value;
if (!meta.findRefCnt(kMetafileKey, &value) || !value)
return nullptr;
return static_cast<MetafileSkiaWrapper*>(value)->metafile_;
}
MetafileSkiaWrapper::MetafileSkiaWrapper(PdfMetafileSkia* metafile)
: metafile_(metafile) {
}
} // namespace printing
| 517 |
3,366 | <gh_stars>1000+
/*
=================================================================================
C++ Primer 5th Exercise Answer Source Code
Copyright (C) 2014-2015 github.com/pezy/Cpp-Primer
Disc_quote
If you have questions, try to connect with me: pezy<<EMAIL>>
=================================================================================
*/
#ifndef CP5_EX15_15_DISC_QUOTE_H_
#define CP5_EX15_15_DISC_QUOTE_H_
#include "ex15_03_Quote.h"
#include <string>
inline namespace EX15 {
using std::string;
class Disc_quote : public EX03::Quote {
public:
Disc_quote() = default;
Disc_quote(string const& b, double p, size_t q, double d) : EX03::Quote(b, p), quantity(q), discount(d){ }
virtual double net_price(size_t) const = 0;
protected:
size_t quantity = 0;
double discount = 0.0;
};
}
#endif // CP5_EX15_15_DISC_QUOTE_H_
| 293 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.