answer
stringlengths
15
1.25M
#include "exception.h" #include "reg_constant.h" #include "fpu_emu.h" #include "fpu_system.h" /* Divide one register by another and put the result into a third register. */ int FPU_div(int flags, int rm, int control_w) { FPU_REG x, y; FPU_REG const *a, *b, *st0_ptr, *st_ptr; FPU_REG *dest; u_char taga, tagb, signa, signb, sign, saved_sign; int tag, deststnr; if ( flags & DEST_RM ) deststnr = rm; else deststnr = 0; if ( flags & REV ) { b = &st(0); st0_ptr = b; tagb = FPU_gettag0(); if ( flags & LOADED ) { a = (FPU_REG *)rm; taga = flags & 0x0f; } else { a = &st(rm); st_ptr = a; taga = FPU_gettagi(rm); } } else { a = &st(0); st0_ptr = a; taga = FPU_gettag0(); if ( flags & LOADED ) { b = (FPU_REG *)rm; tagb = flags & 0x0f; } else { b = &st(rm); st_ptr = b; tagb = FPU_gettagi(rm); } } signa = getsign(a); signb = getsign(b); sign = signa ^ signb; dest = &st(deststnr); saved_sign = getsign(dest); if ( !(taga | tagb) ) { /* Both regs Valid, this should be the most common case. */ reg_copy(a, &x); reg_copy(b, &y); setpositive(&x); setpositive(&y); tag = FPU_u_div(&x, &y, dest, control_w, sign); if ( tag < 0 ) return tag; FPU_settagi(deststnr, tag); return tag; } if ( taga == TAG_Special ) taga = FPU_Special(a); if ( tagb == TAG_Special ) tagb = FPU_Special(b); if ( ((taga == TAG_Valid) && (tagb == TW_Denormal)) || ((taga == TW_Denormal) && (tagb == TAG_Valid)) || ((taga == TW_Denormal) && (tagb == TW_Denormal)) ) { if ( denormal_operand() < 0 ) return FPU_Exception; FPU_to_exp16(a, &x); FPU_to_exp16(b, &y); tag = FPU_u_div(&x, &y, dest, control_w, sign); if ( tag < 0 ) return tag; FPU_settagi(deststnr, tag); return tag; } else if ( (taga <= TW_Denormal) && (tagb <= TW_Denormal) ) { if ( tagb != TAG_Zero ) { /* Want to find Zero/Valid */ if ( tagb == TW_Denormal ) { if ( denormal_operand() < 0 ) return FPU_Exception; } /* The result is zero. */ FPU_copy_to_regi(&CONST_Z, TAG_Zero, deststnr); setsign(dest, sign); return TAG_Zero; } /* We have an exception condition, either 0/0 or Valid/Zero. */ if ( taga == TAG_Zero ) { return arith_invalid(deststnr); } /* Valid/Zero */ return FPU_divide_by_zero(deststnr, sign); } /* Must have infinities, NaNs, etc */ else if ( (taga == TW_NaN) || (tagb == TW_NaN) ) { if ( flags & LOADED ) return real_2op_NaN((FPU_REG *)rm, flags & 0x0f, 0, st0_ptr); if ( flags & DEST_RM ) { int tag; tag = FPU_gettag0(); if ( tag == TAG_Special ) tag = FPU_Special(st0_ptr); return real_2op_NaN(st0_ptr, tag, rm, (flags & REV) ? st0_ptr : &st(rm)); } else { int tag; tag = FPU_gettagi(rm); if ( tag == TAG_Special ) tag = FPU_Special(&st(rm)); return real_2op_NaN(&st(rm), tag, 0, (flags & REV) ? st0_ptr : &st(rm)); } } else if (taga == TW_Infinity) { if (tagb == TW_Infinity) { /* infinity/infinity */ return arith_invalid(deststnr); } else { /* tagb must be Valid or Zero */ if ( (tagb == TW_Denormal) && (denormal_operand() < 0) ) return FPU_Exception; /* Infinity divided by Zero or Valid does not raise and exception, but returns Infinity */ FPU_copy_to_regi(a, TAG_Special, deststnr); setsign(dest, sign); return taga; } } else if (tagb == TW_Infinity) { if ( (taga == TW_Denormal) && (denormal_operand() < 0) ) return FPU_Exception; /* The result is zero. */ FPU_copy_to_regi(&CONST_Z, TAG_Zero, deststnr); setsign(dest, sign); return TAG_Zero; } #ifdef PARANOID else { EXCEPTION(EX_INTERNAL|0x102); return FPU_Exception; } #endif /* PARANOID */ }
#ifndef <API key> #define <API key> #include <string> #include "talk/app/webrtc/<API key>.h" #include "talk/app/webrtc/<API key>.h" #include "talk/app/webrtc/<API key>.h" #include "talk/app/webrtc/statscollector.h" #include "talk/app/webrtc/streamcollection.h" #include "talk/app/webrtc/webrtcsession.h" #include "talk/base/scoped_ptr.h" namespace webrtc { class <API key>; typedef std::vector<<API key>::StunConfiguration> StunConfigurations; typedef std::vector<<API key>::TurnConfiguration> TurnConfigurations; // PeerConnectionImpl implements the PeerConnection interface. // It uses <API key> and WebRtcSession to implement // the PeerConnection functionality. class PeerConnection : public <API key>, public <API key>, public IceObserver, public talk_base::MessageHandler, public sigslot::has_slots<> { public: explicit PeerConnection(<API key>* factory); bool Initialize( const <API key>::RTCConfiguration& configuration, const <API key>* constraints, <API key>* allocator_factory, <API key>* <API key>, <API key>* observer); virtual talk_base::scoped_refptr<<API key>> local_streams(); virtual talk_base::scoped_refptr<<API key>> remote_streams(); virtual bool AddStream(<API key>* local_stream, const <API key>* constraints); virtual void RemoveStream(<API key>* local_stream); virtual talk_base::scoped_refptr<DtmfSenderInterface> CreateDtmfSender( AudioTrackInterface* track); virtual talk_base::scoped_refptr<<API key>> CreateDataChannel( const std::string& label, const DataChannelInit* config); virtual bool GetStats(StatsObserver* observer, webrtc::<API key>* track, StatsOutputLevel level); virtual SignalingState signaling_state(); // TODO(bemasc): Remove ice_state() when callers are removed. virtual IceState ice_state(); virtual IceConnectionState <API key>(); virtual IceGatheringState ice_gathering_state(); virtual const <API key>* local_description() const; virtual const <API key>* remote_description() const; // JSEP01 virtual void CreateOffer(<API key>* observer, const <API key>* constraints); virtual void CreateAnswer(<API key>* observer, const <API key>* constraints); virtual void SetLocalDescription(<API key>* observer, <API key>* desc); virtual void <API key>(<API key>* observer, <API key>* desc); // TODO(mallinath) : Deprecated version, remove after all clients are updated. virtual bool UpdateIce(const IceServers& configuration, const <API key>* constraints); virtual bool UpdateIce( const <API key>::RTCConfiguration& config); virtual bool AddIceCandidate(const <API key>* candidate); virtual void RegisterUMAObserver(UMAObserver* observer); virtual void Close(); protected: virtual ~PeerConnection(); private: // Implements MessageHandler. virtual void OnMessage(talk_base::Message* msg); // Implements <API key>. virtual void OnAddRemoteStream(<API key>* stream) OVERRIDE; virtual void <API key>(<API key>* stream) OVERRIDE; virtual void OnAddDataChannel(<API key>* data_channel) OVERRIDE; virtual void <API key>(<API key>* stream, AudioTrackInterface* audio_track, uint32 ssrc) OVERRIDE; virtual void <API key>(<API key>* stream, VideoTrackInterface* video_track, uint32 ssrc) OVERRIDE; virtual void <API key>( <API key>* stream, AudioTrackInterface* audio_track) OVERRIDE; virtual void <API key>( <API key>* stream, VideoTrackInterface* video_track) OVERRIDE; virtual void <API key>(<API key>* stream, AudioTrackInterface* audio_track, uint32 ssrc) OVERRIDE; virtual void <API key>(<API key>* stream, VideoTrackInterface* video_track, uint32 ssrc) OVERRIDE; virtual void <API key>( <API key>* stream, AudioTrackInterface* audio_track, uint32 ssrc) OVERRIDE; virtual void <API key>( <API key>* stream, VideoTrackInterface* video_track) OVERRIDE; virtual void OnRemoveLocalStream(<API key>* stream); // Implements IceObserver virtual void <API key>(IceConnectionState new_state); virtual void <API key>(IceGatheringState new_state); virtual void OnIceCandidate(const <API key>* candidate); virtual void OnIceComplete(); // Signals from WebRtcSession. void <API key>(cricket::BaseSession* session, cricket::BaseSession::State state); void <API key>(SignalingState signaling_state); bool DoInitialize(IceTransportsType type, const StunConfigurations& stun_config, const TurnConfigurations& turn_config, const <API key>* constraints, <API key>* allocator_factory, <API key>* <API key>, <API key>* observer); talk_base::Thread* signaling_thread() const { return factory_->signaling_thread(); } void <API key>(<API key>* observer, const std::string& error); bool IsClosed() const { return signaling_state_ == <API key>::kClosed; } // Storing the factory as a scoped reference pointer ensures that the memory // in the <API key> remains available as long as the // PeerConnection is running. It is passed to PeerConnection as a raw pointer. // However, since the reference counting is done in the // <API key> all instances created using the raw pointer // will refer to the same reference count. talk_base::scoped_refptr<<API key>> factory_; <API key>* observer_; UMAObserver* uma_observer_; SignalingState signaling_state_; // TODO(bemasc): Remove ice_state_. IceState ice_state_; IceConnectionState <API key>; IceGatheringState <API key>; talk_base::scoped_ptr<cricket::PortAllocator> port_allocator_; talk_base::scoped_ptr<WebRtcSession> session_; talk_base::scoped_ptr<<API key>> <API key>; talk_base::scoped_ptr<<API key>> <API key>; StatsCollector stats_; }; } // namespace webrtc #endif // <API key>
#pragma once #include "ap_version.h" #define THISFIRMWARE "ArduPlane V3.8.0beta3" #define FIRMWARE_VERSION 3,8,0,<API key>+2 #ifndef GIT_VERSION #define FIRMWARE_STRING THISFIRMWARE #else #define FIRMWARE_STRING THISFIRMWARE " (" GIT_VERSION ")" #endif
package jbenchmarker.logoot; import jbenchmarker.core.Document; /** * * @author urso */ public interface TimestampedDocument extends Document { int getReplicaNumber(); int nextClock(); }
#include "cgroup.h" #include "qq_types.h" #include <unistd.h> #include <errno.h> typedef enum { <API key>, // open dialog every time <API key>, // open dialog when establish conversation CG_OPEN_SLIENT, // establish conversation without dialog } CGroupOpenOption; typedef struct qq_chat_group_ { qq_chat_group parent; PurpleLog* log; GList* msg_list; unsigned int unread_num; } qq_chat_group_; static void open_conversation(qq_chat_group* cg, CGroupOpenOption opt) { g_return_if_fail(cg); LwqqGroup* g = cg->group; PurpleChat* chat = cg->chat; PurpleConnection* gc = chat->account->gc; const char* key = try_get(g->account, g->gid); static int index = 0; PurpleConversation* conv = CGROUP_GET_CONV(cg); if (conv == NULL) { if (opt != CG_OPEN_SLIENT) <API key>(gc, index++, key); } else if (opt == <API key>) <API key>(conv); } static void set_user_list(qq_chat_group* cg) { PurpleConversation* conv = CGROUP_GET_CONV(cg); qq_account* ac = cg->chat->account->gc->proto_data; LwqqClient* lc = ac->qq; LwqqSimpleBuddy* member; LwqqBuddy* buddy; <API key> flag; GList* users = NULL; GList* flags = NULL; GList* extra_msgs = NULL; LwqqGroup* group = cg->group; PurpleConvChat* chat = PURPLE_CONV_CHAT(conv); // only there are no member we add it. if (<API key>(PURPLE_CONV_CHAT(conv)) == NULL) { LIST_FOREACH(member, &group->members, entries) { extra_msgs = g_list_append(extra_msgs, NULL); flag = 0; if (<API key>(member, group)) flag |= <API key>; if (member->stat != LWQQ_STATUS_OFFLINE) flag |= <API key>; if (member->mflag & <API key>) flag |= PURPLE_CBFLAGS_OP; flags = g_list_append(flags, GINT_TO_POINTER(flag)); if ((buddy = find_buddy_by_uin(lc, member->uin))) { if (ac->flag & QQ_USE_QQNUM) users = g_list_append(users, try_get(buddy->qqnumber, buddy->uin)); else users = g_list_append(users, buddy->uin); } else { // note nick may be NULL in special situation users = g_list_append(users, member->card ?: member->nick); } } if (users) // sometimes, member is empty, so users is NULL <API key>(chat, users, extra_msgs, flags, FALSE); g_list_free(users); g_list_free(flags); g_list_free(extra_msgs); } return; } static void msg_free(PurpleConvMessage* msg) { if (msg) { s_free(msg->who); s_free(msg->what); s_free(msg); } } static void force_delete_log(PurpleLog* log) { #ifndef WIN32 char procpath[128]; char filepath[256] = { 0 }; <API key>* data = log->logger_data; int fd = fileno(data->file); if (fd < 0) return; snprintf(procpath, sizeof(procpath), "/proc/self/fd/%d", fd); if (readlink(procpath, filepath, sizeof(filepath)) < 0) return; if (unlink(filepath) < 0) lwqq_puts(strerror(errno)); #endif } qq_chat_group* qq_cgroup_new(struct qq_chat_group_opt* opt) { qq_chat_group_* cg_ = s_malloc0(sizeof(*cg_)); cg_->parent.opt = opt; return (qq_chat_group*)cg_; } void qq_cgroup_free(qq_chat_group* cg) { qq_chat_group_* cg_ = (qq_chat_group_*)cg; if (cg) { GList* ptr = cg_->msg_list; while (ptr) { msg_free(ptr->data); ptr = ptr->next; } g_list_free(cg_->msg_list); purple_log_free(cg_->log); } s_free(cg); } void qq_cgroup_got_msg(qq_chat_group* cg, const char* serv_id, PurpleMessageFlags flags, const char* message, time_t t) { qq_chat_group_* cg_ = (qq_chat_group_*)cg; PurpleConnection* gc = cg->chat->account->gc; qq_account* ac = gc->proto_data; LwqqBuddy* b = find_buddy_by_uin(ac->qq, serv_id); LwqqSimpleBuddy* sb = NULL; const char* name; if (b == NULL) sb = <API key>(cg->group, serv_id); if (cg->group->mask > 0 && CGROUP_GET_CONV(cg) == NULL) { if (cg_->unread_num == 0) { cg_->log = purple_log_new(PURPLE_LOG_CHAT, cg->group->account, cg->chat->account, NULL, t, NULL); } name = b ? (b->markname ?: b->nick) : (sb ? (sb->card ?: sb->nick) : serv_id); purple_log_write(cg_->log, flags, name, t, message); PurpleConvMessage* msg = s_malloc0(sizeof(*msg)); msg->who = s_strdup(serv_id); msg->when = t; msg->flags = flags; msg->what = s_strdup(message); cg_->msg_list = g_list_append(cg_->msg_list, msg); cg_->unread_num++; cg->opt->new_msg_notice(cg); } else { open_conversation(cg, <API key>); set_user_list(cg); name = b ? (b->qqnumber ?: b->nick) : (sb ? (sb->card ?: sb->nick) : serv_id); PurpleConversation* conv = CGROUP_GET_CONV(cg); serv_got_chat_in(gc, <API key>(PURPLE_CONV_CHAT(conv)), name, flags, message, t); } } void qq_cgroup_open(qq_chat_group* cg) { open_conversation(cg, <API key>); LwqqGroup* group = cg->group; qq_account* ac = cg->chat->account->gc->proto_data; PurpleConversation* conv = CGROUP_GET_CONV(cg); <API key>(PURPLE_CONV_CHAT(conv), NULL, cg->group->memo); <API key>(cg); if (LIST_EMPTY(&group->members)) { LwqqAsyncEvent* ev = <API key>(ac->qq, group, NULL); <API key>(ev, _C_(p, set_user_list, cg)); } else { set_user_list(cg); // note only have got user_list, there may be unread msg; qq_chat_group_* cg_ = (qq_chat_group_*)cg; if (cg->group->mask > 0 && cg_->unread_num > 0) { if (purple_log_delete(cg_->log) == 0) force_delete_log(cg_->log); purple_log_free(cg_->log); cg_->log = NULL; GList* ptr = cg_->msg_list; while (ptr) { PurpleConvMessage* msg = ptr->data; qq_cgroup_got_msg(cg, msg->who, msg->flags, msg->what, msg->when); msg_free(msg); ptr = ptr->next; } g_list_free(cg_->msg_list); cg_->msg_list = NULL; cg_->unread_num = 0; cg->opt->new_msg_notice(cg); } } } void <API key>(qq_chat_group* cg) { PurpleConversation* conv = CGROUP_GET_CONV(cg); if (conv == NULL) return; PurpleConvChat* chat = PURPLE_CONV_CHAT(conv); <API key>(chat); set_user_list(cg); } unsigned int <API key>(qq_chat_group* cg) { return ((qq_chat_group_*)cg)->unread_num; } void <API key>(qq_chat_group* cg, LwqqMask m) { cg->mask_local = m; cg->group->mask = m; qq_account* ac = cg->chat->account->gc->proto_data; <API key>(ac->db, &cg->group); }
// RUN: %clang_cc1 -triple <API key>.0 -emit-llvm < %s | FileCheck -check-prefix=FREEBSD %s // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm < %s | FileCheck -check-prefix=WIN64 %s struct foo { int x; float y; char z; }; // FREEBSD: %[[STRUCT_FOO:.*]] = type { i32, float, i8 } // WIN64: %[[STRUCT_FOO:.*]] = type { i32, float, i8 } void __attribute__((ms_abi)) f1(void); void __attribute__((sysv_abi)) f2(void); void f3(void) { // FREEBSD-LABEL: define void @f3() // WIN64-LABEL: define void @f3() f1(); // FREEBSD: call x86_64_win64cc void @f1() // WIN64: call void @f1() f2(); // FREEBSD: call void @f2() // WIN64: call x86_64_sysvcc void @f2() } // FREEBSD: declare x86_64_win64cc void @f1() // FREEBSD: declare void @f2() // WIN64: declare void @f1() // WIN64: declare x86_64_sysvcc void @f2() // Win64 ABI varargs void __attribute__((ms_abi)) f4(int a, ...) { // FREEBSD-LABEL: define x86_64_win64cc void @f4 // WIN64-LABEL: define void @f4 <API key> ap; <API key>(ap, a); // FREEBSD: %[[AP:.*]] = alloca i8* // FREEBSD: call void @llvm.va_start // WIN64: %[[AP:.*]] = alloca i8* // WIN64: call void @llvm.va_start int b = __builtin_va_arg(ap, int); // FREEBSD: %[[AP_CUR:.*]] = load i8*, i8** %[[AP]] // FREEBSD-NEXT: %[[AP_NEXT:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR]], i64 8 // FREEBSD-NEXT: store i8* %[[AP_NEXT]], i8** %[[AP]] // FREEBSD-NEXT: bitcast i8* %[[AP_CUR]] to i32* // WIN64: %[[AP_CUR:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: %[[AP_NEXT:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR]], i64 8 // WIN64-NEXT: store i8* %[[AP_NEXT]], i8** %[[AP]] // WIN64-NEXT: bitcast i8* %[[AP_CUR]] to i32* // FIXME: These are different now. We probably need __builtin_ms_va_arg. double _Complex c = __builtin_va_arg(ap, double _Complex); // FREEBSD: %[[AP_CUR2:.*]] = load i8*, i8** %[[AP]] // FREEBSD-NEXT: %[[AP_NEXT2:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR2]], i64 16 // FREEBSD-NEXT: store i8* %[[AP_NEXT2]], i8** %[[AP]] // FREEBSD-NEXT: bitcast i8* %[[AP_CUR2]] to { double, double }* // WIN64: %[[AP_CUR2:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: %[[AP_NEXT2:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR2]], i64 8 // WIN64-NEXT: store i8* %[[AP_NEXT2]], i8** %[[AP]] // WIN64-NEXT: %[[CUR2:.*]] = bitcast i8* %[[AP_CUR2]] to { double, double }** // WIN64-NEXT: load { double, double }*, { double, double }** %[[CUR2]] struct foo d = __builtin_va_arg(ap, struct foo); // FREEBSD: %[[AP_CUR3:.*]] = load i8*, i8** %[[AP]] // FREEBSD-NEXT: %[[AP_NEXT3:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR3]], i64 16 // FREEBSD-NEXT: store i8* %[[AP_NEXT3]], i8** %[[AP]] // FREEBSD-NEXT: bitcast i8* %[[AP_CUR3]] to %[[STRUCT_FOO]]* // WIN64: %[[AP_CUR3:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: %[[AP_NEXT3:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR3]], i64 8 // WIN64-NEXT: store i8* %[[AP_NEXT3]], i8** %[[AP]] // WIN64-NEXT: %[[CUR3:.*]] = bitcast i8* %[[AP_CUR3]] to %[[STRUCT_FOO]]* // WIN64-NEXT: load %[[STRUCT_FOO]]*, %[[STRUCT_FOO]]** %[[CUR3]] <API key> ap2; <API key>(ap2, ap); // FREEBSD: %[[AP_VAL:.*]] = load i8*, i8** %[[AP]] // FREEBSD-NEXT: store i8* %[[AP_VAL]], i8** %[[AP2:.*]] // WIN64: %[[AP_VAL:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: store i8* %[[AP_VAL]], i8** %[[AP2:.*]] __builtin_ms_va_end(ap); // FREEBSD: call void @llvm.va_end // WIN64: call void @llvm.va_end } // Let's verify that normal va_lists work right on Win64, too. void f5(int a, ...) { // WIN64-LABEL: define void @f5 __builtin_va_list ap; __builtin_va_start(ap, a); // WIN64: %[[AP:.*]] = alloca i8* // WIN64: call void @llvm.va_start int b = __builtin_va_arg(ap, int); // WIN64: %[[AP_CUR:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: %[[AP_NEXT:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR]], i64 8 // WIN64-NEXT: store i8* %[[AP_NEXT]], i8** %[[AP]] // WIN64-NEXT: bitcast i8* %[[AP_CUR]] to i32* double _Complex c = __builtin_va_arg(ap, double _Complex); // WIN64: %[[AP_CUR2:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: %[[AP_NEXT2:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR2]], i64 8 // WIN64-NEXT: store i8* %[[AP_NEXT2]], i8** %[[AP]] // WIN64-NEXT: bitcast i8* %[[AP_CUR2]] to { double, double }* struct foo d = __builtin_va_arg(ap, struct foo); // WIN64: %[[AP_CUR3:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: %[[AP_NEXT3:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR3]], i64 8 // WIN64-NEXT: store i8* %[[AP_NEXT3]], i8** %[[AP]] // WIN64-NEXT: bitcast i8* %[[AP_CUR3]] to %[[STRUCT_FOO]]* __builtin_va_list ap2; __builtin_va_copy(ap2, ap); // WIN64: call void @llvm.va_copy __builtin_va_end(ap); // WIN64: call void @llvm.va_end } // Verify that using a Win64 va_list from a System V function works. void __attribute__((sysv_abi)) f6(<API key> ap) { // FREEBSD-LABEL: define void @f6 // FREEBSD: store i8* %ap, i8** %[[AP:.*]] // WIN64-LABEL: define x86_64_sysvcc void @f6 // WIN64: store i8* %ap, i8** %[[AP:.*]] int b = __builtin_va_arg(ap, int); // FREEBSD: %[[AP_CUR:.*]] = load i8*, i8** %[[AP]] // FREEBSD-NEXT: %[[AP_NEXT:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR]], i64 8 // FREEBSD-NEXT: store i8* %[[AP_NEXT]], i8** %[[AP]] // FREEBSD-NEXT: bitcast i8* %[[AP_CUR]] to i32* // WIN64: %[[AP_CUR:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: %[[AP_NEXT:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR]], i64 8 // WIN64-NEXT: store i8* %[[AP_NEXT]], i8** %[[AP]] // WIN64-NEXT: bitcast i8* %[[AP_CUR]] to i32* double _Complex c = __builtin_va_arg(ap, double _Complex); // FREEBSD: %[[AP_CUR2:.*]] = load i8*, i8** %[[AP]] // FREEBSD-NEXT: %[[AP_NEXT2:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR2]], i64 16 // FREEBSD-NEXT: store i8* %[[AP_NEXT2]], i8** %[[AP]] // FREEBSD-NEXT: bitcast i8* %[[AP_CUR2]] to { double, double }* // WIN64: %[[AP_CUR2:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: %[[AP_NEXT2:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR2]], i64 8 // WIN64-NEXT: store i8* %[[AP_NEXT2]], i8** %[[AP]] // WIN64-NEXT: bitcast i8* %[[AP_CUR2]] to { double, double }* struct foo d = __builtin_va_arg(ap, struct foo); // FREEBSD: %[[AP_CUR3:.*]] = load i8*, i8** %[[AP]] // FREEBSD-NEXT: %[[AP_NEXT3:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR3]], i64 16 // FREEBSD-NEXT: store i8* %[[AP_NEXT3]], i8** %[[AP]] // FREEBSD-NEXT: bitcast i8* %[[AP_CUR3]] to %[[STRUCT_FOO]]* // WIN64: %[[AP_CUR3:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: %[[AP_NEXT3:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR3]], i64 8 // WIN64-NEXT: store i8* %[[AP_NEXT3]], i8** %[[AP]] // WIN64-NEXT: bitcast i8* %[[AP_CUR3]] to %[[STRUCT_FOO]]* <API key> ap2; <API key>(ap2, ap); // FREEBSD: %[[AP_VAL:.*]] = load i8*, i8** %[[AP]] // FREEBSD-NEXT: store i8* %[[AP_VAL]], i8** %[[AP2:.*]] // WIN64: %[[AP_VAL:.*]] = load i8*, i8** %[[AP]] // WIN64-NEXT: store i8* %[[AP_VAL]], i8** %[[AP2:.*]] }
#ifndef __MMUT_Contact__ #define __MMUT_Contact__ #include <utility> #include <string> #include <mmut_manager.h> #include <mman_base.h> #include <mmut_connectivity.h> DefineClass(CContact); class CContact : public CMMANBase { public : CContact(PCMMUTManager molHndin, int selHndin); CContact(PCMMUTManager molHndin); CContact(PCMMUTManager molHndin, int selHndin, PCMMUTManager molHndin2, int selHndin2); ~CContact(); void InitParams(); void SetParams(int v, double *value, int niv, int *ivalue); int Calculate (bool separate_models = 1); int Calculate0 (int model=0); std::string Print (bool geometry=1); Connectivity2 close_contacts; private: //the algorithm parameters parameters // Params int test_VDW_radius; int label_VDW_radius; int exclude_hbondable; mmdb::realtype simple_max_cutoff; mmdb::realtype simple_min_cutoff; mmdb::realtype VDW_fraction_min; mmdb::realtype VDW_fraction_max; }; #endif
(function($) { /** * @constructor * * @extends $.pkp.controllers.modal.ModalHandler * * @param {jQuery} $handledElement The clickable element * the modal will be attached to. * @param {Object} options Non-default options to configure * the modal. * * Options are: * - okButton string the name for the confirmation button. * - cancelButton string the name for the cancel button * (or false for no button). * - dialogText string the text to be displayed in the modal. * - All options from the ModalHandler widget. * - All options documented for the jQueryUI dialog widget, * except for the buttons parameter which is not supported. */ $.pkp.controllers.modal.<API key> = function($handledElement, options) { this.parent($handledElement, options); }; $.pkp.classes.Helper.inherits($.pkp.controllers.modal.<API key>, $.pkp.controllers.modal.ModalHandler); // Protected methods /** @inheritDoc */ $.pkp.controllers.modal.<API key>.prototype.checkOptions = function(options) { // Check the mandatory options of the ModalHandler handler. if (!this.parent('checkOptions', options)) { return false; } // Check for our own mandatory options. return typeof options.okButton === 'string' && (options.cancelButton === false || typeof options.cancelButton === 'string') && typeof options.dialogText === 'string'; }; /** @inheritDoc */ $.pkp.controllers.modal.<API key>.prototype.mergeOptions = function(options) { // Let the parent class prepare the options first. var internalOptions = this.parent('mergeOptions', options); // Configure confirmation button. internalOptions.buttons = { }; internalOptions.buttons[options.okButton] = this.callbackWrapper(this.modalConfirm); delete options.okButton; // Configure the cancel button. if (options.cancelButton) { internalOptions.buttons[options.cancelButton] = this.callbackWrapper(this.modalClose); delete options.cancelButton; } // Add the modal dialog text. var $handledElement = this.getHtmlElement(); $handledElement.html(internalOptions.dialogText); delete internalOptions.dialogText; return internalOptions; }; // Public methods $.pkp.controllers.modal.<API key>.prototype.modalConfirm = function(dialogElement) { // The default implementation will simply close the modal. this.modalClose(dialogElement); }; /** @param {jQuery} $ jQuery closure. */ })(jQuery);
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- /* IMU driver backend class. Each supported gyro/accel sensor type needs to have an object derived from this class. Note that drivers can implement just gyros or just accels, and can also provide multiple gyro/accel instances. */ #ifndef <API key> #define <API key> class <API key> { public: <API key>(AP_InertialSensor &imu); // we declare a virtual destructor so that drivers can // override with a custom destructor if need be. virtual ~<API key>(void) {} /* * Update the sensor data. Called by the frontend to transfer * accumulated sensor readings to the frontend structure via the * <API key>() and <API key>() functions */ virtual bool update() = 0; /* * return true if at least one accel sample is available in the backend * since the last call to update() */ virtual bool <API key>() = 0; /* * return true if at least one gyro sample is available in the backend * since the last call to update() */ virtual bool <API key>() = 0; /* return the product ID */ int16_t product_id(void) const { return _product_id; } protected: // access to frontend AP_InertialSensor &_imu; // rotate gyro vector and offset void <API key>(uint8_t instance, const Vector3f &gyro); // rotate accel vector, scale and offset void <API key>(uint8_t instance, const Vector3f &accel); // backend should fill in its product ID from AP_PRODUCT_ID_* int16_t _product_id; // return the default filter frequency in Hz for the sample rate uint8_t _default_filter(void) const; // note that each backend is also expected to have a static detect() // function which instantiates an instance of the backend sensor // driver if the sensor is available }; #endif // <API key>
CREATE TABLE IF NOT EXISTS `_DATABASE_NAME_`.CalendarSettings ( `calendarSettingsID` int(10) unsigned NOT NULL AUTO_INCREMENT, `shortName` tinytext NOT NULL, `value` varchar(45) DEFAULT NULL, PRIMARY KEY (`calendarSettingsID`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; DELETE FROM `_DATABASE_NAME_`.CalendarSettings; INSERT INTO `_DATABASE_NAME_`.CalendarSettings VALUES (1,'Days Before Subscription End','730'); INSERT INTO `_DATABASE_NAME_`.CalendarSettings VALUES (2,'Days After Subscription End','90'); INSERT INTO `_DATABASE_NAME_`.CalendarSettings VALUES (3,'Resource Type(s)','1'); INSERT INTO `_DATABASE_NAME_`.CalendarSettings VALUES (4,'Authorized Site(s)','1');
'use strict'; var async = require('async'), nconf = require('nconf'), gravatar = require('gravatar'), plugins = require('./plugins'), db = require('./database'), meta = require('./meta'), topics = require('./topics'), groups = require('./groups'), Password = require('./password'), utils = require('../public/src/utils'); (function(User) { User.email = require('./user/email'); User.notifications = require('./user/notifications'); User.reset = require('./user/reset'); User.digest = require('./user/digest'); require('./user/auth')(User); require('./user/create')(User); require('./user/posts')(User); require('./user/follow')(User); require('./user/profile')(User); require('./user/admin')(User); require('./user/delete')(User); require('./user/settings')(User); require('./user/search')(User); require('./user/jobs')(User); require('./user/picture')(User); User.getUserField = function(uid, field, callback) { User.getUserFields(uid, [field], function(err, user) { callback(err, user ? user[field] : null); }); }; User.getUserFields = function(uid, fields, callback) { User.<API key>([uid], fields, function(err, users) { callback(err, users ? users[0] : null); }); }; User.<API key> = function(uids, fields, callback) { var fieldsToRemove = []; function addField(field) { if (fields.indexOf(field) === -1) { fields.push(field); fieldsToRemove.push(field); } } if (!Array.isArray(uids) || !uids.length) { return callback(null, []); } var keys = uids.map(function(uid) { return 'user:' + uid; }); if (fields.indexOf('uid') === -1) { fields.push('uid'); } if (fields.indexOf('picture') !== -1) { addField('email'); addField('gravatarpicture'); addField('uploadedpicture'); } db.getObjectsFields(keys, fields, function(err, users) { if (err) { return callback(err); } modifyUserData(users, fieldsToRemove, callback); }); }; User.getUserData = function(uid, callback) { User.getUsersData([uid], function(err, users) { callback(err, users ? users[0] : null); }); }; User.getUsersData = function(uids, callback) { if (!Array.isArray(uids) || !uids.length) { return callback(null, []); } var keys = uids.map(function(uid) { return 'user:' + uid; }); db.getObjects(keys, function(err, users) { if (err) { return callback(err); } modifyUserData(users, [], callback); }); }; function modifyUserData(users, fieldsToRemove, callback) { users.forEach(function(user) { if (!user) { return; } if (user.password) { user.password = undefined; } if (!parseInt(user.uid, 10)) { user.uid = 0; user.username = '[[global:guest]]'; user.userslug = ''; user.picture = User.<API key>(''); } if (user.picture) { if (user.picture === user.uploadedpicture) { user.picture = user.uploadedpicture = user.picture.startsWith('http') ? user.picture : nconf.get('relative_path') + user.picture; } else { user.picture = User.<API key>(user.email); } } for(var i=0; i<fieldsToRemove.length; ++i) { user[fieldsToRemove[i]] = undefined; } }); plugins.fireHook('filter:users.get', users, callback); } User.<API key> = function(uid, callback) { callback = callback || function() {}; User.getUserFields(uid, ['status', 'lastonline'], function(err, userData) { var now = Date.now(); if (err || userData.status === 'offline' || now - parseInt(userData.lastonline, 10) < 300000) { return callback(err); } User.setUserField(uid, 'lastonline', now, callback); }); }; User.updateOnlineUsers = function(uid, callback) { callback = callback || function() {}; var now = Date.now(); async.waterfall([ function(next) { db.sortedSetScore('users:online', uid, next); }, function(userOnlineTime, next) { if (now - parseInt(userOnlineTime, 10) < 300000) { return callback(); } db.sortedSetAdd('users:online', now, uid, next); }, function(next) { topics.pushUnreadCount(uid); plugins.fireHook('action:user.online', {uid: uid, timestamp: now}); next(); } ], callback); }; User.setUserField = function(uid, field, value, callback) { callback = callback || function() {}; db.setObjectField('user:' + uid, field, value, function(err) { if (err) { return callback(err); } plugins.fireHook('action:user.set', {uid: uid, field: field, value: value, type: 'set'}); callback(); }); }; User.setUserFields = function(uid, data, callback) { callback = callback || function() {}; db.setObject('user:' + uid, data, function(err) { if (err) { return callback(err); } for (var field in data) { if (data.hasOwnProperty(field)) { plugins.fireHook('action:user.set', {uid: uid, field: field, value: data[field], type: 'set'}); } } callback(); }); }; User.<API key> = function(uid, field, value, callback) { callback = callback || function() {}; db.incrObjectFieldBy('user:' + uid, field, value, function(err, value) { if (err) { return callback(err); } plugins.fireHook('action:user.set', {uid: uid, field: field, value: value, type: 'increment'}); callback(null, value); }); }; User.<API key> = function(uid, field, value, callback) { callback = callback || function() {}; db.incrObjectFieldBy('user:' + uid, field, -value, function(err, value) { if (err) { return callback(err); } plugins.fireHook('action:user.set', {uid: uid, field: field, value: value, type: 'decrement'}); callback(null, value); }); }; User.getUidsFromSet = function(set, start, stop, callback) { if (set === 'users:online') { var count = parseInt(stop, 10) === -1 ? stop : stop - start + 1; var now = Date.now(); db.<API key>(set, start, count, now, now - 300000, callback); } else { db.<API key>(set, start, stop, callback); } }; User.getUsersFromSet = function(set, uid, start, stop, callback) { async.waterfall([ function(next) { User.getUidsFromSet(set, start, stop, next); }, function(uids, next) { User.getUsers(uids, uid, next); } ], callback); }; User.getUsers = function(uids, uid, callback) { var fields = ['uid', 'username', 'userslug', 'picture', 'status', 'banned', 'joindate', 'postcount', 'reputation', 'email:confirmed']; plugins.fireHook('filter:users.addFields', {fields: fields}, function(err, data) { if (err) { return callback(err); } data.fields = data.fields.filter(function(field, index, array) { return array.indexOf(field) === index; }); async.parallel({ userData: function(next) { User.<API key>(uids, data.fields, next); }, isAdmin: function(next) { User.isAdministrator(uids, next); }, isOnline: function(next) { require('./socket.io').isUsersOnline(uids, next); } }, function(err, results) { if (err) { return callback(err); } results.userData.forEach(function(user, index) { if (!user) { return; } user.status = User.getStatus(user.status, results.isOnline[index]); user.joindateISO = utils.toISOString(user.joindate); user.administrator = results.isAdmin[index]; user.banned = parseInt(user.banned, 10) === 1; user['email:confirmed'] = parseInt(user['email:confirmed'], 10) === 1; }); plugins.fireHook('filter:userlist.get', {users: results.userData, uid: uid}, function(err, data) { if (err) { return callback(err); } callback(null, data.users); }); }); }); }; User.getStatus = function(status, isOnline) { return isOnline ? (status || 'online') : 'offline'; }; User.<API key> = function(email) { var <API key> = meta.config.<API key>; if (<API key> && <API key>.indexOf('http') === -1) { <API key> = nconf.get('url') + meta.config.<API key>; } var options = { size: parseInt(meta.config.<API key>, 10) || 128, default: <API key> || meta.config.<API key> || 'identicon', rating: 'pg' }; if (!email) { email = ''; } return gravatar.url(email, options, true); }; User.hashPassword = function(password, callback) { if (!password) { return callback(null, password); } Password.hash(nconf.get('bcrypt_rounds') || 12, password, callback); }; User.addTopicIdToUser = function(uid, tid, timestamp, callback) { async.parallel([ async.apply(db.sortedSetAdd, 'uid:' + uid + ':topics', timestamp, tid), async.apply(User.<API key>, uid, 'topiccount', 1) ], callback); }; User.exists = function(userslug, callback) { User.getUidByUserslug(userslug, function(err, exists) { callback(err, !! exists); }); }; User.getUidByUsername = function(username, callback) { if (!username) { return callback(); } db.sortedSetScore('username:uid', username, callback); }; User.getUidsByUsernames = function(usernames, callback) { db.sortedSetScores('username:uid', usernames, callback); }; User.getUidByUserslug = function(userslug, callback) { if (!userslug) { return callback(); } db.sortedSetScore('userslug:uid', userslug, callback); }; User.getUsernamesByUids = function(uids, callback) { User.<API key>(uids, ['username'], function(err, users) { if (err) { return callback(err); } users = users.map(function(user) { return user.username; }); callback(null, users); }); }; User.<API key> = function(slug, callback) { async.waterfall([ function(next) { User.getUidByUserslug(slug, next); }, function(uid, next) { User.getUserField(uid, 'username', next); } ], callback); }; User.getUidByEmail = function(email, callback) { db.sortedSetScore('email:uid', email.toLowerCase(), callback); }; User.getUsernameByEmail = function(email, callback) { db.sortedSetScore('email:uid', email.toLowerCase(), function(err, uid) { if (err) { return callback(err); } User.getUserField(uid, 'username', callback); }); }; User.isModerator = function(uid, cid, callback) { function filterIsModerator(err, isModerator) { if (err) { return callback(err); } plugins.fireHook('filter:user.isModerator', {uid: uid, cid:cid, isModerator: isModerator}, function(err, data) { if (Array.isArray(uid) && !Array.isArray(data.isModerator) || Array.isArray(cid) && !Array.isArray(data.isModerator)) { return callback(new Error('filter:user.isModerator - i/o mismatch')); } callback(err, data.isModerator); }); } if (Array.isArray(cid)) { if (!parseInt(uid, 10)) { return filterIsModerator(null, cid.map(function() {return false;})); } var uniqueCids = cid.filter(function(cid, index, array) { return array.indexOf(cid) === index; }); var groupNames = uniqueCids.map(function(cid) { return 'cid:' + cid + ':privileges:mods'; // At some point we should *probably* change this to "moderate" as well }), groupListNames = uniqueCids.map(function(cid) { return 'cid:' + cid + ':privileges:groups:moderate'; }); async.parallel({ user: async.apply(groups.isMemberOfGroups, uid, groupNames), group: async.apply(groups.<API key>, uid, groupListNames) }, function(err, checks) { if (err) { return callback(err); } var isMembers = checks.user.map(function(isMember, idx) { return isMember || checks.group[idx]; }), map = {}; uniqueCids.forEach(function(cid, index) { map[cid] = isMembers[index]; }); filterIsModerator(null, cid.map(function(cid) { return map[cid]; })); }); } else { if (Array.isArray(uid)) { async.parallel([ async.apply(groups.isMembers, uid, 'cid:' + cid + ':privileges:mods'), async.apply(groups.<API key>, uid, 'cid:' + cid + ':privileges:groups:moderate') ], function(err, checks) { var isModerator = checks[0].map(function(isMember, idx) { return isMember || checks[1][idx]; }); filterIsModerator(null, isModerator); }); } else { async.parallel([ async.apply(groups.isMember, uid, 'cid:' + cid + ':privileges:mods'), async.apply(groups.isMemberOfGroupList, uid, 'cid:' + cid + ':privileges:groups:moderate') ], function(err, checks) { var isModerator = checks[0] || checks[1]; filterIsModerator(null, isModerator); }); } } }; User.isAdministrator = function(uid, callback) { if (Array.isArray(uid)) { groups.isMembers(uid, 'administrators', callback); } else { groups.isMember(uid, 'administrators', callback); } }; User.<API key> = function(uid, callback) { db.getSortedSetRange('uid:' + uid + ':ignored:cids', 0, -1, callback); }; User.<API key> = function(uid, callback) { async.parallel({ ignored: function(next) { User.<API key>(uid, next); }, all: function(next) { db.getSortedSetRange('categories:cid', 0, -1, next); } }, function(err, results) { if (err) { return callback(err); } var watched = results.all.filter(function(cid) { return cid && results.ignored.indexOf(cid) === -1; }); callback(null, watched); }); }; User.ignoreCategory = function(uid, cid, callback) { if (!uid) { return callback(); } db.sortedSetAdd('uid:' + uid + ':ignored:cids', Date.now(), cid, callback); }; User.watchCategory = function(uid, cid, callback) { if (!uid) { return callback(); } db.sortedSetRemove('uid:' + uid + ':ignored:cids', cid, callback); }; }(exports));
#include "../Mod/ArticleDefinition.h" #include "../Mod/Mod.h" #include "../Mod/RuleUfo.h" #include "ArticleStateTFTD.h" #include "ArticleStateTFTDUso.h" #include "../Engine/Game.h" #include "../Engine/Palette.h" #include "../Engine/LocalizedText.h" #include "../Interface/TextList.h" namespace OpenXcom { ArticleStateTFTDUso::ArticleStateTFTDUso(<API key> *defs) : ArticleStateTFTD(defs) { RuleUfo *ufo = _game->getMod()->getUfo(defs->id); _lstInfo = new TextList(150, 50, 168, 142); add(_lstInfo); _lstInfo->setColor(Palette::blockOffset(0)+2); _lstInfo->setColumns(2, 100, 50); _lstInfo->setDot(true); _lstInfo->addRow(2, tr("STR_DAMAGE_CAPACITY").c_str(), Text::formatNumber(ufo->getMaxDamage()).c_str()); _lstInfo->addRow(2, tr("STR_WEAPON_POWER").c_str(), Text::formatNumber(ufo->getWeaponPower()).c_str()); _lstInfo->addRow(2, tr("STR_WEAPON_RANGE").c_str(), tr("STR_KILOMETERS").arg(ufo->getWeaponRange()).c_str()); _lstInfo->addRow(2, tr("STR_MAXIMUM_SPEED").c_str(), tr("STR_KNOTS").arg(Text::formatNumber(ufo->getMaxSpeed())).c_str()); for (int i = 0; i != 4; ++i) { _lstInfo->setCellColor(i, 1, Palette::blockOffset(15)+4); } centerAllSurfaces(); } ArticleStateTFTDUso::~ArticleStateTFTDUso() {} }
#ifndef <API key> #define <API key> #include "FLAC/format.h" unsigned <API key>(unsigned blocksize, unsigned predictor_order); unsigned <API key>(unsigned blocksize); unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order); void <API key>(<API key> *object); void <API key>(<API key> *object); FLAC__bool <API key>(<API key> *object, unsigned max_partition_order); #endif
# <API key>: true module RuboCop module Cop module Layout # This cop checks whether the end statement of a do..end block # is on its own line. # @example # # bad # blah do |i| # foo(i) end # # good # blah do |i| # foo(i) # end # # bad # blah { |i| # foo(i) } # # good # blah { |i| # foo(i) class BlockEndNewline < Cop include Alignment MSG = 'Expression at %<line>d, %<column>d should be on its own line.' def on_block(node) return if node.single_line? # If the end is on its own line, there is no offense return if begins_its_line?(node.loc.end) add_offense(node, location: :end) end def autocorrect(node) lambda do |corrector| corrector.replace(delimiter_range(node), "\n#{node.loc.end.source}#{offset(node)}") end end private def message(node) format(MSG, line: node.loc.end.line, column: node.loc.end.column + 1) end def delimiter_range(node) Parser::Source::Range.new( node.loc.expression.source_buffer, node.children.compact.last.loc.expression.end_pos, node.loc.expression.end_pos ) end end end end end
// Collect the Fire Sprite's Fomor Scrolls // Scroll collection quest, purchasable from shops. public class <API key> : QuestScript { public override void Load() { SetId(71065); SetScrollId(70138); SetName(L("Collect the Fire Sprite's Fomor Scrolls")); SetDescription(L("The evil Fomors are controlling various creatures in the neighborhood. Retrieve Fomor Scrolls from these animals in order to free them from the reign of these evil spirits. You will be rewarded for collecting [10 Fire Sprite Fomor Scrolls].")); SetType(QuestType.Collect); SetCancelable(true); SetIcon(QuestIcon.Collect); if (IsEnabled("QuestViewRenewal")) SetCategory(QuestCategory.Repeat); AddObjective("collect", L("Collect 10 Fire Sprite Fomor Scrolls"), 0, 0, 0, Collect(71065, 10)); AddReward(Gold(3500)); } }
/** @file SgArray.h Static array. */ #ifndef SG_ARRAY_H #define SG_ARRAY_H #include <algorithm> #include <cstring> template<typename T, int SIZE> class SgArray; /** Helper class to allow partial specialization of SgArray::operator=. Partial member function specialization is not yet supported by standard C++. */ template<typename T, int SIZE> class SgArrayAssign { public: static void Assign(T* dest, const T* src); }; template<int SIZE> class SgArrayAssign<int,SIZE> { public: static void Assign(int* dest, const int* src); }; template<int SIZE> class SgArrayAssign<bool,SIZE> { public: static void Assign(bool* dest, const bool* src); }; template<typename T,int SIZE> class SgArrayAssign<T*,SIZE> { public: static void Assign(T** dest, T* const * src); }; template<typename T, int SIZE> void SgArrayAssign<T,SIZE>::Assign(T* dest, const T* src) { SG_ASSERT(dest != src); // self-assignment not supported for efficiency T* p = dest; const T* pp = src; for (int i = SIZE; i--; ++p, ++pp) *p = *pp; } template<int SIZE> void SgArrayAssign<int,SIZE>::Assign(int* dest, const int* src) { SG_ASSERT(dest != src); // self-assignment not supported for efficiency std::memcpy(dest, src, SIZE * sizeof(int)); } template<int SIZE> void SgArrayAssign<bool,SIZE>::Assign(bool* dest, const bool* src) { SG_ASSERT(dest != src); // self-assignment not supported for efficiency std::memcpy(dest, src, SIZE * sizeof(bool)); } template<typename T, int SIZE> void SgArrayAssign<T*,SIZE>::Assign(T** dest, T* const * src) { SG_ASSERT(dest != src); // self-assignment not supported for efficiency std::memcpy(dest, src, SIZE * sizeof(T*)); } /** Static array. Wrapper class around a C style array. Uses assertions for indices in range in debug mode. @deprecated Use boost::array instead */ template<typename T, int SIZE> class SgArray { public: /** Local const iterator */ class Iterator { public: Iterator(const SgArray& array); const T& operator*() const; void operator++(); operator bool() const; private: const T* m_end; const T* m_current; }; /** Local non-const iterator */ class NonConstIterator { public: NonConstIterator(SgArray& array); T& operator*() const; void operator++(); operator bool() const; private: const T* m_end; T* m_current; }; SgArray(); SgArray(const SgArray& array); explicit SgArray(const T& val); SgArray& operator=(const SgArray& array); T& operator[](int index); const T& operator[](int index) const; SgArray& operator*=(T val); void Fill(const T& val); /** Elements must be comparable */ T MinValue() const; /** Elements must be comparable */ T MaxValue() const; private: friend class Iterator; friend class NonConstIterator; T m_array[SIZE]; }; template<typename T, int SIZE> SgArray<T,SIZE>::Iterator::Iterator(const SgArray& array) : m_end(array.m_array + SIZE), m_current(array.m_array) { } template<typename T, int SIZE> const T& SgArray<T,SIZE>::Iterator::operator*() const { SG_ASSERT(*this); return *m_current; } template<typename T, int SIZE> void SgArray<T,SIZE>::Iterator::operator++() { ++m_current; } template<typename T, int SIZE> SgArray<T,SIZE>::Iterator::operator bool() const { return m_current < m_end; } template<typename T, int SIZE> SgArray<T,SIZE>::NonConstIterator::NonConstIterator(SgArray& array) : m_end(array.m_array + SIZE), m_current(array.m_array) { } template<typename T, int SIZE> T& SgArray<T,SIZE>::NonConstIterator::operator*() const { SG_ASSERT(*this); return *m_current; } template<typename T, int SIZE> void SgArray<T,SIZE>::NonConstIterator::operator++() { ++m_current; } template<typename T, int SIZE> SgArray<T,SIZE>::NonConstIterator::operator bool() const { return m_current < m_end; } template<typename T, int SIZE> SgArray<T,SIZE>::SgArray() { } template<typename T, int SIZE> SgArray<T,SIZE>::SgArray(const SgArray& array) { SG_ASSERT(&array != this); // self-assignment not supported for efficiency *this = array; } template<typename T, int SIZE> SgArray<T,SIZE>::SgArray(const T& val) { Fill(val); } template<typename T, int SIZE> SgArray<T,SIZE>& SgArray<T,SIZE>::operator=(const SgArray& array) { SG_ASSERT(&array != this); // self-assignment not supported for efficiency SgArrayAssign<T,SIZE>::Assign(m_array, array.m_array); return *this; } template<typename T, int SIZE> T& SgArray<T,SIZE>::operator[](int index) { SG_ASSERT(index >= 0); SG_ASSERT(index < SIZE); return m_array[index]; } template<typename T, int SIZE> const T& SgArray<T,SIZE>::operator[](int index) const { SG_ASSERT(index >= 0); SG_ASSERT(index < SIZE); return m_array[index]; } template<typename T, int SIZE> SgArray<T,SIZE>& SgArray<T,SIZE>::operator*=(T val) { T* p = m_array; for (int i = SIZE; i *p *= val; return *this; } template<typename T, int SIZE> void SgArray<T,SIZE>::Fill(const T& val) { T* v = m_array; for (int i = SIZE; i *v = val; } template<typename T, int SIZE> T SgArray<T,SIZE>::MaxValue() const { return *std::max_element(m_array, m_array + SIZE); } template<typename T, int SIZE> T SgArray<T,SIZE>::MinValue() const { return *std::min_element(m_array, m_array + SIZE); } #endif // SG_ARRAY_H
#ifndef <API key> #define <API key> #include "base/macros.h" #include "device/generic_sensor/<API key>.h" #include "device/generic_sensor/public/interfaces/sensor_provider.mojom.h" namespace device { class <API key>; class PlatformSensor; // Implementation of SensorProvider mojo interface. // Uses <API key> singleton to create platform specific instances // of PlatformSensor which are used by SensorImpl. class <API key> SensorProviderImpl final : public mojom::SensorProvider { public: static void Create( scoped_refptr<base::<API key>> file_task_runner, mojom::<API key> request); ~SensorProviderImpl() override; private: explicit SensorProviderImpl(<API key>* provider); // SensorProvider implementation. void GetSensor(mojom::SensorType type, mojom::SensorRequest sensor_request, const GetSensorCallback& callback) override; // Helper callback method to return created sensors. void SensorCreated(mojom::SensorType type, mojo::<API key> cloned_handle, mojom::SensorRequest sensor_request, const GetSensorCallback& callback, scoped_refptr<PlatformSensor> sensor); <API key>* provider_; base::WeakPtrFactory<SensorProviderImpl> weak_ptr_factory_; <API key>(SensorProviderImpl); }; } // namespace device #endif // <API key>
#ifndef <API key> #define <API key> #include <QObject> #include <QString> #include <QHash> #include "qtorrenthandle.h" #include <libtorrent/alert_types.hpp> class QBtSession; class SpeedSample; class TorrentSpeedMonitor : public QObject { Q_OBJECT Q_DISABLE_COPY(TorrentSpeedMonitor) public: explicit TorrentSpeedMonitor(QBtSession* session); ~TorrentSpeedMonitor(); qlonglong getETA(const QString &hash, const libtorrent::torrent_status &status) const; private slots: void statsReceived(const libtorrent::stats_alert& stats); void removeSamples(const QTorrentHandle& h); private: QHash<QString, SpeedSample> m_samples; QBtSession *m_session; }; #endif // <API key>
<!DOCTYPE html> <!-- DO NOT EDIT! Generated by referrer-policy/generic/tools/generate.py using referrer-policy/generic/template/test.release.html.template. --> <html> <head> <title>Referrer-Policy: Referrer Policy is set to '<API key>'</title> <meta name="description" content="Check that cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL."> <meta name="referrer" content="<API key>"> <link rel="author" title="Kristijan Burnik" href="burnik@chromium.org"> <link rel="help" href="https://w3c.github.io/<API key>/#<API key>"> <meta name="assert" content="The referrer URL is origin when a document served over http requires an https sub-resource via img-tag using the meta-referrer delivery method with <API key> and when the target request is cross-origin."> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/security-features/resources/common.js"></script> <script src="/referrer-policy/generic/<API key>.js?pipe=sub"></script> </head> <body> <script> <API key>( { "referrer_policy": "<API key>", "delivery_method": "meta-referrer", "redirection": "<API key>", "origin": "cross-origin", "source_protocol": "http", "target_protocol": "https", "subresource": "img-tag", "referrer_url": "origin" }, document.querySelector("meta[name=assert]").content, new SanityChecker() ).start(); </script> <div id="log"></div> </body> </html>
(function (module) { mifosX.controllers = _.extend(module, { <API key>: function (scope, resourceFactory, routeParams, location, dateFilter) { scope.charges = []; scope.formData = {}; scope.isCollapsed = true; scope.loanId = routeParams.id; resourceFactory.<API key>.get({loanId: scope.loanId}, function (data) { scope.charges = data.chargeOptions; }); scope.selectCharge = function(chargeId){ for(var i in scope.charges){ if(scope.charges[i].id == chargeId){ scope.isCollapsed = false; scope.chargeData = scope.charges[i]; scope.formData.amount = scope.charges[i].amount; } } }; scope.cancel = function () { location.path('/viewloanaccount/' + scope.loanId); }; scope.submit = function () { this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; if (this.formData.dueDate) { this.formData.dueDate = dateFilter(this.formData.dueDate, scope.df); } ; resourceFactory.loanResource.save({resourceType: 'charges', loanId: scope.loanId}, this.formData, function (data) { location.path('/viewloanaccount/' + data.loanId); }); }; } }); mifosX.ng.application.controller('<API key>', ['$scope', 'ResourceFactory', '$routeParams', '$location', 'dateFilter', mifosX.controllers.<API key>]).run(function ($log) { $log.info("<API key> initialized"); }); }(mifosX.controllers || {}));
#![deny(unsafe_code)] use app_units::Au; use block::<API key>; use context::LayoutContext; use <API key>::{<API key>, <API key>}; use euclid::{Point2D, Rect, Size2D}; use floats::{FloatKind, Floats, PlacementInfo}; use flow::{<API key>, MutableFlowUtils, OpaqueFlow}; use flow::{self, BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, <API key>}; use flow_ref; use fragment::{CoordinateSystem, Fragment, <API key>, <API key>}; use gfx::display_list::OpaqueNode; use gfx::font::FontMetrics; use gfx::font_context::FontContext; use incremental::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, <API key>}; use layout_debug; use model::<API key>; use std::cmp::max; use std::collections::VecDeque; use std::sync::Arc; use std::{fmt, isize, mem}; use style::computed_values::{display, overflow_x, position, text_align, text_justify}; use style::computed_values::{text_overflow, vertical_align, white_space}; use style::properties::ComputedValues; use style::values::computed::LengthOrPercentage; use text; use unicode_bidi; use util; use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; use util::print_tree::PrintTree; use util::range::{Range, RangeIndex}; use wrapper::PseudoElementType; // From gfxFontConstants.h in Firefox static <API key>: f32 = 0.20; static <API key>: f32 = 0.34; `Line`s are represented as offsets into the child list, rather than as an object that "owns" fragments. Choosing a different set of line breaks requires a new list of offsets, and possibly some splitting and merging of TextFragments. A similar list will keep track of the mapping between CSS fragments and the corresponding fragments in the inline flow. After line breaks are determined, render fragments in the inline flow may overlap visually. For example, in the case of nested inline CSS fragments, outer inlines must be at least as large as the inner inlines, for purposes of drawing noninherited things like backgrounds, borders, outlines. N.B. roc has an alternative design where the list instead consists of things like "start outer fragment, text, start inner fragment, text, end inner fragment, text, end outer fragment, text". This seems a little complicated to serve as the starting point, but the current design doesn't make it hard to try out that alternative. Line fragments also contain some metadata used during line breaking. The green zone is the area that the line can expand to before it collides with a float or a horizontal wall of the containing block. The block-start inline-start corner of the green zone is the same as that of the line, but the green zone can be taller and wider than the line itself. #[derive(RustcEncodable, Debug, Clone)] pub struct Line { A range of line indices that describe line breaks. For example, consider the following HTML and rendered element with linebreaks: ~~~html <span>I <span>like truffles, <img></span> yes I do.</span> ~~~ ~~~text + | I like | | truffles, | | + | | | | | +----+ yes | | I do. | + ~~~ The ranges that describe these lines would be: | [0, 2) | [2, 3) | [3, 5) | [5, 6) | | | 'I like' | 'truffles,' | '<img> yes' | 'I do.' | pub range: Range<FragmentIndex>, The bidirectional embedding level runs for this line, in visual order. Can be set to `None` if the line is 100% left-to-right. pub visual_runs: Option<Vec<(Range<FragmentIndex>, u8)>>, The bounds are the exact position and extents of the line with respect to the parent box. For example, for the HTML below... ~~~html <div><span>I <span>like truffles, <img></span></div> ~~~ ...the bounds would be: ~~~text + | ^ | | | | | origin.y | | | | | v | |< - origin.x ->+ - - - - - - - - + | | | | ^ | | | | <img> | size.block | | I like truffles, | | v | | + - - - - - - - - + | | | | | |< | | | | + ~~~ pub bounds: LogicalRect<Au>, The green zone is the greatest extent from which a line can extend to before it collides with a float. ~~~text + |::::::::::::::::: | |:::::::::::::::::FFFFFF| |============:::::FFFFFF| |:::::::::::::::::FFFFFF| |:::::::::::::::::FFFFFF| |::::::::::::::::: | | FFFFFFFFF | | FFFFFFFFF | | FFFFFFFFF | | | + === line ::: green zone FFF float ~~~ pub green_zone: LogicalSize<Au>, The inline metrics for this line. pub inline_metrics: InlineMetrics, } impl Line { fn new(writing_mode: WritingMode, <API key>: Au, <API key>: Au) -> Line { Line { range: Range::empty(), visual_runs: None, bounds: LogicalRect::zero(writing_mode), green_zone: LogicalSize::zero(writing_mode), inline_metrics: InlineMetrics::new(<API key>, <API key>, <API key>), } } } int_range_index! { #[derive(RustcEncodable)] #[doc = "The index of a fragment in a flattened vector of DOM elements."] struct FragmentIndex(isize) } Arranges fragments into lines, splitting them up as necessary. struct LineBreaker { The floats we need to flow around. floats: Floats, The resulting fragment list for the flow, consisting of possibly-broken fragments. new_fragments: Vec<Fragment>, The next fragment or fragments that we need to work on. work_list: VecDeque<Fragment>, The line we're currently working on. pending_line: Line, The lines we've already committed. lines: Vec<Line>, The index of the last known good line breaking opportunity. The opportunity will either be inside this fragment (if it is splittable) or immediately prior to it. <API key>: Option<FragmentIndex>, The current position in the block direction. cur_b: Au, The computed value of the indentation for the first line (`text-indent`, CSS 2.1 § 16.1). <API key>: Au, The minimum block-size above the baseline for each line, as specified by the line height and font style. <API key>: Au, The minimum depth below the baseline for each line, as specified by the line height and font style. <API key>: Au, } impl LineBreaker { Creates a new `LineBreaker` with a set of floats and the indentation of the first line. fn new(float_context: Floats, <API key>: Au, <API key>: Au, <API key>: Au) -> LineBreaker { LineBreaker { new_fragments: Vec::new(), work_list: VecDeque::new(), pending_line: Line::new(float_context.writing_mode, <API key>, <API key>), floats: float_context, lines: Vec::new(), cur_b: Au(0), <API key>: None, <API key>: <API key>, <API key>: <API key>, <API key>: <API key>, } } Resets the `LineBreaker` to the initial state it had after a call to `new`. fn reset_scanner(&mut self) { self.lines = Vec::new(); self.new_fragments = Vec::new(); self.cur_b = Au(0); self.reset_line(); } Reinitializes the pending line to blank data. fn reset_line(&mut self) -> Line { self.<API key> = None; mem::replace(&mut self.pending_line, Line::new(self.floats.writing_mode, self.<API key>, self.<API key>)) } Reflows fragments for the given inline flow. fn scan_for_lines(&mut self, flow: &mut InlineFlow, layout_context: &LayoutContext) { self.reset_scanner(); // Create our fragment iterator. debug!("LineBreaker: scanning for lines, {} fragments", flow.fragments.len()); let mut old_fragments = mem::replace(&mut flow.fragments, InlineFragments::new()); let old_fragment_iter = old_fragments.fragments.into_iter(); // TODO(pcwalton): This would likely be better as a list of dirty line indices. That way we // could resynchronize if we discover during reflow that all subsequent fragments must have // the same position as they had in the previous reflow. I don't know how common this case // really is in practice, but it's probably worth handling. self.lines = Vec::new(); // Do the reflow. self.reflow_fragments(old_fragment_iter, flow, layout_context); // Perform unicode bidirectional layout. let para_level = flow.base.writing_mode.to_bidi_level(); // The text within a fragment is at a single bidi embedding level (because we split // fragments on level run boundaries during flow construction), so we can build a level // array with just one entry per fragment. let levels: Vec<u8> = self.new_fragments.iter().map(|fragment| match fragment.specific { <API key>::ScannedText(ref info) => info.run.bidi_level, _ => para_level }).collect(); let mut lines = mem::replace(&mut self.lines, Vec::new()); // If everything is LTR, don't bother with reordering. let has_rtl = levels.iter().cloned().any(unicode_bidi::is_rtl); if has_rtl { // Compute and store the visual ordering of the fragments within the line. for line in &mut lines { let range = line.range.begin().to_usize()..line.range.end().to_usize(); let runs = unicode_bidi::visual_runs(range, &levels); line.visual_runs = Some(runs.iter().map(|run| { let start = FragmentIndex(run.start as isize); let len = FragmentIndex(run.len() as isize); (Range::new(start, len), levels[run.start]) }).collect()); } } // Place the fragments back into the flow. old_fragments.fragments = mem::replace(&mut self.new_fragments, vec![]); flow.fragments = old_fragments; flow.lines = lines; } Reflows the given fragments, which have been plucked out of the inline flow. fn reflow_fragments<'a, I>(&mut self, mut old_fragment_iter: I, flow: &'a InlineFlow, layout_context: &LayoutContext) where I: Iterator<Item=Fragment> { loop { // Acquire the next fragment to lay out from the work list or fragment list, as // appropriate. let fragment = match self.<API key>(&mut old_fragment_iter) { None => break, Some(fragment) => fragment, }; // Try to append the fragment. self.reflow_fragment(fragment, flow, layout_context); } if !self.<API key>() { debug!("LineBreaker: partially full line {} at end of scanning; committing it", self.lines.len()); self.flush_current_line() } } Acquires a new fragment to lay out from the work list or fragment list as appropriate. Note that you probably don't want to call this method directly in order to be incremental- reflow-safe; try `<API key>` instead. fn next_fragment<I>(&mut self, old_fragment_iter: &mut I) -> Option<Fragment> where I: Iterator<Item=Fragment> { self.work_list.pop_front().or_else(|| old_fragment_iter.next()) } Acquires a new fragment to lay out from the work list or fragment list, merging it with any subsequent fragments as appropriate. In effect, what this method does is to return the next fragment to lay out, undoing line break operations that any previous reflows may have performed. You probably want to be using this method instead of `next_fragment`. fn <API key><I>(&mut self, old_fragment_iter: &mut I) -> Option<Fragment> where I: Iterator<Item=Fragment> { let mut result = match self.next_fragment(old_fragment_iter) { None => return None, Some(fragment) => fragment, }; loop { let candidate = match self.next_fragment(old_fragment_iter) { None => return Some(result), Some(fragment) => fragment, }; let need_to_merge = match (&mut result.specific, &candidate.specific) { (&mut <API key>::ScannedText(ref mut result_info), &<API key>::ScannedText(ref candidate_info)) => { util::arc_ptr_eq(&result_info.run, &candidate_info.run) && <API key>(&result.inline_context, &candidate.inline_context) } _ => false, }; if need_to_merge { result.merge_with(candidate); continue } self.work_list.push_front(candidate); return Some(result) } } Commits a line to the list. fn flush_current_line(&mut self) { debug!("LineBreaker: flushing line {}: {:?}", self.lines.len(), self.pending_line); self.<API key>(); self.lines.push(self.pending_line.clone()); self.cur_b = self.pending_line.bounds.start.b + self.pending_line.bounds.size.block; self.reset_line(); } Removes trailing whitespace from the pending line if necessary. This is done right before flushing it. fn <API key>(&mut self) { if self.pending_line.range.is_empty() { return } let last_fragment_index = self.pending_line.range.end() - FragmentIndex(1); let mut fragment = &mut self.new_fragments[last_fragment_index.get() as usize]; let mut <API key> = None; if let <API key>::ScannedText(_) = fragment.specific { <API key> = Some(fragment.border_box.size.inline + fragment.margin.inline_start_end()); } fragment.<API key>(); if let <API key>::ScannedText(ref mut <API key>) = fragment.specific { let <API key> = &mut **<API key>; let range = &mut <API key>.range; <API key>.content_size.inline = <API key>.run.metrics_for_range(range).advance_width; fragment.border_box.size.inline = <API key>.content_size.inline + fragment.border_padding.inline_start_end(); self.pending_line.bounds.size.inline = self.pending_line.bounds.size.inline - (<API key>.unwrap() - (fragment.border_box.size.inline + fragment.margin.inline_start_end())); } } // FIXME(eatkinson): this assumes that the tallest fragment in the line determines the line // block-size. This might not be the case with some weird text fonts. fn <API key>(&self, new_fragment: &Fragment, layout_context: &LayoutContext) -> InlineMetrics { self.pending_line.inline_metrics.max(&new_fragment.inline_metrics(layout_context)) } fn <API key>(&self, new_fragment: &Fragment, layout_context: &LayoutContext) -> Au { max(self.pending_line.bounds.size.block, self.<API key>(new_fragment, layout_context).block_size()) } Computes the position of a line that has only the provided fragment. Returns the bounding rect of the line's green zone (whose origin coincides with the line's origin) and the actual inline-size of the first fragment after splitting. fn <API key>(&self, flow: &InlineFlow, first_fragment: &Fragment, ceiling: Au) -> (LogicalRect<Au>, Au) { debug!("LineBreaker: trying to place first fragment of line {}; fragment size: {:?}, \ splittable: {}", self.lines.len(), first_fragment.border_box.size, first_fragment.can_split()); // Initially, pretend a splittable fragment has zero inline-size. We will move it later if // it has nonzero inline-size and that causes problems. let <API key> = if first_fragment.can_split() { Au(0) } else { first_fragment.<API key>() + self.<API key>() }; // Try to place the fragment between floats. let line_bounds = self.floats.<API key>(&PlacementInfo { size: LogicalSize::new(self.floats.writing_mode, <API key>, first_fragment.border_box.size.block), ceiling: ceiling, max_inline_size: flow.base.position.size.inline, kind: FloatKind::Left, }); // Simple case: if the fragment fits, then we can stop here. if line_bounds.size.inline > first_fragment.<API key>() { debug!("LineBreaker: fragment fits on line {}", self.lines.len()); return (line_bounds, first_fragment.<API key>()); } // If not, but we can't split the fragment, then we'll place the line here and it will // overflow. if !first_fragment.can_split() { debug!("LineBreaker: line doesn't fit, but is unsplittable"); } (line_bounds, first_fragment.<API key>()) } Performs float collision avoidance. This is called when adding a fragment is going to increase the block-size, and because of that we will collide with some floats. We have two options here: 1) Move the entire line so that it doesn't collide any more. 2) Break the line and put the new fragment on the next line. The problem with option 1 is that we might move the line and then wind up breaking anyway, which violates the standard. But option 2 is going to look weird sometimes. So we'll try to move the line whenever we can, but break if we have to. Returns false if and only if we should break the line. fn avoid_floats(&mut self, flow: &InlineFlow, in_fragment: Fragment, new_block_size: Au) -> bool { debug!("LineBreaker: entering float collision avoider!"); // First predict where the next line is going to be. let (next_line, <API key>) = self.<API key>(flow, &in_fragment, self.pending_line.bounds.start.b); let next_green_zone = next_line.size; let new_inline_size = self.pending_line.bounds.size.inline + <API key>; // Now, see if everything can fit at the new location. if next_green_zone.inline >= new_inline_size && next_green_zone.block >= new_block_size { debug!("LineBreaker: case=adding fragment collides vertically with floats: moving \ line"); self.pending_line.bounds.start = next_line.start; self.pending_line.green_zone = next_green_zone; debug_assert!(!self.<API key>(), "Non-terminating line breaking"); self.work_list.push_front(in_fragment); return true } debug!("LineBreaker: case=adding fragment collides vertically with floats: breaking line"); self.work_list.push_front(in_fragment); false } Tries to append the given fragment to the line, splitting it if necessary. Commits the current line if needed. fn reflow_fragment(&mut self, mut fragment: Fragment, flow: &InlineFlow, layout_context: &LayoutContext) { // Determine initial placement for the fragment if we need to. let <API key> = if self.<API key>() { fragment.<API key>(); let (line_bounds, _) = self.<API key>(flow, &fragment, self.cur_b); self.pending_line.bounds.start = line_bounds.start; self.pending_line.green_zone = line_bounds.size; false } else { fragment.white_space().allow_wrap() }; debug!("LineBreaker: trying to append to line {} (fragment size: {:?}, green zone: {:?}): \ {:?}", self.lines.len(), fragment.border_box.size, self.pending_line.green_zone, fragment); // NB: At this point, if `green_zone.inline < self.pending_line.bounds.size.inline` or // `green_zone.block < self.pending_line.bounds.size.block`, then we committed a line that // overlaps with floats. let green_zone = self.pending_line.green_zone; let new_block_size = self.<API key>(&fragment, layout_context); if new_block_size > green_zone.block { // Uh-oh. Float collision imminent. Enter the float collision avoider! if !self.avoid_floats(flow, fragment, new_block_size) { self.flush_current_line(); } return } // Record the last known good line break opportunity if this is one. if <API key> { self.<API key> = Some(self.pending_line.range.end()) } // If we must flush the line after finishing this fragment due to `white-space: pre`, // detect that. let line_flush_mode = if fragment.white_space().preserve_newlines() { if fragment.<API key>() { LineFlushMode::Flush } else { LineFlushMode::No } } else { LineFlushMode::No }; // If we're not going to overflow the green zone vertically, we might still do so // horizontally. We'll try to place the whole fragment on this line and break somewhere if // it doesn't fit. let indentation = self.<API key>(); let new_inline_size = self.pending_line.bounds.size.inline + fragment.<API key>() + indentation; if new_inline_size <= green_zone.inline { debug!("LineBreaker: fragment fits without splitting"); self.<API key>(layout_context, fragment, line_flush_mode); return } // If the wrapping mode prevents us from splitting, then back up and split at the last // known good split point. if !fragment.white_space().allow_wrap() { debug!("LineBreaker: fragment can't split; falling back to last known good split point"); if !self.<API key>() { // No line breaking opportunity exists at all for this line. Overflow. self.<API key>(layout_context, fragment, line_flush_mode); } else { self.work_list.push_front(fragment); } return; } // Split it up! let <API key> = green_zone.inline - self.pending_line.bounds.size.inline - indentation; let <API key>; let inline_end_fragment; let split_result = match fragment.<API key>(<API key>, self.<API key>()) { None => { // We failed to split. Defer to the next line if we're allowed to; otherwise, // rewind to the last line breaking opportunity. if <API key> { debug!("LineBreaker: fragment was unsplittable; deferring to next line"); self.work_list.push_front(fragment); self.flush_current_line(); } else if self.<API key>() { // We split the line at a known-good prior position. Restart with the current // fragment. self.work_list.push_front(fragment) } else { // We failed to split and there is no known-good place on this line to split. // Overflow. self.<API key>(layout_context, fragment, LineFlushMode::No) } return } Some(split_result) => split_result, }; <API key> = split_result.inline_start.as_ref().map(|x| { fragment.<API key>(x, split_result.text_run.clone()) }); inline_end_fragment = split_result.inline_end.as_ref().map(|x| { fragment.<API key>(x, split_result.text_run.clone()) }); // Push the first fragment onto the line we're working on and start off the next line with // the second fragment. If there's no second fragment, the next line will start off empty. match (<API key>, inline_end_fragment) { (Some(<API key>), Some(inline_end_fragment)) => { self.<API key>(layout_context, <API key>, LineFlushMode::Flush); self.work_list.push_front(inline_end_fragment) }, (Some(fragment), None) => { self.<API key>(layout_context, fragment, line_flush_mode); } (None, Some(fragment)) => { // Yes, this can happen! self.flush_current_line(); self.work_list.push_front(fragment) } (None, None) => {} } } Pushes a fragment to the current line unconditionally, possibly truncating it and placing an ellipsis based on the value of `text-overflow`. If `flush_line` is `Flush`, then flushes the line afterward; fn <API key>(&mut self, layout_context: &LayoutContext, fragment: Fragment, line_flush_mode: LineFlushMode) { let indentation = self.<API key>(); if self.<API key>() { debug_assert!(self.new_fragments.len() <= (isize::MAX as usize)); self.pending_line.range.reset(FragmentIndex(self.new_fragments.len() as isize), FragmentIndex(0)); } // Determine if an ellipsis will be necessary to account for `text-overflow`. let mut need_ellipsis = false; let <API key> = self.pending_line.green_zone.inline - self.pending_line.bounds.size.inline - indentation; match (fragment.style().get_inheritedtext().text_overflow, fragment.style().get_box().overflow_x) { (text_overflow::T::clip, _) | (_, overflow_x::T::visible) => {} (text_overflow::T::ellipsis, _) => { need_ellipsis = fragment.<API key>() > <API key>; } } if !need_ellipsis { self.<API key>(fragment, layout_context); } else { let ellipsis = fragment.<API key>(layout_context); if let Some(truncation_info) = fragment.<API key>(<API key> - ellipsis.<API key>()) { let fragment = fragment.<API key>(&truncation_info.split, truncation_info.text_run); self.<API key>(fragment, layout_context); } self.<API key>(ellipsis, layout_context); } if line_flush_mode == LineFlushMode::Flush { self.flush_current_line() } } Pushes a fragment to the current line unconditionally, without placing an ellipsis in the case of `text-overflow: ellipsis`. fn <API key>(&mut self, fragment: Fragment, layout_context: &LayoutContext) { let indentation = self.<API key>(); self.pending_line.range.extend_by(FragmentIndex(1)); if !fragment.is_inline_absolute() { self.pending_line.bounds.size.inline = self.pending_line.bounds.size.inline + fragment.<API key>() + indentation; self.pending_line.inline_metrics = self.<API key>(&fragment, layout_context); self.pending_line.bounds.size.block = self.<API key>(&fragment, layout_context); } self.new_fragments.push(fragment); } fn <API key>(&mut self) -> bool { let <API key> = match self.<API key> { None => return false, Some(<API key>) => <API key>, }; for fragment_index in (<API key>.get().. self.pending_line.range.end().get()).rev() { debug_assert!(fragment_index == (self.new_fragments.len() as isize) - 1); self.work_list.push_front(self.new_fragments.pop().unwrap()); } // FIXME(pcwalton): This should actually attempt to split the last fragment if // possible to do so, to handle cases like: // (available width) // The alphabet // (<em><API key></em>) // Here, the last known-good split point is inside the fragment containing // "The alphabet (", which has already been committed by the time we get to this // point. Unfortunately, the existing splitting API (`<API key>`) // has no concept of "split right before the last non-whitespace position". We'll // need to add that feature to the API to handle this case correctly. self.pending_line.range.extend_to(<API key>); self.flush_current_line(); true } Returns the indentation that needs to be applied before the fragment we're reflowing. fn <API key>(&self) -> Au { if self.<API key>() && self.lines.is_empty() { self.<API key> } else { Au(0) } } Returns true if the pending line is empty and false otherwise. fn <API key>(&self) -> bool { self.pending_line.range.length() == FragmentIndex(0) } } Represents a list of inline fragments, including element ranges. #[derive(RustcEncodable, Clone)] pub struct InlineFragments { The fragments themselves. pub fragments: Vec<Fragment>, } impl InlineFragments { Creates an empty set of inline fragments. pub fn new() -> InlineFragments { InlineFragments { fragments: vec![], } } Returns the number of inline fragments. pub fn len(&self) -> usize { self.fragments.len() } Returns true if this list contains no fragments and false if it contains at least one fragment. pub fn is_empty(&self) -> bool { self.fragments.is_empty() } A convenience function to return the fragment at a given index. pub fn get(&self, index: usize) -> &Fragment { &self.fragments[index] } A convenience function to return a mutable reference to the fragment at a given index. pub fn get_mut(&mut self, index: usize) -> &mut Fragment { &mut self.fragments[index] } } Flows for inline layout. #[derive(RustcEncodable)] pub struct InlineFlow { Data common to all flows. pub base: BaseFlow, A vector of all inline fragments. Several fragments may correspond to one node/element. pub fragments: InlineFragments, A vector of ranges into fragments that represents line positions. These ranges are disjoint and are the result of inline layout. This also includes some metadata used for positioning lines. pub lines: Vec<Line>, The minimum block-size above the baseline for each line, as specified by the line height and font style. pub <API key>: Au, The minimum depth below the baseline for each line, as specified by the line height and font style. pub <API key>: Au, The amount of indentation to use on the first line. This is determined by our block parent (because percentages are relative to the containing block, and we aren't in a position to compute things relative to our parent's containing block). pub <API key>: Au, } impl InlineFlow { pub fn from_fragments(fragments: InlineFragments, writing_mode: WritingMode) -> InlineFlow { let mut flow = InlineFlow { base: BaseFlow::new(None, writing_mode, ForceNonfloatedFlag::ForceNonfloated), fragments: fragments, lines: Vec::new(), <API key>: Au(0), <API key>: Au(0), <API key>: Au(0), }; for fragment in &flow.fragments.fragments { if fragment.<API key>() { flow.base.restyle_damage.insert(<API key>) } } flow } Returns the distance from the baseline for the logical block-start inline-start corner of this fragment, taking into account the value of the CSS `vertical-align` property. Negative values mean "toward the logical block-start" and positive values mean "toward the logical block-end". The extra boolean is set if and only if `<API key>` and/or `<API key>` were updated. That is, if the box has a `top` or `bottom` value for `vertical-align`, true is returned. fn <API key>(fragment: &Fragment, ascent: Au, <API key>: Au, <API key>: Au, <API key>: &mut Au, <API key>: &mut Au, <API key>: &mut Au, <API key>: &mut Au, layout_context: &LayoutContext) -> (Au, bool) { let (mut <API key>, mut <API key>) = (Au(0), false); for style in fragment.inline_styles() { // Ignore `vertical-align` values for table cells. let box_style = style.get_box(); match box_style.display { display::T::inline | display::T::block | display::T::inline_block => {} _ => continue, } match box_style.vertical_align { vertical_align::T::baseline => {} vertical_align::T::middle => { // TODO: x-height value should be used from font info. // TODO: Doing nothing here passes our current reftests but doesn't work in // all situations. Add vertical align reftests and fix this. }, vertical_align::T::sub => { let sub_offset = (<API key> + <API key>) .scale_by(<API key>); <API key> = <API key> + sub_offset }, vertical_align::T::super_ => { let super_offset = (<API key> + <API key>) .scale_by(<API key>); <API key> = <API key> - super_offset }, vertical_align::T::text_top => { let fragment_block_size = *<API key> + *<API key>; let <API key> = *<API key>; *<API key> = <API key>; *<API key> = fragment_block_size - *<API key>; <API key> = <API key> + *<API key> - <API key> }, vertical_align::T::text_bottom => { let fragment_block_size = *<API key> + *<API key>; let <API key> = *<API key>; *<API key> = <API key>; *<API key> = fragment_block_size - *<API key>; <API key> = <API key> + *<API key> - <API key> }, vertical_align::T::top => { if !<API key> { <API key> = true; *<API key> = max(*<API key>, *<API key> + *<API key>); <API key> = <API key> + *<API key> } }, vertical_align::T::bottom => { if !<API key> { <API key> = true; *<API key> = max(*<API key>, *<API key> + *<API key>); <API key> = <API key> - *<API key> } }, vertical_align::T::LengthOrPercentage(LengthOrPercentage::Length(length)) => { <API key> = <API key> - length } vertical_align::T::LengthOrPercentage(LengthOrPercentage::Percentage(p)) => { let line_height = fragment.<API key>(layout_context); let percent_offset = line_height.scale_by(p); <API key> = <API key> - percent_offset } vertical_align::T::LengthOrPercentage(LengthOrPercentage::Calc(calc)) => { let line_height = fragment.<API key>(layout_context); let percent_offset = line_height.scale_by(calc.percentage()); <API key> = <API key> - percent_offset - calc.length() } } } (<API key> - ascent, <API key>) } Sets fragment positions in the inline direction based on alignment for one line. This performs text justification if mandated by the style. fn <API key>(fragments: &mut InlineFragments, line: &Line, line_align: text_align::T, indentation: Au, is_last_line: bool) { // Figure out how much inline-size we have. let slack_inline_size = max(Au(0), line.green_zone.inline - line.bounds.size.inline); // Compute the value we're going to use for `text-justify`. if fragments.fragments.is_empty() { return } let text_justify = fragments.fragments[0].style().get_inheritedtext().text_justify; // Translate `left` and `right` to logical directions. let is_ltr = fragments.fragments[0].style().writing_mode.is_bidi_ltr(); let line_align = match (line_align, is_ltr) { (text_align::T::left, true) | (text_align::T::servo_left, true) | (text_align::T::right, false) | (text_align::T::servo_right, false) => text_align::T::start, (text_align::T::left, false) | (text_align::T::servo_left, false) | (text_align::T::right, true) | (text_align::T::servo_right, true) => text_align::T::end, _ => line_align }; // Set the fragment inline positions based on that alignment, and justify the text if // necessary. let mut <API key> = line.bounds.start.i + indentation; match line_align { text_align::T::justify if !is_last_line && text_justify != text_justify::T::none => { InlineFlow::<API key>(fragments, line, slack_inline_size) } text_align::T::justify | text_align::T::start => {} text_align::T::center | text_align::T::servo_center => { <API key> = <API key> + slack_inline_size.scale_by(0.5) } text_align::T::end => { <API key> = <API key> + slack_inline_size } text_align::T::left | text_align::T::servo_left | text_align::T::right | text_align::T::servo_right => unreachable!() } // Lay out the fragments in visual order. let run_count = match line.visual_runs { Some(ref runs) => runs.len(), None => 1 }; for run_idx in 0..run_count { let (range, level) = match line.visual_runs { Some(ref runs) if is_ltr => runs[run_idx], Some(ref runs) => runs[run_count - run_idx - 1], // reverse order for RTL runs None => (line.range, 0) }; // If the bidi embedding direction is opposite the layout direction, lay out this // run in reverse order. let reverse = unicode_bidi::is_ltr(level) != is_ltr; let fragment_indices = if reverse { (range.end().get() - 1..range.begin().get() - 1).step_by(-1) } else { (range.begin().get()..range.end().get()).step_by(1) }; for fragment_index in fragment_indices { let fragment = fragments.get_mut(fragment_index as usize); <API key> = <API key> + fragment.margin.inline_start; let border_start = if fragment.style.writing_mode.is_bidi_ltr() == is_ltr { <API key> } else { line.green_zone.inline - <API key> - fragment.margin.inline_end - fragment.border_box.size.inline }; fragment.border_box = LogicalRect::new(fragment.style.writing_mode, border_start, fragment.border_box.start.b, fragment.border_box.size.inline, fragment.border_box.size.block); fragment.<API key>(); if !fragment.is_inline_absolute() { <API key> = <API key> + fragment.border_box.size.inline + fragment.margin.inline_end; } } } } Justifies the given set of inline fragments, distributing the `slack_inline_size` among all of them according to the value of `text-justify`. fn <API key>(fragments: &mut InlineFragments, line: &Line, slack_inline_size: Au) { // Fast path. if slack_inline_size == Au(0) { return } // First, calculate the number of expansion opportunities (spaces, normally). let mut <API key> = 0i32; for fragment_index in line.range.each_index() { let fragment = fragments.get(fragment_index.to_usize()); let <API key> = match fragment.specific { <API key>::ScannedText(ref info) if !info.range.is_empty() => info, _ => continue }; let fragment_range = <API key>.range; for slice in <API key>.run.<API key>(&fragment_range) { <API key> += slice.glyphs.<API key>(&slice.range) as i32 } } // Then distribute all the space across the expansion opportunities. let <API key> = slack_inline_size.to_f64_px() / (<API key> as f64); for fragment_index in line.range.each_index() { let fragment = fragments.get_mut(fragment_index.to_usize()); let mut <API key> = match fragment.specific { <API key>::ScannedText(ref mut info) if !info.range.is_empty() => info, _ => continue }; let fragment_range = <API key>.range; // FIXME(pcwalton): This is an awful lot of uniqueness making. I don't see any easy way // to get rid of it without regressing the performance of the non-justified case, // though. let run = Arc::make_mut(&mut <API key>.run); { let glyph_runs = Arc::make_mut(&mut run.glyphs); for mut glyph_run in &mut *glyph_runs { let mut range = glyph_run.range.intersect(&fragment_range); if range.is_empty() { continue } range.shift_by(-glyph_run.range.begin()); let glyph_store = Arc::make_mut(&mut glyph_run.glyph_store); glyph_store.<API key>(&range, <API key>); } } // Recompute the fragment's border box size. let new_inline_size = run.advance_for_range(&fragment_range); let new_size = LogicalSize::new(fragment.style.writing_mode, new_inline_size, fragment.border_box.size.block); fragment.border_box = LogicalRect::from_point_size(fragment.style.writing_mode, fragment.border_box.start, new_size); } } Sets final fragment positions in the block direction for one line. Assumes that the fragment positions were initially set to the distance from the baseline first. fn <API key>(fragments: &mut InlineFragments, line: &Line, <API key>: Au, <API key>: Au, <API key>: Au) { for fragment_index in line.range.each_index() { // If any of the inline styles say `top` or `bottom`, adjust the vertical align // appropriately. // FIXME(#5624, pcwalton): This passes our current reftests but isn't the right thing // to do. let fragment = fragments.get_mut(fragment_index.to_usize()); let mut vertical_align = vertical_align::T::baseline; for style in fragment.inline_styles() { match (style.get_box().display, style.get_box().vertical_align) { (display::T::inline, vertical_align::T::top) | (display::T::block, vertical_align::T::top) | (display::T::inline_block, vertical_align::T::top) => { vertical_align = vertical_align::T::top; break } (display::T::inline, vertical_align::T::bottom) | (display::T::block, vertical_align::T::bottom) | (display::T::inline_block, vertical_align::T::bottom) => { vertical_align = vertical_align::T::bottom; break } _ => {} } } match vertical_align { vertical_align::T::top => { fragment.border_box.start.b = fragment.border_box.start.b + <API key> } vertical_align::T::bottom => { fragment.border_box.start.b = fragment.border_box.start.b + <API key> + <API key> + <API key>; } _ => { fragment.border_box.start.b = fragment.border_box.start.b + <API key> + <API key> } } fragment.<API key>(); } } Computes the minimum ascent and descent for each line. This is done during flow construction. `style` is the style of the block. pub fn <API key>(&self, font_context: &mut FontContext, style: &ComputedValues) -> (Au, Au) { // As a special case, if this flow contains only hypothetical fragments, then the entire if self.fragments.fragments.iter().all(|fragment| fragment.is_hypothetical()) { return (Au(0), Au(0)) } let font_style = style.get_font_arc(); let font_metrics = text::<API key>(font_context, font_style); let line_height = text::<API key>(style, &font_metrics); let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height); let mut <API key> = inline_metrics.<API key>; let mut <API key> = inline_metrics.<API key>; // height of line boxes within the element. for frag in &self.fragments.fragments { match frag.inline_context { Some(ref inline_context) => { for node in &inline_context.nodes { let font_style = node.style.get_font_arc(); let font_metrics = text::<API key>(font_context, font_style); let line_height = text::<API key>(&*node.style, &font_metrics); let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height); <API key> = max(<API key>, inline_metrics.<API key>); <API key> = max(<API key>, inline_metrics.<API key>); } } None => {} } } (<API key>, <API key>) } fn <API key>(&mut self) { let mut damage = self.base.restyle_damage; for frag in &self.fragments.fragments { damage.insert(frag.restyle_damage()); } self.base.restyle_damage = damage; } fn <API key>(&self, fragment_index: FragmentIndex) -> Range<FragmentIndex> { let mut start_index = fragment_index; while start_index > FragmentIndex(0) && self.fragments .fragments[(start_index - FragmentIndex(1)).get() as usize] .is_positioned() { start_index = start_index - FragmentIndex(1) } let mut end_index = fragment_index + FragmentIndex(1); while end_index < FragmentIndex(self.fragments.fragments.len() as isize) && self.fragments.fragments[end_index.get() as usize].is_positioned() { end_index = end_index + FragmentIndex(1) } Range::new(start_index, end_index - start_index) } fn <API key>(&self, opaque_flow: OpaqueFlow) -> Range<FragmentIndex> { match self.fragments.fragments.iter().position(|fragment| { match fragment.specific { <API key>::InlineAbsolute(ref inline_absolute) => { OpaqueFlow::from_flow(&*inline_absolute.flow_ref) == opaque_flow } <API key>::<API key>( ref <API key>) => { OpaqueFlow::from_flow(&*<API key>.flow_ref) == opaque_flow } _ => false, } }) { Some(index) => { let index = FragmentIndex(index as isize); self.<API key>(index) } None => { // FIXME(pcwalton): This is quite wrong. We should only return the range // surrounding the inline fragments that constitute the containing block. But this // suffices to get Google looking right. Range::new(FragmentIndex(0), FragmentIndex(self.fragments.fragments.len() as isize)) } } } } impl Flow for InlineFlow { fn class(&self) -> FlowClass { FlowClass::Inline } fn as_inline(&self) -> &InlineFlow { self } fn as_mut_inline(&mut self) -> &mut InlineFlow { self } fn bubble_inline_sizes(&mut self) { self.<API key>(); let _scope = layout_debug_scope!("inline::bubble_inline_sizes {:x}", self.base.debug_id()); let writing_mode = self.base.writing_mode; for kid in self.base.child_iter() { flow::mut_base(kid).floats = Floats::new(writing_mode); } let mut <API key> = <API key>::new(); let mut <API key> = <API key>::new(); let mut <API key> = <API key>::new(); for fragment in &mut self.fragments.fragments { let <API key> = fragment.<API key>().finish(); match fragment.style.get_inheritedtext().white_space { white_space::T::nowrap => { <API key>.<API key>( &<API key>) } white_space::T::pre => { <API key>.<API key>( &<API key>); // Flush the intrinsic sizes we've been gathering up in order to handle the // line break, if necessary. if fragment.<API key>() { <API key>.union_inline( &<API key>.finish()); <API key> = <API key>::new(); <API key>.union_block( &<API key>.finish()); <API key> = <API key>::new(); } } white_space::T::pre_wrap | white_space::T::pre_line => { // Flush the intrinsic sizes we were gathering up for the nonbroken run, if // necessary. <API key>.union_inline( &<API key>.finish()); <API key> = <API key>::new(); <API key>.union_inline(&<API key>); // Flush the intrinsic sizes we've been gathering up in order to handle the // line break, if necessary. if fragment.<API key>() { <API key>.union_inline( &<API key>.finish()); <API key> = <API key>::new(); <API key>.union_block( &<API key>.finish()); <API key> = <API key>::new(); } } white_space::T::normal => { // Flush the intrinsic sizes we were gathering up for the nonbroken run, if // necessary. <API key>.union_inline( &<API key>.finish()); <API key> = <API key>::new(); <API key>.union_inline(&<API key>); } } fragment.restyle_damage.remove(BUBBLE_ISIZES); } // Flush any remaining nonbroken-run and inline-run intrinsic sizes. <API key>.union_inline(&<API key>.finish()); <API key>.union_block(&<API key>.finish()); // Finish up the computation. self.base.<API key> = <API key>.finish() } Recursively (top-down) determines the actual inline-size of child contexts and fragments. When called on this context, the context has had its inline-size set by the parent context. fn assign_inline_sizes(&mut self, _: &LayoutContext) { let _scope = layout_debug_scope!("inline::assign_inline_sizes {:x}", self.base.debug_id()); // Initialize content fragment inline-sizes if they haven't been initialized already. // TODO: Combine this with `LineBreaker`'s walk in the fragment list, or put this into // `Fragment`. debug!("InlineFlow::assign_inline_sizes: floats in: {:?}", self.base.floats); let inline_size = self.base.<API key>; let container_mode = self.base.<API key>; self.base.position.size.inline = inline_size; { let this = &mut *self; for fragment in this.fragments.fragments.iter_mut() { let border_collapse = fragment.style.get_inheritedtable().border_collapse; fragment.<API key>(inline_size, border_collapse); fragment.<API key>(inline_size); fragment.<API key>(inline_size); fragment.<API key>(inline_size); } } // If there are any inline-block kids, propagate explicit block and inline // sizes down to them. let <API key> = self.base.<API key>; for kid in self.base.child_iter() { let kid_base = flow::mut_base(kid); kid_base.<API key> = inline_size; kid_base.<API key> = container_mode; kid_base.<API key> = <API key>; } } Calculate and set the block-size of this flow. See CSS 2.1 § 10.6.1. fn assign_block_size(&mut self, layout_context: &LayoutContext) { let _scope = layout_debug_scope!("inline::assign_block_size {:x}", self.base.debug_id()); // Divide the fragments into lines. // TODO(pcwalton, #226): Get the CSS `line-height` property from the style of the // containing block to determine the minimum line block size. // TODO(pcwalton, #226): Get the CSS `line-height` property from each non-replaced inline // element to determine its block-size for computing the line's own block-size. // TODO(pcwalton): Cache the line scanner? debug!("<API key>: floats in: {:?}", self.base.floats); // Assign the block-size and late-computed inline-sizes for the inline fragments. let <API key> = self.base.<API key>; for fragment in &mut self.fragments.fragments { fragment.<API key>(); fragment.<API key>(<API key>); } // Reset our state, so that we handle incremental reflow correctly. // TODO(pcwalton): Do something smarter, like Gecko and WebKit? self.lines.clear(); // Determine how much indentation the first line wants. let mut indentation = if self.fragments.is_empty() { Au(0) } else { self.<API key> }; // Perform line breaking. let mut scanner = LineBreaker::new(self.base.floats.clone(), indentation, self.<API key>, self.<API key>); scanner.scan_for_lines(self, layout_context); // Now, go through each line and lay out the fragments inside. let mut <API key> = Au(0); let line_count = self.lines.len(); for line_index in 0..line_count { let line = &mut self.lines[line_index]; // Lay out fragments in the inline direction, and justify them if necessary. InlineFlow::<API key>(&mut self.fragments, line, self.base.flags.text_align(), indentation, line_index + 1 == line_count); // Set the block-start position of the current line. // `line_height_offset` is updated at the end of the previous loop. line.bounds.start.b = <API key>; // Calculate the distance from the baseline to the block-start and block-end of the // line. let mut <API key> = self.<API key>; let mut <API key> = self.<API key>; // Calculate the largest block-size among fragments with 'top' and 'bottom' values // respectively. let (mut <API key>, mut <API key>) = (Au(0), Au(0)); for fragment_index in line.range.each_index() { let fragment = &mut self.fragments.fragments[fragment_index.to_usize()]; let InlineMetrics { mut <API key>, mut <API key>, ascent } = fragment.inline_metrics(layout_context); // To calculate text-top and text-bottom value when `vertical-align` is involved, // we should find the top and bottom of the content area of the parent fragment. // TODO: We should extract em-box info from the font size of the parent and // calculate the distances from the baseline to the block-start and the block-end // of the parent's content area. // We should calculate the distance from baseline to the top of parent's content // area. But for now we assume it's the font size. // CSS 2.1 does not state which font to use. This version of the code uses // the parent's font. // Calculate the final block-size above the baseline for this fragment. // The no-update flag decides whether `<API key>` and // `<API key>` are to be updated or not. This will be // set if and only if the fragment has `vertical-align` set to `top` or `bottom`. let (<API key>, no_update_flag) = InlineFlow::<API key>( fragment, ascent, self.<API key>, self.<API key>, &mut <API key>, &mut <API key>, &mut <API key>, &mut <API key>, layout_context); // Unless the current fragment has `vertical-align` set to `top` or `bottom`, // `<API key>` and `<API key>` are // updated. if !no_update_flag { <API key> = max(<API key>, <API key>); <API key> = max(<API key>, <API key>); } // Temporarily use `fragment.border_box.start.b` to mean "the distance from the // baseline". We will assign the real value later. fragment.border_box.start.b = <API key> } // Calculate the distance from the baseline to the top of the largest fragment with a // value for `bottom`. Then, if necessary, update `<API key>`. <API key> = max(<API key>, <API key> - <API key>); // Calculate the distance from baseline to the bottom of the largest fragment with a // value for `top`. Then, if necessary, update `<API key>`. <API key> = max(<API key>, <API key> - <API key>); // Now, the distance from the logical block-start of the line to the baseline can be // computed as `<API key>`. let <API key> = <API key>; // Compute the final positions in the block direction of each fragment. Recall that // `fragment.border_box.start.b` was set to the distance from the baseline above. InlineFlow::<API key>(&mut self.fragments, line, <API key>, <API key>, <API key>); // This is used to set the block-start position of the next line in the next loop. line.bounds.size.block = <API key> + <API key>; <API key> = <API key> + line.bounds.size.block; // We're no longer on the first line, so set indentation to zero. indentation = Au(0) } // End of `lines.iter_mut()` loop. // Assign block sizes for any inline-block descendants. let thread_id = self.base.thread_id; for kid in self.base.child_iter() { if flow::base(kid).flags.contains(<API key>) || flow::base(kid).flags.is_float() { continue } kid.<API key>(layout_context, thread_id); } if self.<API key>() { // Assign block-sizes for all flows in this absolute flow tree. // This is preorder because the block-size of an absolute flow may depend on // the block-size of its containing block, which may also be an absolute flow. (&mut *self as &mut Flow).<API key>( &mut <API key>(layout_context)); } self.base.position.size.block = match self.lines.last() { Some(ref last_line) => last_line.bounds.start.b + last_line.bounds.size.block, None => Au(0), }; self.base.floats = scanner.floats.clone(); let writing_mode = self.base.floats.writing_mode; self.base.floats.translate(LogicalSize::new(writing_mode, Au(0), -self.base.position.size.block)); let <API key> = LogicalSize::new(writing_mode, Au(0), self.base.position.size.block); self.mutate_fragments(&mut |f: &mut Fragment| { match f.specific { <API key>::InlineBlock(ref mut info) => { let block = flow_ref::deref_mut(&mut info.flow_ref); flow::mut_base(block).<API key> = <API key> { <API key>: <API key>, <API key>: writing_mode, }; } <API key>::InlineAbsolute(ref mut info) => { let block = flow_ref::deref_mut(&mut info.flow_ref); flow::mut_base(block).<API key> = <API key> { <API key>: <API key>, <API key>: writing_mode, }; } _ => (), } }); self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); for fragment in &mut self.fragments.fragments { fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); } } fn <API key>(&mut self, _: &LayoutContext) { // First, gather up the positions of all the containing blocks (if any). // FIXME(pcwalton): This will get the absolute containing blocks inside `...` wrong in the // case of something like: // <span style="position: relative"> // Foo // <span style="display: inline-block">...</span> // </span> let mut <API key> = Vec::new(); let container_size = Size2D::new(self.base.<API key>, Au(0)); for (fragment_index, fragment) in self.fragments.fragments.iter().enumerate() { match fragment.specific { <API key>::InlineAbsolute(_) => { let <API key> = self.<API key>( FragmentIndex(fragment_index as isize)); let <API key> = <API key>.begin().get() as usize; debug_assert!(<API key> < self.fragments.fragments.len()); let first_fragment = &self.fragments.fragments[<API key>]; let padding_box_origin = (first_fragment.border_box - first_fragment.style.<API key>()).start; <API key>.push( padding_box_origin.to_physical(self.base.writing_mode, container_size)); } <API key>::InlineBlock(_) if fragment.is_positioned() => { let <API key> = self.<API key>( FragmentIndex(fragment_index as isize)); let <API key> = <API key>.begin().get() as usize; debug_assert!(<API key> < self.fragments.fragments.len()); let first_fragment = &self.fragments.fragments[<API key>]; let padding_box_origin = (first_fragment.border_box - first_fragment.style.<API key>()).start; <API key>.push( padding_box_origin.to_physical(self.base.writing_mode, container_size)); } _ => {} } } // Then compute the positions of all of our fragments. let mut <API key> = <API key>.iter(); for fragment in &mut self.fragments.fragments { let <API key> = fragment.<API key>(&self.base.<API key>, &self.base .<API key> .<API key>, self.base .<API key> .<API key>, CoordinateSystem::Parent); let <API key> = fragment.<API key>(&<API key>); let clip = fragment.<API key>(&self.base.clip, &<API key>, false); let is_positioned = fragment.is_positioned(); match fragment.specific { <API key>::InlineBlock(ref mut info) => { let flow = flow_ref::deref_mut(&mut info.flow_ref); flow::mut_base(flow).clip = clip; let block_flow = flow.as_mut_block(); block_flow.base.<API key> = self.base.<API key>; let <API key> = self.base.<API key>; if is_positioned { let padding_box_origin = <API key>.next().unwrap(); block_flow.base .<API key> .<API key> = <API key> + *padding_box_origin; } block_flow.base.<API key> = <API key>.origin; block_flow.base.<API key> = self.base.<API key>; } <API key>::<API key>(ref mut info) => { let flow = flow_ref::deref_mut(&mut info.flow_ref); flow::mut_base(flow).clip = clip; let block_flow = flow.as_mut_block(); block_flow.base.<API key> = self.base.<API key>; block_flow.base.<API key> = <API key>.origin; block_flow.base.<API key> = self.base.<API key>; } <API key>::InlineAbsolute(ref mut info) => { let flow = flow_ref::deref_mut(&mut info.flow_ref); flow::mut_base(flow).clip = clip; let block_flow = flow.as_mut_block(); block_flow.base.<API key> = self.base.<API key>; let <API key> = self.base.<API key>; let padding_box_origin = <API key>.next().unwrap(); block_flow.base .<API key> .<API key> = <API key> + *padding_box_origin; block_flow.base.<API key> = <API key>.origin; block_flow.base.<API key> = self.base.<API key>; } _ => {} } } } fn <API key>(&mut self, _: Au) {} fn <API key>(&mut self, _: Au) {} fn build_display_list(&mut self, layout_context: &LayoutContext) { self.<API key>(layout_context); for fragment in &mut self.fragments.fragments { fragment.restyle_damage.remove(REPAINT); } } fn repair_style(&mut self, _: &Arc<ComputedValues>) {} fn compute_overflow(&self) -> Rect<Au> { let mut overflow = Rect::zero(); let flow_size = self.base.position.size.to_physical(self.base.writing_mode); let <API key> = &self.base.<API key>.<API key>; for fragment in &self.fragments.fragments { overflow = overflow.union(&fragment.compute_overflow(&flow_size, &<API key>)) } overflow } fn <API key>(&self, iterator: &mut <API key>, level: i32, <API key>: &Point2D<Au>) { // FIXME(#2795): Get the real container size. for fragment in &self.fragments.fragments { if !iterator.should_process(fragment) { continue } let <API key> = &self.base.<API key>; let <API key> = &self.base.<API key>.<API key>; let <API key> = self.base.<API key>.<API key>; iterator.process(fragment, level, &fragment.<API key>(<API key>, <API key>, <API key>, CoordinateSystem::Own) .translate(<API key>)) } } fn mutate_fragments(&mut self, mutator: &mut FnMut(&mut Fragment)) { for fragment in &mut self.fragments.fragments { (*mutator)(fragment) } } fn <API key>(&self) -> bool { self.fragments.fragments.iter().any(|fragment| fragment.is_positioned()) } fn <API key>(&self) -> bool { self.fragments.fragments.iter().any(|fragment| { fragment.style.get_box().position == position::T::relative }) } fn <API key>(&self, for_flow: OpaqueFlow) -> LogicalSize<Au> { let mut <API key> = LogicalSize::new(self.base.writing_mode, Au(0), Au(0)); for index in self.<API key>(for_flow).each_index() { let fragment = &self.fragments.fragments[index.get() as usize]; if fragment.<API key>() { continue } <API key>.inline = <API key>.inline + fragment.border_box.size.inline; <API key>.block = max(<API key>.block, fragment.border_box.size.block); } <API key> } fn <API key>(&self, print_tree: &mut PrintTree) { for fragment in &self.fragments.fragments { print_tree.add_item(format!("{:?}", fragment)); } } } impl fmt::Debug for InlineFlow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}({:x}) {:?}", self.class(), self.base.debug_id(), flow::base(self)) } } #[derive(Clone)] pub struct <API key> { pub address: OpaqueNode, pub style: Arc<ComputedValues>, pub pseudo: PseudoElementType<()>, pub flags: <API key>, } bitflags! { flags <API key>: u8 { const <API key> = 0x01, const <API key> = 0x02, } } impl fmt::Debug for <API key> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.flags.bits()) } } #[derive(Clone)] pub struct <API key> { pub nodes: Vec<<API key>>, } impl <API key> { pub fn new() -> <API key> { <API key> { nodes: vec!(), } } #[inline] pub fn contains_node(&self, node_address: OpaqueNode) -> bool { self.nodes.iter().position(|node| node.address == node_address).is_some() } fn ptr_eq(&self, other: &<API key>) -> bool { if self.nodes.len() != other.nodes.len() { return false } for (this_node, other_node) in self.nodes.iter().zip(&other.nodes) { if !util::arc_ptr_eq(&this_node.style, &other_node.style) { return false } } true } } fn <API key>(inline_context_a: &Option<<API key>>, inline_context_b: &Option<<API key>>) -> bool { match (inline_context_a, inline_context_b) { (&Some(ref inline_context_a), &Some(ref inline_context_b)) => { inline_context_a.ptr_eq(inline_context_b) } (&None, &None) => true, (&Some(_), &None) | (&None, &Some(_)) => false, } } Block-size above the baseline, depth below the baseline, and ascent for a fragment. See CSS 2.1 § 10.8.1. #[derive(Clone, Copy, Debug, RustcEncodable)] pub struct InlineMetrics { pub <API key>: Au, pub <API key>: Au, pub ascent: Au, } impl InlineMetrics { Creates a new set of inline metrics. pub fn new(<API key>: Au, <API key>: Au, ascent: Au) -> InlineMetrics { InlineMetrics { <API key>: <API key>, <API key>: <API key>, ascent: ascent, } } Calculates inline metrics from font metrics and line block-size per CSS 2.1 § 10.8.1. #[inline] pub fn from_font_metrics(font_metrics: &FontMetrics, line_height: Au) -> InlineMetrics { let leading = line_height - (font_metrics.ascent + font_metrics.descent); InlineMetrics { <API key>: font_metrics.ascent + leading.scale_by(0.5), <API key>: font_metrics.descent + leading.scale_by(0.5), ascent: font_metrics.ascent, } } Calculates inline metrics from font metrics and line block-size per CSS 2.1 § 10.8.1. #[inline] pub fn from_block_height(font_metrics: &FontMetrics, block_height: Au, block_start_margin: Au, block_end_margin: Au) -> InlineMetrics { let leading = block_height + block_start_margin + block_end_margin - (font_metrics.ascent + font_metrics.descent); InlineMetrics { <API key>: font_metrics.ascent + leading.scale_by(0.5), <API key>: font_metrics.descent + leading.scale_by(0.5), ascent: font_metrics.ascent + leading.scale_by(0.5) - block_start_margin, } } pub fn block_size(&self) -> Au { self.<API key> + self.<API key> } pub fn max(&self, other: &InlineMetrics) -> InlineMetrics { InlineMetrics { <API key>: max(self.<API key>, other.<API key>), <API key>: max(self.<API key>, other.<API key>), ascent: max(self.ascent, other.ascent), } } } #[derive(Copy, Clone, PartialEq)] enum LineFlushMode { No, Flush, }
from __future__ import with_statement from datetime import datetime import os from django.conf import settings from kuma.core.cache import memcache from kuma.core.tests import ok_ from kuma.users.models import User from kuma.users.tests import UserTestCase, user from . import document, revision from ..models import Document, DocumentSpamAttempt from ..tasks import (build_sitemaps, <API key>, <API key>) class <API key>(UserTestCase): contributors = 10 def setUp(self): super(<API key>, self).setUp() self.cache = memcache def <API key>(self): <API key>() stats = self.cache.get('community_stats') self.assertIsNone(stats) def <API key>(self): for i in range(self.contributors): if i % 2 == 0: locale = 'en-US' else: locale = 'pt-BR' test_user = user(save=True) doc = document(save=True, locale=locale) revision(save=True, creator=test_user, document=doc) <API key>() stats = self.cache.get('community_stats') self.assertIsNotNone(stats) self.assertIn('contributors', stats) self.assertIn('locales', stats) self.assertIsInstance(stats['contributors'], long) self.assertIsInstance(stats['locales'], long) self.assertEqual(stats['contributors'], self.contributors) self.assertEqual(stats['locales'], 2) class SitemapsTestCase(UserTestCase): fixtures = UserTestCase.fixtures + ['wiki/documents.json'] def test_sitemaps_files(self): build_sitemaps() locales = (Document.objects.filter_for_list() .values_list('locale', flat=True)) <API key> = [] for locale in set(locales): # we'll expect to see this locale in the sitemap index file <API key>.append( "<loc>https://example.com/sitemaps/%s/sitemap.xml</loc>" % locale ) sitemap_path = os.path.join(settings.MEDIA_ROOT, 'sitemaps', locale, 'sitemap.xml') with open(sitemap_path, 'r') as sitemap_file: sitemap_xml = sitemap_file.read() docs = Document.objects.filter_for_list(locale=locale) for doc in docs: ok_(doc.modified.strftime('%Y-%m-%d') in sitemap_xml) ok_(doc.slug in sitemap_xml) sitemap_path = os.path.join(settings.MEDIA_ROOT, 'sitemap.xml') with open(sitemap_path, 'r') as sitemap_file: index_xml = sitemap_file.read() for loc in <API key>: ok_(loc in index_xml) class <API key>(UserTestCase): fixtures = UserTestCase.fixtures def <API key>(self): user = User.objects.get(username='testuser01') admin = User.objects.get(username='admin') new_dsa = DocumentSpamAttempt.objects.create( user=user, title='new record', slug='users:me', data='{"PII": "IP, email, etc."}') old_reviewed_dsa = DocumentSpamAttempt.objects.create( user=user, title='old ham', data='{"PII": "plenty"}', review=DocumentSpamAttempt.HAM, reviewer=admin) old_unreviewed_dsa = DocumentSpamAttempt.objects.create( user=user, title='old unknown', data='{"PII": "yep"}') # created is auto-set to current time, update bypasses model logic old_date = datetime(2015, 1, 1) ids = [old_reviewed_dsa.id, old_unreviewed_dsa.id] DocumentSpamAttempt.objects.filter(id__in=ids).update(created=old_date) <API key>() new_dsa.refresh_from_db() assert new_dsa.data is not None old_reviewed_dsa.refresh_from_db() assert old_reviewed_dsa.data is None assert old_reviewed_dsa.review == DocumentSpamAttempt.HAM old_unreviewed_dsa.refresh_from_db() assert old_unreviewed_dsa.data is None assert old_unreviewed_dsa.review == ( DocumentSpamAttempt.REVIEW_UNAVAILABLE)
/* all localizable skin settings shall live here */ @import url("chrome://global/locale/intl.css"); @namespace url("http: /* ::::: XBL bindings ::::: */ radio { -moz-binding: url("chrome://global/skin/globalBindings.xml#radio"); } menulist > menupopup { -moz-binding: url("chrome://global/content/bindings/popup.xml#popup-scrollbars"); } /* ::::: root elements ::::: */ window, page, dialog, wizard, prefwindow { -moz-appearance: window; background-color: #F8F8F8; color: -moz-DialogText; font: message-box; } /* deprecated */ window.dialog { padding-top: 8px; padding-bottom: 10px; -moz-padding-start: 8px; -moz-padding-end: 10px; } /* ::::: alert icons :::::*/ .message-icon, .alert-icon, .error-icon, .question-icon { width: 32px; height: 32px; } .message-icon { list-style-image: url("chrome://global/skin/icons/information-32.png"); } .alert-dialog #info\.icon, .alert-icon { list-style-image: url("chrome://global/skin/icons/Warning.png"); } .error-icon { list-style-image: url("chrome://global/skin/icons/Error.png"); } .question-icon { list-style-image: url("chrome://global/skin/icons/Question.png"); } /* ::::: iframe ::::: */ iframe { border: none; width: 100px; height: 100px; min-width: 10px; min-height: 10px; } /* ::::: statusbar ::::: */ statusbar { -moz-appearance: statusbar; border-top: 1px solid ThreeDLightShadow; border-left: 1px solid ThreeDShadow; border-right: 1px solid ThreeDHighlight; border-bottom: 1px solid ThreeDHighlight; background-color: #F7F7F7; min-height: 22px; } statusbarpanel { -moz-appearance: statusbarpanel; -moz-box-align: center; -moz-box-pack: center; border-left: 1px solid ThreeDHighlight; border-top: 1px solid ThreeDHighlight; border-right: 1px solid ThreeDShadow; border-bottom: 1px solid ThreeDShadow; padding: 0 4px; } statusbarpanel:not(.<API key>):-moz-lwtheme { -moz-appearance: none; border-top-style: none; border-bottom-style: none; -<API key>: none; } .<API key> { -moz-box-align: end; -moz-box-pack: end; -moz-appearance: resizerpanel; padding: 0; border: none; } .<API key>, .<API key>, .<API key> { padding: 0 1px; } /* XXXBlake yeah, shoot me -- these don't belong here. I'll move them later. */ sidebarheader { height: 25px; background-color: #F7F7F7; -moz-appearance: toolbox; border-bottom: 1px solid ThreeDShadow; border-top: 1px solid ThreeDHighlight; } sidebarheader > label { -moz-padding-start: 4px; } .toolbar-focustarget { -moz-user-focus: ignore !important; } toolbar[mode="text"] .toolbarbutton-text { padding: 0 !important; margin: 3px 5px !important; } /* ::::: miscellaneous formatting ::::: */ :root:-moz-lwtheme, [lwthemefooter="true"] { -moz-appearance: none; } :root:-<API key> { text-shadow: 0 -0.5px 1.5px white; } :root:-<API key> { text-shadow: 1px 1px 1.5px black; } statusbar:-moz-lwtheme, sidebarheader:-moz-lwtheme { -moz-appearance: none; background: none; border-style: none; } .inset { border: 1px solid ThreeDShadow; border-right-color: ThreeDHighlight; border-bottom-color: ThreeDHighlight; margin: 0 5px 5px; } .outset { border: 1px solid ThreeDShadow; border-left-color: ThreeDHighlight; border-top-color: ThreeDHighlight; } /* separators */ separator:not([orient="vertical"]) { height: 1.5em; } separator[orient="vertical"] { width: 1.5em; } separator.thin:not([orient="vertical"]) { height: 0.5em; } separator.thin[orient="vertical"] { width: 0.5em; } separator.groove:not([orient="vertical"]) { border-top: 1px solid ThreeDShadow; border-bottom: 1px solid ThreeDHighlight; height: 0; margin-top: 0.4em; margin-bottom: 0.4em; } separator.groove[orient="vertical"] { border-left: 1px solid ThreeDShadow; border-right: 1px solid ThreeDHighlight; width: 0; margin-left: 0.4em; margin-right: 0.4em; } .small-margin { margin: 1px 2px; } .plain { -moz-appearance: none; margin: 0 !important; border: none; padding: 0; } description, label { cursor: default; margin-top: 1px; margin-bottom: 2px; -moz-margin-start: 6px; -moz-margin-end: 5px; } description { margin-bottom: 4px; } label[disabled="true"] { color: GrayText; } label[disabled="true"]:-moz-system-metric(windows-classic) { color: ThreeDShadow; text-shadow: 1px 1px ThreeDHighlight; } .tooltip-label { margin: 0; } .header { font-weight: bold; } .monospace { font-family: monospace; } .indent { -moz-margin-start: 23px; } .box-padded { padding: 5px; } .spaced { margin: 3px 5px 4px; } .wizard-box { padding: 20px 44px 10px; } .text-link { color: -<API key>; border: 1px solid transparent; cursor: pointer; } .text-link:hover { text-decoration: underline; } .text-link:-moz-focusring { border: 1px dotted -moz-DialogText; } <API key> { margin-top: .5em; } /* :::::: autoscroll popup ::::: */ .autoscroller { height: 28px; width: 28px; border: none; margin: -14px; padding: 0; background-image: url("chrome://global/skin/icons/autoscroll.png"); background-color: transparent; background-position: right top; -moz-appearance: none; } .autoscroller[scrolldir="NS"] { background-position: right center; } .autoscroller[scrolldir="EW"] { background-position: right bottom; } /* :::::: Close button icons ::::: */ .close-icon { list-style-image: url("chrome://global/skin/icons/close.png"); -moz-image-region: rect(0, 16px, 16px, 0); } .close-icon:hover { -moz-image-region: rect(0, 32px, 16px, 16px); } .close-icon:hover:active { -moz-image-region: rect(0, 48px, 16px, 32px); }
// This file is part of libigl, a simple c++ geometry processing library. // v. 2.0. If a copy of the MPL was not distributed with this file, You can #ifndef <API key> #define <API key> #ifndef IGL_NO_OPENGL #include "igl_inline.h" #include "OpenGL_convenience.h" namespace igl { // Inputs: // obj OpenGL index of shader to print info log about IGL_INLINE void <API key>(const GLuint obj); } #ifndef IGL_STATIC_LIBRARY # include "<API key>.cpp" #endif #endif #endif
// +build jsoniter package json import ( jsoniter "github.com/json-iterator/go" ) var ( json = jsoniter.<API key> MarshalIndent = json.MarshalIndent Marshal = json.Marshal Unmarshal = json.Unmarshal NewDecoder = json.NewDecoder NewEncoder = json.NewEncoder )
#ifndef <API key> #define <API key> #include <string> #include "PyIncludeWrapper.h" #include <opencog/atomspace/AtomSpace.h> #include <opencog/server/Factory.h> #include <opencog/server/Request.h> #include <opencog/server/RequestClassInfo.h> namespace opencog { class PyRequest : public Request { protected: PyObject* _pyrequest; std::string _moduleName; std::string _className; std::string _last_result; RequestClassInfo* _cci; public: const RequestClassInfo& info() const { return *_cci; } /** Request's constructor */ PyRequest(CogServer&, const std::string& moduleName, const std::string& className, RequestClassInfo*); /** Request's desconstructor */ virtual ~PyRequest(); /** Returns 'true' if the command completed successfully and 'false' otherwise. */ virtual bool execute(void); virtual bool isShell(void) { return info().is_shell; } }; } // namespace #endif // <API key>
<?php /** * @see <API key> */ require_once 'Zend/Markup/Exception.php'; class <API key> extends <API key> { }
<?php $mess=array( "Standard login screen" => "Schermata di login standard", "Display a standard user/password login screen" => "Visualizza una schermata standard con username/password", "Order" => "Ordine", "Order this plugin with other auth frontends" => "Ordina questo plugin rispetto agli altri frontend di autenticazione", "Protocol Type" => "Tipo Protocollo", "Enable/disable automatically based on the protocol used" => "Abilita/Disabilita automaticamente in base al protocollo in uso", "Sessions Only" => "Solo Sessioni", "REST Only" => "Solo REST", "Session-based or Rest" => "Basato su sessione o Rest", );
package org.ow2.<API key>.common.client; import org.ow2.<API key>.common.shared.Config; import com.google.gwt.storage.client.Storage; /** * Persistent global key-value store using HTML5 storage * <p> * Some older browsers may not be compatible * in that case, they will neither store nor retrieve values, * but should not get a runtime exception. * * * * @author mschnoor * */ public class Settings { private static Settings instance = null; public static Settings get() { if (instance == null) { Settings.instance = new Settings(); } return Settings.instance; } /** * Load settings by reading persistent storage and loading values into the global Config * Config must have been created before this can be called */ public static void load() { for (String key : Config.get().getProperties().keySet()) { String val = Settings.get().getSetting(key); if (val != null && val.trim().length() > 0) { Config.get().set(key, val); } } } private Storage store = null; public Settings() { this.store = Storage.<API key>(); } /** * @param key * @return the associated value if HTML5 Storage is supported, or null * @see com.google.gwt.storage.client.Storage */ public String getSetting(String key) { if (this.store != null) return store.getItem(key); return null; } /** * Store a value in a global persistent storage * Does nothing if HTML5 Storage is not supported * @param key * @param value * @see com.google.gwt.storage.client.Storage */ public void setSetting(String key, String value) { if (this.store != null) { this.store.setItem(key, value); } } /** * Clear the value associated with this key from the persistent storage * @param key */ public void clearSetting(String key) { if (this.store != null) { this.store.removeItem(key); } } }
# <API key>: true require "spec_helper" module Decidim module Pages module Admin describe PageForm do subject do described_class.from_params(attributes).with_context( <API key>: <API key> ) end let(:<API key>) { create(:organization) } let(:body) do { "en" => "<p>Content</p>", "ca" => "<p>Contingut</p>", "es" => "<p>Contenido</p>" } end let(:commentable) { true } let(:attributes) do { "page" => { "body" => body, "commentable" => commentable } } end context "when everything is OK" do it { is_expected.to be_valid } end end end end end
package org.ow2.proactive.scheduler.core.jmx.mbean; import java.io.IOException; import javax.management.<API key>; import javax.management.StandardMBean; import org.ow2.proactive.jmx.Chronological; import org.ow2.proactive.scheduler.common.NotificationData; import org.ow2.proactive.scheduler.common.SchedulerEvent; import org.ow2.proactive.scheduler.common.SchedulerUsers; import org.ow2.proactive.scheduler.common.job.JobStatus; import org.ow2.proactive.scheduler.common.job.UserIdentification; import org.ow2.proactive.scheduler.common.task.TaskStatus; import org.ow2.proactive.scheduler.core.db.SchedulerDBManager; import org.ow2.proactive.scheduler.core.jmx.SchedulerJMXHelper; import org.ow2.proactive.utils.Tools; /** * Implementation of the <API key> interface. * * @author The ProActive Team * @since ProActive Scheduling 2.1 */ public final class <API key> extends StandardMBean implements RuntimeDataMBean { private final SchedulerDBManager dbManager; private final SchedulerUsers schedulerClients; /** Current Scheduler status typed as scheduler event */ private volatile SchedulerEvent schedulerStatus; private int neededNodes; public <API key>(SchedulerDBManager dbManager) throws <API key> { super(RuntimeDataMBean.class); this.schedulerClients = new SchedulerUsers(); this.dbManager = dbManager; } public void usersUpdatedEvent(final NotificationData<UserIdentification> notificationData) { synchronized (schedulerClients) { this.schedulerClients.update(notificationData.getData()); } } /** * Methods for dispatching events * * Call the MBean event for the related Scheduler Updated event type * * @see org.ow2.proactive.scheduler.common.<API key>#<API key>(org.ow2.proactive.scheduler.common.SchedulerEvent) * @param eventType the type of the received event */ public void <API key>(final SchedulerEvent eventType) { this.schedulerStatus = eventType; } // ATTRIBUTES TO CONTROL /** * Returns the connected clients count * @return current number of connected users */ @Chronological public int <API key>() { synchronized (schedulerClients) { return this.schedulerClients.getUsersCount(); } } /** * @return current number of finished jobs */ @Chronological public int <API key>() { return (int) dbManager.<API key>(); } @Chronological @Override public int getStalledJobsCount() { return (int) dbManager.getJobsCount(JobStatus.STALLED); } @Chronological @Override public int getPausedJobsCount() { return (int) dbManager.getJobsCount(JobStatus.PAUSED); } @Chronological @Override public int getInErrorJobsCount() { return (int) dbManager.getJobsCount(JobStatus.IN_ERROR); } @Override public int getKilledJobsCount() { return (int) dbManager.getJobsCount(JobStatus.KILLED); } @Override public int <API key>() { return (int) dbManager.getJobsCount(JobStatus.CANCELED); } @Override public int getFailedJobsCount() { return (int) dbManager.getJobsCount(JobStatus.FAILED); } /** * @return current number of pending jobs */ @Chronological @Override public int getPendingJobsCount() { return (int) dbManager.getPendingJobsCount(); } /** * @return current number of running jobs */ @Chronological @Override public int getRunningJobsCount() { return (int) dbManager.getRunningJobsCount(); } /** * @return current number of jobs submitted to the Scheduler */ public int getTotalJobsCount() { return (int) dbManager.getTotalJobsCount(); } /** * @return current number of pending tasks */ public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.PENDING); } /** * @return current number of finished tasks */ public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.FINISHED); } @Override public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.SUBMITTED); } @Override public int getPausedTasksCount() { return (int) dbManager.getTaskCount(TaskStatus.PAUSED); } @Override public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.WAITING_ON_ERROR); } @Override public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.WAITING_ON_FAILURE); } @Override public int getFailedTasksCount() { return (int) dbManager.getTaskCount(TaskStatus.FAILED); } @Override public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.NOT_STARTED); } @Override public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.NOT_RESTARTED); } @Override public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.ABORTED); } @Override public int getFaultyTasksCount() { return (int) dbManager.getTaskCount(TaskStatus.FAULTY); } @Override public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.SKIPPED); } @Override public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.IN_ERROR); } /** * @return current number of running tasks */ public int <API key>() { return (int) dbManager.getTaskCount(TaskStatus.RUNNING); } /** * @return current number of tasks submitted to the Scheduler */ public int getTotalTasksCount() { return (int) dbManager.getTotalTasksCount(); } /** * @return current status of the Scheduler as String */ public String getStatus() { return this.schedulerStatus.toString(); } /** * Getter methods for the KPI values * * @return current mean job pending time as integer */ @Chronological public int <API key>() { return (int) dbManager.<API key>(); } /** * @return current mean job execution time as integer */ @Chronological public int <API key>() { return (int) dbManager.<API key>(); } /** * @return current mean job submitting period as integer */ @Chronological public int <API key>() { return (int) dbManager.<API key>(); } // UTILITY METHODS /** * Getter methods for KPI values as String * * @return current mean job pending time as formatted duration */ public String <API key>() { return Tools.<API key>(0, <API key>()); } /** * @return current mean job execution time as formatted duration */ public String <API key>() { return Tools.<API key>(0, <API key>()); } /** * @return current mean job submitting period as formatted duration */ public String <API key>() { return Tools.<API key>(0, <API key>()); } // MBEAN OPERATIONS /** * This method represents a possible Operation to Invoke on the MBean. * It gives the pending time for a given Job * * @param jobId, the id of the Job to check * @return a representation as long of the duration of the pending time for the given job */ public long getJobPendingTime(final String jobId) { return dbManager.getJobPendingTime(jobId); } /** * This method gives the running time for a given Job * * @param jobId, the id of the Job to check * @return a representation as long of the duration of the running time for the given job */ public long getJobRunningTime(final String jobId) { return dbManager.getJobRunningTime(jobId); } /** * This method gives the mean task pending time for a given Job * * @param jobId, the id of the Job to check * @return a representation as long of the duration of the mean task pending time for the given job */ public long <API key>(final String jobId) { return (long) dbManager.<API key>(jobId); } /** * This method gives the mean task running time for a given Job * * @param jobId, the id of the Job to check * @return a representation as long of the duration of the mean task running time for the given job */ public long <API key>(final String jobId) { return (long) dbManager.<API key>(jobId); } /** * This method gives the total number of nodes used by a given Job * * @param jobId, the id of the Job to check * @return the total number of nodes used by the given job */ public int <API key>(final String jobId) { return dbManager.<API key>(jobId); } // UTILITY OPERATIONS /** * This method represents a possible Operation to Invoke on the MBean. * It gives the pending time for a given Job as String * * @param jobId, the id of the Job to check * @return a formatted representation of the duration of the pending time for the given job. */ public String <API key>(final String jobId) { return Tools.<API key>(0, getJobPendingTime(jobId)); } /** * This method gives the running time for a given Job as String * * @param jobId, the id of the Job to check * @return a formatted representation of the duration of the running time for the given job */ public String <API key>(final String jobId) { return Tools.<API key>(0, getJobRunningTime(jobId)); } /** * This method gives the mean task pending time for a given Job as String * * @param jobId, the id of the Job to check * @return a formatted representation of the duration of the mean task pending time for the given job */ public String <API key>(final String jobId) { return Tools.<API key>(0, <API key>(jobId)); } /** * This method gives the mean task running time for a given Job as String * * @param jobId, the id of the Job to check * @return a formatted representation as long of the duration of the mean task running time for the given job. */ public String <API key>(final String jobId) { return Tools.<API key>(0, <API key>(jobId)); } /** * Sends the statistics accumulated in the RRD data base * * @return data base file converted to bytes * @throws IOException when data base cannot be read */ public byte[] getStatisticHistory() throws IOException { return SchedulerJMXHelper.getInstance().getDataStore().getBytes(); } @Override public int getNeededNodes() { return neededNodes; } public void setNeededNodes(int neededNodes) { this.neededNodes = neededNodes; } }
class Users::SessionsController < Devise::SessionsController private def <API key>(resource) if !verifying_via_email? && resource.show_welcome_screen? welcome_path else super end end def <API key>(resource) request.referer.present? ? request.referer : super end def verifying_via_email? return false if resource.blank? stored_path = session[<API key>(resource)] || "" stored_path[0..5] == "/email" end end
package org.geomajas.widget.featureinfo.gwt.example.client; import com.google.gwt.core.client.GWT; import com.smartgwt.client.types.VisibilityMode; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Img; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.SectionStack; import com.smartgwt.client.widgets.layout.SectionStackSection; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.toolbar.ToolStrip; import org.geomajas.gwt.client.util.WidgetLayout; import org.geomajas.gwt.client.widget.LayerTree; import org.geomajas.gwt.client.widget.Legend; import org.geomajas.gwt.client.widget.LocaleSelect; import org.geomajas.gwt.client.widget.MapWidget; import org.geomajas.gwt.client.widget.OverviewMap; import org.geomajas.gwt.client.widget.Toolbar; import org.geomajas.gwt.example.base.SamplePanel; import org.geomajas.gwt.example.base.SamplePanelFactory; import org.geomajas.widget.featureinfo.client.widget.factory.WidgetFactory; import org.geomajas.widget.featureinfo.gwt.example.client. <API key>.<API key>; import org.geomajas.widget.featureinfo.gwt.example.client.i18n.ApplicationMessages; /** * Sample to demonstrate use of the featureinfo plug-in. * * @author Wout Swartenbroekx */ public class FeatureinfoPanel extends SamplePanel { public static final ApplicationMessages MESSAGES = GWT.create(ApplicationMessages.class); public static final String TITLE = "FeatureInfo plug-in"; private OverviewMap overviewMap; private Legend legend; private static final String <API key> = "<API key>"; public static final SamplePanelFactory FACTORY = new SamplePanelFactory() { public SamplePanel createPanel() { return new FeatureinfoPanel(); } }; @Override public Canvas getViewPanel() { VLayout mainLayout = new VLayout(); mainLayout.setWidth100(); mainLayout.setHeight100(); // Top bar: ToolStrip topBar = new ToolStrip(); topBar.setHeight(33); topBar.setWidth100(); topBar.addSpacer(6); Img icon = new Img("[ISOMORPHIC]/geomajas/<API key>.png"); icon.setSize(24); topBar.addMember(icon); topBar.addSpacer(6); Label title = new Label(MESSAGES.applicationTitle("Feature info")); title.setStyleName("appTitle"); title.setWidth(300); topBar.addMember(title); topBar.addFill(); topBar.addMember(new LocaleSelect("Nederlands")); mainLayout.addMember(topBar); HLayout layout = new HLayout(); layout.setWidth100(); layout.setHeight100(); layout.setMembersMargin(5); layout.setMargin(5); // Create the left-side (map and tabs): final MapWidget map = new MapWidget("mapMain", "featureInfoApp"); final Toolbar toolbar = new Toolbar(map); toolbar.setButtonSize(WidgetLayout.<API key>); VLayout mapLayout = new VLayout(); mapLayout.setShowResizeBar(true); mapLayout.setResizeBarTarget("tabs"); mapLayout.addMember(toolbar); mapLayout.addMember(map); mapLayout.setHeight("65%"); VLayout leftLayout = new VLayout(); leftLayout.setShowEdges(true); leftLayout.addMember(mapLayout); layout.addMember(leftLayout); // Create the right-side (overview map, layer-tree, legend): final SectionStack sectionStack = new SectionStack(); sectionStack.setShowEdges(true); sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE); sectionStack.<API key>(true); sectionStack.<API key>(false); sectionStack.setSize("250px", "100%"); // Overview map layout: SectionStackSection section1 = new SectionStackSection("Overview map"); section1.setExpanded(true); overviewMap = new OverviewMap("mapOverview", "featureInfoApp", map, false, true); section1.addItem(overviewMap); sectionStack.addSection(section1); // LayerTree layout: SectionStackSection section2 = new SectionStackSection("Layer tree"); section2.setExpanded(true); LayerTree layerTree = new LayerTree(map); section2.addItem(layerTree); sectionStack.addSection(section2); // Legend layout: SectionStackSection section3 = new SectionStackSection("Legend"); section3.setExpanded(true); legend = new Legend(map.getMapModel()); section3.addItem(legend); sectionStack.addSection(section3); // Putting the right side layouts together: layout.addMember(sectionStack); <API key>(); legend.setHeight(200); overviewMap.setHeight(200); mainLayout.addMember(layout); return mainLayout; } private void <API key>() { WidgetFactory.put(<API key>, new <API key>()); } @Override public String getDescription() { return MESSAGES.<API key>(); } @Override public String[] <API key>() { return new String[]{ "classpath:org/geomajas/widget/featureinfo/gwt/example/context/applicationContext.xml", "classpath:org/geomajas/widget/featureinfo/gwt/example/context/mapMain.xml"}; } @Override public String ensureUserLoggedIn() { return "luc"; } }
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreateContestTables extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('contests', function (Blueprint $table) { $table->charset = 'utf8mb4'; $table->collation = 'utf8mb4_general_ci'; $table->increments('id'); $table->string('name'); $table->text('description'); $table->enum('type', ['art', 'beatmap', 'music']); $table->tinyInteger('max_votes')->default(3); $table->string('header_url'); $table->timestamp('ends_at'); $table->timestamps(); }); Schema::create('contest_entries', function (Blueprint $table) { $table->charset = 'utf8mb4'; $table->collation = 'utf8mb4_general_ci'; $table->increments('id'); $table->string('name'); $table->string('masked_name'); $table->string('entry_url'); $table->integer('contest_id')->unsigned(); $table->foreign('contest_id') ->references('id') ->on('contests') ->onDelete('restrict'); $table->timestamps(); }); Schema::create('contest_votes', function (Blueprint $table) { $table->charset = 'utf8mb4'; $table->collation = 'utf8mb4_general_ci'; $table->increments('id'); $table->integer('contest_id')->unsigned(); $table->foreign('contest_id') ->references('id') ->on('contests') ->onDelete('restrict'); $table->mediumInteger('user_id')->unsigned(); $table->foreign('user_id') ->references('user_id') ->on('phpbb_users') ->onDelete('restrict'); $table->integer('contest_entry_id')->unsigned(); $table->foreign('contest_entry_id') ->references('id') ->on('contest_entries') ->onDelete('restrict'); $table->tinyInteger('weight')->unsigned()->default(1); $table->unique(['contest_id', 'user_id', 'contest_entry_id']); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('contest_votes'); Schema::drop('contest_entries'); Schema::drop('contests'); } }
package org.ow2.proactive.authentication.principals; public class <API key> extends GroupNamePrincipal implements <API key> { private static final long serialVersionUID = 1L; public <API key>(String name) { super(name); } }
package org.geomajas.plugin.editing.client.merge; import java.util.ArrayList; import java.util.List; import org.geomajas.annotation.Api; import org.geomajas.command.dto.UnionInfo; import org.geomajas.geometry.Geometry; import org.geomajas.plugin.editing.client.GeometryFunction; import org.geomajas.plugin.editing.client.merge.event.<API key>; import org.geomajas.plugin.editing.client.merge.event.<API key>; import org.geomajas.plugin.editing.client.merge.event.<API key>; import org.geomajas.plugin.editing.client.merge.event.<API key>; import org.geomajas.plugin.editing.client.merge.event.<API key>; import org.geomajas.plugin.editing.client.merge.event.<API key>; import org.geomajas.plugin.editing.client.merge.event.<API key>; import org.geomajas.plugin.editing.client.merge.event.<API key>; import org.geomajas.plugin.editing.client.service.<API key>; import org.geomajas.plugin.editing.client.service.<API key>; import com.google.gwt.core.client.Callback; import com.google.gwt.event.shared.EventBus; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.event.shared.SimpleEventBus; /** * Service for the process of merging multiple geometries into a single geometry. * * @author Pieter De Graef * @since 1.0.0 */ @Api(allMethods = true) public class <API key> { private final List<Geometry> geometries = new ArrayList<Geometry>(); private final EventBus eventBus = new SimpleEventBus(); private boolean busy; private int precision = -1; private boolean <API key>; // Constructors: /** * Default constructor. */ public <API key>() { } // Public methods for adding handlers: /** * Register a {@link <API key>} to listen to events that signal the merging process has started. * * @param handler * The {@link <API key>} to add as listener. * @return The registration of the handler. */ public HandlerRegistration <API key>(<API key> handler) { return eventBus.addHandler(<API key>.TYPE, handler); } /** * Register a {@link <API key>} to listen to events that signal the merging process has ended (either * through stop or cancel). * * @param handler * The {@link <API key>} to add as listener. * @return The registration of the handler. */ public HandlerRegistration <API key>(<API key> handler) { return eventBus.addHandler(<API key>.TYPE, handler); } /** * Register a {@link <API key>} to listen to events that signal a geometry has been added to the * list for merging. * * @param handler * The {@link <API key>} to add as listener. * @return The registration of the handler. */ public HandlerRegistration <API key>(<API key> handler) { return eventBus.addHandler(<API key>.TYPE, handler); } /** * Register a {@link <API key>} to listen to events that signal a geometry has been removed from * the list for merging. * * @param handler * The {@link <API key>} to add as listener. * @return The registration of the handler. */ public HandlerRegistration <API key>(<API key> handler) { return eventBus.addHandler(<API key>.TYPE, handler); } // Public methods for merging work-flow: /** * Start the merging process. From this point on add some geometries and call either <code>stop</code> or * <code>cancel</code>. * * @throws <API key> * In case a merging process is already started. */ public void start() throws <API key> { if (busy) { throw new <API key>("Can't start a new merging process while another one is still busy."); } busy = true; eventBus.fireEvent(new <API key>()); } /** * Add a geometry to the list for merging. When <code>stop</code> is called, it is this list that is merged. * * @param geometry * The geometry to add. * @throws <API key> * In case the merging process has not been started. */ public void addGeometry(Geometry geometry) throws <API key> { if (!busy) { throw new <API key>("Can't add a geometry if no merging process is active."); } geometries.add(geometry); eventBus.fireEvent(new <API key>(geometry)); } /** * Remove a geometry from the merging list again. * * @param geometry * The geometry to remove. * @throws <API key> * In case the merging process has not been started. */ public void removeGeometry(Geometry geometry) throws <API key> { if (!busy) { throw new <API key>("Can't remove a geometry if no merging process is active."); } geometries.remove(geometry); eventBus.fireEvent(new <API key>(geometry)); } /** * Clear the entire list of geometries for merging, basically resetting the process. * * @throws <API key> * In case the merging process has not been started. */ public void clearGeometries() throws <API key> { if (!busy) { throw new <API key>("Can't clear geometry list if no merging process is active."); } for (Geometry geometry : geometries) { eventBus.fireEvent(new <API key>(geometry)); } geometries.clear(); } /** * End the merging process by effectively executing the merge operation and returning the result through a * call-back. * * @param callback * The call-back function that will receive the merged geometry. * @throws <API key> * Thrown in case the merging process has not been started or some other merging error. */ public void stop(final GeometryFunction callback) throws <API key> { if (!busy) { throw new <API key>("Can't stop the merging process since it is not activated."); } if (callback == null) { cancel(); return; } merge(new GeometryFunction() { public void execute(Geometry geometry) { callback.execute(geometry); try { clearGeometries(); } catch (<API key> e) { } busy = false; eventBus.fireEvent(new <API key>(geometry)); } }); } /** * End the merging process without executing the merge operation. This method will simply clean up. * * @throws <API key> * In case the merging process has not been started. */ public void cancel() throws <API key> { clearGeometries(); busy = false; eventBus.fireEvent(new <API key>(null)); } /** * Is the merging process currently active or not? * * @return Is the merging process currently active or not? */ public boolean isBusy() { return busy; } /** * Get the current precision to be used when merging geometries. * * @return The current precision to be used when merging geometries. */ public int getPrecision() { return precision; } /** * Set the precision to be used when merging geometries. Basically there are 2 options: * <ul> * <li>-1: Use a floating point precision model. This is the default value.</li> * <li>&ge; 0: Use a fixed precision model. Know that larger values, although increasingly precise, can run into * robustness problems.</li> * </ul> * * @param precision * The new value. */ public void setPrecision(int precision) { this.precision = precision; } /** * Set the boolean that triggers the usage of the precision value as buffer. * <p><b>Default</b> = false<p> * <p><b>Note</b>: If false all lines and points are ignored during the merging process.<p> * * @param <API key> */ public void <API key>(boolean <API key>) { this.<API key> = <API key>; } /** * Get the boolean that triggers the usage of the precision value as buffer. * * @return <API key> */ public boolean <API key>() { return <API key>; } // Private methods: private void merge(final GeometryFunction callback) { <API key> operationService = new <API key>(); UnionInfo unionInfo = new UnionInfo(); unionInfo.<API key>(true); unionInfo.setPrecision(precision); operationService.union(geometries, unionInfo, new Callback<Geometry, Throwable>() { public void onSuccess(Geometry result) { callback.execute(result); } public void onFailure(Throwable reason) { reason.printStackTrace(); } }); } }
<?php $dictionary['FP_events'] = array( 'table' => 'fp_events', 'audited' => true, 'duplicate_merge' => true, 'fields' => array( 'duration_hours' => array( 'name' => 'duration_hours', 'vname' => 'LBL_DURATION_HOURS', 'type' => 'int', 'group' => 'duration', 'len' => '3', 'comment' => 'Duration (hours)', 'importable' => 'required', 'required' => true, ), 'duration_minutes' => array( 'name' => 'duration_minutes', 'vname' => '<API key>', 'type' => 'int', 'group' => 'duration', 'len' => '2', 'comment' => 'Duration (minutes)', ), 'date_start' => array( 'name' => 'date_start', 'vname' => 'LBL_DATE', 'type' => 'datetimecombo', 'dbType' => 'datetime', 'comment' => 'Date of start of meeting', 'importable' => 'required', 'required' => true, 'enable_range_search' => true, 'options' => '<API key>', 'display_default' => 'now&12:45pm', 'validation' => array('type' => 'isbefore', 'compareto' => 'date_end', 'blank' => false), ), 'date_end' => array( 'name' => 'date_end', 'vname' => 'LBL_DATE_END', 'type' => 'datetimecombo', 'dbType' => 'datetime', 'massupdate' => false, 'comment' => 'Date meeting ends', 'enable_range_search' => true, 'display_default' => 'now&01:45pm', 'options' => '<API key>', ), 'link' => array( 'name' => 'link', 'vname' => 'LBL_RESPONSE_LINK', 'type' => 'varchar', 'source' => 'non-db', 'reportable' => true, ), 'link_declined' => array( 'name' => 'link_declined', 'vname' => '<API key>', 'type' => 'varchar', 'source' => 'non-db', 'reportable' => true, ), 'budget' => array( 'required' => false, 'name' => 'budget', 'vname' => 'LBL_BUDGET', 'type' => 'currency', 'massupdate' => 0, 'no_default' => false, 'comments' => '', 'help' => '', 'importable' => 'true', 'duplicate_merge' => 'disabled', '<API key>' => '0', 'audited' => false, 'reportable' => true, 'unified_search' => false, 'merge_filter' => 'disabled', 'len' => 26, 'size' => '20', 'enable_range_search' => false, 'precision' => 6, ), 'currency_id' => array( 'required' => false, 'name' => 'currency_id', 'vname' => 'LBL_CURRENCY', 'type' => 'currency_id', 'massupdate' => 0, 'no_default' => false, 'comments' => '', 'help' => '', 'importable' => 'true', 'duplicate_merge' => 'disabled', '<API key>' => 0, 'audited' => false, 'reportable' => true, 'unified_search' => false, 'merge_filter' => 'disabled', 'len' => 36, 'size' => '20', 'dbType' => 'id', 'studio' => 'visible', 'function' => array( 'name' => 'getCurrencyDropDown', 'returns' => 'html', 'onListView' => true, ), ), 'duration' => array( 'name' => 'duration', 'vname' => 'LBL_DURATION', 'type' => 'enum', 'options' => 'duration_dom', 'source' => 'non-db', 'comment' => 'Duration handler dropdown', 'massupdate' => false, 'reportable' => false, 'importable' => false, ), 'invite_templates' => array( 'required' => false, 'name' => 'invite_templates', 'vname' => '<API key>', 'type' => 'enum', 'massupdate' => 0, 'no_default' => false, 'comments' => '', 'help' => '', 'importable' => 'true', 'duplicate_merge' => 'disabled', '<API key>' => '0', 'audited' => false, 'reportable' => true, 'unified_search' => false, 'merge_filter' => 'disabled', 'len' => 100, 'size' => '20', 'options' => 'email_templet_list', 'studio' => 'visible', 'dependency' => false, ), 'accept_redirect' => array( 'name' => 'accept_redirect', 'vname' => 'LBL_ACCEPT_REDIRECT', 'type' => 'url', 'massupdate' => '0', 'default' => '', 'no_default' => false, 'comments' => 'Insert a URL to a web page here.', 'help' => 'Insert the URL for the page that you want the event delegates to see when they accept the invitation from the email.', 'importable' => 'true', 'duplicate_merge' => 'disabled', '<API key>' => '0', 'audited' => false, 'reportable' => true, 'unified_search' => false, 'merge_filter' => 'disabled', 'len' => '255', 'size' => '20', 'dbType' => 'varchar', 'gen' => '0', 'link_target' => '_blank', 'id' => '<API key>', ), 'decline_redirect' => array( 'required' => false, 'name' => 'decline_redirect', 'vname' => '<API key>', 'type' => 'url', 'massupdate' => '0', 'default' => null, 'no_default' => false, 'comments' => 'Insert a URL to a web page here.', 'help' => 'Insert the URL for the page that you want the event delegates to see when they have declined the invitation from the email.', 'importable' => 'true', 'duplicate_merge' => 'disabled', '<API key>' => '0', 'audited' => false, 'reportable' => true, 'unified_search' => false, 'merge_filter' => 'disabled', 'len' => '255', 'size' => '20', 'dbType' => 'varchar', 'gen' => null, 'link_target' => '_blank', 'id' => '<API key>', ), 'fp_events_contacts' => array( 'name' => 'fp_events_contacts', 'type' => 'link', 'relationship' => 'fp_events_contacts', 'source' => 'non-db', 'vname' => '<API key>', ), '<API key>' => array( 'name' => '<API key>', 'type' => 'link', 'relationship' => '<API key>', 'source' => 'non-db', 'vname' => '<API key>', ), 'fp_events_leads_1' => array( 'name' => 'fp_events_leads_1', 'type' => 'link', 'relationship' => 'fp_events_leads_1', 'source' => 'non-db', 'vname' => '<API key>', ), '<API key>' => array( 'name' => '<API key>', 'type' => 'link', 'relationship' => '<API key>', 'source' => 'non-db', 'vname' => '<API key>', 'id_name' => '<API key>', ), '<API key>' => array( 'name' => '<API key>', 'type' => 'relate', 'source' => 'non-db', 'vname' => '<API key>', 'save' => true, 'id_name' => '<API key>', 'link' => '<API key>', 'table' => 'fp_event_locations', 'module' => 'FP_Event_Locations', 'rname' => 'name', ), '<API key>' => array( 'name' => '<API key>', 'type' => 'link', 'relationship' => '<API key>', 'source' => 'non-db', 'reportable' => false, 'side' => 'right', 'vname' => '<API key>', ), '<API key>' => array( 'name' => '<API key>', 'vname' => 'LBL_ACTIVITY_STATUS', 'type' => 'enum', 'options' => '<API key>', 'len' => '255', 'default' => '', ), ), 'relationships' => array(), 'optimistic_locking' => true, 'unified_search' => true, ); if (!class_exists('VardefManager')) { require_once('include/SugarObjects/VardefManager.php'); } VardefManager::createVardef('FP_events', 'FP_events', array('basic', 'assignable', 'security_groups'));
#include <assert.h> #include <limits.h> #include <math.h> #include "./vpx_dsp_rtcd.h" #include "vpx_dsp/vpx_dsp_common.h" #include "vpx_scale/yv12config.h" #include "vpx/vpx_integer.h" #include "vp9/common/vp9_reconinter.h" #include "vp9/encoder/vp9_context_tree.h" #include "vp9/encoder/vp9_noise_estimate.h" #include "vp9/encoder/vp9_encoder.h" #if <API key> // For SVC: only do noise estimation on top spatial layer. static INLINE int noise_est_svc(const struct VP9_COMP *const cpi) { return (!cpi->use_svc || (cpi->use_svc && cpi->svc.spatial_layer_id == cpi->svc.<API key> - 1)); } #endif void <API key>(NOISE_ESTIMATE *const ne, int width, int height) { ne->enabled = 0; ne->level = kLowLow; ne->value = 0; ne->count = 0; ne->thresh = 90; ne->last_w = 0; ne->last_h = 0; if (width * height >= 1920 * 1080) { ne->thresh = 200; } else if (width * height >= 1280 * 720) { ne->thresh = 140; } else if (width * height >= 640 * 360) { ne->thresh = 115; } ne->num_frames_estimate = 15; } static int <API key>(VP9_COMP *const cpi) { #if <API key> if (cpi->common.use_highbitdepth) return 0; #endif // Enable noise estimation if denoising is on. #if <API key> if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi) && cpi->common.width >= 320 && cpi->common.height >= 180) return 1; #endif // Only allow noise estimate under certain encoding mode. // Enabled for 1 pass CBR, speed >=5, and if resolution is same as original. // Not enabled for SVC mode and screen_content_mode. // Not enabled for low resolutions. if (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR && cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cpi->oxcf.speed >= 5 && cpi->resize_state == ORIG && cpi->resize_pending == 0 && !cpi->use_svc && cpi->oxcf.content != VP9E_CONTENT_SCREEN && cpi->common.width * cpi->common.height >= 640 * 360) return 1; else return 0; } #if <API key> static void copy_frame(YV12_BUFFER_CONFIG *const dest, const YV12_BUFFER_CONFIG *const src) { int r; const uint8_t *srcbuf = src->y_buffer; uint8_t *destbuf = dest->y_buffer; assert(dest->y_width == src->y_width); assert(dest->y_height == src->y_height); for (r = 0; r < dest->y_height; ++r) { memcpy(destbuf, srcbuf, dest->y_width); destbuf += dest->y_stride; srcbuf += src->y_stride; } } #endif // <API key> NOISE_LEVEL <API key>(NOISE_ESTIMATE *const ne) { int noise_level = kLowLow; if (ne->value > (ne->thresh << 1)) { noise_level = kHigh; } else { if (ne->value > ne->thresh) noise_level = kMedium; else if (ne->value > ((9 * ne->thresh) >> 4)) noise_level = kLow; else noise_level = kLowLow; } return noise_level; } void <API key>(VP9_COMP *const cpi) { const VP9_COMMON *const cm = &cpi->common; NOISE_ESTIMATE *const ne = &cpi->noise_estimate; const int low_res = (cm->width <= 352 && cm->height <= 288); // Estimate of noise level every frame_period frames. int frame_period = 8; int <API key> = 6; unsigned int thresh_sum_diff = 100; unsigned int thresh_sum_spatial = (200 * 200) << 8; unsigned int thresh_spatial_var = (32 * 32) << 8; int min_blocks_estimate = cm->mi_rows * cm->mi_cols >> 7; int frame_counter = cm->current_video_frame; // Estimate is between current source and last source. YV12_BUFFER_CONFIG *last_source = cpi->Last_Source; #if <API key> if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi)) { last_source = &cpi->denoiser.last_source; // Tune these thresholds for different resolutions when denoising is // enabled. if (cm->width > 640 && cm->width < 1920) { <API key> = 4; thresh_sum_diff = 200; thresh_sum_spatial = (120 * 120) << 8; thresh_spatial_var = (48 * 48) << 8; } } #endif ne->enabled = <API key>(cpi); if (cpi->svc.<API key> > 1) frame_counter = cpi->svc.current_superframe; if (!ne->enabled || frame_counter % frame_period != 0 || last_source == NULL || (cpi->svc.<API key> == 1 && (ne->last_w != cm->width || ne->last_h != cm->height))) { #if <API key> if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi)) copy_frame(&cpi->denoiser.last_source, cpi->Source); #endif if (last_source != NULL) { ne->last_w = cm->width; ne->last_h = cm->height; } return; } else if (cm->current_video_frame > 60 && cpi->rc.<API key> < (low_res ? 70 : 50)) { // Force noise estimation to 0 and denoiser off if content has high motion. ne->level = kLowLow; ne->count = 0; ne->num_frames_estimate = 10; #if <API key> if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi) && cpi->svc.current_superframe > 1) { <API key>(&cpi->denoiser, ne->level); copy_frame(&cpi->denoiser.last_source, cpi->Source); } #endif return; } else { int num_samples = 0; uint64_t avg_est = 0; int bsize = BLOCK_16X16; static const unsigned char const_source[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Loop over sub-sample of 16x16 blocks of frame, and for blocks that have // been encoded as zero/small mv at least x consecutive frames, compute // the variance to update estimate of noise in the source. const uint8_t *src_y = cpi->Source->y_buffer; const int src_ystride = cpi->Source->y_stride; const uint8_t *last_src_y = last_source->y_buffer; const int last_src_ystride = last_source->y_stride; const uint8_t *src_u = cpi->Source->u_buffer; const uint8_t *src_v = cpi->Source->v_buffer; const int src_uvstride = cpi->Source->uv_stride; int mi_row, mi_col; int num_low_motion = 0; int frame_low_motion = 1; for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) { for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) { int bl_index = mi_row * cm->mi_cols + mi_col; if (cpi->consec_zero_mv[bl_index] > <API key>) num_low_motion++; } } if (num_low_motion < ((3 * cm->mi_rows * cm->mi_cols) >> 3)) frame_low_motion = 0; for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) { for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) { // 16x16 blocks, 1/4 sample of frame. if (mi_row % 4 == 0 && mi_col % 4 == 0 && mi_row < cm->mi_rows - 1 && mi_col < cm->mi_cols - 1) { int bl_index = mi_row * cm->mi_cols + mi_col; int bl_index1 = bl_index + 1; int bl_index2 = bl_index + cm->mi_cols; int bl_index3 = bl_index2 + 1; int consec_zeromv = VPXMIN(cpi->consec_zero_mv[bl_index], VPXMIN(cpi->consec_zero_mv[bl_index1], VPXMIN(cpi->consec_zero_mv[bl_index2], cpi->consec_zero_mv[bl_index3]))); // Only consider blocks that are likely steady background. i.e, have // been encoded as zero/low motion x (= <API key>) frames // in a row. consec_zero_mv[] defined for 8x8 blocks, so consider all // 4 sub-blocks for 16x16 block. Also, avoid skin blocks. if (frame_low_motion && consec_zeromv > <API key>) { int is_skin = 0; if (cpi->use_skin_detection) { is_skin = <API key>(src_y, src_u, src_v, src_ystride, src_uvstride, bsize, consec_zeromv, 0); } if (!is_skin) { unsigned int sse; // Compute variance. unsigned int variance = cpi->fn_ptr[bsize].vf( src_y, src_ystride, last_src_y, last_src_ystride, &sse); // Only consider this block as valid for noise measurement if the // average term (sse - variance = N * avg^{2}, N = 16X16) of the // temporal residual is small (avoid effects from lighting // change). if ((sse - variance) < thresh_sum_diff) { unsigned int sse2; const unsigned int spatial_variance = cpi->fn_ptr[bsize].vf( src_y, src_ystride, const_source, 0, &sse2); // Avoid blocks with high brightness and high spatial variance. if ((sse2 - spatial_variance) < thresh_sum_spatial && spatial_variance < thresh_spatial_var) { avg_est += low_res ? variance >> 4 : variance / ((spatial_variance >> 9) + 1); num_samples++; } } } } } src_y += 8; last_src_y += 8; src_u += 4; src_v += 4; } src_y += (src_ystride << 3) - (cm->mi_cols << 3); last_src_y += (last_src_ystride << 3) - (cm->mi_cols << 3); src_u += (src_uvstride << 2) - (cm->mi_cols << 2); src_v += (src_uvstride << 2) - (cm->mi_cols << 2); } ne->last_w = cm->width; ne->last_h = cm->height; // Update noise estimate if we have at a minimum number of block samples, // and avg_est > 0 (avg_est == 0 can happen if the application inputs // duplicate frames). if (num_samples > min_blocks_estimate && avg_est > 0) { // Normalize. avg_est = avg_est / num_samples; // Update noise estimate. ne->value = (int)((15 * ne->value + avg_est) >> 4); ne->count++; if (ne->count == ne->num_frames_estimate) { // Reset counter and check noise level condition. ne->num_frames_estimate = 30; ne->count = 0; ne->level = <API key>(ne); #if <API key> if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi)) <API key>(&cpi->denoiser, ne->level); #endif } } } #if <API key> if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi)) copy_frame(&cpi->denoiser.last_source, cpi->Source); #endif }
<!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <title lang="en">Rgaa22 Test.9.8 Passed 04 (Some text is written here in english and is long enough to enable the language determination (more than twenty words)</title> </head> <body> <div> <h1 lang="en">Rgaa22 Test.9.8 Passed 04 (Some text is written here in english and is long enough to enable the language determination (more than twenty words)</h1> <div lang="fr"> <div class="test-detail" > Présence d’une langue de traitement </div> <p>Du texte en français est ajouté pour rendre la détection de ce bloc sur lequel l'attribut lang est défini fiable </p> </div> <p class="test-explanation" lang="en"> Passed: the lang attribute is provided for all the textuals tags (Some text is written here in english and is long enough to enable the language determination (more than twenty words) </p> </div> </body> </html>
# -*- coding: utf-8 -*- # OpenERP, Open Source Management Solution # This program is free software: you can redistribute it and/or modify # published by the Free Software Foundation, either version 3 of the # This program is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the from osv import osv, fields class res_company(osv.osv): _name = "res.company" _inherit = 'res.company' _columns = { 'currency2_id' : fields.many2one('res.currency', string="Secondary Currency"), }
package org.geomajas.gwt.example.client.sample.mapwidget; import com.google.gwt.core.client.GWT; import org.geomajas.gwt.example.base.SamplePanel; import org.geomajas.gwt.example.base.SamplePanelFactory; import org.geomajas.gwt.client.controller.PanController; import org.geomajas.gwt.client.map.MapView.ZoomOption; import org.geomajas.gwt.client.spatial.Bbox; import org.geomajas.gwt.client.widget.MapWidget; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; import org.geomajas.gwt.example.client.sample.i18n.SampleMessages; /** * <p> * Sample that shows how to enable/disable maxBounds. * </p> * * @author Frank Wynants */ public class <API key> extends SamplePanel { private static final SampleMessages MESSAGES = GWT.create(SampleMessages.class); private boolean <API key>; private Bbox maxBounds; public static final String TITLE = "MaxBoundsToggle"; public static final SamplePanelFactory FACTORY = new SamplePanelFactory() { public SamplePanel createPanel() { return new <API key>(); } }; public Canvas getViewPanel() { final Bbox belgiumBounds = new Bbox(135977.5229612165, 6242678.930647222, 679887.6148060877, 625824.2623034349); VLayout layout = new VLayout(); layout.setWidth100(); layout.setHeight100(); layout.setMembersMargin(10); HLayout mapLayout = new HLayout(); mapLayout.setShowEdges(true); mapLayout.setHeight("60%"); // Map with ID mapOsm is defined in the XML configuration. (mapOsm.xml) final MapWidget map = new MapWidget("mapOsm", "gwtExample"); map.setController(new PanController(map)); mapLayout.addMember(map); HLayout buttonLayout = new HLayout(); buttonLayout.setMembersMargin(10); // Create a button to toggle bounds between the whole world an Belgium final IButton butToggleMaxBounds = new IButton(MESSAGES.<API key>()); butToggleMaxBounds.setWidth100(); buttonLayout.addMember(butToggleMaxBounds); butToggleMaxBounds.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (<API key>) { // switch to whole world bounds <API key> = false; map.getMapModel().getMapView().setMaxBounds(maxBounds); // apply the bounds to indicate to the user that something has changed map.getMapModel().getMapView().applyBounds(maxBounds, ZoomOption.LEVEL_FIT); butToggleMaxBounds.setTitle(MESSAGES.<API key>()); } else { // switch to Belgium bounds if (maxBounds == null) { // First we save the World bounds: maxBounds = map.getMapModel().getMapView().getMaxBounds(); } map.getMapModel().getMapView().setMaxBounds(belgiumBounds); // force a new scale level so we go inside the bounding box of Belgium map.getMapModel().getMapView().applyBounds(belgiumBounds, ZoomOption.LEVEL_FIT); <API key> = true; butToggleMaxBounds.setTitle(MESSAGES.<API key>()); } } }); layout.addMember(mapLayout); layout.addMember(buttonLayout); return layout; } public String getDescription() { return MESSAGES.<API key>(); } public String[] <API key>() { return new String[] { "classpath:org/geomajas/gwt/example/context/mapOsm.xml", "classpath:org/geomajas/gwt/example/base/layerOsm.xml" }; } public String ensureUserLoggedIn() { return "luc"; } }
#include <assert.h> #include <stdlib.h> #include "./vpx_dsp_rtcd.h" #include "vpx/vpx_integer.h" const int16_t vpx_rv[] = { 8, 5, 2, 2, 8, 12, 4, 9, 8, 3, 0, 3, 9, 0, 0, 0, 8, 3, 14, 4, 10, 1, 11, 14, 1, 14, 9, 6, 12, 11, 8, 6, 10, 0, 0, 8, 9, 0, 3, 14, 8, 11, 13, 4, 2, 9, 0, 3, 9, 6, 1, 2, 3, 14, 13, 1, 8, 2, 9, 7, 3, 3, 1, 13, 13, 6, 6, 5, 2, 7, 11, 9, 11, 8, 7, 3, 2, 0, 13, 13, 14, 4, 12, 5, 12, 10, 8, 10, 13, 10, 4, 14, 4, 10, 0, 8, 11, 1, 13, 7, 7, 14, 6, 14, 13, 2, 13, 5, 4, 4, 0, 10, 0, 5, 13, 2, 12, 7, 11, 13, 8, 0, 4, 10, 7, 2, 7, 2, 2, 5, 3, 4, 7, 3, 3, 14, 14, 5, 9, 13, 3, 14, 3, 6, 3, 0, 11, 8, 13, 1, 13, 1, 12, 0, 10, 9, 7, 6, 2, 8, 5, 2, 13, 7, 1, 13, 14, 7, 6, 7, 9, 6, 10, 11, 7, 8, 7, 5, 14, 8, 4, 4, 0, 8, 7, 10, 0, 8, 14, 11, 3, 12, 5, 7, 14, 3, 14, 5, 2, 6, 11, 12, 12, 8, 0, 11, 13, 1, 2, 0, 5, 10, 14, 7, 8, 0, 4, 11, 0, 8, 0, 3, 10, 5, 8, 0, 11, 6, 7, 8, 10, 7, 13, 9, 2, 5, 1, 5, 10, 2, 4, 3, 5, 6, 10, 8, 9, 4, 11, 14, 0, 10, 0, 5, 13, 2, 12, 7, 11, 13, 8, 0, 4, 10, 7, 2, 7, 2, 2, 5, 3, 4, 7, 3, 3, 14, 14, 5, 9, 13, 3, 14, 3, 6, 3, 0, 11, 8, 13, 1, 13, 1, 12, 0, 10, 9, 7, 6, 2, 8, 5, 2, 13, 7, 1, 13, 14, 7, 6, 7, 9, 6, 10, 11, 7, 8, 7, 5, 14, 8, 4, 4, 0, 8, 7, 10, 0, 8, 14, 11, 3, 12, 5, 7, 14, 3, 14, 5, 2, 6, 11, 12, 12, 8, 0, 11, 13, 1, 2, 0, 5, 10, 14, 7, 8, 0, 4, 11, 0, 8, 0, 3, 10, 5, 8, 0, 11, 6, 7, 8, 10, 7, 13, 9, 2, 5, 1, 5, 10, 2, 4, 3, 5, 6, 10, 8, 9, 4, 11, 14, 3, 8, 3, 7, 8, 5, 11, 4, 12, 3, 11, 9, 14, 8, 14, 13, 4, 3, 1, 2, 14, 6, 5, 4, 4, 11, 4, 6, 2, 1, 5, 8, 8, 12, 13, 5, 14, 10, 12, 13, 0, 9, 5, 5, 11, 10, 13, 9, 10, 13, }; void <API key>(unsigned char *src_ptr, unsigned char *dst_ptr, int src_pixels_per_line, int dst_pixels_per_line, int cols, unsigned char *f, int size) { unsigned char *p_src, *p_dst; int row; int col; unsigned char v; unsigned char d[4]; assert(size >= 8); assert(cols >= 8); for (row = 0; row < size; row++) { /* post_proc_down for one row */ p_src = src_ptr; p_dst = dst_ptr; for (col = 0; col < cols; col++) { unsigned char p_above2 = p_src[col - 2 * src_pixels_per_line]; unsigned char p_above1 = p_src[col - src_pixels_per_line]; unsigned char p_below1 = p_src[col + src_pixels_per_line]; unsigned char p_below2 = p_src[col + 2 * src_pixels_per_line]; v = p_src[col]; if ((abs(v - p_above2) < f[col]) && (abs(v - p_above1) < f[col]) && (abs(v - p_below1) < f[col]) && (abs(v - p_below2) < f[col])) { unsigned char k1, k2, k3; k1 = (p_above2 + p_above1 + 1) >> 1; k2 = (p_below2 + p_below1 + 1) >> 1; k3 = (k1 + k2 + 1) >> 1; v = (k3 + v + 1) >> 1; } p_dst[col] = v; } /* now post_proc_across */ p_src = dst_ptr; p_dst = dst_ptr; p_src[-2] = p_src[-1] = p_src[0]; p_src[cols] = p_src[cols + 1] = p_src[cols - 1]; for (col = 0; col < cols; col++) { v = p_src[col]; if ((abs(v - p_src[col - 2]) < f[col]) && (abs(v - p_src[col - 1]) < f[col]) && (abs(v - p_src[col + 1]) < f[col]) && (abs(v - p_src[col + 2]) < f[col])) { unsigned char k1, k2, k3; k1 = (p_src[col - 2] + p_src[col - 1] + 1) >> 1; k2 = (p_src[col + 2] + p_src[col + 1] + 1) >> 1; k3 = (k1 + k2 + 1) >> 1; v = (k3 + v + 1) >> 1; } d[col & 3] = v; if (col >= 2) p_dst[col - 2] = d[(col - 2) & 3]; } /* handle the last two pixels */ p_dst[col - 2] = d[(col - 2) & 3]; p_dst[col - 1] = d[(col - 1) & 3]; /* next row */ src_ptr += src_pixels_per_line; dst_ptr += dst_pixels_per_line; } } void <API key>(unsigned char *src, int pitch, int rows, int cols, int flimit) { int r, c, i; unsigned char *s = src; unsigned char d[16]; for (r = 0; r < rows; r++) { int sumsq = 16; int sum = 0; for (i = -8; i < 0; i++) s[i] = s[0]; /* 17 avoids valgrind warning - we buffer values in c in d * and only write them when we've read 8 ahead... */ for (i = 0; i < 17; i++) s[i + cols] = s[cols - 1]; for (i = -8; i <= 6; i++) { sumsq += s[i] * s[i]; sum += s[i]; d[i + 8] = 0; } for (c = 0; c < cols + 8; c++) { int x = s[c + 7] - s[c - 8]; int y = s[c + 7] + s[c - 8]; sum += x; sumsq += x * y; d[c & 15] = s[c]; if (sumsq * 15 - sum * sum < flimit) { d[c & 15] = (8 + sum + s[c]) >> 4; } s[c - 8] = d[(c - 8) & 15]; } s += pitch; } } void <API key>(unsigned char *dst, int pitch, int rows, int cols, int flimit) { int r, c, i; for (c = 0; c < cols; c++) { unsigned char *s = &dst[c]; int sumsq = 0; int sum = 0; unsigned char d[16]; for (i = -8; i < 0; i++) s[i * pitch] = s[0]; /* 17 avoids valgrind warning - we buffer values in c in d * and only write them when we've read 8 ahead... */ for (i = 0; i < 17; i++) s[(i + rows) * pitch] = s[(rows - 1) * pitch]; for (i = -8; i <= 6; i++) { sumsq += s[i * pitch] * s[i * pitch]; sum += s[i * pitch]; } for (r = 0; r < rows + 8; r++) { sumsq += s[7 * pitch] * s[7 * pitch] - s[-8 * pitch] * s[-8 * pitch]; sum += s[7 * pitch] - s[-8 * pitch]; d[r & 15] = s[0]; if (sumsq * 15 - sum * sum < flimit) { d[r & 15] = (vpx_rv[(r & 127) + (c & 7)] + sum + s[0]) >> 4; } if (r >= 8) s[-8 * pitch] = d[(r - 8) & 15]; s += pitch; } } }
//{namespace name=backend/product_feed/view/feed} /** * Shopware UI - Product Feed list main window. * * Default feed list view. Extends a grid view. */ //{block name="backend/product_feed/view/feed/list"} Ext.define('Shopware.apps.ProductFeed.view.feed.List', { extend:'Ext.grid.Panel', border: false, alias:'widget.<API key>', region:'center', autoScroll:true, store:'List', ui:'shopware-ui', /** * Initialize the Shopware.apps.Customer.view.main.List and defines the necessary * default configuration */ initComponent:function () { var me = this; me.registerEvents(); me.columns = me.getColumns(); me.toolbar = me.getToolbar(); me.pagingbar = me.getPagingBar(); me.store = me.listStore; me.dockedItems = [ me.toolbar, me.pagingbar ]; me.callParent(arguments); }, /** * Defines additional events which will be * fired from the component * * @return void */ registerEvents:function () { this.addEvents( /** * Event will be fired when the user clicks the delete icon in the * action column * * @event deleteColumn * @param [object] View - Associated Ext.view.Table * @param [integer] rowIndex - Row index * @param [integer] colIndex - Column index * @param [object] item - Associated HTML DOM node */ 'deleteColumn', /** * Event will be fired when the user clicks the delete icon in the * action column * * @event deleteColumn * @param [object] View - Associated Ext.view.Table * @param [integer] rowIndex - Row index * @param [integer] colIndex - Column index * @param [object] item - Associated HTML DOM node */ 'editColumn', /** * Event will be fired when the user clicks the duplicate icon in the * action column * * @event duplicateColumn * @param [object] View - Associated Ext.view.Table * @param [integer] rowIndex - Row index * @param [integer] colIndex - Column index * @param [object] item - Associated HTML DOM node */ 'duplicateColumn', /** * Event will be fired when the user clicks the exectue icon in the * action column * * @event executeFeed * @param [object] View - Associated Ext.view.Table * @param [integer] rowIndex - Row index * @param [integer] colIndex - Column index * @param [object] item - Associated HTML DOM node */ 'executeFeed' ); return true; }, /** * Creates the grid columns * * @return [array] grid columns */ getColumns:function () { var me = this; var columnsData = [ { header:'{s name=list/column/title}Title{/s}', dataIndex:'name', flex:1 }, { header:'{s name=list/column/file_name}File name{/s}', dataIndex:'fileName', renderer:me.fileNameRenderer, flex:1 }, { header:'{s name=list/column/count_articles}Number of articles{/s}', dataIndex:'countArticles', flex:1 }, { header:'{s name=list/column/last_export}Last export{/s}', dataIndex:'lastExport', flex:1, renderer : me.onDateRenderer }, { xtype:'actioncolumn', width:110, items:me.<API key>() } ]; return columnsData; }, onDateRenderer : function(value) { //console.log(value); if(!value) { return; } return Ext.util.Format.date(value) + ' ' + Ext.util.Format.date(value, 'H:i:s'); }, /** * Creates the items of the action column * * @return [array] action column itesm */ <API key>: function () { var me = this, actionColumnData = []; /*{if {acl_is_allowed privilege=update}}*/ actionColumnData.push({ iconCls:'sprite-pencil', cls:'editBtn', tooltip:'{s name=list/action_column/edit}Edit this product feed{/s}', handler:function (view, rowIndex, colIndex, item) { me.fireEvent('editColumn', view, rowIndex, colIndex, item); } }); /*{if {acl_is_allowed privilege=delete}}*/ actionColumnData.push({ iconCls:'<API key>', action:'delete', cls:'delete', tooltip:'{s name=list/action_column/delete}Delete this feed{/s}', handler:function (view, rowIndex, colIndex, item) { me.fireEvent('deleteColumn', view, rowIndex, colIndex, item); } }); /*{if {acl_is_allowed privilege=create}}*/ actionColumnData.push({ iconCls:'<API key>', cls:'duplicate', tooltip:'{s name=list/action_column/duplicate}Duplicate this feed{/s}', handler:function (view, rowIndex, colIndex, item) { me.fireEvent('duplicateColumn', view, rowIndex, colIndex, item); } }); /*{if {acl_is_allowed privilege=generate}}*/ actionColumnData.push({ iconCls:'sprite-lightning', cls:'arrow-lightning', tooltip:'{s name=list/action_column/execute}Execute feed{/s}', handler:function (view, rowIndex, colIndex, item) { me.fireEvent('executeFeed', view, rowIndex, colIndex, item); } }); return actionColumnData; }, /** * Creates the grid toolbar with the add and delete button * * @return [Ext.toolbar.Toolbar] grid toolbar */ getToolbar:function () { return Ext.create('Ext.toolbar.Toolbar', { dock:'top', ui:'shopware-ui', items:[ /*{if {acl_is_allowed privilege=create}}*/ { iconCls:'sprite-plus-circle', text:'{s name=list/button/add}Add{/s}', action:'add' } ] }); }, /** * Creates the paging toolbar for the product feed grid to allow * and store paging. The paging toolbar uses the same store as the Grid * * @return Ext.toolbar.Paging The paging toolbar for the customer grid */ getPagingBar: function () { var me = this; return Ext.create('Ext.toolbar.Paging', { store:me.listStore, dock:'bottom', displayInfo:true }); }, /** * Formats the Filename Column and adds a Link to the Feed * * @param [string] - The order time value * @return [string] - The passed value */ fileNameRenderer:function (value, p, record) { /*{if {acl_is_allowed privilege=generate}}*/ return '<a href="{url controller=export}' + '/index/'+record.get('fileName')+ '?feedID='+record.get('id')+'&hash='+ record.get('hash') + '" target="_blank">' + value + '</a>'; /*{else}*/ return value; } }); //{/block}
require 'spec_helper' module Lti describe <API key> do describe '#create' do it 'creates a RegistrationRequest' do enable_cache do reg_request = described_class.create_request('profile_url', 'return_url') reg_request.lti_version.should == 'LTI-2p0' reg_request.<API key>.should == 'iframe' reg_request.tc_profile_url.should == 'profile_url' end end it 'writes the reg password to the cache' do enable_cache do IMS::LTI::Models::Messages::RegistrationRequest.any_instance.expects(:<API key>). returns(['key', 'password']) Rails.cache.expects(:write).with('<API key>/key', 'password', anything) described_class.create_request('profile_url', 'return_url') end end it 'generates the cache key' do described_class.req_cache_key('reg_key').should == '<API key>/reg_key' end end end end
package org.opennms.features.reporting.model.jasperreport; import javax.xml.bind.annotation.XmlAttribute; public interface <API key> { @XmlAttribute(name = "id") public abstract String getId(); @XmlAttribute(name = "template") public abstract String getTemplate(); @XmlAttribute(name = "engine") public abstract String getEngine(); public abstract void setId(String id); public abstract void setTemplate(String template); public abstract void setEngine(String engine); }
<?php namespace pocketmine\event\inventory; use pocketmine\event\block\BlockEvent; use pocketmine\event\Cancellable; use pocketmine\item\Item; use pocketmine\tile\Furnace; class FurnaceBurnEvent extends BlockEvent implements Cancellable{ public static $handlerList = null; private $furnace; private $fuel; private $burnTime; private $burning = true; public function __construct(Furnace $furnace, Item $fuel, $burnTime){ parent::__construct($furnace->getBlock()); $this->fuel = $fuel; $this->burnTime = (int) $burnTime; $this->furnace = $furnace; } /** * @return Furnace */ public function getFurnace(){ return $this->furnace; } /** * @return Item */ public function getFuel(){ return $this->fuel; } /** * @return int */ public function getBurnTime(){ return $this->burnTime; } /** * @param int $burnTime */ public function setBurnTime($burnTime){ $this->burnTime = (int) $burnTime; } /** * @return bool */ public function isBurning(){ return $this->burning; } /** * @param bool $burning */ public function setBurning($burning){ $this->burning = (bool) $burning; } /** * @return EventName|string */ public function getName(){ return "FurnaceBurnEvent"; } }
<!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Rgaa30 Test.12-6-3 Passed 01</title> </head> <body> <div> <h1>Rgaa30 Test.12-6-3 Passed 01</h1> <div class="test-detail" lang="fr"> Dans chaque ensemble de pages, la fonctionnalité vers le <a href="http://references.modernisation.gouv.fr/<API key> </div> <div class="testcase"> </div> <div class="test-explanation"> Passed. </div> </div> </body> </html>
#ifndef <API key> #define <API key> #include <glib.h> #include <glib-object.h> #include <krb5.h> #include "goaidentityinquiry.h" G_BEGIN_DECLS #define <API key> (<API key> ()) #define <API key>(obj) (<API key> ((obj), <API key>, GoaKerberosIdentity)) #define <API key>(klass) (<API key> ((klass), <API key>, <API key>)) #define <API key>(obj) (<API key> ((obj), <API key>)) #define <API key>(klass) (<API key> ((klass), <API key>)) #define <API key>(obj) (<API key>((obj), <API key>, <API key>)) typedef struct <API key> GoaKerberosIdentity; typedef struct <API key> <API key>; typedef struct <API key> <API key>; typedef enum <API key> <API key>; enum <API key> { <API key>, <API key>, <API key> }; struct <API key> { GObject parent; <API key> *priv; }; struct <API key> { GObjectClass parent_class; }; GType <API key> (void); GoaIdentity *<API key> (krb5_context kerberos_context, krb5_ccache cache, GError **error); gboolean <API key> (GoaKerberosIdentity *self, const char *principal_name, gconstpointer initial_password, const char *preauth_source, <API key> flags, <API key> inquiry_func, gpointer inquiry_data, GDestroyNotify destroy_notify, GCancellable *cancellable, GError **error); void <API key> (GoaKerberosIdentity *identity, GoaKerberosIdentity *new_identity); gboolean <API key> (GoaKerberosIdentity *self, GError **error); gboolean <API key> (GoaKerberosIdentity *self, GError **error); char *<API key> (GoaKerberosIdentity *self); char *<API key> (GoaKerberosIdentity *self); char *<API key><API key> (GoaKerberosIdentity *self); G_END_DECLS #endif /* <API key> */
#ifndef _GADGET_RUMBLE_H_ #define _GADGET_RUMBLE_H_ #include <gadget/gadgetConfig.h> #include <vector> #include <boost/concept_check.hpp> /* for <API key> */ #include <boost/noncopyable.hpp> #include <boost/signal.hpp> #include <cppdom/cppdom.h> #include <vpr/Util/SignalProxy.h> #include <vpr/IO/SerializableObject.h> #include <jccl/Config/ConfigElementPtr.h> #include <gadget/Type/RumblePtr.h> #include <gadget/Type/RumbleEffect.h> #include <gadget/Type/RumbleEffectPtr.h> namespace gadget { /** \class Rumble Rumble.h gadget/Type/Rumble.h * * Rumble is the abstract base class from which devices supporting rumble * haptic feedback derive. * * @since 2.1.16 */ class GADGET_API Rumble : public vpr::SerializableObject , private boost::noncopyable { protected: /* Constructor/Destructors */ Rumble(); public: /** * Creates a Rumble instance and returns it wrapped in a * RumblePtr object. */ static RumblePtr create(); virtual ~Rumble(); virtual bool config(jccl::ConfigElementPtr e) { boost::<API key>(e); return true; } /** * Gets the supported capabilities in a bitmask. * * @return bitmask defined in Rumble::RumbleType * */ virtual unsigned int getCapabilities() { return 0; } /** * Gets the number of directional axes supported by device. * * @return integer number of axes. * */ virtual int getNumAxes() { return 0; } /** * Gets the number of effects the device can store. * * @return integer number of effects or -1 for error. * */ virtual int getMaxStoredEffects() { return 0; } /** * Gets the number of effects the device can play simultaneously. * * @return integer number of effects or -1 for error. * */ virtual int <API key>() { return 0; } /** * Creates a new effect. * * @param type The type of effect to create. * @param name The name to give the effect. It can be retreeved again * with getEffect(). * @return a pointer to the effect or null if the type is not supported or * the name is not available. * */ RumbleEffectPtr createEffect(RumbleEffect::RumbleType type); /** * Stop all effects. * * @return true for success. * */ virtual bool stopAllEffects() { return false; } /** * Pause/resume effect playback. * * @return true for success. * * @param pause True to pause, false to un-pause * */ virtual bool setPause(const bool pause) { boost::<API key>(pause); return false; } /** * Get pause state. * * @return true for paused, false for un-paused. * */ virtual bool getPaused() { return false; } /** * Required to support serialization interface, does nothing. * * @param writer The object writer to which this object will be * serialized. */ virtual void writeObject(vpr::ObjectWriter* writer) { boost::<API key>(writer); } /** * Required to support serialization interface, does nothing. * * @param reader The object reader from which this object will be * de-serialized. */ virtual void readObject(vpr::ObjectReader* reader) { boost::<API key>(reader); } protected: virtual RumbleEffectPtr createEffectImp(RumbleEffect::RumbleType type) { boost::<API key>(type); return RumbleEffectPtr(); } private: static const std::string sTypeName; }; } // End of gadget namespace #endif /* _GADGET_RUMBLE_H_ */
// CombinedImageTag.cs: The class provides an abstraction to combine // ImageTags. // Mike Gemuende (mike@gemuende.de) // Paul Lange (palango@gmx.de) // This library is free software; you can redistribute it and/or modify // 2.1 as published by the Free Software Foundation. // This library is distributed in the hope that it will be useful, but // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // You should have received a copy of the GNU Lesser General Public // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA using System; using System.Collections.Generic; using TagLib.IFD; using TagLib.Xmp; namespace TagLib.Image { <summary> Combines some <see cref="ImageTag"/> instance to behave as one. </summary> public class CombinedImageTag : ImageTag { #region Private Fields <summary> Direct access to the Exif (IFD) tag (if any) </summary> public IFDTag Exif { get; private set; } <summary> Direct access to the Xmp tag (if any) </summary> public XmpTag Xmp { get; private set; } <summary> Other image tags available in this tag. </summary> public List<ImageTag> OtherTags { get; private set; } <summary> Stores the types of the tags, which are allowed for the current instance. </summary> internal TagTypes AllowedTypes { get; private set; } <summary> Returns all image tags in this tag, with XMP and Exif first. </summary> public List<ImageTag> AllTags { get { if (all_tags == null) { all_tags = new List<ImageTag> (); if (Xmp != null) all_tags.Add (Xmp); if (Exif != null) all_tags.Add (Exif); all_tags.AddRange (OtherTags); } return all_tags; } } List<ImageTag> all_tags; #endregion #region Constructors <summary> Constructs and initializes a new instance of <see cref="CombinedImageTag" /> with a restriction on the allowed tag types contained in this combined tag. </summary> <param name="allowedTypes"> A <see cref="TagTypes" /> value, which restricts the types of metadata that can be contained in this combined tag. </param> public CombinedImageTag (TagTypes allowedTypes) { AllowedTypes = allowedTypes; OtherTags = new List<ImageTag> (); } #endregion #region Protected Methods internal void AddTag (ImageTag tag) { if ((tag.TagTypes & AllowedTypes) != tag.TagTypes) throw new Exception ($"Attempted to add {tag.TagTypes} to an image, but the only allowed types are {AllowedTypes}"); if (tag is IFDTag) Exif = tag as IFDTag; else if (tag is XmpTag) { // we treat a IPTC-IIM tag as a XMP tag. However, we prefer the real XMP tag. // See comments in Jpeg/File.cs for what we should do to deal with this properly. if (Xmp != null && (tag is IIM.IIMTag || Xmp is IIM.IIMTag)) { if (!(tag is IIM.IIMTag iimTag)) { iimTag = Xmp as IIM.IIMTag; Xmp = tag as XmpTag; } if (string.IsNullOrEmpty (Xmp.Title)) Xmp.Title = iimTag.Title; if (string.IsNullOrEmpty (Xmp.Creator)) Xmp.Creator = iimTag.Creator; if (string.IsNullOrEmpty (Xmp.Copyright)) Xmp.Copyright = iimTag.Copyright; if (string.IsNullOrEmpty (Xmp.Comment)) Xmp.Comment = iimTag.Comment; if (Xmp.Keywords == null) Xmp.Keywords = iimTag.Keywords; } else { Xmp = tag as XmpTag; } } else OtherTags.Add (tag); all_tags = null; } internal void RemoveTag (ImageTag tag) { if (tag is IFDTag) Exif = null; else if (tag is XmpTag) Xmp = null; else OtherTags.Remove (tag); all_tags = null; } #endregion #region Public Methods (Tag) <summary> Gets the tag types contained in the current instance. </summary> <value> A bitwise combined <see cref="TagLib.TagTypes" /> containing the tag types contained in the current instance. </value> public override TagTypes TagTypes { get { TagTypes types = TagTypes.None; foreach (ImageTag tag in AllTags) types |= tag.TagTypes; return types; } } <summary> Clears all of the child tags. </summary> public override void Clear () { foreach (ImageTag tag in AllTags) tag.Clear (); } #endregion #region Public Properties (ImageTag) <summary> Gets or sets the keywords for the image described by the current instance. </summary> <value> A <see cref="T:string[]" /> containing the keywords of the current instace. </value> public override string[] Keywords { get { foreach (ImageTag tag in AllTags) { string[] value = tag.Keywords; if (value != null && value.Length > 0) return value; } return new string[] { }; } set { foreach (ImageTag tag in AllTags) tag.Keywords = value; } } <summary> Gets or sets the rating for the image described by the current instance. </summary> <value> A <see cref="System.Nullable"/> containing the rating of the current instace. </value> public override uint? Rating { get { foreach (ImageTag tag in AllTags) { uint? value = tag.Rating; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Rating = value; } } <summary> Gets or sets the time when the image, the current instance belongs to, was taken. </summary> <value> A <see cref="System.Nullable"/> with the time the image was taken. </value> public override DateTime? DateTime { get { foreach (ImageTag tag in AllTags) { DateTime? value = tag.DateTime; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.DateTime = value; } } <summary> Gets or sets the orientation of the image described by the current instance. </summary> <value> A <see cref="TagLib.Image.ImageOrientation" /> containing the orienatation of the image </value> public override ImageOrientation Orientation { get { foreach (ImageTag tag in AllTags) { ImageOrientation value = tag.Orientation; if ((uint)value >= 1U && (uint)value <= 8U) return value; } return ImageOrientation.None; } set { foreach (ImageTag tag in AllTags) tag.Orientation = value; } } <summary> Gets or sets the software the image, the current instance belongs to, was created with. </summary> <value> A <see cref="string" /> containing the name of the software the current instace was created with. </value> public override string Software { get { foreach (ImageTag tag in AllTags) { string value = tag.Software; if (!string.IsNullOrEmpty (value)) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Software = value; } } <summary> Gets or sets the latitude of the GPS coordinate the current image was taken. </summary> <value> A <see cref="System.Nullable"/> with the latitude ranging from -90.0 to +90.0 degrees. </value> public override double? Latitude { get { foreach (ImageTag tag in AllTags) { double? value = tag.Latitude; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Latitude = value; } } <summary> Gets or sets the longitude of the GPS coordinate the current image was taken. </summary> <value> A <see cref="System.Nullable"/> with the longitude ranging from -180.0 to +180.0 degrees. </value> public override double? Longitude { get { foreach (ImageTag tag in AllTags) { double? value = tag.Longitude; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Longitude = value; } } <summary> Gets or sets the altitude of the GPS coordinate the current image was taken. The unit is meter. </summary> <value> A <see cref="System.Nullable"/> with the altitude. A positive value is above sea level, a negative one below sea level. The unit is meter. </value> public override double? Altitude { get { foreach (ImageTag tag in AllTags) { double? value = tag.Altitude; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Altitude = value; } } <summary> Gets the exposure time the image, the current instance belongs to, was taken with. </summary> <value> A <see cref="System.Nullable"/> with the exposure time in seconds. </value> public override double? ExposureTime { get { foreach (ImageTag tag in AllTags) { double? value = tag.ExposureTime; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.ExposureTime = value; } } <summary> Gets the FNumber the image, the current instance belongs to, was taken with. </summary> <value> A <see cref="System.Nullable"/> with the FNumber. </value> public override double? FNumber { get { foreach (ImageTag tag in AllTags) { double? value = tag.FNumber; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.FNumber = value; } } <summary> Gets the ISO speed the image, the current instance belongs to, was taken with. </summary> <value> A <see cref="System.Nullable"/> with the ISO speed as defined in ISO 12232. </value> public override uint? ISOSpeedRatings { get { foreach (ImageTag tag in AllTags) { uint? value = tag.ISOSpeedRatings; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.ISOSpeedRatings = value; } } <summary> Gets the focal length the image, the current instance belongs to, was taken with. </summary> <value> A <see cref="System.Nullable"/> with the focal length in millimeters. </value> public override double? FocalLength { get { foreach (ImageTag tag in AllTags) { double? value = tag.FocalLength; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.FocalLength = value; } } <summary> Gets the focal length the image, the current instance belongs to, was taken with, assuming a 35mm film camera. </summary> <value> A <see cref="System.Nullable"/> with the focal length in 35mm equivalent in millimeters. </value> public override uint? <API key> { get { foreach (ImageTag tag in AllTags) { uint? value = tag.<API key>; if (value != null) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.<API key> = value; } } <summary> Gets the manufacture of the recording equipment the image, the current instance belongs to, was taken with. </summary> <value> A <see cref="string" /> with the manufacture name. </value> public override string Make { get { foreach (ImageTag tag in AllTags) { string value = tag.Make; if (!string.IsNullOrEmpty (value)) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Make = value; } } <summary> Gets the model name of the recording equipment the image, the current instance belongs to, was taken with. </summary> <value> A <see cref="string" /> with the model name. </value> public override string Model { get { foreach (ImageTag tag in AllTags) { string value = tag.Model; if (!string.IsNullOrEmpty (value)) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Model = value; } } <summary> Gets or sets the creator of the image. </summary> <value> A <see cref="string" /> with the name of the creator. </value> public override string Creator { get { foreach (ImageTag tag in AllTags) { string value = tag.Creator; if (!string.IsNullOrEmpty (value)) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Creator = value; } } #endregion #region Public Properties (Tag) <summary> Gets and sets the title for the media described by the current instance. </summary> <value> A <see cref="string" /> object containing the title for the media described by the current instance or <see langword="null" /> if no value is present. </value> public override string Title { get { foreach (ImageTag tag in AllTags) { string value = tag.Title; if (!string.IsNullOrEmpty (value)) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Title = value; } } <summary> Gets and sets a user comment on the media represented by the current instance. </summary> <value> A <see cref="string" /> object containing user comments on the media represented by the current instance or <see langword="null" /> if no value is present. </value> public override string Comment { get { foreach (ImageTag tag in AllTags) { string value = tag.Comment; if (!string.IsNullOrEmpty (value)) return value; } return string.Empty; } set { foreach (ImageTag tag in AllTags) tag.Comment = value; } } <summary> Gets and sets the copyright information for the media represented by the current instance. </summary> <value> A <see cref="string" /> object containing the copyright information for the media represented by the current instance or <see langword="null" /> if no value present. </value> public override string Copyright { get { foreach (ImageTag tag in AllTags) { string value = tag.Copyright; if (!string.IsNullOrEmpty (value)) return value; } return null; } set { foreach (ImageTag tag in AllTags) tag.Copyright = value; } } #endregion } }
#if !defined (<API key>) && !defined(<API key>) #error "Only <polkitbackend/polkitbackend.h> can be included directly, this file may disappear or change contents." #endif #ifndef <API key> #define <API key> #include <glib-object.h> #include <polkitbackend/polkitbackendtypes.h> #include <polkitbackend/<API key>.h> G_BEGIN_DECLS #define <API key> (<API key> ()) #define <API key>(o) (<API key> ((o), <API key>, <API key>)) #define <API key>(k) (<API key> ((k), <API key>, <API key>)) #define <API key>(o) (<API key> ((o), <API key>,<API key>)) #define <API key>(o) (<API key> ((o), <API key>)) #define <API key>(k) (<API key> ((k), <API key>)) typedef struct <API key> <API key>; /** * <API key>: * * The #<API key> struct should not be accessed directly. */ struct <API key> { /*< private >*/ <API key> parent_instance; }; /** * <API key>: * @parent_class: The parent class. * @<API key>: Returns list of identities for administrator authentication or %NULL to use the default * implementation. See <API key><API key>() for details. * @<API key>: Checks for an authorization or %NULL to use the default implementation. * See <API key><API key>() for details. * * Class structure for #<API key>. */ struct <API key> { /*< public >*/ <API key> parent_class; /* VTable */ GList * (*<API key>) (<API key> *authority, PolkitSubject *caller, PolkitSubject *subject, PolkitIdentity *user_for_subject, gboolean subject_is_local, gboolean subject_is_active, const gchar *action_id, PolkitDetails *details); <API key> (*<API key>) (<API key> *authority, PolkitSubject *caller, PolkitSubject *subject, PolkitIdentity *user_for_subject, gboolean subject_is_local, gboolean subject_is_active, const gchar *action_id, PolkitDetails *details, <API key> implicit); /*< private >*/ /* Padding for future expansion */ void (*_polkit_reserved1) (void); void (*_polkit_reserved2) (void); void (*_polkit_reserved3) (void); void (*_polkit_reserved4) (void); void (*_polkit_reserved5) (void); void (*_polkit_reserved6) (void); void (*_polkit_reserved7) (void); void (*_polkit_reserved8) (void); void (*_polkit_reserved9) (void); void (*_polkit_reserved10) (void); void (*_polkit_reserved11) (void); void (*_polkit_reserved12) (void); void (*_polkit_reserved13) (void); void (*_polkit_reserved14) (void); void (*_polkit_reserved15) (void); void (*_polkit_reserved16) (void); void (*_polkit_reserved17) (void); void (*_polkit_reserved18) (void); void (*_polkit_reserved19) (void); void (*_polkit_reserved20) (void); void (*_polkit_reserved21) (void); void (*_polkit_reserved22) (void); void (*_polkit_reserved23) (void); void (*_polkit_reserved24) (void); void (*_polkit_reserved25) (void); void (*_polkit_reserved26) (void); void (*_polkit_reserved27) (void); void (*_polkit_reserved28) (void); void (*_polkit_reserved29) (void); void (*_polkit_reserved30) (void); void (*_polkit_reserved31) (void); void (*_polkit_reserved32) (void); }; GType <API key> (void) G_GNUC_CONST; GList *<API key><API key> (<API key> *authority, PolkitSubject *caller, PolkitSubject *subject, PolkitIdentity *user_for_subject, gboolean subject_is_local, gboolean subject_is_active, const gchar *action_id, PolkitDetails *details); <API key> <API key><API key> ( <API key> *authority, PolkitSubject *caller, PolkitSubject *subject, PolkitIdentity *user_for_subject, gboolean subject_is_local, gboolean subject_is_active, const gchar *action_id, PolkitDetails *details, <API key> implicit); G_END_DECLS #endif /* <API key> */
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>LCOV - doc-coverage.info - Cqrs/Domain/Exceptions/<API key>.cs</title> <link rel="stylesheet" type="text/css" href="../../../gcov.css"> </head> <body> <table width="100%" border=0 cellspacing=0 cellpadding=0> <tr><td class="title">LCOV - code coverage report</td></tr> <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> <tr> <td width="100%"> <table cellpadding=1 border=0 width="100%"> <tr> <td width="10%" class="headerItem">Current view:</td> <td width="35%" class="headerValue"><a href="../../../index.html">top level</a> - <a href="index.html">Cqrs/Domain/Exceptions</a> - <API key>.cs</td> <td width="5%"></td> <td width="15%"></td> <td width="10%" class="headerCovTableHead">Hit</td> <td width="10%" class="headerCovTableHead">Total</td> <td width="15%" class="headerCovTableHead">Coverage</td> </tr> <tr> <td class="headerItem">Test:</td> <td class="headerValue">doc-coverage.info</td> <td></td> <td class="headerItem">Lines:</td> <td class="headerCovTableEntry">0</td> <td class="headerCovTableEntry">2</td> <td class="<API key>">0.0 %</td> </tr> <tr> <td class="headerItem">Date:</td> <td class="headerValue">2017-07-26</td> <td></td> </tr> <tr><td><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> </table> </td> </tr> <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> </table> <table cellpadding=0 cellspacing=0 border=0> <tr> <td><br></td> </tr> <tr> <td> <pre class="sourceHeading"> Line data Source code</pre> <pre class="source"> <span class="lineNum"> 1 </span> : <span class="lineNum"> 2 </span> : <span class="lineNum"> 3 </span> : <span class="lineNum"> 4 </span> : <span class="lineNum"> 5 </span> : <span class="lineNum"> 6 </span> : <span class="lineNum"> 7 </span> : #endregion <span class="lineNum"> 8 </span> : <span class="lineNum"> 9 </span> : using System; <span class="lineNum"> 10 </span> : <span class="lineNum"> 11 </span> : namespace Cqrs.Domain.Exceptions <span class="lineNum"> 12 </span> : { <span class="lineNum"> 13 </span> : [Serializable] <span class="lineNum"> 14 </span> : public class <API key> : Exception <span class="lineNum"> 15 </span><span class="lineNoCov"> 0 : {</span> <span class="lineNum"> 16 </span><span class="lineNoCov"> 0 : public <API key>(Type aggregateType, Type eventType)</span> <span class="lineNum"> 17 </span> : : base(string.Format(&quot;An event of type {0} tried to be saved from {1} but no id was set on either&quot;, eventType.FullName, aggregateType.FullName)) <span class="lineNum"> 18 </span> : { <span class="lineNum"> 19 </span> : } <span class="lineNum"> 20 </span> : } <span class="lineNum"> 21 </span> : } </pre> </td> </tr> </table> <br> <table width="100%" border=0 cellspacing=0 cellpadding=0> <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.10</a></td></tr> </table> <br> </body> </html>
#ifndef <API key> #define <API key> #include <App/PropertyStandard.h> #include <Mod/Part/App/Part2DObject.h> #include "FeatureAddSub.h" class TopoDS_Shape; class TopoDS_Face; class TopoDS_Wire; class gp_Dir; class gp_Lin; namespace PartDesign { class PartDesignExport ProfileBased : public PartDesign::FeatureAddSub { PROPERTY_HEADER(PartDesign::SketchBased); public: ProfileBased(); // Common properties for all sketch based features Profile used to create this feature App::PropertyLinkSub Profile; Reverse extrusion direction App::PropertyBool Reversed; Make extrusion symmetric to sketch plane App::PropertyBool Midplane; Face to extrude up to App::PropertyLinkSub UpToFace; short mustExecute() const; /** calculates and updates the Placement property based on the features * this one is made from: either from Base, if there is one, or from sketch, * if there is no base. */ void positionByPrevious(void); /** applies a transform on the Placement of the Sketch or its * support if it has one */ virtual void transformPlacement(const Base::Placement &transform); /** * Verifies the linked Profile and returns it if it is a valid 2D object * @param silent if profile property is malformed and the parameter is true * silently returns nullptr, otherwice throw a Base::Exception. * Default is false. */ Part::Part2DObject* getVerifiedSketch(bool silent=false) const; /** * Verifies the linked Profile and returns it if it is a valid object * @param silent if profile property is malformed and the parameter is true * silently returns nullptr, otherwice throw a Base::Exception. * Default is false. */ Part::Feature* getVerifiedObject(bool silent=false) const; /** * Verifies the linked Object and returns the shape used as profile * @param silent if profirle property is malformed and the parameter is true * silently returns nullptr, otherwice throw a Base::Exception. * Default is false. */ TopoDS_Shape getVerifiedFace(bool silent = false) const; Returns the wires the sketch is composed of std::vector<TopoDS_Wire> getProfileWires() const; Returns the face of the sketch support (if any) const TopoDS_Face getSupportFace() const; Base::Vector3d getProfileNormal() const; retrieves the number of axes in the linked sketch (defined as construction lines) int getSketchAxisCount(void) const; virtual Part::Feature* getBaseObject(bool silent=false) const; //backwards compatibility: profile property was renamed and has different type now virtual void Restore(Base::XMLReader& reader); protected: void remapSupportShape(const TopoDS_Shape&); TopoDS_Shape refineShapeIfActive(const TopoDS_Shape&) const; Extract a face from a given LinkSub static void <API key>(TopoDS_Face& upToFace, const App::PropertyLinkSub& refFace); Find a valid face to extrude up to static void getUpToFace(TopoDS_Face& upToFace, const TopoDS_Shape& support, const TopoDS_Face& supportface, const TopoDS_Shape& sketchshape, const std::string& method, const gp_Dir& dir, const double offset); /** * Generate a linear prism * It will be a stand-alone solid created with <API key> */ static void generatePrism(TopoDS_Shape& prism, const TopoDS_Shape& sketchshape, const std::string& method, const gp_Dir& direction, const double L, const double L2, const bool midplane, const bool reversed); Check whether the wire after projection on the face is inside the face static bool checkWireInsideFace(const TopoDS_Wire& wire, const TopoDS_Face& face, const gp_Dir& dir); Check whether the line crosses the face (line and face must be on the same plane) static bool <API key>(const gp_Lin& line, const TopoDS_Face& face); Used to suggest a value for Reversed flag so that material is always removed (Groove) or added (Revolution) from the support double getReversedAngle(const Base::Vector3d& b, const Base::Vector3d& v); get Axis from ReferenceAxis void getAxis(const App::DocumentObject* pcReferenceAxis, const std::vector<std::string>& subReferenceAxis, Base::Vector3d& base, Base::Vector3d& dir); private: void onChanged(const App::Property* prop); bool isParallelPlane(const TopoDS_Shape&, const TopoDS_Shape&) const; bool isEqualGeometry(const TopoDS_Shape&, const TopoDS_Shape&) const; bool isQuasiEqual(const TopoDS_Shape&, const TopoDS_Shape&) const; }; } //namespace PartDesign #endif // <API key>
<?php /** * Consent script * * This script displays a page to the user, which requests that the user * authorizes the release of attributes. * * @package SimpleSAMLphp */ /** * Explicit instruct consent page to send no-cache header to browsers to make * sure the users attribute information are not store on client disk. * * In an vanilla apache-php installation is the php variables set to: * * session.cache_limiter = nocache * * so this is just to make sure. */ <API key>('nocache'); $globalConfig = <API key>::getInstance(); SimpleSAML\Logger::info('Consent - getconsent: Accessing consent interface'); if (!array_key_exists('StateId', $_REQUEST)) { throw new <API key>( 'Missing required StateId query parameter.' ); } $id = $_REQUEST['StateId']; $state = <API key>::loadState($id, 'consent:request'); if (array_key_exists('core:SP', $state)) { $spentityid = $state['core:SP']; } else if (array_key_exists('saml:sp:State', $state)) { $spentityid = $state['saml:sp:State']['core:SP']; } else { $spentityid = 'UNKNOWN'; } // The user has pressed the yes-button if (array_key_exists('yes', $_REQUEST)) { if (array_key_exists('saveconsent', $_REQUEST)) { SimpleSAML\Logger::stats('consentResponse remember'); } else { SimpleSAML\Logger::stats('consentResponse rememberNot'); } $statsInfo = array( 'remember' => array_key_exists('saveconsent', $_REQUEST), ); if (isset($state['Destination']['entityid'])) { $statsInfo['spEntityID'] = $state['Destination']['entityid']; } SimpleSAML_Stats::log('consent:accept', $statsInfo); if ( array_key_exists('consent:store', $state) && array_key_exists('saveconsent', $_REQUEST) && $_REQUEST['saveconsent'] === '1' ) { // Save consent $store = $state['consent:store']; $userId = $state['consent:store.userId']; $targetedId = $state['consent:store.destination']; $attributeSet = $state['consent:store.attributeSet']; SimpleSAML\Logger::debug( 'Consent - saveConsent() : [' . $userId . '|' . $targetedId . '|' . $attributeSet . ']' ); try { $store->saveConsent($userId, $targetedId, $attributeSet); } catch (Exception $e) { SimpleSAML\Logger::error('Consent: Error writing to storage: ' . $e->getMessage()); } } SimpleSAML_<API key>::resumeProcessing($state); } // Prepare attributes for presentation $attributes = $state['Attributes']; $noconsentattributes = $state['consent:noconsentattributes']; // Remove attributes that do not require consent foreach ($attributes AS $attrkey => $attrval) { if (in_array($attrkey, $noconsentattributes)) { unset($attributes[$attrkey]); } } $para = array( 'attributes' => &$attributes ); // Reorder attributes according to <API key> hooks SimpleSAML\Module::callHooks('<API key>', $para); // Make, populate and layout consent form $t = new <API key>($globalConfig, 'consent:consentform.php'); $t->data['srcMetadata'] = $state['Source']; $t->data['dstMetadata'] = $state['Destination']; $t->data['yesTarget'] = SimpleSAML\Module::getModuleURL('consent/getconsent.php'); $t->data['yesData'] = array('StateId' => $id); $t->data['noTarget'] = SimpleSAML\Module::getModuleURL('consent/noconsent.php'); $t->data['noData'] = array('StateId' => $id); $t->data['attributes'] = $attributes; $t->data['checked'] = $state['consent:checked']; // Fetch privacypolicy if (array_key_exists('privacypolicy', $state['Destination'])) { $privacypolicy = $state['Destination']['privacypolicy']; } elseif (array_key_exists('privacypolicy', $state['Source'])) { $privacypolicy = $state['Source']['privacypolicy']; } else { $privacypolicy = false; } if ($privacypolicy !== false) { $privacypolicy = str_replace( '%SPENTITYID%', urlencode($spentityid), $privacypolicy ); } $t->data['sppp'] = $privacypolicy; // Set focus element switch ($state['consent:focus']) { case 'yes': $t->data['autofocus'] = 'yesbutton'; break; case 'no': $t->data['autofocus'] = 'nobutton'; break; case null: default: break; } if (array_key_exists('consent:store', $state)) { $t->data['usestorage'] = true; } else { $t->data['usestorage'] = false; } if (array_key_exists('consent:hiddenAttributes', $state)) { $t->data['hiddenAttributes'] = $state['consent:hiddenAttributes']; } else { $t->data['hiddenAttributes'] = array(); } $t->show();
package org.herac.tuxguitar.io.abc; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.herac.tuxguitar.app.TuxGuitar; import org.herac.tuxguitar.io.abc.base.ABCChord; import org.herac.tuxguitar.player.base.MidiInstrument; import org.herac.tuxguitar.song.factory.TGFactory; import org.herac.tuxguitar.song.managers.TGSongManager; import org.herac.tuxguitar.song.models.TGBeat; import org.herac.tuxguitar.song.models.TGChannel; import org.herac.tuxguitar.song.models.TGChord; import org.herac.tuxguitar.song.models.TGDuration; import org.herac.tuxguitar.song.models.TGMeasure; import org.herac.tuxguitar.song.models.TGMeasureHeader; import org.herac.tuxguitar.song.models.TGNote; import org.herac.tuxguitar.song.models.TGNoteEffect; import org.herac.tuxguitar.song.models.TGSong; import org.herac.tuxguitar.song.models.TGString; import org.herac.tuxguitar.song.models.TGStroke; import org.herac.tuxguitar.song.models.TGTempo; import org.herac.tuxguitar.song.models.TGTimeSignature; import org.herac.tuxguitar.song.models.TGTrack; import org.herac.tuxguitar.song.models.TGDivisionType; import org.herac.tuxguitar.song.models.TGVoice; import org.herac.tuxguitar.song.models.effects.TGEffectGrace; public class ABCOutputStream { private static final String ABC_VERSION = "ABC standard 2.0 & ABCplus-1.1.0"; private static final String[] ABC_KEY_SIGNATURES = new String[]{ "C","G","D","A","E","B","F#","C#","F","Bb","Eb","Ab", "Db", "Gb","Cb" }; private TGSongManager manager; private TGChannel channelAux; private PrintWriter writer; private ABCSettings settings; private int barsperstaff; private int instrumentoffset; private int[] droneparm; private int from; private int to; private int measures; private int diagramt; private int chordt; private int baset; private String vId; private String wline; private String line; private int dronet; private String gchord; private boolean droneon; private String drum; private int enterstogo; private int enters; private int times; private String triol; public ABCOutputStream(OutputStream stream,ABCSettings settings){ this.writer = new PrintWriter(stream); this.settings = settings; this.instrumentoffset=(settings==null) ? 1 : settings.<API key>() ? 1 : 0; } public void writeSong(TGSong song){ this.manager = new TGSongManager(); this.channelAux = null; this.addVersion(); this.addPaper(song); this.addSongDefinitions(song); this.addSong(song); this.writer.flush(); this.writer.close(); } private void addVersion(){ this.writer.println("% ABC version " + ABC_VERSION + " with ABCPlus"); } private void addPaper(TGSong song){ this.writer.println("%%scale 0.66"); } private void addSongDefinitions(TGSong song){ String[] line={ "X:1" }; if(song.getComments()!=null) line=song.getComments().split("\\n+"); String s="X:1"; for(int i=0;i<line.length;i++) { if(line[i].startsWith("X:")) { s=line[i]; break; } } this.writer.println(s); this.writer.println("%%exprabove 0"); this.writer.println("%%exprbelow 1"); this.diagramt=this.settings.getDiagramTrack(); this.chordt=this.settings.getChordTrack(); this.baset=this.settings.getBaseTrack(); this.dronet=this.settings.getDroneTrack(); if(this.diagramt==ABCSettings.AUTO_TRACK || this.chordt==ABCSettings.AUTO_TRACK || this.baset==ABCSettings.AUTO_TRACK || this.dronet==ABCSettings.AUTO_TRACK) { for(int t=0;t<song.countTracks();t++) { TGTrack track = song.getTrack(t); int tnum=track.getNumber(); if(this.settings.getTrack() == ABCSettings.ALL_TRACKS || this.settings.getTrack() == tnum) { String id = track.getName(); if((tnum==this.diagramt+1 || id.indexOf('\t')<0) && !isPercussionTrack(song, track)) { for(int j=0;j<song.countTracks();j++) { TGTrack buddy=song.getTrack(j); if(this.chordt==j+1 || buddy.getName().matches(id+"\tchords")) { if(this.chordt==ABCSettings.AUTO_TRACK) this.chordt=j+1; if(this.diagramt==ABCSettings.AUTO_TRACK) this.diagramt=t+1; } if(this.baset==j+1 || buddy.getName().matches(id+"\tbase")) { if(this.baset==ABCSettings.AUTO_TRACK) this.baset=j+1; if(this.diagramt==ABCSettings.AUTO_TRACK) this.diagramt=t+1; } if(this.dronet==j+1 || buddy.getName().matches(id+"\tdrone")) { if(this.dronet==ABCSettings.AUTO_TRACK) this.dronet=j+1; } } } } } } if(this.chordt==ABCSettings.AUTO_TRACK) this.chordt=this.baset; if(this.baset==ABCSettings.AUTO_TRACK) this.baset=this.chordt; if(this.chordt==ABCSettings.NO_TRACK) this.baset=ABCSettings.NO_TRACK; if(this.baset==ABCSettings.NO_TRACK) this.chordt=ABCSettings.NO_TRACK; this.measures=song.countMeasureHeaders(); this.from=ABCSettings.FIRST_MEASURE; this.to=ABCSettings.LAST_MEASURE; if(this.settings.getMeasureFrom() != ABCSettings.FIRST_MEASURE || this.settings.getMeasureTo() != ABCSettings.LAST_MEASURE) { this.from=this.settings.getMeasureFrom(); to=this.settings.getMeasureTo(); } if(this.from==ABCSettings.FIRST_MEASURE) this.from=0; if(this.to==ABCSettings.LAST_MEASURE) to=measures-1; if(this.from>measures-1) this.from=measures-1; if(this.to<this.from) this.to=this.from; this.measures=this.to-this.from+1; this.barsperstaff=this.settings.getMeasuresPerLine(); if(this.barsperstaff==ABCSettings.AUTO_MEASURES) { this.barsperstaff=5; while((measures % this.barsperstaff) > 0) --this.barsperstaff; if(this.barsperstaff<2) { if((measures % 3)<2) this.barsperstaff=3; else this.barsperstaff=4; } } this.writer.println("%%%barsperstaff "+this.barsperstaff); if(song.getName()!=null && song.getName().trim().length()>0) this.writer.println("T:"+song.getName()); if(song.getAlbum()!=null && song.getAlbum().trim().length()>0) this.writer.println("O:"+song.getAlbum()); if(song.getAuthor()!=null && song.getAuthor().trim().length()>0) this.writer.println("A:"+song.getAuthor()); if(song.getTranscriber()!=null && song.getTranscriber().trim().length()>0) this.writer.println("Z:"+song.getTranscriber()); TGTimeSignature ts = song.getMeasureHeader(0).getTimeSignature(); int n=ts.getNumerator(); int d=ts.getDenominator().getValue(); if(n==4 && d==4) this.writer.println("M:C"); else if(n==2 && d==2) this.writer.println("M:C|"); else this.writer.println("M:"+n+"/"+d); this.writer.println("L:1/8"); n=song.getMeasureHeader(0).getTempo().getValue(); this.writer.println("Q:1/4="+n); int trackCount = 0; for(int i = 0; i < song.countTracks(); i ++) { TGTrack track = song.getTrack(i); String id = handleId(track.getName()); if(id.indexOf('\t')<0 && !isPercussionTrack(song, track) && i!=this.chordt-1 && i!=this.baset-1 && i!=this.dronet-1) ++trackCount; } if(trackCount > 1 && this.settings.getTrack() == ABCSettings.ALL_TRACKS) { for(int i = 0; i < song.countTracks(); i ++) { TGTrack track = song.getTrack(i); String id = handleId(track.getName()); if(id.indexOf('\t')<0 && !isPercussionTrack(song, track) && i!=this.chordt-1 && i!=this.baset-1 && i!=this.dronet-1) this.writer.println("V:"+id.replaceAll("\\s+","_")+" clef="+clefname(track.getMeasure(0).getClef())); } if(this.settings.isTrackGroupEnabled()) { String staves="%%staves "; String stave2=""; String stave3=""; int v=0; for(int i = 0; i < song.countTracks(); i ++) { TGTrack track = song.getTrack(i); String id = handleId(track.getName()); int clef=track.getMeasure(0).getClef(); if(id.indexOf('\t')<0 && !isPercussionTrack(song, track) && i!=this.chordt-1 && i!=this.baset-1 && i!=this.dronet-1) { ++v; if(v==1 && clef==TGMeasure.CLEF_TREBLE) staves+="1 "; else if(clef==TGMeasure.CLEF_TREBLE) stave2+=v+" "; else if(clef==TGMeasure.CLEF_BASS) stave3+=v+" "; else staves+=v+" "; } } if(stave2.trim().split(" ").length>1) stave2="("+stave2.trim()+")"; if(stave3.trim().split(" ").length>1) stave3="("+stave3.trim()+")"; if(stave2.length()>0 && stave3.length()>0) staves+="{"+stave2.trim()+" "+stave3.trim()+"}"; else staves+=(stave2+stave3).trim(); this.writer.println(staves); } } if(song.getMeasureHeader(0).getTripletFeel()!=TGMeasureHeader.TRIPLET_FEEL_NONE) this.writer.println("R:hornpipe"); this.writer.println("K:"+ABC_KEY_SIGNATURES[song.getTrack(0).getMeasure(0).getKeySignature()]); int v=0; TGBeat[] gchordBeat=new TGBeat[2]; for(int i = 0; i < song.countTracks(); i ++) { TGTrack track = song.getTrack(i); String id = handleId(track.getName()); int tnum=track.getNumber(); if(id.indexOf('\t')>0) { for(int j=0;j<song.countTracks();j++) { TGTrack buddy=song.getTrack(j); if(id.matches(buddy.getName()+"\t.*")) { tnum=buddy.getNumber(); break; } } } if(this.settings.getTrack() == ABCSettings.ALL_TRACKS || this.settings.getTrack() == tnum){ TGChannel channel = getChannel(song, track); int instrument=channel.getProgram()+this.instrumentoffset; String instrName=MidiInstrument.INSTRUMENT_LIST[instrument-this.instrumentoffset].getName(); int pan=channel.getBalance(); if(isPercussionTrack(song, track)) { TGBeat beat=getFirstBeat(track); if(beat==null) { this.writer.println("%%MIDI drumoff"); this.drum=""; } else { this.writer.println("%%MIDI drumon"); this.drum=getABCDrum(track, beat.getMeasure().getNumber()); this.writer.println("%%MIDI drum "+this.drum); } } else if(id.indexOf('\t')<0 && this.chordt!=i+1 && this.baset!=i+1 && this.dronet!=i+1) { ++v; this.writer.println("%%MIDI voice "+id.replaceAll("\\s+","_")+" instrument="+instrument+" % "+instrName+" pan="+pan); } else if(this.dronet==i+1 || id.endsWith("\tdrone")) { TGBeat beat=getFirstBeat(track); if(beat!=null) { this.droneparm=getDroneParm(beat); this.droneparm[4]=instrument; String drone=instrument+" "+droneparm[0]+" "+droneparm[1]+" "+droneparm[2]+" "+droneparm[3]; this.writer.println("% drone <instrument> <pitch1> <pitch2> <vol1> <vol2>"); this.writer.println("%%MIDI drone "+drone+" % "+instrName); this.droneon=beat.getMeasure().getNumber()<2; if(this.droneon) this.writer.println("%%MIDI droneon"); else this.writer.println("%%MIDI droneoff"); } } else if(this.chordt==i+1 || id.endsWith("\tchords")) { gchordBeat[0]=getFirstBeat(track); if(gchordBeat[0]!=null) { int[] p=getDroneParm(gchordBeat[0]); this.writer.println("%%MIDI chordprog "+instrument+" % "+instrName); this.writer.println("%%MIDI chordvol "+p[2]); } } else if(this.baset==i+1 || id.endsWith("\tbase")) { gchordBeat[1]=getFirstBeat(track); if(gchordBeat[1]!=null) { int[] p=getDroneParm(gchordBeat[1]); this.writer.println("%%MIDI bassprog "+instrument+" % "+instrName); this.writer.println("%%MIDI bassvol "+p[2]); } } } } s=null; v=-1; boolean gchords=false; for(int i=0;i<2;i++) { if(gchordBeat[i]!=null) { gchords=true; if(v<0) v=i; else if(gchordBeat[i].getMeasure().getNumber()<gchordBeat[v].getMeasure().getNumber()) v=i; if(gchordBeat[i].getMeasure().getNumber()<2) s="%%MIDI gchordon"; } } if(s==null && gchords) s="%%MIDI gchordoff"; this.gchord=null; if(v>=0) { this.gchord=getABCGchord(song, gchordBeat[v].getMeasure().getNumber()); } if(this.gchord!=null) this.writer.println("%%MIDI gchord "+this.gchord); if(s!=null) this.writer.println(s); } private String handleId(String name) { if(name.indexOf('\t')<0) return name; if(this.chordt==ABCSettings.NO_TRACK) name=name.replaceAll("\tchords", " chords"); if(this.baset==ABCSettings.NO_TRACK) name=name.replaceAll("\tbase", " base"); if(this.dronet==ABCSettings.NO_TRACK) name=name.replaceAll("\tdrone", " drone"); return name; } private String getABCGchord(TGSong song, int m) { TGMeasure chordm=song.getTrack(chordt-1).getMeasure(m-1); TGMeasure basem=song.getTrack(baset-1).getMeasure(m-1); int clen=chordm.countBeats(); int blen=basem.countBeats(); char[] gc=new char[clen+blen]; int[] gn=new int[clen+blen]; int[] gd=new int[clen+blen]; int cb=0; int bb=0; int kgv=1; int sx=0; while(cb<clen || bb<blen) { TGBeat beatc=null; TGBeat beatb=null; char b=0; char c=0; String db=""; String dc=""; int cticks=0; int bticks=0; if(cb<chordm.countBeats()) beatc=chordm.getBeat(cb); if(bb<basem.countBeats()) beatb=basem.getBeat(bb); if(beatb!=null && (beatc==null || beatb.getStart()<=beatc.getStart())) { int n=0; for(int v=0;v<beatb.countVoices();v++) n+=beatb.getVoice(v).countNotes(); TGDuration duration = beatb.getVoice(0).getDuration(); bticks=(int) duration.getTime(); db=getABCDuration(duration); if(n==0) b='z'; else { if(chordt==baset && n>3) b='f'; else if(chordt!=baset) { if(n==1) b=getABCGchordNote(song,beatb); else b='f'; if(b=='G') b='f'; } } ++bb; } if(beatc!=null && (beatb==null || beatc.getStart()<=beatb.getStart())) { int n=0; for(int v=0;v<beatc.countVoices();v++) n+=beatc.getVoice(v).countNotes(); TGDuration duration = beatc.getVoice(0).getDuration(); cticks=(int) duration.getTime(); dc=getABCDuration(duration); if(n==0) c='z'; else { if(chordt==baset && n>3) c='b'; else if(chordt!=baset) { if(n==1) c=getABCGchordNote(song,beatc); else c='c'; } } ++cb; } if(b>0 && c>0) { if(b=='z') gc[sx]=c; else if(c=='z') gc[sx]=b; else if(cticks>bticks) gc[sx]=c; else if(bticks>cticks) gc[sx]=b; else gc[sx]='b'; } else if(b>0) gc[sx]=b; else if(c>0) gc[sx]=c; else gc[sx]='z'; String d=""; if(b>0 && c>0) { if(cticks>bticks) d=dc; else d=db; } else if(b>0) d=db; else if(c>0) d=dc; if(d.indexOf('/')<0) { gd[sx]=1; if(d.length()==0) gn[sx]=1; else gn[sx]=Integer.parseInt(d, 10); } else { int i=d.indexOf('/'); int q=2; int n=1; if(i>0) n=Integer.parseInt(d.substring(0,i), 10); if(i<d.length()-1) q=Integer.parseInt(d.substring(i+1), 10); kgv=getKgv(kgv,q); gn[sx]=n; gd[sx]=q; } ++sx; } if(kgv>1) { while(kgv>8) { kgv/=2; } for(int i=0;i<sx;i++) { if(((gn[i]*kgv) % gd[i])==0) { gn[i]=(gn[i]*kgv)/gd[i]; gd[i]=1; } else { gn[i]=gn[i]*kgv; while((gn[i]&1)==0 && (gd[i]&1)==0) { gn[i]/=2; gd[i]/=2; } } } } String s=""; for(int i=0;i<sx;i++) { s+=gc[i]; if(gn[i]>1) s+=gn[i]; if(gd[i]>1) { s+='/'; if(gd[i]>2) s+=gd[i]; } } if(s.matches("(./)+")) s=s.replaceAll("/",""); for(int i=1;i<10;i++) if(s.matches("(."+i+")+")) s=s.replaceAll(""+i,""); if(s.matches("z[z0-9]*")) return ""; return s; } private int getKgv(int kgv, int q) { return kgv * q / getGgd(kgv,q); } private int getGgd(int p, int q) { int m=p; int n=q; if(m<n) { m=q; n=p; } int r=m%n; while(r>0) { m=n; n=r; r=m%n; } return n; } private char getABCGchordNote(TGSong song, TGBeat beat) { char c='f'; TGChord chord=findChord(song,beat); if(chord!=null) { String name=chord.getName().replaceAll("[^ -~]", " ").trim(); while(name.length()>0 && "CDEFGAB".indexOf(name.charAt(0))<0) name=name.substring(1); if(name.length()>0) { name=name.split("\\s+")[0]; ABCChord abcChord=new ABCChord(name); TGNote note=null; for(int v=0;v<beat.countVoices();v++) { for(int i=0;i<beat.getVoice(v).countNotes();i++) note=beat.getVoice(v).getNote(i); } if(note!=null) { int value=beat.getMeasure().getTrack().getString(note.getString()).getValue() + note.getValue(); c=abcChord.getGchordChar(value+24); } } } return c; } private TGChord findChord(TGSong song, TGBeat beat) { TGChord chord=null; long start=beat.getStart(); int m=beat.getMeasure().getNumber(); for(int x=m;x>0;x for(int t=0;t<song.countTracks();t++) { TGMeasure measure=song.getTrack(t).getMeasure(x-1); for(int b=0;b<measure.countBeats();b++) { TGBeat bx=measure.getBeat(b); if(x==m && bx.getStart()>start) break; if(bx.getChord()!=null) { chord=bx.getChord(); } } if(chord!=null) return chord; } } return null; } private String getABCDrum(TGTrack drumTrack, int m) { String s=""; String ins=""; String vol=""; TGMeasure drumm=drumTrack.getMeasure(m-1); int db=0; while(db<drumm.countBeats()) { TGBeat beatd=drumm.getBeat(db); int n=0; for(int v=0;v<beatd.countVoices();v++) n+=beatd.getVoice(v).countNotes(); if(n==0) s+="z"+getABCDuration(beatd.getVoice(0).getDuration()); else { s+="d"+getABCDuration(beatd.getVoice(0).getDuration()); for(int v=0;v<beatd.countVoices();v++) { for(int i=0;i<beatd.getVoice(v).countNotes();i++) { TGNote note=beatd.getVoice(v).getNote(i); int val=note.getValue()+drumTrack.getString(note.getString()).getValue(); ins+=" "+(val-12); vol+=" "+note.getVelocity(); } } } ++db; } if(s.matches("(./)+")) s=s.replaceAll("/",""); for(int i=1;i<10;i++) if(s.matches("(."+i+")+")) s=s.replaceAll(""+i,""); if(s.matches("z[z0-9]*")) return ""; return s+ins+vol; } private int[] getDroneParm(TGBeat beat) { int[] p=new int[5]; int i=0; for(int v=0;v<beat.countVoices();v++) { for(int n=0;n<beat.getVoice(v).countNotes();n++) { TGNote note = beat.getVoice(v).getNote(n); p[i]=note.getValue()+beat.getMeasure().getTrack().getString(note.getString()).getValue(); p[i+2]=note.getVelocity(); i++; if(i>1) return p; } } return p; } private TGBeat getFirstBeat(TGTrack track) { for(int m=0;m<track.countMeasures();m++) { for(int b=0;b<track.getMeasure(m).countBeats();b++) { TGBeat beat=track.getMeasure(m).getBeat(b); if(!beat.isRestBeat()) { for(int v=0;v<beat.countVoices();v++) { if(beat.getVoice(v).countNotes()>0) return beat; } } } } return null; } private String clefname(int clef) { switch(clef) { case TGMeasure.CLEF_ALTO: return "alto"; case TGMeasure.CLEF_BASS: return "bass"; case TGMeasure.CLEF_TENOR: return "tenor"; case TGMeasure.CLEF_TREBLE: return "treble"; } return "treble"; } private void addSong(TGSong song) { for(int m=this.from-1;m<this.to;m+=this.barsperstaff) { this.writer.println("% "+(m+1)); boolean first=true; for(int t=0;t<song.countTracks();t++) { if(t==this.baset-1 || t==this.chordt-1 || t==this.dronet-1) continue; TGTrack track = song.getTrack(t); int tnum=track.getNumber(); if(this.settings.getTrack() == ABCSettings.ALL_TRACKS || this.settings.getTrack() == tnum) { this.vId = track.getName().replaceAll("\\s+", "_"); if(!isPercussionTrack(song, track)) { this.line="[V:"+this.vId+"] "; this.wline="w:"; for(int b=0;b<this.barsperstaff && m+b<this.to; b++) { TGMeasure measure = track.getMeasure(m+b); TGMeasure prevMeasure = m+b==0? measure: track.getMeasure(m+b-1); this.handleBeginMeasure(measure, prevMeasure); if(first && this.chordt > 0 && this.baset > 0) handleGChord(song,m+b+1); if(first && this.dronet > 0) handleDrone(song,m+b+1); if(t==this.diagramt-1 && this.chordt > 0) { TGTrack chordTrack=song.getTrack(this.chordt-1); TGMeasure chordsMeasure = chordTrack.getMeasure(m+b); measure=mergeChords(measure,chordsMeasure,song.getMeasureHeader(m+b)); measure.setTrack(track); // prevent nullpointer in addBeat later on... } this.<API key>(measure,0); this.handleEndMeasure(measure); } this.writer.println(this.line.replaceAll(":\\]\\s*\\|", ":|").replaceAll("\\|\\s*\\[:", "|:")); if(this.wline.length()>2) this.writer.println(this.wline); first=false; } } } this.writer.println("%"); } } private void handleBeginMeasure(TGMeasure measure, TGMeasure previous) { // Open repeat if(measure.isRepeatOpen()){ this.addRepeatOpen(measure.getHeader()); } else if(measure.getHeader().<API key>() > 0){ // Open a repeat alternative only if this measure isn't who opened the repeat. this.<API key>(measure.getHeader().<API key>()); } if(previous == null || measure.getTempo().getValue() != previous.getTempo().getValue()) { this.addTempo(measure.getTempo()); } if(previous == null || measure.getClef() != previous.getClef()){ this.addClef(measure.getClef()); } if(previous == null || measure.getKeySignature() != previous.getKeySignature()){ this.addKeySignature(measure.getKeySignature()); } if(previous == null || !measure.getTimeSignature().isEqual(previous.getTimeSignature())){ this.addTimeSignature(measure.getTimeSignature()); } } private void handleEndMeasure(TGMeasure measure) { handleTrioles(); // Close repeat int count=measure.getRepeatClose(); if(count > 0){ this.line += " "+(count>1? String.valueOf(count): "") + ":"; } if(!this.line.endsWith(":")) this.line+=" "; this.line += "|"; } private void handleDrone(TGSong song, int m) { TGTrack droneTrack = song.getTrack(this.dronet-1); TGMeasure droneMeasure=droneTrack.getMeasure(m); if(droneMeasure.countBeats()>0) { int[] dp=getDroneParm(droneMeasure.getBeat(0)); for(int i=0;i<4;i++) { if(dp[i]!=this.droneparm[i]) { this.line += " [I:MIDI=drone "+this.droneparm[4]+" "+dp[0]+" "+dp[1]+" "+dp[2]+" "+dp[3]+"]"; break; } } for(int i=0;i<4;i++) this.droneparm[i]=dp[i]; if(!this.droneon) { this.line += " [I:MIDI=droneon]"; this.droneon=true; } } else { if(this.droneon) { this.line += " [I:MIDI=droneoff]"; this.droneon=false; } } } private void handleGChord(TGSong song, int m) { String gc=getABCGchord(song, m); if(this.gchord==null || !this.gchord.equals(gc)) { if(gc.length()==0) { if(this.gchord != null) { this.line += "[I:MIDI=gchordoff]"; this.gchord=null; } } else { this.line+=" [I:MIDI=gchord "+gc+"]"; if(this.gchord==null) this.line+=" [I:MIDI=gchordon]"; this.gchord=gc; } } } private TGMeasure mergeChords(TGMeasure measure, TGMeasure chordsMeasure, TGMeasureHeader header) { TGFactory factory = TuxGuitar.getInstance().getSongManager().getFactory(); TGMeasure m=measure.clone(factory, header); for(int i=0;i<chordsMeasure.countBeats();i++) { TGBeat cb=chordsMeasure.getBeat(i).clone(factory); if(cb.isChordBeat()) { boolean hit=false; int x=-1; TGBeat prevmb=null; for(int j=0;j<m.countBeats();j++) { TGBeat mb = m.getBeat(j); if(mb.getStart()==cb.getStart()) { mb.setChord(cb.getChord()); if(cb.getText()!=null && mb.getText()==null) mb.setText(cb.getText()); hit=true; break; } else if(mb.getStart()>cb.getStart()) break; x=j; prevmb=mb; } if(!hit) { cb.removeText(); for(int v=0;v<cb.countVoices();v++) { TGVoice voice = cb.getVoice(v); while(voice.countNotes()>0) voice.removeNote(voice.getNote(0)); } if(prevmb!=null && prevmb.getStart()+prevmb.getVoice(0).getDuration().getTime()>cb.getStart()) { long time=cb.getStart()-prevmb.getStart(); TGDuration duration1=TGDuration.fromTime(factory, time); TGDuration duration2=TGDuration.fromTime(factory, prevmb.getVoice(0).getDuration().getTime()-time); for(int v=0;v<cb.countVoices();v++) { TGVoice voice = cb.getVoice(v); voice.setDuration(duration2); if(v<prevmb.countVoices()) { TGVoice prevvoice = prevmb.getVoice(v); prevvoice.setDuration(duration1); for(int n=0;n<prevvoice.countNotes();n++) { TGNote note=prevvoice.getNote(n).clone(factory); note.setTiedNote(true); voice.addNote(note); } } } } m.addBeat(cb); m.moveBeat(x+1, cb); } } } return m; } private void addRepeatOpen(TGMeasureHeader measure){ if(!this.line.endsWith("|")) this.line += "["; this.line += ": "; } private void <API key>(int alternatives) { int bit=1; String comma="["; if(this.line.endsWith("|")) comma=""; for(int i=0;i<8;i++) { if((alternatives&bit)==bit) { this.line += comma+(i+1); comma=","; } bit<<=1; } } private void addTempo(TGTempo tempo) { this.line += "[Q:1/4=" + tempo.getValue()+"]"; } private void addTimeSignature(TGTimeSignature ts) { this.line += "[M:" + ts.getNumerator() + "/" + ts.getDenominator().getValue()+"]"; } private void addKeySignature(int keySignature) { if(keySignature >= 0 && keySignature < ABC_KEY_SIGNATURES.length){ this.line += "[K:" + ABC_KEY_SIGNATURES[keySignature] + "]"; } } private void addClef(int clef){ String clefName = ""; if(clef == TGMeasure.CLEF_TREBLE){ clefName = "treble"; } else if(clef == TGMeasure.CLEF_BASS){ clefName = "bass"; } else if(clef == TGMeasure.CLEF_ALTO){ clefName = "alto"; } else if(clef == TGMeasure.CLEF_TENOR){ clefName = "tenor"; } if(clefName!=""){ this.line += "[V:"+vId+" clef="+clefName+"]"; } } private void <API key>(TGMeasure measure,int voice){ this.line += " "; this.addComponents(measure,voice); } private void addComponents(TGMeasure measure,int vIndex){ int key = measure.getKeySignature(); TGBeat previous = null; for(int i = 0 ; i < measure.countBeats() ; i ++){ TGBeat beat = measure.getBeat( i ); TGVoice voice = beat.getVoice( vIndex ); if( !voice.isEmpty() ){ this.addBeat(key, beat, voice); previous = beat; } } // It Means that all voice beats are empty if( previous == null ){ int ticks=(int) (measure.getTimeSignature().getDenominator().getTime() * measure.getTimeSignature().getNumerator()); int eight=(int) (TGDuration.QUARTER_TIME/2); this.line += "x"+String.valueOf(ticks/eight); } } private void addBeat(int key,TGBeat beat, TGVoice voice){ // Add Chord, if was not previously added in another voice if( beat.isChordBeat() && voice.getIndex()==0) { String name=beat.getChord().getName().replaceAll("[^ -~]", " ").trim(); while(name.length()>0 && "CDEFGAB".indexOf(name.charAt(0))<0) name=name.substring(1); if(name.length()>0) { name=name.split("\\s+")[0]; this.line += "\""+name+"\""; } } if(voice.isRestVoice()){ boolean skip = false; for( int v = 0 ; v < beat.countVoices() ; v ++ ){ if( !skip && v != voice.getIndex() ){ TGVoice current = beat.getVoice( v ); if(!current.isEmpty() && current.getDuration().isEqual( voice.getDuration() )){ skip = (!current.isRestVoice() || current.getIndex() < voice.getIndex()); } } } this.addTrioles(voice.getDuration()); this.line += ( skip ? "x" : "z" ) ; this.addDuration( voice.getDuration() ); } else{ this.<API key>(voice); int size = voice.countNotes(); this.addTrioles(voice.getDuration()); this.addEffectsOnBeat( voice ); this.<API key>( voice ); if(size > 1) this.line += "["; String tie=""; for(int i = 0 ; i < size ; i ++){ TGNote note = voice.getNote(i); this.<API key>(note); this.addKey(key, (beat.getMeasure().getTrack().getString(note.getString()).getValue() + note.getValue()) ); if(this.isAnyTiedTo(note)){ tie = "-"; } this.addEffectsOnNote(note.getEffect()); } if(size > 1) this.line += "]"; this.addDuration( voice.getDuration() ); this.line += tie; } // Add Text, if was not previously added in another voice boolean skip = false; for( int v = 0 ; v < voice.getIndex() ; v ++ ){ skip = (skip || !beat.getVoice( v ).isEmpty() ); } if( !skip ) { if( beat.isTextBeat() ){ this.wline+=" " + beat.getText().getValue(); } // Check if it's a lyric beat to skip if( beat.getMeasure().getTrack().getLyrics().getFrom() > beat.getMeasure().getNumber()){ this.wline+=" *"; } } this.line += " "; } private void addTrioles(TGDuration duration) { TGDivisionType dt=duration.getDivision(); int times=dt.getTimes(); int enters=dt.getEnters(); if(enters==times) { handleTrioles(); } else { if(this.enterstogo==0) { this.enterstogo=enters; this.triol = "("+enters+":"+times+":"+enters; this.line += this.triol+" "; } this.enters=enters; this.times=times; --this.enterstogo; if(this.enterstogo==0) { int p=this.line.lastIndexOf(this.triol); if(this.times==2) this.line=this.line.substring(0, p)+"("+this.enters+" "+this.line.substring(p+this.triol.length()); this.enters=1; this.times=1; } } } private void handleTrioles() { if(this.enters == this.times) return; int p=this.line.lastIndexOf(this.triol); if(p>=0) { if(this.enterstogo>0) { this.line=this.line.substring(0, p)+ "("+this.enters+":"+this.times+":"+(this.enters-this.enterstogo)+ this.line.substring(p+this.triol.length()); } else { if(this.times==2) this.line=this.line.substring(0, p)+"("+this.enters+" "+this.line.substring(p+this.triol.length()); } } this.enterstogo=0; this.enters=1; this.times=1; } private void addKey(int keySignature,int value){ String pitch=getABCKey(keySignature, value) ; int i=this.line.lastIndexOf('|')+1; this.line += scanMeasure(this.line.substring(i),pitch); } private String scanMeasure(String m, String pitch) { char c=pitch.charAt(0); switch(c) { case '=': case '_': case '^': c=pitch.charAt(1); } if(m.lastIndexOf(c)<0) return pitch; String sharp="^"+c; String flat="_"+c; String normal="="+c; int isharp=m.lastIndexOf(sharp); int iflat=m.lastIndexOf(flat); int inormal=m.lastIndexOf(normal); if(inormal<0 && isharp<0 && iflat<0) return pitch; switch(pitch.charAt(0)) { case '=': if(inormal>isharp && inormal>iflat) pitch=pitch.substring(1); break; case '^': if(isharp>inormal && isharp>iflat) pitch=pitch.substring(1); break; case '_': if(iflat>inormal && iflat>isharp) pitch=pitch.substring(1); break; default: if(inormal<iflat || inormal<isharp) pitch="="+pitch; break; } return pitch; } private void addDuration(TGDuration duration){ this.line += getABCDuration(duration); } private void <API key>(TGNote note){ TGNoteEffect effect = note.getEffect(); if( effect.isDeadNote() ){ this.line += "\"<x\""; } if( effect.isPalmMute() ){ this.line += "\"_palmMute\""; } if( effect.isGhostNote() ){ this.line += "\"<(\""; this.line += "\">)\""; } if( effect.isBend() ){ this.line += "+upbow+"; } } private void addEffectsOnNote(TGNoteEffect effect){ if( effect.isHarmonic() ){ this.line += "\"_harmonic\""; } } private void <API key>(TGVoice voice){ int tremoloPicking = -1; for( int i = 0 ; i < voice.countNotes() ; i ++ ){ TGNote note = voice.getNote(i); if( tremoloPicking == -1 && note.getEffect().isTremoloPicking() ){ tremoloPicking = note.getEffect().getTremoloPicking().getDuration().getValue(); } } if( tremoloPicking != -1 ){ this.line += "+trill+"; } } private void addEffectsOnBeat(TGVoice voice){ boolean trill = false; boolean vibrato = false; boolean staccato = false; boolean accentuatedNote = false; boolean <API key> = false; boolean arpeggio = ( voice.getBeat().getStroke().getDirection() != TGStroke.STROKE_NONE ); for( int i = 0 ; i < voice.countNotes() ; i ++ ){ TGNoteEffect effect = voice.getNote(i).getEffect(); trill = (trill || effect.isTrill() ); vibrato = (vibrato || effect.isVibrato() ); staccato = (staccato || effect.isStaccato() ); accentuatedNote = (accentuatedNote || effect.isAccentuatedNote() ); <API key> = (<API key> || effect.<API key>() ); } if( trill ){ this.line += "+trill+"; } if( vibrato ){ this.line += "+prall+"; } if( staccato ){ this.line += "."; } if( accentuatedNote ){ this.line += "+>+"; } if( <API key> ){ this.line += "^^"; } if( arpeggio ){ this.line += "+arpeggio+"; } } private void <API key>(TGVoice voice){ List<TGNote> graceNotes = new ArrayList<TGNote>(); for( int i = 0 ; i < voice.countNotes() ; i ++ ){ TGNote note = voice.getNote(i); if( note.getEffect().isGrace() ){ graceNotes.add( note ); } } if( !graceNotes.isEmpty() ){ this.line += "{"; int duration = 0; for( int i = 0 ; i < graceNotes.size() ; i ++ ){ TGNote note = (TGNote)graceNotes.get( i ); TGMeasure measure = voice.getBeat().getMeasure(); TGString string = measure.getTrack().getString(note.getString()); TGEffectGrace grace = note.getEffect().getGrace(); if( duration < TGDuration.SIXTY_FOURTH && grace.getDuration() == 1 ){ duration = TGDuration.SIXTY_FOURTH; }else if( duration < TGDuration.THIRTY_SECOND && grace.getDuration() == 2 ){ duration = TGDuration.THIRTY_SECOND; }else if( duration < TGDuration.SIXTEENTH && grace.getDuration() == 3 ){ duration = TGDuration.SIXTEENTH; } this.addKey(measure.getKeySignature(), (string.getValue() + grace.getFret()) ); } this.line += "}"; } } private boolean isAnyTiedTo(TGNote note){ TGMeasure measure = note.getVoice().getBeat().getMeasure(); TGBeat beat = this.manager.getMeasureManager().getNextBeat( measure.getBeats(), note.getVoice().getBeat()); while( measure != null){ while( beat != null ){ TGVoice voice = beat.getVoice(0); // If is a rest beat, all voice sounds must be stopped. if(voice.isRestVoice()){ return false; } // Check if is there any note at same string. Iterator<TGNote> it = voice.getNotes().iterator(); while( it.hasNext() ){ TGNote current = (TGNote) it.next(); if(current.getString() == note.getString()){ return current.isTiedNote(); } } beat = this.manager.getMeasureManager().getNextBeat( measure.getBeats(), beat); } measure = this.manager.getTrackManager().getNextMeasure(measure); if( measure != null ){ beat = this.manager.getMeasureManager().getFirstBeat( measure.getBeats() ); } } return false; } private String getABCKey(int keySignature , int value){ final String[][] ABC_SCALE = { { "B", "c", "=d", "d", "=e", "e", "f", "=g", "g", "=a", "a", "=b" } , // 7 sharps { "=c", "c", "=d", "d", "=e", "e", "f", "=g", "g", "=a", "a", "b" } , // 6 sharps { "=c", "c", "=d", "d", "e", "=f", "f", "=g", "g", "=a", "a", "b" } , // 5 sharps { "=c", "c", "=d", "d", "e", "=f", "f", "=g", "g", "a", "^a", "b" } , // 4 sharps { "=c", "c", "d", "^d", "e", "=f", "f", "=g", "g", "a", "^a", "b" } , // 3 sharps { "=c", "c", "d", "^d", "e", "=f", "f", "g", "^g", "a", "^a", "b" } , // 2 sharps { "c", "^c", "d", "^d", "e", "=f", "f", "g", "^g", "a", "^a", "b" } , // 1 sharp { "c", "^c", "d", "^d", "e", "f", "^f", "g", "^g", "a", "^a", "b" } , // 0 sharps { "c", "_d", "d", "_e", "e", "f", "_g", "g", "_a", "a", "b", "=b" } , // 1 flat { "c", "_d", "d", "e", "=e", "f", "_g", "g", "_a", "a", "b", "=b" } , // 2 flats { "c", "_d", "d", "e", "=e", "f", "_g", "g", "a", "=a", "b", "=b" } , // 3 flats { "c", "d", "=d", "e", "=e", "f", "_g", "g", "a", "=a", "b", "=b" } , // 4 flats { "c", "d", "=d", "e", "=e", "f", "g", "=g", "a", "=a", "b", "=b" } , // 5 flats { "=c", "d", "=d", "e", "=e", "f", "g", "=g", "a", "=a", "b", "c" } , // 6 flats { "=c", "d", "=d", "e", "f", "=f", "g", "=g", "a", "=a", "b", "c" } , // 7 flats }; int octave=value / 12; int note=value % 12; String[] ABC_NOTES = ABC_SCALE[keySignature>7?keySignature:7-keySignature]; // see TGMeasureimpl.java String key = ABC_NOTES[ note ]; if(keySignature==7 && note==0 && octave==5) key="B"; else if(keySignature>12 && note==11 && octave==4) key="c"; else { if(octave < 5) key=key.toUpperCase(); else key=key.toLowerCase(); } for(int i = 5; i < octave; i ++){ key += "'"; } for(int i = octave; i < 4; i ++){ key += ","; } return key; } private String getABCDuration(TGDuration value) { int ticks=getTime(value); int eight=(int) (TGDuration.QUARTER_TIME/2); int d=1; while(((ticks * d) % eight)>0) d = d * 2; String duration = Integer.toString((ticks*d)/eight); if(duration.equals("1")) duration=""; if(d==1) return duration; if(d==2) return duration+"/"; duration+="/"+Integer.toString(d); return duration; } private int getTime(TGDuration value) { long time = (long)( TGDuration.QUARTER_TIME * ( 4.0f / value.getValue()) ) ; if(value.isDotted()){ time += time / 2; }else if(value.isDoubleDotted()){ time += ((time / 4) * 3); } return (int)time; } protected TGChannel getChannel(TGSong song, TGTrack track ){ TGChannel tgChannel = this.manager.getChannel(song, track.getChannelId() ); if( tgChannel != null ){ return tgChannel; } if( this.channelAux == null ){ this.channelAux = this.manager.createChannel(); } return this.channelAux; } private boolean isPercussionTrack(TGSong song, TGTrack track){ return this.manager.isPercussionChannel(song, track.getChannelId()); } }
from scipy import * from pylab import * num_detectors = 100 x = 0.5+0.25*arange(0,float(num_detectors))/float(num_detectors) y = zeros(num_detectors) + 0.5 t = 0. n_cycles = 1 dt = 0.1/n_cycles tmax = 8 def vel(x,y): return [-(y-0.5),x-0.5] while(t<tmax): t = t + dt [k1_x,k1_y] = vel(x,y) [k2_x,k2_y] = vel(x+0.5*dt*k1_x,y+0.5*dt*k1_y) [k3_x,k3_y] = vel(x+0.5*dt*k2_x,y+0.5*dt*k2_y) [k4_x,k4_y] = vel(x+dt*k3_x,y+dt*k3_y) x = x + dt*(k1_x/6.+k2_x/3. + k3_x/3. + k4_x/6.) y = y + dt*(k1_y/6.+k2_y/3. + k3_y/3. + k4_y/6.) plot(x,y,'.') #show() x.tofile('Xvals.txt',sep=' ') y.tofile('Yvals.txt',sep=' ')
// This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // This library is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // You should have received a copy of the GNU Lesser General Public // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package gnu.trove.impl.hash; import gnu.trove.procedure.*; import gnu.trove.impl.HashFunctions; import java.io.ObjectOutput; import java.io.ObjectInput; import java.io.IOException; // THIS IS A GENERATED CLASS. DO NOT HAND EDIT! // /** * An open addressed hashing implementation for byte/float primitive entries. * * Created: Sun Nov 4 08:56:06 2001 * * @author Eric D. Friedman * @author Rob Eden * @author Jeff Randall * @version $Id: _K__V_Hash.template,v 1.1.2.6 2009/11/07 03:36:44 robeden Exp $ */ abstract public class TByteFloatHash extends TPrimitiveHash { static final long serialVersionUID = 1L; /** the set of bytes */ public transient byte[] _set; /** * key that represents null * * NOTE: should not be modified after the Hash is created, but is * not final because of Externalization * */ protected byte no_entry_key; /** * value that represents null * * NOTE: should not be modified after the Hash is created, but is * not final because of Externalization * */ protected float no_entry_value; protected boolean consumeFreeSlot; /** * Creates a new <code>T#E#Hash</code> instance with the default * capacity and load factor. */ public TByteFloatHash() { super(); no_entry_key = ( byte ) 0; no_entry_value = ( float ) 0; } /** * Creates a new <code>T#E#Hash</code> instance whose capacity * is the next highest prime above <tt>initialCapacity + 1</tt> * unless that value is already prime. * * @param initialCapacity an <code>int</code> value */ public TByteFloatHash( int initialCapacity ) { super( initialCapacity ); no_entry_key = ( byte ) 0; no_entry_value = ( float ) 0; } /** * Creates a new <code>TByteFloatHash</code> instance with a prime * value at or near the specified capacity and load factor. * * @param initialCapacity used to find a prime capacity for the table. * @param loadFactor used to calculate the threshold over which * rehashing takes place. */ public TByteFloatHash( int initialCapacity, float loadFactor ) { super(initialCapacity, loadFactor); no_entry_key = ( byte ) 0; no_entry_value = ( float ) 0; } /** * Creates a new <code>TByteFloatHash</code> instance with a prime * value at or near the specified capacity and load factor. * * @param initialCapacity used to find a prime capacity for the table. * @param loadFactor used to calculate the threshold over which * rehashing takes place. * @param no_entry_value value that represents null */ public TByteFloatHash( int initialCapacity, float loadFactor, byte no_entry_key, float no_entry_value ) { super(initialCapacity, loadFactor); this.no_entry_key = no_entry_key; this.no_entry_value = no_entry_value; } /** * Returns the value that is used to represent null as a key. The default * value is generally zero, but can be changed during construction * of the collection. * * @return the value that represents null */ public byte getNoEntryKey() { return no_entry_key; } /** * Returns the value that is used to represent null. The default * value is generally zero, but can be changed during construction * of the collection. * * @return the value that represents null */ public float getNoEntryValue() { return no_entry_value; } /** * initializes the hashtable to a prime capacity which is at least * <tt>initialCapacity + 1</tt>. * * @param initialCapacity an <code>int</code> value * @return the actual capacity chosen */ protected int setUp( int initialCapacity ) { int capacity; capacity = super.setUp( initialCapacity ); _set = new byte[capacity]; return capacity; } /** * Searches the set for <tt>val</tt> * * @param val an <code>byte</code> value * @return a <code>boolean</code> value */ public boolean contains( byte val ) { return index(val) >= 0; } /** * Executes <tt>procedure</tt> for each key in the map. * * @param procedure a <code>TByteProcedure</code> value * @return false if the loop over the set terminated because * the procedure returned false for some value. */ public boolean forEach( TByteProcedure procedure ) { byte[] states = _states; byte[] set = _set; for ( int i = set.length; i if ( states[i] == FULL && ! procedure.execute( set[i] ) ) { return false; } } return true; } /** * Releases the element currently stored at <tt>index</tt>. * * @param index an <code>int</code> value */ protected void removeAt( int index ) { _set[index] = no_entry_key; super.removeAt( index ); } /** * Locates the index of <tt>val</tt>. * * @param key an <code>byte</code> value * @return the index of <tt>val</tt> or -1 if it isn't in the set. */ protected int index( byte key ) { int hash, probe, index, length; final byte[] states = _states; final byte[] set = _set; length = states.length; hash = HashFunctions.hash( key ) & 0x7fffffff; index = hash % length; byte state = states[index]; if (state == FREE) return -1; if (state == FULL && set[index] == key) return index; return indexRehashed(key, index, hash, state); } int indexRehashed(byte key, int index, int hash, byte state) { // see Knuth, p. 529 int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; do { index -= probe; if (index < 0) { index += length; } state = _states[index]; if (state == FREE) return -1; if (key == _set[index] && state != REMOVED) return index; } while (index != loopIndex); return -1; } /** * Locates the index at which <tt>val</tt> can be inserted. if * there is already a value equal()ing <tt>val</tt> in the set, * returns that value as a negative integer. * * @param key an <code>byte</code> value * @return an <code>int</code> value */ protected int insertKey( byte val ) { int hash, index; hash = HashFunctions.hash(val) & 0x7fffffff; index = hash % _states.length; byte state = _states[index]; consumeFreeSlot = false; if (state == FREE) { consumeFreeSlot = true; insertKeyAt(index, val); return index; // empty, all done } if (state == FULL && _set[index] == val) { return -index - 1; // already stored } // already FULL or REMOVED, must probe return insertKeyRehash(val, index, hash, state); } int insertKeyRehash(byte val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look until FREE slot or we start to loop */ do { // Identify first removed slot if (state == REMOVED && firstRemoved == -1) firstRemoved = index; index -= probe; if (index < 0) { index += length; } state = _states[index]; // A FREE slot stops the search if (state == FREE) { if (firstRemoved != -1) { insertKeyAt(firstRemoved, val); return firstRemoved; } else { consumeFreeSlot = true; insertKeyAt(index, val); return index; } } if (state == FULL && _set[index] == val) { return -index - 1; } // Detect loop } while (index != loopIndex); // We inspected all reachable slots and did not find a FREE one // If we found a REMOVED slot we return the first one found if (firstRemoved != -1) { insertKeyAt(firstRemoved, val); return firstRemoved; } // Can a resizing strategy be found that resizes the set? throw new <API key>("No free or removed slots available. Key set full?!!"); } void insertKeyAt(int index, byte val) { _set[index] = val; // insert value _states[index] = FULL; } protected int XinsertKey( byte key ) { int hash, probe, index, length; final byte[] states = _states; final byte[] set = _set; length = states.length; hash = HashFunctions.hash( key ) & 0x7fffffff; index = hash % length; byte state = states[index]; consumeFreeSlot = false; if ( state == FREE ) { consumeFreeSlot = true; set[index] = key; states[index] = FULL; return index; // empty, all done } else if ( state == FULL && set[index] == key ) { return -index -1; // already stored } else { // already FULL or REMOVED, must probe // compute the double hash probe = 1 + ( hash % ( length - 2 ) ); // if the slot we landed on is FULL (but not removed), probe // until we find an empty slot, a REMOVED slot, or an element // equal to the one we are trying to insert. // finding an empty slot means that the value is not present // and that we should use that slot as the insertion point; // finding a REMOVED slot means that we need to keep searching, // however we want to remember the offset of that REMOVED slot // so we can reuse it in case a "new" insertion (i.e. not an update) // is possible. // finding a matching value means that we've found that our desired // key is already in the table if ( state != REMOVED ) { // starting at the natural offset, probe until we find an // offset that isn't full. do { index -= probe; if (index < 0) { index += length; } state = states[index]; } while ( state == FULL && set[index] != key ); } // if the index we found was removed: continue probing until we // locate a free location or an element which equal()s the // one we have. if ( state == REMOVED) { int firstRemoved = index; while ( state != FREE && ( state == REMOVED || set[index] != key ) ) { index -= probe; if (index < 0) { index += length; } state = states[index]; } if (state == FULL) { return -index -1; } else { set[index] = key; states[index] = FULL; return firstRemoved; } } // if it's full, the key is already stored if (state == FULL) { return -index -1; } else { consumeFreeSlot = true; set[index] = key; states[index] = FULL; return index; } } } /** {@inheritDoc} */ public void writeExternal( ObjectOutput out ) throws IOException { // VERSION out.writeByte( 0 ); // SUPER super.writeExternal( out ); // NO_ENTRY_KEY out.writeByte( no_entry_key ); // NO_ENTRY_VALUE out.writeFloat( no_entry_value ); } /** {@inheritDoc} */ public void readExternal( ObjectInput in ) throws IOException, <API key> { // VERSION in.readByte(); // SUPER super.readExternal( in ); // NO_ENTRY_KEY no_entry_key = in.readByte(); // NO_ENTRY_VALUE no_entry_value = in.readFloat(); } } // TByteFloatHash
OCAML_BUILDDIR=../build/ocaml TYPE=native DEBUG=-cflags -g OCAMLBUILD=ocamlbuild -j 0 ${DEBUG} -build-dir "${OCAML_BUILDDIR}" ifeq ($(OS), Windows_NT) WINDOWS_LIBS = $(shell dirname $(shell which ocamlc)) OCAMLBUILDFLAGS = -lflag -cclib -lflag -lshell32 endif TEST_BINARY=${OCAML_BUILDDIR}/tests/test.$(TYPE) # Windows only: Set WINDRES, if it is neither called <API key>.exe (i686) # nor <API key>.exe (x86_64). # WINDRES=i686-w64-windres # export WINDRES .PHONY: all ocaml doc clean tags test all: build_dir ocaml test build_dir: [ -d "${OCAML_BUILDDIR}" ] || mkdir -p "${OCAML_BUILDDIR}" test: ocaml @if [ -f "${TEST_BINARY}" ]; then "${TEST_BINARY}"; else echo "Unit-tests not compiled, so skipping tests"; fi # Build static version (of $TYPE) ocaml: build_dir $(OCAMLBUILD) $(OCAMLBUILDFLAGS) "all-${TYPE}.otarget" #cp 0install.ml "$(OCAML_BUILDDIR)/" if [ "$(OS)" = "Windows_NT" ];then make ocaml_windows; else make ocaml_posix; fi # For static Windows version, we also need the runenv.native helper. ocaml_windows: cp ${OCAML_BUILDDIR}/static_0install.$(TYPE) ${OCAML_BUILDDIR}/0install.exe cp ${OCAML_BUILDDIR}/runenv.native ${OCAML_BUILDDIR}/0install-runenv.exe ln -f "${OCAML_BUILDDIR}/0install.exe" "${OCAML_BUILDDIR}/0launch.exe" cp "${WINDOWS_LIBS}/libeay32.dll" "${WINDOWS_LIBS}/ssleay32.dll" "${OCAML_BUILDDIR}" ocaml_posix: cp ${OCAML_BUILDDIR}/static_0install.$(TYPE) ${OCAML_BUILDDIR}/0install -[ -L 0install ] || ln -s ../build/ocaml/0install 0install @# so Vim can find the type annotations: -[ -L _build -o -e _build ] || ln -s ${OCAML_BUILDDIR} _build ln -f "${OCAML_BUILDDIR}/0install" "${OCAML_BUILDDIR}/0launch" doc: ocp-pack -o support.ml.tmp support/logging.ml support/common.ml support/utils.ml support/basedir.ml support/qdom.ml support/system.ml echo '(** General support code; not 0install-specific *)' > support.ml cat support.ml.tmp >> support.ml rm support.ml.tmp $(OCAMLBUILD) 0install.docdir/index.html rm support.ml # Results turn up in the "html" directory after running the unit-tests. coverage: rm -f bisect*.out OCAML_COVERAGE=true make test ocaml-bisect-report -I "${OCAML_BUILDDIR}" -html html "bisect0001.out" clean: $(OCAMLBUILD) -clean tags: ctags -R [a-z]*
// rbOOmit: An implementation of the Certified Reduced Basis method. // This file is part of rbOOmit. // rbOOmit is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // rbOOmit is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // You should have received a copy of the GNU Lesser General Public // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef <API key> #define <API key> // libMesh includes #include "libmesh/auto_ptr.h" #include "libmesh/point.h" #include "libmesh/rb_evaluation.h" #include "libmesh/replicated_mesh.h" #include "libmesh/rb_theta_expansion.h" // C++ includes namespace libMesh { class RBParameters; class <API key>; class Elem; class RBTheta; /** * This class is part of the rbOOmit framework. * * RBEIMEvaluation extends RBEvaluation to * encapsulate the code and data required * to perform "online" evaluations for * EIM approximations. * * \author David J. Knezevic * \date 2011 */ class RBEIMEvaluation : public RBEvaluation { public: /** * Constructor. */ RBEIMEvaluation (const libMesh::Parallel::Communicator & comm_in <API key>); /** * Destructor. */ virtual ~RBEIMEvaluation (); /** * The type of the parent. */ typedef RBEvaluation Parent; /** * Clear this object. */ virtual void clear() libmesh_override; /** * Resize the data structures for storing data associated * with this object. */ virtual void <API key>(const unsigned int Nmax, bool <API key>=true) libmesh_override; /** * Attach the parametrized function that we will approximate * using the Empirical Interpolation Method. */ void <API key>(<API key> * pf); /** * Get the number of parametrized functions that have * been attached to this system. */ unsigned int <API key>() const; /** * Get a writable reference to the interpolation points mesh. */ ReplicatedMesh & <API key>(); /** * @return the value of the parametrized function that is being * approximated at the point \p p. * \p var_index specifies the * variable (i.e. the parametrized function index) to be evaluated. * \p elem specifies the element of the mesh that contains p. */ Number <API key>(unsigned int var_index, const Point & p, const Elem & elem); /** * Calculate the EIM approximation to <API key> * using the first \p N EIM basis functions. Store the * solution coefficients in the member RB_solution. * @return the EIM a posteriori error bound. */ virtual Real rb_solve(unsigned int N) libmesh_override; /** * Calculate the EIM approximation for the given * right-hand side vector \p EIM_rhs. Store the * solution coefficients in the member RB_solution. */ void rb_solve(DenseVector<Number> & EIM_rhs); /** * @return a scaling factor that we can use to provide a consistent * scaling of the RB error bound across different parameter values. */ virtual Real <API key>() libmesh_override; /** * Build a vector of RBTheta objects that accesses the components * of the RB_solution member variable of this RBEvaluation. * Store these objects in the member vector rb_theta_objects. */ void <API key>(); /** * @return the vector of theta objects that point to this RBEIMEvaluation. */ std::vector<RBTheta *> <API key>(); /** * Build a theta object corresponding to EIM index \p index. * The default implementation builds an RBEIMTheta object, possibly * override in subclasses if we need more specialized behavior. */ virtual UniquePtr<RBTheta> build_eim_theta(unsigned int index); /** * Write out all the data to text files in order to segregate the * Offline stage from the Online stage. * Note: This is a legacy method, use RBDataSerialization instead. */ virtual void <API key>(const std::string & directory_name = "offline_data", const bool write_binary_data=true) libmesh_override; /** * Read in the saved Offline reduced basis data * to initialize the system for Online solves. * Note: This is a legacy method, use RBDataSerialization instead. */ virtual void <API key>(const std::string & directory_name = "offline_data", bool <API key>=true, const bool read_binary_data=true) libmesh_override; /** * Dense matrix that stores the lower triangular * interpolation matrix that can be used */ DenseMatrix<Number> <API key>; /** * The list of interpolation points, i.e. locations at * which the basis functions are maximized. */ std::vector<Point> <API key>; /** * The corresponding list of variables indices at which * the interpolation points were identified. */ std::vector<unsigned int> <API key>; /** * The corresponding list of elements at which * the interpolation points were identified. */ std::vector<Elem *> <API key>; private: /** * Write out <API key> by putting the elements into * a mesh and writing out the mesh. */ void <API key>(const std::string & directory_name); /** * Read int <API key> from a mesh. */ void <API key>(const std::string & directory_name); /** * This vector stores the parametrized functions * that will be approximated in this EIM system. */ std::vector<<API key> *> <API key>; /** * The vector of RBTheta objects that are created to point to * this RBEIMEvaluation. */ std::vector<RBTheta *> <API key>; /** * We initialize RBEIMEvaluation so that it has an "empty" RBThetaExpansion, because * this isn't used at all in the EIM. */ RBThetaExpansion <API key>; /** * Store the parameters at which the previous solve was performed (so we can avoid * an unnecessary repeat solve). */ RBParameters <API key>; /** * Store the number of basis functions used for the previous solve (so we can avoid * an unnecessary repeat solve). */ unsigned int _previous_N; /** * Store the previous error bound returned by rb_solve (so we can return it if we * are avoiding an unnecessary repeat solve). */ Real <API key>; /** * Mesh object that we use to store copies of the elements associated with * interpolation points. */ ReplicatedMesh <API key>; }; } #endif // <API key>
<div cond="$module_info->footer_text" class="footer_text">{$module_info->footer_text}</div> <div cond="$mi->bd_font!='N'" id="install_ng2"> <button type="button" class="tg_blur2"></button><button class="tg_close2">X</button> <h3> </h3><br /> <h4> PC <b></b> .</h4> <p> <b></b> <br /><b></b> .</p> <a class="do btn_img" href="http://hangeul.naver.com" target="_blank"><span class="tx_ico_chk"></span> </a> <a class="btn_img no close" href="#">{$lang->cmd_cancel}</a> <button type="button" class="tg_blur2"></button> </div> <p class="blind">Designed by sketchbooks.co.kr / sketchbook5 board skin</p> </div> <div class="fontcheckWrp"> <div cond="$mi->bd_font!='N'" class="blind"> <p id="fontcheck_ng3" style="font-family:'',NanumGothic,monospace,Verdana !important">Sketchbook5, 5</p> <p id="fontcheck_ng4" style="font-family:monospace,Verdana !important">Sketchbook5, 5</p> </div> <div class="blind"> <p id="fontcheck_np1" style="font-family:' ','Nanum Pen Script',np,monospace,Verdana !important">Sketchbook5, 5</p> <p id="fontcheck_np2" style="font-family:monospace,Verdana !important">Sketchbook5, 5</p> </div> </div>
#include <libming.h> #include <stdlib.h> int main() { SWFMovie m = <API key>(8); SWFShape s = newSWFShape(); SWFFill f = <API key>(s, 255,0,0,255); <API key>(s, f); <API key>(10); SWFShape_movePenTo(s, 167.000000, 69.875040); <API key>(s, 198.796531,69.875040,224.624960,95.703469,224.624960,127.500000); <API key>(s, 224.624960,159.296531,198.796531,185.124960,167.000000,185.124960); <API key>(s, 135.203469,185.124960,109.375040,159.296531,109.375040,127.500000); <API key>(s, 109.375040,95.703469,135.203469,69.875040,167.000000,69.875040); SWFMovie_add(m, s); SWFMovie_save(m, "test02.swf"); return 0; }
<?php lmb_require('limb/dbal/src/query/lmbSelectQuery.class.php'); class lmbSelectQueryTest extends UnitTestCase { function testConstruct() { $sql = new lmbSelectQuery('foo'); $this->assertEqual($sql->getTables(), array('foo')); } }
#!/usr/bin/perl my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); my @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); my $dtstr = sprintf("%s, %d %s %d %02d:%02d:%02d", $days[$wday], $mday, $months[$mon], $year+1900, $hour, $min, $sec); my $repo = "https://qgvdial.googlecode.com/svn/trunk"; my $cmd; # Delete any existing version file system("rm -f ver.cfg"); # Get the latest version file from the repository $cmd = "svn export $repo/build-files/ver.cfg"; system($cmd); # Pull out the version from the file open(QVARFILE, "ver.cfg") or die; my $qver = <QVARFILE>; close QVARFILE; chomp $qver; # Get the subversion checkin version my $svnver = `svn log $repo --limit=1 | grep \"^r\"`; # Parse out the version number from the output we pulled out $svnver =~ m/^r(\d+)*/; $svnver = $1; # Create the version suffix $qver = "$qver.$svnver"; # Get the full path of the base directory my $basedir = `pwd`; chomp $basedir; $basedir = "$basedir/qgvdial-$qver"; # Delete any previous checkout directories system("rm -rf qgvdial-* qgvtp-* qgvdial_* qgvtp_* version.pl"); system("svn export $repo $basedir"); system("cp $basedir/build-files/version.pl ."); # Append the version to the pro file open(PRO_FILE, ">>$basedir/qgvdial/maemo/maemo.pro") || die "Cannot open pro file"; print PRO_FILE "VERSION=__QGVDIAL_VERSION__\n"; close PRO_FILE; # Version replacement $cmd = "perl version.pl __QGVDIAL_VERSION__ $qver $basedir"; print "$cmd\n"; system($cmd); # Date replacement $cmd = "perl version.pl <API key> '$dtstr' $basedir"; print "$cmd\n"; system($cmd); # NO Cipher replacement for Maemo: The source is publicly available. # Mixpanel replacement open my $mixpanel_token_file, '<', "mixpanel.token"; my $mixpanel_token = <$mixpanel_token_file>; close $mixpanel_token_file; chomp $mixpanel_token; $cmd = "perl version.pl <API key> '$mixpanel_token' $basedir"; print "$cmd\n"; system($cmd); # Copy the client secret file to the api directory :( $cmd = "cd $basedir/api ; cp ../../client_<API key>.apps.googleusercontent.com.json ."; print "$cmd\n"; system($cmd); # Do everything upto the preparation of the debian directory. Code is still not compiled. $cmd = "cd $basedir && echo y | dh_make -n --createorig --single -e yuvraaj\@gmail.com -c lgpl2"; print "$cmd\n"; system($cmd); # Put all the debianization files into the debian folder system("cd $basedir/qgvdial/maemo/qtc_packaging/debian_fremantle/ ; cp compat control copyright README rules ../../../../debian/"); system("cd $basedir/debian ; cp ../build-files/qgvdial/changelog.txt changelog"); # Copy the top level pro file system("cp $basedir/build-files/qgvdial/maemo/maemo.pro $basedir"); # Reverse the order of these two lines for a complete build $cmd = "cd $basedir && dpkg-buildpackage -rfakeroot"; $cmd = "cd $basedir && dpkg-buildpackage -rfakeroot -sa -S -uc -us"; # Execute the rest of the build command system($cmd); system("cd $basedir/.. ; dput -f fremantle-upload qgvdial*.changes"); exit(0);
#include "config.h" #include "pango-impl-utils.h" #include "pango-glyph.h" #include "<API key>.h" #include <string.h> /** * pango_shape: * @text: the text to process * @length: the length (in bytes) of @text * @analysis: #PangoAnalysis structure from pango_itemize() * @glyphs: glyph string in which to store results * * Given a segment of text and the corresponding * #PangoAnalysis structure returned from pango_itemize(), * convert the characters into glyphs. You may also pass * in only a substring of the item from pango_itemize(). */ void pango_shape (const gchar *text, gint length, const PangoAnalysis *analysis, PangoGlyphString *glyphs) { int i; int last_cluster; glyphs->num_glyphs = 0; if (G_LIKELY (analysis->shape_engine && analysis->font)) { <API key> (analysis->shape_engine, analysis->font, text, length, analysis, glyphs); if (G_UNLIKELY (glyphs->num_glyphs == 0)) { /* If a font has been correctly chosen, but no glyphs are output, * there's probably something wrong with the shaper, or the font. * * Trying to be informative, we print out the font description, * shaper name, and the text, but to not flood the terminal with * zillions of the message, we set a flag to only err once per * font/engine pair. * * To do the flag fast, we use the engine qname to qflag the font, * but also the font description to flag the engine. This is * supposed to be fast to check, but also avoid writing out * duplicate warnings when a new PangoFont is created. */ GType engine_type = G_OBJECT_TYPE (analysis->shape_engine); GQuark warned_quark = g_type_qname (engine_type); if (!g_object_get_qdata (G_OBJECT (analysis->font), warned_quark)) { <API key> *desc; char *font_name; const char *engine_name; desc = pango_font_describe (analysis->font); font_name = <API key> (desc); <API key> (desc); if (!g_object_get_data (G_OBJECT (analysis->shape_engine), font_name)) { engine_name = g_type_name (engine_type); if (!engine_name) engine_name = "(unknown)"; g_warning ("shaping failure, expect ugly output. shape-engine='%s', font='%s', text='%.*s'", engine_name, font_name, length == -1 ? (gint) strlen (text) : length, text); <API key> (G_OBJECT (analysis->shape_engine), font_name, GINT_TO_POINTER (1), NULL); } g_free (font_name); <API key> (G_OBJECT (analysis->font), warned_quark, GINT_TO_POINTER (1), NULL); } } } else glyphs->num_glyphs = 0; if (G_UNLIKELY (!glyphs->num_glyphs)) { PangoEngineShape *fallback_engine = <API key> (); <API key> (fallback_engine, analysis->font, text, length, analysis, glyphs); if (G_UNLIKELY (!glyphs->num_glyphs)) return; } /* make sure last_cluster is invalid */ last_cluster = glyphs->log_clusters[0] - 1; for (i = 0; i < glyphs->num_glyphs; i++) { /* Set glyphs[i].attr.is_cluster_start based on log_clusters[] */ if (glyphs->log_clusters[i] != last_cluster) { glyphs->glyphs[i].attr.is_cluster_start = TRUE; last_cluster = glyphs->log_clusters[i]; } else glyphs->glyphs[i].attr.is_cluster_start = FALSE; /* Shift glyph if width is negative, and negate width. * This is useful for rotated font matrices and shouldn't * harm in normal cases. */ if (glyphs->glyphs[i].geometry.width < 0) { glyphs->glyphs[i].geometry.width = -glyphs->glyphs[i].geometry.width; glyphs->glyphs[i].geometry.x_offset += glyphs->glyphs[i].geometry.width; } } /* Make sure glyphstring direction conforms to analysis->level */ if (G_UNLIKELY ((analysis->level & 1) && glyphs->log_clusters[0] < glyphs->log_clusters[glyphs->num_glyphs - 1])) { /* Warn once per shaper */ static GQuark warned_quark = 0; if (!warned_quark) warned_quark = <API key> ("pango-shape-warned"); if (analysis->shape_engine && !g_object_get_qdata (G_OBJECT (analysis->shape_engine), warned_quark)) { GType engine_type = G_OBJECT_TYPE (analysis->shape_engine); const char *engine_name = g_type_name (engine_type); if (!engine_name) engine_name = "(unknown)"; g_warning ("Expected RTL run but shape-engine='%s' returned LTR. Fixing.", engine_name); <API key> (G_OBJECT (analysis->shape_engine), warned_quark, GINT_TO_POINTER (1), NULL); } /* *Fix* it so we don't crash later */ <API key> (glyphs, 0, glyphs->num_glyphs); } }
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ #include "XFEMAction.h" #include "FEProblem.h" #include "DisplacedProblem.h" #include "NonlinearSystem.h" #include "XFEM.h" #include "Executioner.h" #include "MooseEnum.h" #include "Parser.h" #include "Factory.h" #include "<API key>.h" #include "XFEMCircleCut.h" #include "XFEMGeometricCut2D.h" #include "XFEMSquareCut.h" #include "XFEMEllipseCut.h" // libMesh includes #include "libmesh/transient_system.h" #include "libmesh/string_to_enum.h" template<> InputParameters validParams<XFEMAction>() { InputParameters params = validParams<Action>(); params.addParam<std::string>("cut_type", "line_segment_2d", "The type of XFEM cuts"); params.addParam<std::vector<Real> >("cut_data","Data for XFEM geometric cuts"); params.addParam<std::vector<Real> >("cut_scale","X,Y scale factors for XFEM geometric cuts"); params.addParam<std::vector<Real> >("cut_translate","X,Y translations for XFEM geometric cuts"); params.addParam<std::string>("qrule", "volfrac", "XFEM quadrature rule to use"); params.addParam<bool>("output_cut_plane",false,"Output the XFEM cut plane and volume fraction"); params.addParam<bool>("<API key>", false, "Use fixed crack growth increment"); params.addParam<Real>("<API key>", 0.1, "Crack growth increment"); return params; } XFEMAction::XFEMAction(InputParameters params) : Action(params), _xfem_cut_type(getParam<std::string>("cut_type")), _xfem_qrule(getParam<std::string>("qrule")), _xfem_cut_plane(false), <API key>(getParam<bool>("<API key>")), <API key>(getParam<Real>("<API key>")) { _order = "CONSTANT"; _family = "MONOMIAL"; if (isParamValid("output_cut_plane")) _xfem_cut_plane = getParam<bool>("output_cut_plane"); } void XFEMAction::act() { MooseSharedPointer<XFEMInterface> xfem_interface = _problem->getXFEM(); if (xfem_interface == NULL) { _pars.set<FEProblemBase *>("_fe_problem_base") = &*_problem; MooseSharedPointer<XFEM> new_xfem (new XFEM(_pars)); _problem->initXFEM(new_xfem); xfem_interface = _problem->getXFEM(); } MooseSharedPointer<XFEM> xfem = <API key>::<API key><XFEM>(xfem_interface); if (xfem == NULL) mooseError("dynamic cast of xfem object failed"); if (_current_task == "setup_xfem"){ _xfem_cut_data = getParam<std::vector<Real> >("cut_data"); xfem->setXFEMQRule(_xfem_qrule); xfem-><API key>(<API key>, <API key>); MooseSharedPointer<<API key>> new_xfem_epl (new <API key>(xfem, 0)); _problem->geomSearchData().<API key>(0, new_xfem_epl); if (_problem->getDisplacedProblem() != NULL) { MooseSharedPointer<<API key>> new_xfem_epl2 (new <API key>(xfem, 0, true)); _problem->getDisplacedProblem()->geomSearchData().<API key>(0, new_xfem_epl2); } if (_xfem_cut_type == "line_segment_2d") { if (_xfem_cut_data.size() % 6 != 0) mooseError("Length of XFEM_cuts must be a multiple of 6."); unsigned int num_cuts = _xfem_cut_data.size()/6; std::vector<Real> trans; if (isParamValid("cut_translate")) { trans = getParam<std::vector<Real> >("cut_translate"); } else { trans.push_back(0.0); trans.push_back(0.0); } std::vector<Real> scale; if (isParamValid("cut_scale")) { scale = getParam<std::vector<Real> >("cut_scale"); } else { scale.push_back(1.0); scale.push_back(1.0); } for (unsigned int i = 0; i < num_cuts; ++i) { Real x0 = (_xfem_cut_data[i*6+0]+trans[0])*scale[0]; Real y0 = (_xfem_cut_data[i*6+1]+trans[1])*scale[1]; Real x1 = (_xfem_cut_data[i*6+2]+trans[0])*scale[0]; Real y1 = (_xfem_cut_data[i*6+3]+trans[1])*scale[1]; Real t0 = _xfem_cut_data[i*6+4]; Real t1 = _xfem_cut_data[i*6+5]; xfem->addGeometricCut(new XFEMGeometricCut2D( x0, y0, x1, y1, t0, t1)); } } else if (_xfem_cut_type == "square_cut_3d") { if (_xfem_cut_data.size() % 12 != 0) mooseError("Length of XFEM_cuts must be 12 when square_cut_3d"); unsigned int num_cuts = _xfem_cut_data.size()/12; std::vector<Real> square_cut_data(12); for (unsigned i = 0; i < num_cuts; ++i){ for (unsigned j = 0; j < 12; j++){ square_cut_data[j] = _xfem_cut_data[i*12+j]; } xfem->addGeometricCut(new XFEMSquareCut(square_cut_data)); } } else if (_xfem_cut_type == "circle_cut_3d") { if (_xfem_cut_data.size() % 9 != 0) mooseError("Length of XFEM_cuts must be 9 when circle_cut_3d"); unsigned int num_cuts = _xfem_cut_data.size()/9; std::vector<Real> circle_cut_data(9); for (unsigned i = 0; i < num_cuts; ++i){ for (unsigned j = 0; j < 9; j++){ circle_cut_data[j] = _xfem_cut_data[i*9+j]; } xfem->addGeometricCut(new XFEMCircleCut(circle_cut_data)); } } else if (_xfem_cut_type == "ellipse_cut_3d") { if (_xfem_cut_data.size() % 9 != 0) mooseError("Length of XFEM_cuts must be 9 when ellipse_cut_3d"); unsigned int num_cuts = _xfem_cut_data.size()/9; std::vector<Real> ellipse_cut_data(9); for (unsigned i = 0; i < num_cuts; ++i){ for (unsigned j = 0; j < 9; j++){ ellipse_cut_data[j] = _xfem_cut_data[i*9+j]; } xfem->addGeometricCut(new XFEMEllipseCut(ellipse_cut_data)); } } else mooseError("unrecognized XFEM cut type"); } else if (_current_task == "add_aux_variable" && _xfem_cut_plane) { _problem->addAuxVariable("xfem_cut_origin_x",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut_origin_y",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut_origin_z",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut_normal_x",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut_normal_y",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut_normal_z",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut2_origin_x",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut2_origin_y",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut2_origin_z",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut2_normal_x",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut2_normal_y",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_cut2_normal_z",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); _problem->addAuxVariable("xfem_volfrac",FEType(Utility::string_to_enum<Order>(_order),Utility::string_to_enum<FEFamily>(_family))); } else if (_current_task == "add_aux_kernel" && _xfem_cut_plane) { InputParameters params = _factory.getValidParams("XFEMVolFracAux"); params.set<MultiMooseEnum>("execute_on") = "timestep_begin"; params.set<AuxVariableName>("variable") = "xfem_volfrac"; _problem->addAuxKernel("XFEMVolFracAux","xfem_volfrac",params); params = _factory.getValidParams("XFEMCutPlaneAux"); params.set<MultiMooseEnum>("execute_on") = "timestep_end"; // first cut plane params.set<unsigned int>("plane_id") = 0; params.set<AuxVariableName>("variable") = "xfem_cut_origin_x"; params.set<MooseEnum>("quantity") = "origin_x"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_origin_x", params); params.set<AuxVariableName>("variable") = "xfem_cut_origin_y"; params.set<MooseEnum>("quantity") = "origin_y"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_origin_y", params); params.set<AuxVariableName>("variable") = "xfem_cut_origin_z"; params.set<MooseEnum>("quantity") = "origin_z"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_origin_z", params); params.set<AuxVariableName>("variable") = "xfem_cut_normal_x"; params.set<MooseEnum>("quantity") = "normal_x"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_normal_x", params); params.set<AuxVariableName>("variable") = "xfem_cut_normal_y"; params.set<MooseEnum>("quantity") = "normal_y"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_normal_y", params); params.set<AuxVariableName>("variable") = "xfem_cut_normal_z"; params.set<MooseEnum>("quantity") = "normal_z"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_normal_z", params); // second cut plane params.set<unsigned int>("plane_id") = 1; params.set<AuxVariableName>("variable") = "xfem_cut2_origin_x"; params.set<MooseEnum>("quantity") = "origin_x"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_origin_x", params); params.set<AuxVariableName>("variable") = "xfem_cut2_origin_y"; params.set<MooseEnum>("quantity") = "origin_y"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_origin_y", params); params.set<AuxVariableName>("variable") = "xfem_cut2_origin_z"; params.set<MooseEnum>("quantity") = "origin_z"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_origin_z", params); params.set<AuxVariableName>("variable") = "xfem_cut2_normal_x"; params.set<MooseEnum>("quantity") = "normal_x"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_normal_x", params); params.set<AuxVariableName>("variable") = "xfem_cut2_normal_y"; params.set<MooseEnum>("quantity") = "normal_y"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_normal_y", params); params.set<AuxVariableName>("variable") = "xfem_cut2_normal_z"; params.set<MooseEnum>("quantity") = "normal_z"; _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_normal_z", params); } }
import re import transaction from ..models import DBSession SQL_TABLE = """ SELECT c.oid, n.nspname, c.relname FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relname = :table_name AND pg_catalog.pg_table_is_visible(c.oid) ORDER BY 2, 3 """ SQL_TABLE_SCHEMA = """ SELECT c.oid, n.nspname, c.relname FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relname = :table_name AND n.nspname = :schema ORDER BY 2, 3 """ SQL_FIELDS = """ SELECT a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod), (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128) FROM pg_catalog.pg_attrdef d WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef), a.attnotnull, a.attnum, (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation, NULL AS indexdef, NULL AS attfdwoptions FROM pg_catalog.pg_attribute a WHERE a.attrelid = :table_id AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum""" def get_table_seq(table_name): t = table_name.split('.') if t[1:]: schema = t[0] table_name = t[1] sql = text(SQL_TABLE_SCHEMA) q = engine.execute(sql, schema=schema, table_name=table_name) else: sql = text(SQL_TABLE) q = engine.execute(sql, table_name=table_name) r = q.fetchone() table_id = r.oid sql = text(SQL_FIELDS) q = engine.execute(sql, table_id=table_id) regex = re.compile("nextval\('(.*)'\:") for r in q.fetchall(): if not r.substring: continue if r.substring.find('nextval') == -1: continue match = regex.search(r.substring) return match.group(1) def set_sequence(orm, seq_name): row = DBSession.query(orm).order_by('id DESC').first() last_id = row.id seq_name = get_table_seq(orm.__tablename__) sql = "SELECT setval('%s', %d)" % (seq_name, last_id) engine = DBSession.bind engine.execute(sql) def set_sequences(ORMs): for orm in ORMs: set_sequence(orm) def get_pkeys(table): r = [] for c in table.constraints: if c.__class__ is not <API key>: continue for col in c: r.append(col.name) return r def insert_(engine, fixtures): session_factory = sessionmaker(bind=engine) session = session_factory() metadata = MetaData(engine) sequences = [] for tablename, data in fixtures: table = Table(tablename, metadata, autoload=True) class T(Base, BaseModel): __table__ = table keys = get_pkeys(table) for d in data: filter_ = {} for key in keys: val = d[key] filter_[key] = val q = session.query(T).filter_by(**filter_) if q.first(): continue u = T() u.from_dict(d) m = session.add(u) seq_name = get_table_seq(tablename) if seq_name: sequences.append((T, seq_name)) session.commit() set_sequences(sequences)
package org.jgrapht.alg; import java.util.*; import org.jgrapht.*; import org.jgrapht.graph.*; /** * List of simple paths in increasing order of weight. * * @author Guillaume Boulmier * @since July 5, 2007 */ final class <API key><V, E> extends <API key><V, E, RankingPathElement<V, E>> { /** * Vertex that paths of the list must not disconnect. */ private V <API key> = null; private Map<RankingPathElement<V, E>, Boolean> path2disconnect = new HashMap<RankingPathElement<V, E>, Boolean>(); /** * Creates a list with an empty path. The list size is 1. * * @param maxSize max number of paths the list is able to store. */ <API key>( Graph<V, E> graph, int maxSize, RankingPathElement<V, E> pathElement) { super(graph, maxSize, pathElement); } /** * Creates paths obtained by concatenating the specified edge to the * specified paths. * * @param prevPathElementList paths, list of <code> * RankingPathElement</code>. * @param edge edge reaching the end vertex of the created paths. * @param maxSize maximum number of paths the list is able to store. */ <API key>( Graph<V, E> graph, int maxSize, <API key><V, E> elementList, E edge) { this(graph, maxSize, elementList, edge, null); assert (!this.pathElements.isEmpty()); } /** * Creates paths obtained by concatenating the specified edge to the * specified paths. * * @param prevPathElementList paths, list of <code> * RankingPathElement</code>. * @param edge edge reaching the end vertex of the created paths. * @param maxSize maximum number of paths the list is able to store. */ <API key>( Graph<V, E> graph, int maxSize, <API key><V, E> elementList, E edge, V <API key>) { super(graph, maxSize, elementList, edge); this.<API key> = <API key>; // loop over the path elements in increasing order of weight. for (int i = 0; i < elementList.size(); i++) { RankingPathElement<V, E> prevPathElement = elementList.get(i); if (isNotValidPath(prevPathElement, edge)) { continue; } if (size() < this.maxSize) { double weight = calculatePathWeight(prevPathElement, edge); RankingPathElement<V, E> newPathElement = new RankingPathElement<V, E>( this.graph, prevPathElement, edge, weight); // the new path is inserted at the end of the list. this.pathElements.add(newPathElement); } } } /** * Creates an empty list. The list size is 0. * * @param maxSize max number of paths the list is able to store. */ <API key>(Graph<V, E> graph, int maxSize, V vertex) { super(graph, maxSize, vertex); } /** * <p>Adds paths in the list at vertex y. Candidate paths are obtained by * concatenating the specified edge (v->y) to the paths <code> * elementList</code> at vertex v.</p> * * Complexity = * * <ul> * <li>w/o guard-vertex: O(<code>k*np</code>) where <code>k</code> is the * max size limit of the list and <code>np</code> is the maximum number of * vertices in the paths stored in the list</li> * <li>with guard-vertex: O(<code>k*(m+n)</code>) where <code>k</code> is * the max size limit of the list, <code>m</code> is the number of edges of * the graph and <code>n</code> is the number of vertices of the graph, * O(<code>m+n</code>) being the complexity of the <code> * <API key></code> to check whether a path exists towards the * guard-vertex</li> * </ul> * * @param elementList list of paths at vertex v. * @param edge edge (v->y). * * @return <code>true</code> if at least one path has been added in the * list, <code>false</code> otherwise. */ public boolean addPathElements( <API key><V, E> elementList, E edge) { assert (this.vertex.equals( Graphs.getOppositeVertex( this.graph, edge, elementList.getVertex()))); boolean pathAdded = false; // loop over the paths elements of the list at vertex v. for ( int vIndex = 0, yIndex = 0; vIndex < elementList.size(); vIndex++) { RankingPathElement<V, E> prevPathElement = elementList.get(vIndex); if (isNotValidPath(prevPathElement, edge)) { // checks if path is simple and if guard-vertex is not // disconnected. continue; } double newPathWeight = calculatePathWeight(prevPathElement, edge); RankingPathElement<V, E> newPathElement = new RankingPathElement<V, E>( this.graph, prevPathElement, edge, newPathWeight); // loop over the paths of the list at vertex y from yIndex to the // end. RankingPathElement<V, E> yPathElement = null; for (; yIndex < size(); yIndex++) { yPathElement = get(yIndex); // case when the new path is shorter than the path Py stored at // index y if (newPathWeight < yPathElement.getWeight()) { this.pathElements.add(yIndex, newPathElement); pathAdded = true; // ensures max size limit is not exceeded. if (size() > this.maxSize) { this.pathElements.remove(this.maxSize); } break; } // case when the new path is of the same length as the path Py // stored at index y if (newPathWeight == yPathElement.getWeight()) { this.pathElements.add(yIndex + 1, newPathElement); pathAdded = true; // ensures max size limit is not exceeded. if (size() > this.maxSize) { this.pathElements.remove(this.maxSize); } break; } } // case when the new path is longer than the longest path in the // list (Py stored at the last index y) if (newPathWeight > yPathElement.getWeight()) { // ensures max size limit is not exceeded. if (size() < this.maxSize) { // the new path is inserted at the end of the list. this.pathElements.add(newPathElement); pathAdded = true; } else { // max size limit is reached -> end of the loop over the // paths elements of the list at vertex v. break; } } } return pathAdded; } /** * @return list of <code>RankingPathElement</code>. */ List<RankingPathElement<V, E>> getPathElements() { return this.pathElements; } /** * Costs taken into account are the weights stored in <code>Edge</code> * objects. * * @param pathElement * @param edge the edge via which the vertex was encountered. * * @return the cost obtained by concatenation. * * @see Graph#getEdgeWeight(E) */ private double calculatePathWeight( RankingPathElement<V, E> pathElement, E edge) { double pathWeight = this.graph.getEdgeWeight(edge); // otherwise it's the start vertex. if ((pathElement.getPrevEdge() != null)) { pathWeight += pathElement.getWeight(); } return pathWeight; } /** * Ensures that paths of the list do not disconnect the guard-vertex. * * @return <code>true</code> if the specified path element disconnects the * guard-vertex, <code>false</code> otherwise. */ private boolean <API key>( RankingPathElement<V, E> prevPathElement) { if (this.<API key> == null) { return false; } if (this.path2disconnect.containsKey(prevPathElement)) { return this.path2disconnect.get(prevPathElement); } <API key><V, E> <API key>; MaskFunctor<V, E> connectivityMask; if (this.graph instanceof DirectedGraph<?, ?>) { connectivityMask = new PathMask<V, E>(prevPathElement); <API key><V, E> connectivityGraph = new <API key><V, E>( (DirectedGraph<V, E>) this.graph, connectivityMask); <API key> = new <API key><V, E>( connectivityGraph); } else { connectivityMask = new PathMask<V, E>(prevPathElement); <API key><V, E> connectivityGraph = new <API key><V, E>( (UndirectedGraph<V, E>) this.graph, connectivityMask); <API key> = new <API key><V, E>( connectivityGraph); } if (connectivityMask.isVertexMasked(this.<API key>)) { // the guard-vertex was already in the path element -> invalid path this.path2disconnect.put(prevPathElement, true); return true; } if (!<API key>.pathExists( this.vertex, this.<API key>)) { this.path2disconnect.put(prevPathElement, true); return true; } this.path2disconnect.put(prevPathElement, false); return false; } private boolean isNotValidPath( RankingPathElement<V, E> prevPathElement, E edge) { return !isSimplePath(prevPathElement, edge) || <API key>(prevPathElement); } /** * Ensures that paths of the list are simple (check that the vertex was not * already in the path element). * * @param prevPathElement * @param edge * * @return <code>true</code> if the resulting path (obtained by * concatenating the specified edge to the specified path) is simple, <code> * false</code> otherwise. */ private boolean isSimplePath( RankingPathElement<V, E> prevPathElement, E edge) { RankingPathElement<V, E> pathElementToTest = prevPathElement; while (pathElementToTest.getPrevEdge() != null) { if (pathElementToTest.getVertex() == this.vertex) { return false; } else { pathElementToTest = pathElementToTest.getPrevPathElement(); } } return true; } private static class PathMask<V, E> implements MaskFunctor<V, E> { private Set<E> maskedEdges; private Set<V> maskedVertices; /** * Creates a mask for all the edges and the vertices of the path * (including the 2 extremity vertices). * * @param pathElement */ PathMask(RankingPathElement<V, E> pathElement) { this.maskedEdges = new HashSet<E>(); this.maskedVertices = new HashSet<V>(); while (pathElement.getPrevEdge() != null) { this.maskedEdges.add(pathElement.getPrevEdge()); this.maskedVertices.add(pathElement.getVertex()); pathElement = pathElement.getPrevPathElement(); } this.maskedVertices.add(pathElement.getVertex()); } // implement MaskFunctor public boolean isEdgeMasked(E edge) { return this.maskedEdges.contains(edge); } // implement MaskFunctor public boolean isVertexMasked(V vertex) { return this.maskedVertices.contains(vertex); } } } // End <API key>.java
package com.google.java.contract.core.model; import com.google.java.contract.Ensures; import com.google.java.contract.Invariant; import com.google.java.contract.Requires; import com.google.java.contract.util.Predicate; @Invariant({ "isSimpleName(getSimpleName())", "isQualifiedName(getQualifiedName())", "isQualifiedName(<API key>())", "isBinaryName(getBinaryName())" }) public class ClassName extends TypeName { protected String simpleName; protected String qualifiedName; protected String semiQualifiedName; protected String binaryName; /** * Constructs a new ClassName from its binary name. Other forms are * inferred. The resulting class name is not generic (has no generic * parameter). */ @Requires("isBinaryName(binaryName)") @Ensures("binaryName.equals(getBinaryName())") public ClassName(String binaryName) { this.binaryName = binaryName; simpleName = null; <API key>(); inferQualifiedName(); inferSimpleName(); declaredName = qualifiedName; } /** * Constructs a new ClassName from its binary and declared * names. Other forms are inferred. The binary and declared names * must represent the same type. */ @Requires({ "isBinaryName(binaryName)", "declaredName != null" }) @Ensures({ "binaryName.equals(getBinaryName())", "declaredName.equals(getDeclaredName())" }) public ClassName(String binaryName, String declaredName) { this.binaryName = binaryName; this.declaredName = declaredName; simpleName = null; <API key>(); inferQualifiedName(); inferSimpleName(); <API key>(); } @Requires({ "binaryName != null", "declaredName != null", "simpleName != null", "binaryName.endsWith(simpleName)" }) @Ensures({ "binaryName.equals(getBinaryName())", "declaredName.equals(getDeclaredName())", "simpleName.equals(getSimpleName())" }) public ClassName(String binaryName, String declaredName, String simpleName) { this.binaryName = binaryName; this.declaredName = declaredName; this.simpleName = simpleName; <API key>(); inferQualifiedName(); <API key>(); } protected void <API key>() { if (!declaredName.replaceAll("<[^.]*>", "").startsWith(qualifiedName)) { throw new <API key>( "declared name '" + declaredName + "' does not match qualified name '" + qualifiedName + "'"); } } public String getSimpleName() { return simpleName; } /** * Returns the relative component of {@code pathName}. * * @param pathName a dot-separated path */ @Requires("pathName != null") @Ensures("result != null") public static String getRelativeName(String pathName) { int lastSep = pathName.lastIndexOf('.'); if (lastSep == -1) { return pathName; } else { return pathName.substring(lastSep + 1); } } /** * Returns the package component of {@code pathName}. * * @param pathName a dot-separated path */ @Requires("pathName != null") @Ensures("result != null") public static String getPackageName(String pathName) { int lastSep = pathName.lastIndexOf('.'); if (lastSep == -1) { return ""; } else { return pathName.substring(0, lastSep); } } public String getQualifiedName() { return qualifiedName; } public String <API key>() { return semiQualifiedName; } public String getBinaryName() { return binaryName; } private void <API key>() { semiQualifiedName = binaryName.replace('/', '.'); } private void inferQualifiedName() { if (simpleName == null) { qualifiedName = semiQualifiedName.replace('$', '.'); } else { int prefixLength = semiQualifiedName.length() - simpleName.length(); String prefix = semiQualifiedName.substring(0, prefixLength); qualifiedName = prefix.replace('$', '.') + simpleName; } } private void inferSimpleName() { int i = qualifiedName.lastIndexOf('.'); if (i == -1) { simpleName = qualifiedName; } else { simpleName = qualifiedName.substring(i + 1); } } @Override public boolean equals(Object obj) { return obj instanceof ClassName && binaryName.equals(((ClassName) obj).binaryName) && declaredName.equals(((ClassName) obj).declaredName); } @Override public int hashCode() { return binaryName.hashCode() ^ declaredName.hashCode(); } /** * Returns {@code true} if {@code name} is <em>syntactically</em> a * valid simple name. */ public static boolean isSimpleName(String name) { if (name == null || name.isEmpty()) { return false; } if (!Character.<API key>(name.charAt(0))) { return false; } int len = name.length(); for (int i = 1; i < len; ++i) { if (!Character.<API key>(name.charAt(i))) { return false; } } return true; } protected static final Predicate<String> IS_SIMPLE_NAME = new Predicate<String>() { @Override public boolean apply(String name) { return isSimpleName(name); } }; public static Predicate<String> isSimpleName() { return IS_SIMPLE_NAME; } /** * Returns {@code true} if {@code name} is <em>syntactically</em> a * valid qualified name. * * <p>Note: there is no syntactical difference between * semi-qualified and fully-qualified names. */ @Ensures("result == isBinaryName(name.replace('.', '/'))") public static boolean isQualifiedName(String name) { if (name == null || name.isEmpty()) { return false; } String[] parts = name.split("\\."); for (String part : parts) { if (!isSimpleName(part)) { return false; } } return true; } private static final Predicate<String> IS_QUALIFIED_NAME = new Predicate<String>() { @Override public boolean apply(String name) { return isQualifiedName(name); } }; public static Predicate<String> isQualifiedName() { return IS_QUALIFIED_NAME; } /** * Returns {@code true} if {@code name} is <em>syntactically</em> a * valid qualified name followed by the two characters {@code .*}. */ public static boolean isStarQualifiedName(String name) { return name != null && name.endsWith(".*") && isQualifiedName(name.substring(0, name.length() - 2)); } /** * Returns {@code true} if {@code name} is <em>syntactically</em> a * valid binary name. */ @Ensures("result == isQualifiedName(name.replace('/', '.'))") public static boolean isBinaryName(String name) { if (name == null || name.isEmpty()) { return false; } String[] parts = name.split("/"); for (String part : parts) { if (!isSimpleName(part)) { return false; } } return true; } private static final Predicate<String> IS_BINARY_NAME = new Predicate<String>() { @Override public boolean apply(String name) { return isBinaryName(name); } }; public static Predicate<String> isBinaryName() { return IS_BINARY_NAME; } }
#include "base64.h" #include <errno.h> #include <string.h> #include <assert.h> #include <stdint.h> /** * sixbit_to_b64 - maps a 6-bit value to the base64 alphabet * @param map A base 64 map (see base64_init_map) * @param sixbit Six-bit value to map * @return a base 64 character */ static char sixbit_to_b64(const base64_maps_t *maps, const uint8_t sixbit) { assert(sixbit <= 63); return maps->encode_map[(unsigned char)sixbit]; } /** * sixbit_from_b64 - maps a base64-alphabet character to its 6-bit value * @param maps A base 64 maps structure (see base64_init_maps) * @param sixbit Six-bit value to map * @return a six-bit value */ static int8_t sixbit_from_b64(const base64_maps_t *maps, const unsigned char b64letter) { int8_t ret; ret = maps->decode_map[(unsigned char)b64letter]; if (ret == (int8_t)0xff) { errno = EDOM; return -1; } return ret; } bool <API key>(const base64_maps_t *maps, const char b64char) { return (maps->decode_map[(const unsigned char)b64char] != (int8_t)0xff); } void base64_init_maps(base64_maps_t *dest, const char src[64]) { unsigned char i; memcpy(dest->encode_map,src,64); memset(dest->decode_map,0xff,256); for (i=0; i<64; i++) { dest->decode_map[(unsigned char)src[i]] = i; } } size_t <API key>(size_t srclen) { return ((srclen + 2) / 3) * 4; } void <API key>(const base64_maps_t *maps, char dest[4], const char src[3]) { char a = src[0]; char b = src[1]; char c = src[2]; dest[0] = sixbit_to_b64(maps, (a & 0xfc) >> 2); dest[1] = sixbit_to_b64(maps, ((a & 0x3) << 4) | ((b & 0xf0) >> 4)); dest[2] = sixbit_to_b64(maps, ((c & 0xc0) >> 6) | ((b & 0xf) << 2)); dest[3] = sixbit_to_b64(maps, c & 0x3f); } void <API key>(const base64_maps_t *maps, char dest[4], const char *src, const size_t srclen) { char longsrc[3] = { 0 }; assert(srclen <= 3); memcpy(longsrc, src, srclen); <API key>(maps, dest, longsrc); memset(dest+1+srclen, '=', 3-srclen); } ssize_t <API key>(const base64_maps_t *maps, char *dest, const size_t destlen, const char *src, const size_t srclen) { size_t src_offset = 0; size_t dest_offset = 0; if (destlen < <API key>(srclen)) { errno = EOVERFLOW; return -1; } while (srclen - src_offset >= 3) { <API key>(maps, &dest[dest_offset], &src[src_offset]); src_offset += 3; dest_offset += 4; } if (src_offset < srclen) { <API key>(maps, &dest[dest_offset], &src[src_offset], srclen-src_offset); dest_offset += 4; } memset(&dest[dest_offset], '\0', destlen-dest_offset); return dest_offset; } size_t <API key>(size_t srclen) { return ((srclen+3)/4*3); } ssize_t <API key>(const base64_maps_t *maps, char dest[3], const char src[4]) { signed char a; signed char b; signed char c; signed char d; a = sixbit_from_b64(maps, src[0]); b = sixbit_from_b64(maps, src[1]); c = sixbit_from_b64(maps, src[2]); d = sixbit_from_b64(maps, src[3]); if ((a == -1) || (b == -1) || (c == -1) || (d == -1)) { return -1; } dest[0] = (a << 2) | (b >> 4); dest[1] = ((b & 0xf) << 4) | (c >> 2); dest[2] = ((c & 0x3) << 6) | d; return 0; } ssize_t <API key>(const base64_maps_t *maps, char dest[3], const char * src, const size_t srclen) { char longsrc[4]; int quartet_result; size_t insize = srclen; while (insize != 0 && src[insize-1] == '=') { /* throw away padding symbols */ insize } if (insize == 0) { return 0; } if (insize == 1) { /* the input is malformed.... */ errno = EINVAL; return -1; } memcpy(longsrc, src, insize); memset(longsrc+insize, 'A', 4-insize); quartet_result = <API key>(maps, dest, longsrc); if (quartet_result == -1) { return -1; } return insize - 1; } ssize_t <API key>(const base64_maps_t *maps, char *dest, const size_t destlen, const char *src, const size_t srclen) { ssize_t dest_offset = 0; ssize_t i; ssize_t more; if (destlen < <API key>(srclen)) { errno = EOVERFLOW; return -1; } for(i=0; srclen - i > 4; i+=4) { if (<API key>(maps, &dest[dest_offset], &src[i]) == -1) { return -1; } dest_offset += 3; } more = <API key>(maps, &dest[dest_offset], &src[i], srclen - i); if (more == -1) { return -1; } dest_offset += more; memset(&dest[dest_offset], '\0', destlen-dest_offset); return dest_offset; } /** * base64_maps_rfc4648 - pregenerated maps struct for rfc4648 */ const base64_maps_t base64_maps_rfc4648 = { "<API key>+/", "\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff" \ "\xff\xff\xff\x3e\xff" \ "\xff\xff\x3f\x34\x35" \ "\x36\x37\x38\x39\x3a" \ "\x3b\x3c\x3d\xff\xff" \ "\xff\xff\xff\xff\xff" \ "\x00\x01\x02\x03\x04" /* 65 A */ \ "\x05\x06\x07\x08\x09" \ "\x0a\x0b\x0c\x0d\x0e" \ "\x0f\x10\x11\x12\x13" \ "\x14\x15\x16\x17\x18" \ "\x19\xff\xff\xff\xff" \ "\xff\xff\x1a\x1b\x1c" \ "\x1d\x1e\x1f\x20\x21" /* 100 */ \ "\x22\x23\x24\x25\x26" /* 105 */ \ "\x27\x28\x29\x2a\x2b" /* 110 */ \ "\x2c\x2d\x2e\x2f\x30" /* 115 */ \ "\x31\x32\x33\xff\xff" /* 120 */ \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" /* 125 */ \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" /* 155 */ \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" /* 185 */ \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" /* 215 */ \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \ "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" /* 245 */ };
/** @file Game.cpp */ #include "SgSystem.h" #include "Game.hpp" #include "Groups.hpp" using namespace benzene; Game::Game(StoneBoard& board) : m_board(&board), m_allow_swap(false), m_game_time(1800) { NewGame(); } void Game::NewGame() { LogFine() << "Game::NewGame()\n"; m_board->StartNewGame(); m_time_remaining[BLACK] = m_game_time; m_time_remaining[WHITE] = m_game_time; m_history.clear(); } void Game::SetGameTime(double time) { m_game_time = time; m_time_remaining[BLACK] = m_game_time; m_time_remaining[WHITE] = m_game_time; } Game::ReturnType Game::PlayMove(HexColor color, HexPoint cell) { if (cell < 0 || cell >= FIRST_INVALID || !m_board->Const().IsValid(cell)) return INVALID_MOVE; if (color == EMPTY) return INVALID_MOVE; if (HexPointUtil::isSwap(cell)) { if (!m_allow_swap || m_history.size() != 1) return INVALID_MOVE; } if (m_board->IsPlayed(cell)) return OCCUPIED_CELL; m_board->PlayMove(color, cell); m_history.push_back(Move(color, cell)); return VALID_MOVE; } void Game::UndoMove() { if (m_history.empty()) return; m_board->UndoMove(m_history.back().Point()); m_history.pop_back(); } bool GameUtil::IsGameOver(const Game& game) { Groups groups; GroupBuilder::Build(game.Board(), groups); return groups.IsGameOver(); } bool GameUtil::<API key>(const Game& game, const StoneBoard& pos, MoveSequence& seq) { if (game.Board().Const() != pos.Const()) return false; StoneBoard cur(pos); cur.StartNewGame(); if (cur == pos) { seq = game.History(); return true; } const MoveSequence& history = game.History(); for (MoveSequence::const_iterator it = history.begin(); it != history.end(); ++it) { const Move& move = *it; cur.PlayMove(move.Color(), move.Point()); if (cur == pos) { LogInfo() << "Position matched!\n"; seq.assign(++it, history.end()); return true; } } return false; } void GameUtil::HistoryToSequence(const MoveSequence& history, PointSequence& sequence) { sequence.clear(); for (MoveSequence::const_iterator it = history.begin(); it != history.end(); ++it) { const Move& move = *it; sequence.push_back(move.Point()); } }
var searchData= [ ['canvas',['canvas',['../class_q_rcode.html#<API key>',1,'QRcode']]] ];
class Cms::<API key> < Cms::BaseController before_filter :load_page_route before_filter :load_model, :only => [:edit, :update, :destroy] def new @model = resource.new end def create @model = resource.new(params[object_name]) if @model.save flash[:notice] = "#{object_name.titleize} added" redirect_to cms_page_route_url(@page_route) else render :action => "new" end end def update if @model.update_attributes(params[object_name]) flash[:notice] = "#{object_name.titleize} updated" redirect_to cms_page_route_url(@page_route) else render :action => "edit" end end def destroy @model.destroy flash[:notice] = "#{object_name.titleize} deleted" redirect_to cms_page_route_url(@page_route) end protected def load_page_route @page_route end def load_model @model = resource.find(params[:id]) end def resource @page_route.send(resource_name.pluralize) end def resource_name self.class.name.match(/Cms::PageRoute(\w+)Controller/)[1].downcase.singularize end def object_name "page_route_#{resource_name}" end end
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="de"> <head> <!-- Generated by javadoc (version 1.7.0_17) on Wed May 15 16:29:39 CEST 2013 --> <title>SimpleStrategy</title> <meta name="date" content="2013-05-15"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><! if (location.href.indexOf('is-external=true') == -1) { parent.document.title="SimpleStrategy"; } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar_top"> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Class</li> <li>Next Class</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?de/fu_berlin/maniac/strategies/SimpleStrategy.html" target="_top">Frames</a></li> <li><a href="SimpleStrategy.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> </a></div> <div class="header"> <div class="subTitle">de.fu_berlin.maniac.strategies</div> <h2 title="Class SimpleStrategy" class="title">Class SimpleStrategy</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>de.fu_berlin.maniac.strategies.SimpleStrategy</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd><a href="../../../../de/fu_berlin/maniac/general/<API key>.html" title="interface in de.fu_berlin.maniac.general"><API key></a></dd> </dl> <hr> <br> <pre>public class <span class="strong">SimpleStrategy</span> extends java.lang.Object implements <a href="../../../../de/fu_berlin/maniac/general/<API key>.html" title="interface in de.fu_berlin.maniac.general"><API key></a></pre> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../../de/fu_berlin/maniac/strategies/SimpleStrategy.html#SimpleStrategy()">SimpleStrategy</a></strong>()</code>&nbsp;</td> </tr> </table> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="method_summary"> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../de/fu_berlin/maniac/strategies/SimpleStrategy.html#onException(de.fu_berlin.maniac.exception.ManiacException, boolean)">onException</a></strong>(<a href="../../../../de/fu_berlin/maniac/exception/ManiacException.html" title="class in de.fu_berlin.maniac.exception">ManiacException</a>&nbsp;ex, boolean&nbsp;fatal)</code> <div class="block">This function is called when an exception occurs in the ManiacLib.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>java.lang.Long</code></td> <td class="colLast"><code><strong><a href="../../../../de/fu_berlin/maniac/strategies/SimpleStrategy.html#onRcvAdvert(de.fu_berlin.maniac.packet_builder.Advert)">onRcvAdvert</a></strong>(<a href="../../../../de/fu_berlin/maniac/packet_builder/Advert.html" title="class in de.fu_berlin.maniac.packet_builder">Advert</a>&nbsp;adv)</code> <div class="block">This function is called by the Mothership class when a new advert is received.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../de/fu_berlin/maniac/strategies/SimpleStrategy.html#onRcvBid(de.fu_berlin.maniac.packet_builder.Bid)">onRcvBid</a></strong>(<a href="../../../../de/fu_berlin/maniac/packet_builder/Bid.html" title="class in de.fu_berlin.maniac.packet_builder">Bid</a>&nbsp;bid)</code> <div class="block">This function is called for every bid that is received so you can log it for your strategy It is advised that if you want to make any time and resource consuming action to NOT do them in this function because it will delay new incoming packets.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../de/fu_berlin/maniac/strategies/SimpleStrategy.html#onRcvBidWin(de.fu_berlin.maniac.packet_builder.BidWin)">onRcvBidWin</a></strong>(<a href="../../../../de/fu_berlin/maniac/packet_builder/BidWin.html" title="class in de.fu_berlin.maniac.packet_builder">BidWin</a>&nbsp;bidwin)</code> <div class="block">This function is called for every bidwin (a packet announcing the winner of an auction, sent by the auctioneer) that is received so you can log it for your strategy.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../de/fu_berlin/maniac/general/AuctionParameters.html" title="class in de.fu_berlin.maniac.general">AuctionParameters</a></code></td> <td class="colLast"><code><strong><a href="../../../../de/fu_berlin/maniac/strategies/SimpleStrategy.html#onRcvData(de.fu_berlin.maniac.packet_builder.Data)">onRcvData</a></strong>(<a href="../../../../de/fu_berlin/maniac/packet_builder/Data.html" title="class in de.fu_berlin.maniac.packet_builder">Data</a>&nbsp;packet)</code> <div class="block">This function is called when a Data packet is received following an auction that this node has won.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../de/fu_berlin/maniac/packet_builder/Bid.html" title="class in de.fu_berlin.maniac.packet_builder">Bid</a></code></td> <td class="colLast"><code><strong><a href="../../../../de/fu_berlin/maniac/strategies/SimpleStrategy.html#selectWinner(java.util.List)">selectWinner</a></strong>(java.util.List&lt;<a href="../../../../de/fu_berlin/maniac/packet_builder/Bid.html" title="class in de.fu_berlin.maniac.packet_builder">Bid</a>&gt;&nbsp;bids)</code> <div class="block">This function is called at the end of an auction of a data packet perfomed by this node.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>java.lang.Integer</code></td> <td class="colLast"><code><strong><a href="../../../../de/fu_berlin/maniac/strategies/SimpleStrategy.html#sendBid(de.fu_berlin.maniac.packet_builder.Advert)">sendBid</a></strong>(<a href="../../../../de/fu_berlin/maniac/packet_builder/Advert.html" title="class in de.fu_berlin.maniac.packet_builder">Advert</a>&nbsp;adv)</code> <div class="block">This function is called after the delay that was returned with onRcvAdvert(Advert adv) It is advised that if you want to make any time and resource consuming action to NOT do them in this function because it will delay new incoming packets.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="<API key>.lang.Object"> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> </a> <h3>Constructor Detail</h3> <a name="SimpleStrategy()"> </a> <ul class="blockListLast"> <li class="blockList"> <h4>SimpleStrategy</h4> <pre>public&nbsp;SimpleStrategy()</pre> </li> </ul> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="method_detail"> </a> <h3>Method Detail</h3> <a name="onRcvAdvert(de.fu_berlin.maniac.packet_builder.Advert)"> </a> <ul class="blockList"> <li class="blockList"> <h4>onRcvAdvert</h4> <pre>public&nbsp;java.lang.Long&nbsp;onRcvAdvert(<a href="../../../../de/fu_berlin/maniac/packet_builder/Advert.html" title="class in de.fu_berlin.maniac.packet_builder">Advert</a>&nbsp;adv)</pre> <div class="block"><strong>Description copied from interface:&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onRcvAdvert(de.fu_berlin.maniac.packet_builder.Advert)"><API key></a></code></strong></div> <div class="block">This function is called by the Mothership class when a new advert is received. It is advised that if you want to make any time and resource consuming action to NOT do them in this function because it will delay new incoming packets. You should do any time consuming actions in a seperate thread!</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onRcvAdvert(de.fu_berlin.maniac.packet_builder.Advert)">onRcvAdvert</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html" title="interface in de.fu_berlin.maniac.general"><API key></a></code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>adv</code> - All received adverts are passed to you using this function, EXCEPT: 1. Adverts that advertise a data packet that this node has already won previously. 2. Adverts that are from backbones that are not this nodes associated backbone.</dd> <dt><span class="strong">Returns:</span></dt><dd>The return value should be a Long between 0 and AUCTION_TIMEOUT (specified in Mothership). The return value determines after how many milliseconds the sendBid(Advert adv) function is called. This gives you the opportunity to delay your bid in case you want to listen to other incoming bids before! If you return null or anything <=0 there will be 0ms delay, if you return a value more than AUCTION_TIMEOUT the delay will be AUCTION_TIMEOUT which will most likely result in your bid not making it in time to the advertising node (because of wireless travel time)</dd></dl> </li> </ul> <a name="onRcvBid(de.fu_berlin.maniac.packet_builder.Bid)"> </a> <ul class="blockList"> <li class="blockList"> <h4>onRcvBid</h4> <pre>public&nbsp;void&nbsp;onRcvBid(<a href="../../../../de/fu_berlin/maniac/packet_builder/Bid.html" title="class in de.fu_berlin.maniac.packet_builder">Bid</a>&nbsp;bid)</pre> <div class="block"><strong>Description copied from interface:&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onRcvBid(de.fu_berlin.maniac.packet_builder.Bid)"><API key></a></code></strong></div> <div class="block">This function is called for every bid that is received so you can log it for your strategy It is advised that if you want to make any time and resource consuming action to NOT do them in this function because it will delay new incoming packets. You should do any time consuming actions in a seperate thread!</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onRcvBid(de.fu_berlin.maniac.packet_builder.Bid)">onRcvBid</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html" title="interface in de.fu_berlin.maniac.general"><API key></a></code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>bid</code> - This function will be called with every bid received (except the bids this node sent out itself of course)</dd></dl> </li> </ul> <a name="onRcvBidWin(de.fu_berlin.maniac.packet_builder.BidWin)"> </a> <ul class="blockList"> <li class="blockList"> <h4>onRcvBidWin</h4> <pre>public&nbsp;void&nbsp;onRcvBidWin(<a href="../../../../de/fu_berlin/maniac/packet_builder/BidWin.html" title="class in de.fu_berlin.maniac.packet_builder">BidWin</a>&nbsp;bidwin)</pre> <div class="block"><strong>Description copied from interface:&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onRcvBidWin(de.fu_berlin.maniac.packet_builder.BidWin)"><API key></a></code></strong></div> <div class="block">This function is called for every bidwin (a packet announcing the winner of an auction, sent by the auctioneer) that is received so you can log it for your strategy. It is advised that if you want to make any time and resource consuming action to NOT do them in this function because it will delay new incoming packets. You should do any time consuming actions in a seperate thread!</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onRcvBidWin(de.fu_berlin.maniac.packet_builder.BidWin)">onRcvBidWin</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html" title="interface in de.fu_berlin.maniac.general"><API key></a></code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>bidwin</code> - This function will be called with every bidwin received (except the bids this node sent out itself of course)</dd></dl> </li> </ul> <a name="onRcvData(de.fu_berlin.maniac.packet_builder.Data)"> </a> <ul class="blockList"> <li class="blockList"> <h4>onRcvData</h4> <pre>public&nbsp;<a href="../../../../de/fu_berlin/maniac/general/AuctionParameters.html" title="class in de.fu_berlin.maniac.general">AuctionParameters</a>&nbsp;onRcvData(<a href="../../../../de/fu_berlin/maniac/packet_builder/Data.html" title="class in de.fu_berlin.maniac.packet_builder">Data</a>&nbsp;packet)</pre> <div class="block"><strong>Description copied from interface:&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onRcvData(de.fu_berlin.maniac.packet_builder.Data)"><API key></a></code></strong></div> <div class="block">This function is called when a Data packet is received following an auction that this node has won. It is advised that if you want to make any time and resource consuming action to NOT do them in this function because it will delay new incoming packets. You should do any time consuming actions in a seperate thread!</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onRcvData(de.fu_berlin.maniac.packet_builder.Data)">onRcvData</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html" title="interface in de.fu_berlin.maniac.general"><API key></a></code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>packet</code> - This function will be called with every data packet received (which means that the data packet was won earlier by this node in an auction)</dd> <dt><span class="strong">Returns:</span></dt><dd>The return value is a AuctionParameters object, which contains the two Integers 'maxBid' and 'fine'. If you return null, the node will start an auction for this data packet with the same parameters as the auction it was won from had, else it will start an auction with the specified parameters (if they are valid, see AuctionParamters)</dd></dl> </li> </ul> <a name="selectWinner(java.util.List)"> </a> <ul class="blockList"> <li class="blockList"> <h4>selectWinner</h4> <pre>public&nbsp;<a href="../../../../de/fu_berlin/maniac/packet_builder/Bid.html" title="class in de.fu_berlin.maniac.packet_builder">Bid</a>&nbsp;selectWinner(java.util.List&lt;<a href="../../../../de/fu_berlin/maniac/packet_builder/Bid.html" title="class in de.fu_berlin.maniac.packet_builder">Bid</a>&gt;&nbsp;bids)</pre> <div class="block"><strong>Description copied from interface:&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#selectWinner(java.util.List)"><API key></a></code></strong></div> <div class="block">This function is called at the end of an auction of a data packet perfomed by this node.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#selectWinner(java.util.List)">selectWinner</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html" title="interface in de.fu_berlin.maniac.general"><API key></a></code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>bids</code> - It is passed a list of bids that came in for this data packet.</dd> <dt><span class="strong">Returns:</span></dt><dd>The return value is the bid you choose to be the winner (and which will get the Data packet). ************** IMPORTANT NOTE: To use the backbone to deliver the data, return null. This will send the data packet to the backbone, this will guarantee that the packet will arrive at the finalDestination. This will cost as much currency as the original maxBid advertised from originating backbone was. **************</dd></dl> </li> </ul> <a name="onException(de.fu_berlin.maniac.exception.ManiacException, boolean)"> </a> <ul class="blockList"> <li class="blockList"> <h4>onException</h4> <pre>public&nbsp;void&nbsp;onException(<a href="../../../../de/fu_berlin/maniac/exception/ManiacException.html" title="class in de.fu_berlin.maniac.exception">ManiacException</a>&nbsp;ex, boolean&nbsp;fatal)</pre> <div class="block"><strong>Description copied from interface:&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onException(de.fu_berlin.maniac.exception.ManiacException, boolean)"><API key></a></code></strong></div> <div class="block">This function is called when an exception occurs in the ManiacLib.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#onException(de.fu_berlin.maniac.exception.ManiacException, boolean)">onException</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html" title="interface in de.fu_berlin.maniac.general"><API key></a></code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>ex</code> - The exception that occurred in the ManiacLib</dd><dd><code>fatal</code> - Indicates whether the error was fatal and the ManiacLib needs to be restarted</dd></dl> </li> </ul> <a name="sendBid(de.fu_berlin.maniac.packet_builder.Advert)"> </a> <ul class="blockListLast"> <li class="blockList"> <h4>sendBid</h4> <pre>public&nbsp;java.lang.Integer&nbsp;sendBid(<a href="../../../../de/fu_berlin/maniac/packet_builder/Advert.html" title="class in de.fu_berlin.maniac.packet_builder">Advert</a>&nbsp;adv)</pre> <div class="block"><strong>Description copied from interface:&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#sendBid(de.fu_berlin.maniac.packet_builder.Advert)"><API key></a></code></strong></div> <div class="block">This function is called after the delay that was returned with onRcvAdvert(Advert adv) It is advised that if you want to make any time and resource consuming action to NOT do them in this function because it will delay new incoming packets. You should do any time consuming actions in a seperate thread! NOTE: If the Integer returned is less than 0 or more than the MaxBid or null in the Advert message the node will bid for MaxBid.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html#sendBid(de.fu_berlin.maniac.packet_builder.Advert)">sendBid</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../de/fu_berlin/maniac/general/<API key>.html" title="interface in de.fu_berlin.maniac.general"><API key></a></code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>adv</code> - The same advert that was passed to onRcvAdvert(Advert adv) before.</dd> <dt><span class="strong">Returns:</span></dt><dd>The return value specifies your bid for the data packet advertised by the node that sent the advert. NOTE: If the return value is null, 0, or greater than the advertised maximum budget in the advert (also referred to as maxBid or Ceil sometimes), the maximum budget will be bid!</dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <div class="bottomNav"><a name="navbar_bottom"> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Class</li> <li>Next Class</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?de/fu_berlin/maniac/strategies/SimpleStrategy.html" target="_top">Frames</a></li> <li><a href="SimpleStrategy.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> </a></div> </body> </html>
#ifndef MINRDPNGCONF_H #define MINRDPNGCONF_H /* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */ /* List options to turn off features of the build that do not * affect the API (so are not recorded in pnglibconf.h) */ #define PNG_NO_WARNINGS #endif /* MINRDPNGCONF_H */
// System.Runtime.InteropServices.LIBFLAGS.cs // Andreas Nahr (ClassDevelopment@A-SoftTech.com) // 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, // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // included in all copies or substantial portions of the Software. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // 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. using System; namespace System.Runtime.InteropServices { [Obsolete] [Flags, Serializable] public enum LIBFLAGS { LIBFLAG_FRESTRICTED = 1, LIBFLAG_FCONTROL = 2, LIBFLAG_FHIDDEN = 4, <API key> = 8 } }
<?php class Html { private static function get_attributes($array = array()) { unset($array['content']); $attributes = ''; if(isset($array['hidden']) && $array['hidden']) { $attributes .= 'style="display:none" '; } unset($array['hidden']); foreach( $array as $key=>$value ) { $attributes .= $key.'="'.$value.'" '; } return($attributes); } public static function h1($array = array()) { $attributes = self::get_attributes($array); return( '<h1 '.$attributes.'>'.$array['content'].'</h1>' ); } public static function h2($array = array()) { $attributes = self::get_attributes($array); return( '<h2 '.$attributes.'>'.$array['content'].'</h2>' ); } public static function h3($array = array()) { $attributes = self::get_attributes($array); return( '<h3 '.$attributes.'>'.$array['content'].'</h3>' ); } public static function h4($array = array()) { $attributes = self::get_attributes($array); return( '<h4 '.$attributes.'>'.$array['content'].'</h4>' ); } public static function blockquote($array = array()) { $attributes = self::get_attributes($array); return( '<blockquote '.$attributes.'>'.$array['content'].'</blockquote>' ); } public static function p($array = array()) { $attributes = self::get_attributes($array); return( '<p '.$attributes.'>'.$array['content'].'</p>' ); } public static function separator($array = array(), $top=false, $hidden=false) { if(isset($array['class'])) { $array['class'] = 'separator '.$array['class']; } else { $array['class'] = 'separator'; } if($hidden) $hidden = 'style="display:none"'; else $hidden = ''; $attributes = self::get_attributes($array); return( '<header '.$hidden.' class="'.($top?'separator_top':'separator').'"><div '.$attributes.'>'.$array['content'].'</div></header>' ); } public static function form_open($array = array()) { $attributes = self::get_attributes($array); $html = '<form '.$attributes.' >'; $html .= '<input type="hidden" name="token" value="'.Session::getFormToken().'">'; return($html); } public static function form_close() { return( '</form>' ); } public static function input($array = array()) { $attributes = self::get_attributes($array); return( '<input '.$attributes.'/>' ); } public static function checkbox($array = array(), $checked = false) { $attributes = self::get_attributes($array); if( $checked ) return( '<input type="checkbox" '.$attributes.' checked="checked" value="1" />' ); else return( '<input type="checkbox" '.$attributes.' value="1"/>' ); } public static function radio($array = array(), $checked = false) { $attributes = self::get_attributes($array); if( $checked ) return( '<input type="radio" '.$attributes.' checked="checked" />' ); else return( '<input type="radio" '.$attributes.'/>' ); } public static function textarea($array = array()) { $attributes = self::get_attributes($array); return( '<textarea '.$attributes.'>'.$array['content'].'</textarea>' ); } public static function label($array = array()) { $attributes = self::get_attributes($array); return( '<label '.$attributes.'>'.$array['content'].'</label>' ); } public static function select($array = array(), $options = array(), $selected) { $attributes = self::get_attributes($array); $tmp = '<select '.$attributes.'>'; foreach( $options as $key=>$value ) { if( $key == $selected) $attr = 'selected="selected"'; else $attr = ''; $tmp .= '<option value="'.$key.'" '.$attr.'>'.$value.'</option>'; } $tmp .= '</select>'; return( $tmp ); } public static function div($array = array()) { $attributes = self::get_attributes($array); return( '<div '.$attributes.'>'.$array['content'].'</div>' ); } public static function div_open($array = array()) { $attributes = self::get_attributes($array); return( '<div '.$attributes.'>' ); } public static function div_close() { return( '</div>' ); } public static function article_open($array = array()) { $attributes = self::get_attributes($array); return( '<article '.$attributes.'>' ); } public static function article_close() { return( '</article>' ); } public static function header_open($array = array()) { $attributes = self::get_attributes($array); return( '<header '.$attributes.'>' ); } public static function header_close() { return( '</header>' ); } public static function link($array = array()) { $attributes = self::get_attributes($array); return( '<a '.$attributes.'>'.$array['content'].'</a>' ); } public static function span($array = array()) { $attributes = self::get_attributes($array); return( '<span '.$attributes.'>'.$array['content'].'</span>' ); } public static function img($array = array()) { $attributes = self::get_attributes($array); return( '<img '.$attributes.'/>' ); } public static function ul($array = array()) { $attributes = self::get_attributes($array); return( '<ul '.$attributes.'>'.$array['content'].'</ul>' ); } public static function banner($msg, $success, $error) { if( $success ) return('<div class="<API key>">'.$msg.'</div>'); elseif( $error ) return('<div class="notification_error">'.$msg.'</div>'); } } ?>
package jsprit.core.problem.solution.route.state; import jsprit.core.algorithm.state.StateId; import jsprit.core.problem.solution.route.VehicleRoute; import jsprit.core.problem.solution.route.activity.TourActivity; import jsprit.core.problem.vehicle.Vehicle; public interface <API key> { public <T> T getActivityState(TourActivity act, StateId stateId, Class<T> type); public <T> T getActivityState(TourActivity act, Vehicle vehicle, StateId stateId, Class<T> type); public <T> T getRouteState(VehicleRoute route, StateId stateId, Class<T> type); public <T> T getRouteState(VehicleRoute route, Vehicle vehicle, StateId stateId, Class<T> type); }
@font-face { } @font-face { font-family: 'MyFontFamily'; } @font-face { font-family: 'MyWebFont'; src: url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype'); } @font-face { font-family: 'MyWebFont'; src: url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype'), url('myfont.svg#svgFontName') format('svg'); } @font-face { font-family: 'MyWebFont'; src: url('myfont.eot?#iefix') format('embedded-opentype'), url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype'); } @font-face { font-family: 'MyWebFont'; src: url('myfont.eot?#iefix') format('embedded-opentype'), url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype'), url('myfont.svg#svgFontName') format('svg'); } @font-face { font-family: 'MyWebFont'; src: url('myfont.eot'); src: url('myfont.eot?#iefix') format('embedded-opentype'), url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype'), url('myfont.svg#svgFontName') format('svg'); } @font-face { font-family: 'MyWebFont'; src: url('myfont.woff2') format('woff2'); /* Noncompliant: 'woff' format is missing */ } @font-face { font-family: 'MyWebFont'; src: url('myfont.woff') format('woff'); /* Noncompliant: 'woff2' format is expected */ } @font-face { font-family: 'MyWebFont'; src: url('myfont.ttf') format('truetype'); /* Noncompliant: 'woff2' format is missing */ } @font-face { font-family: 'MyWebFont'; src: url('myfont.ttf') format('truetype'), /* Noncompliant: 'woff2' format is expected */ url('myfont.woff2') format('woff2'); } @font-face { font-family: 'MyWebFont'; src: url('myfont.woff2') format('woff2'), url('myfont.ttf') format('truetype'), /* Noncompliant: 'woff' format is expected */ url('myfont.woff') format('woff'); } @font-face { font-family: 'MyWebFont'; src: url('myfont.eot'); src: url('myfont.eot?#iefix') format('embedded-opentype'), url('myfont.woff') format('woff'); /* Noncompliant: 'woff2' format is expected */ } @font-face { font-family: 'MyWebFont'; src: url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.svg#svgFontName') format('svg') /* Noncompliant: 'truetype' format is expected */ url('myfont.ttf') format('truetype'); } @font-face { font-family: 'MyWebFont'; src: url('myfont.eot'); src: locale('font'); /* Noncompliant: 'truetype' format is expected */ } @font-face { font-family: 'MyWebFont'; src: url('myfont.woff2') format('woff2'); src: url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype'); } @font-face { font-family: 'MyWebFont'; src: local('font'); src: url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype'); }
{% extends "admin/change_list.html" %} {% load pages_tags i18n future staticfiles %} {% block extrahead %} {{ block.super }} <link rel="stylesheet" href="{% static "mezzanine/css/admin/page_tree.css" %}"> <style> .delete {width:10px; height:10px; margin:2px 4px 0 10px; display:block; float:right; background:url('{% static settings.<API key>|add:"img/admin/icon_deletelink.gif" %}');} .grappelli-delete {width:11px; height:11px; margin:4px 4px 0 10px; background:url('{% static settings.<API key>|add:"img/icons/<API key>.png" %}');} .grappelli-delete:hover {background:url('{% static settings.<API key>|add:"img/icons/<API key>.png" %}');} </style> <script>window.__page_ordering_url = '{% url "admin_page_ordering" %}';</script> <script src="{% static "mezzanine/js/jquery-ui-1.9.1.custom.min.js" %}"></script> <script src="{% static "mezzanine/js/admin/jquery.mjs.nestedSortable.js" %}"></script> <script src="{% static "mezzanine/js/admin/page_tree.js" %}"></script> {% endblock %} {% block content %} <div id="content-main"> {% if has_add_permission %} <div id="addlist-primary"> <select class="addlist"> <option value="">{% trans "Add" %} ...</option> {% for model in page_models %} {% <API key> model %} {% if model.perms.add %} <option value="{{ model.add_url }}">{{ model.meta_verbose_name }}</option> {% endif %} {% endfor %} </select> </div> {% endif %} {% if cl.result_count == 0 %} <p class="paginator">0 {{ cl.opts.verbose_name_plural }}</p> {% else %} <div id="tree">{% page_menu "pages/menus/admin.html" %}</div> {% endif %} </div> {% endblock %}
import BaseView from './BaseView'; import hb_template from '../hb_templates/cataloging.hbs'; import '<API key>'; import 'backbone.stickit'; export default BaseView.extend({ template : hb_template, events : { // To set the model value from a datetimepicker, handle the event of the input's div 'dp.change #<API key>' : 'changeTemporalStart', 'dp.change #<API key>' : 'changeTemporalEnd' }, bindings : { '#prod-desc-input' : 'productDescription', '#volume-input' : 'volume', '#issue-input' : 'issue', '#edition-input' : 'edition', '#start-page-input' : 'startPage', '#end-page-input' : 'endPage', '#num-pages-input' : 'numberOfPages', '#online-only-input' : { observe : 'onlineOnly', onGet : function(value) { return value === 'Y'; }, onSet : function(val) { return val ? 'Y' : 'N'; } }, '#<API key>' : { observe : '<API key>', onGet : function(value) { return value === 'Y'; }, onSet : function(val) { return val ? 'Y' : 'N'; } }, '#<API key>' : 'temporalStart', '#temporal-end-input' : 'temporalEnd', '#notes-input' : 'notes', '#scale-input' : 'scale', '#projection-input' : 'projection', '#datum-input' : 'datum', '#comment-input' : 'publicComments' }, render : function() { BaseView.prototype.render.apply(this, arguments); //Set up datepickers this.$('#<API key>').datetimepicker({ format : 'YYYY-MM-DD' }); this.$('#<API key>').datetimepicker({ format : 'YYYY-MM-DD' }); this.stickit(); return this; }, /* * DOM event handlers */ changeTemporalStart : function(ev) { if (ev.date) { this.model.set('temporalStart', ev.date.format('YYYY-MM-DD')); } else { this.model.unset('temporalStart'); } }, changeTemporalEnd : function(ev) { if (ev.date) { this.model.set('temporalEnd', ev.date.format('YYYY-MM-DD')); } else { this.model.unset('temporalEnd'); } } });
package org.eclipse.bpel.model.resource; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.xmi.impl.<API key>; public class <API key> extends <API key> { /** * @see org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl#createResource(URI) */ public Resource createResource(URI uri) { return new BPELResourceImpl(uri); } }
package resourceapply import ( "k8s.io/klog" apiextv1beta1 "k8s.io/<API key>/pkg/apis/apiextensions/v1beta1" apiextclientv1beta1 "k8s.io/<API key>/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/openshift/library-go/pkg/operator/events" "github.com/openshift/library-go/pkg/operator/resource/resourcemerge" ) // <API key> applies the required <API key> to the cluster. func <API key>(client apiextclientv1beta1.<API key>, recorder events.Recorder, required *apiextv1beta1.<API key>) (*apiextv1beta1.<API key>, bool, error) { existing, err := client.<API key>().Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { actual, err := client.<API key>().Create(required) reportCreateEvent(recorder, required, err) return actual, true, err } if err != nil { return nil, false, err } modified := resourcemerge.BoolPtr(false) existingCopy := existing.DeepCopy() resourcemerge.<API key>(modified, existingCopy, *required) if !*modified { return existing, false, nil } if klog.V(4) { klog.Infof("<API key> %q changes: %s", existing.Name, JSONPatch(existing, existingCopy)) } actual, err := client.<API key>().Update(existingCopy) reportUpdateEvent(recorder, required, err) return actual, true, err }
package org.mediameter.cliff.test.places.disambiguation; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.List; import org.junit.Test; import org.mediameter.cliff.ParseManager; import org.mediameter.cliff.test.places.CodedArticle; import org.mediameter.cliff.test.util.TestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.bericotech.clavin.resolver.ResolvedLocation; /** * Tests that verify against a small hand-coded corpus of articles. These check that the * list of extracted places contains the hand-coded one. */ public class <API key> { private static final Logger logger = LoggerFactory.getLogger(<API key>.class); @Test public void <API key>() throws Exception { List<CodedArticle> articles = TestUtils.<API key>(TestUtils.HUFFPO_JSON_PATH); assertEquals(22, articles.size()); <API key>(articles,"huff"); } @Test public void <API key>() throws Exception{ List<CodedArticle> articles = TestUtils.<API key>(TestUtils.BBC_JSON_PATH); assertEquals(25, articles.size()); } @Test public void <API key>() throws Exception{ List<CodedArticle> articles = TestUtils.<API key>(TestUtils.NYT_JSON_PATH); assertEquals(23, articles.size()); } private void <API key>(List<CodedArticle> articles, String source) throws Exception{ for(CodedArticle article: articles){ logger.info("Testing article "+article.mediacloudId+" (looking for "+article.handCodedPlaceName+" / "+article.<API key>+")"); List<ResolvedLocation> resolvedLocations = ParseManager.extractAndResolve(article.text).<API key>(); String <API key> = ""; for(ResolvedLocation loc: resolvedLocations){ <API key> += loc.getGeoname().<API key>()+" "; } assertTrue("Didn't find "+source+" "+article.handCodedPlaceName+" ("+article.<API key>+") " + "in article "+article.mediacloudId+ "( found "+<API key>+")", article.<API key>(resolvedLocations)); } } }
require 'spec_helper' describe Ridley::Middleware::ChefAuth do let(:server_url) { "https://api.opscode.com/organizations/vialstudios/" } describe "ClassMethods" do subject { described_class } describe "#<API key> do let(:client_name) { "reset" } let(:client_key) { fixtures_path.join("reset.pem") } it "returns a Hash of authentication headers" do options = { http_method: "GET", host: "https://api.opscode.com", path: "/something.file" } subject.<API key>(client_name, client_key, options).should be_a(Hash) end context "when the :client_key is an actual key" do let(:client_key) { File.read(fixtures_path.join("reset.pem")) } it "returns a Hash of authentication headers" do options = { http_method: "GET", host: "https://api.opscode.com", path: "/something.file" } subject.<API key>(client_name, client_key, options).should be_a(Hash) end end end end subject do Faraday.new(server_url) do |conn| conn.request :chef_auth, "reset", "/Users/reset/.chef/reset.pem" conn.adapter Faraday.default_adapter end end end
#ifndef <API key> #define <API key> #include "src/objects/name.h" #include "src/heap/<API key>.h" #include "src/objects/map-inl.h" #include "src/objects/<API key>.h" // Has to be the last include (doesn't have include guards): #include "src/objects/object-macros.h" namespace v8 { namespace internal { <API key>(Name) <API key>(Symbol) BIT_FIELD_ACCESSORS(Symbol, flags, is_private, Symbol::IsPrivateBit) BIT_FIELD_ACCESSORS(Symbol, flags, <API key>, Symbol::<API key>) BIT_FIELD_ACCESSORS(Symbol, flags, <API key>, Symbol::<API key>) BIT_FIELD_ACCESSORS(Symbol, flags, <API key>, Symbol::<API key>) bool Symbol::is_private_name() const { bool value = Symbol::IsPrivateNameBit::decode(flags()); DCHECK_IMPLIES(value, is_private()); return value; } void Symbol::set_is_private_name() { // TODO(gsathya): Re-order the bits to have these next to each other // and just do the bit shifts once. set_flags(Symbol::IsPrivateBit::update(flags(), true)); set_flags(Symbol::IsPrivateNameBit::update(flags(), true)); } DEF_GETTER(Name, IsUniqueName, bool) { uint32_t type = map(isolate).instance_type(); bool result = (type & (kIsNotStringMask | <API key>)) != (kStringTag | kNotInternalizedTag); SLOW_DCHECK(result == HeapObject::IsUniqueName()); return result; } bool Name::Equals(Name other) { if (other == *this) return true; if ((this-><API key>() && other.<API key>()) || this->IsSymbol() || other.IsSymbol()) { return false; } return String::cast(*this).SlowEquals(String::cast(other)); } bool Name::Equals(Isolate* isolate, Handle<Name> one, Handle<Name> two) { if (one.is_identical_to(two)) return true; if ((one-><API key>() && two-><API key>()) || one->IsSymbol() || two->IsSymbol()) { return false; } return String::SlowEquals(isolate, Handle<String>::cast(one), Handle<String>::cast(two)); } bool Name::IsHashFieldComputed(uint32_t field) { return (field & <API key>) == 0; } bool Name::HasHashCode() { return IsHashFieldComputed(hash_field()); } uint32_t Name::Hash() { // Fast case: has hash code already been computed? uint32_t field = hash_field(); if (IsHashFieldComputed(field)) return field >> kHashShift; // Slow case: compute hash code and set it. Has to be a string. return String::cast(*this).ComputeAndSetHash(); } DEF_GETTER(Name, IsInterestingSymbol, bool) { return IsSymbol(isolate) && Symbol::cast(*this).<API key>(); } DEF_GETTER(Name, IsPrivate, bool) { return this->IsSymbol(isolate) && Symbol::cast(*this).is_private(); } DEF_GETTER(Name, IsPrivateName, bool) { bool is_private_name = this->IsSymbol(isolate) && Symbol::cast(*this).is_private_name(); DCHECK_IMPLIES(is_private_name, IsPrivate()); return is_private_name; } bool Name::AsArrayIndex(uint32_t* index) { return IsString() && String::cast(*this).AsArrayIndex(index); } bool Name::AsIntegerIndex(size_t* index) { return IsString() && String::cast(*this).AsIntegerIndex(index); } // static bool Name::<API key>(uint32_t hash) { return (hash & Name::<API key>) == 0; } } // namespace internal } // namespace v8 #include "src/objects/object-macros-undef.h" #endif // <API key>
package grpc import ( "fmt" "math" "testing" "time" "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context" "github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc/naming" ) type testWatcher struct { // the channel to receives name resolution updates update chan *naming.Update // the side channel to get to know how many updates in a batch side chan int // the channel to notifiy update injector that the update reading is done readDone chan int } func (w *testWatcher) Next() (updates []*naming.Update, err error) { n := <-w.side if n == 0 { return nil, fmt.Errorf("w.side is closed") } for i := 0; i < n; i++ { u := <-w.update if u != nil { updates = append(updates, u) } } w.readDone <- 0 return } func (w *testWatcher) Close() { } func (w *testWatcher) inject(updates []*naming.Update) { w.side <- len(updates) for _, u := range updates { w.update <- u } <-w.readDone } type testNameResolver struct { w *testWatcher addr string } func (r *testNameResolver) Resolve(target string) (naming.Watcher, error) { r.w = &testWatcher{ update: make(chan *naming.Update, 1), side: make(chan int, 1), readDone: make(chan int), } r.w.side <- 1 r.w.update <- &naming.Update{ Op: naming.Add, Addr: r.addr, } go func() { <-r.w.readDone }() return r.w, nil } func startServers(t *testing.T, numServers, port int, maxStreams uint32) ([]*server, *testNameResolver) { var servers []*server for i := 0; i < numServers; i++ { s := &server{readyChan: make(chan bool)} servers = append(servers, s) go s.start(t, port, maxStreams) s.wait(t, 2*time.Second) } // Point to server1 addr := "127.0.0.1:" + servers[0].port return servers, &testNameResolver{ addr: addr, } } func TestNameDiscovery(t *testing.T) { // Start 3 servers on 3 ports. servers, r := startServers(t, 3, 0, math.MaxUint32) cc, err := Dial("foo.bar.com", WithPicker(<API key>(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{})) if err != nil { t.Fatalf("Failed to create ClientConn: %v", err) } var reply string if err := Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, cc); err != nil || reply != expectedResponse { t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want <nil>", err) } // Inject name resolution change to point to the second server now. var updates []*naming.Update updates = append(updates, &naming.Update{ Op: naming.Delete, Addr: "127.0.0.1:" + servers[0].port, }) updates = append(updates, &naming.Update{ Op: naming.Add, Addr: "127.0.0.1:" + servers[1].port, }) r.w.inject(updates) servers[0].stop() if err := Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, cc); err != nil || reply != expectedResponse { t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want <nil>", err) } // Add another server address (server#3) to name resolution updates = nil updates = append(updates, &naming.Update{ Op: naming.Add, Addr: "127.0.0.1:" + servers[2].port, }) r.w.inject(updates) // Stop server#2. The library should direct to server#3 automatically. servers[1].stop() if err := Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, cc); err != nil || reply != expectedResponse { t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want <nil>", err) } cc.Close() servers[2].stop() } func TestEmptyAddrs(t *testing.T) { servers, r := startServers(t, 1, 0, math.MaxUint32) cc, err := Dial("foo.bar.com", WithPicker(<API key>(r)), WithBlock(), WithInsecure(), WithCodec(testCodec{})) if err != nil { t.Fatalf("Failed to create ClientConn: %v", err) } var reply string if err := Invoke(context.Background(), "/foo/bar", &expectedRequest, &reply, cc); err != nil || reply != expectedResponse { t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want <nil>", err) } // Inject name resolution change to remove the server address so that there is no address // available after that. var updates []*naming.Update updates = append(updates, &naming.Update{ Op: naming.Delete, Addr: "127.0.0.1:" + servers[0].port, }) r.w.inject(updates) // Loop until the above updates apply. for { time.Sleep(10 * time.Millisecond) ctx, _ := context.WithTimeout(context.Background(), 10*time.Millisecond) if err := Invoke(ctx, "/foo/bar", &expectedRequest, &reply, cc); err != nil { break } } cc.Close() servers[0].stop() }
package org.apereo.cas.configuration.model.support.sms; import org.apereo.cas.configuration.support.RequiredProperty; import org.apereo.cas.configuration.support.RequiresModule; import com.fasterxml.jackson.annotation.JsonFilter; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; import java.io.Serializable; /** * This is {@link TextMagicProperties}. * * @author Misagh Moayyed * @since 5.1.0 */ @RequiresModule(name = "<API key>") @Getter @Setter @Accessors(chain = true) @JsonFilter("TextMagicProperties") public class TextMagicProperties implements Serializable { private static final long serialVersionUID = <API key>; /** * Secure token used to establish a handshake. */ @RequiredProperty private String token; /** * Username authorized to use the service as the bind account. */ @RequiredProperty private String username; /** * Check that whether debugging is enabled for this API client. */ private boolean debugging; /** * set password for the first HTTP basic authentication. */ private String password; /** * read timeout (in milliseconds). */ private int readTimeout = 5_000; /** * connect timeout (in milliseconds). */ private int connectTimeout = 5_000; /** * Set the User-Agent header's value (by adding to the default header map). */ private String userAgent; /** * Should SSL connections be verified? */ private boolean verifyingSsl = true; /** * write timeout (in milliseconds). */ private int writeTimeout; /** * set API key value for the first API key authentication. */ private String apiKey; /** * set API key prefix for the first API key authentication. */ private String apiKeyPrefix; }
package org.elasticsearch.xpack.eql.execution.assembler; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.xpack.eql.<API key>; import org.elasticsearch.xpack.eql.execution.search.Limit; import org.elasticsearch.xpack.eql.execution.search.PITAwareQueryClient; import org.elasticsearch.xpack.eql.execution.search.QueryRequest; import org.elasticsearch.xpack.eql.execution.search.RuntimeUtils; import org.elasticsearch.xpack.eql.execution.search.extractor.FieldHitExtractor; import org.elasticsearch.xpack.eql.execution.search.extractor.<API key>; import org.elasticsearch.xpack.eql.execution.search.extractor.<API key>; import org.elasticsearch.xpack.eql.execution.sequence.SequenceMatcher; import org.elasticsearch.xpack.eql.execution.sequence.TumblingWindow; import org.elasticsearch.xpack.eql.plan.physical.EsQueryExec; import org.elasticsearch.xpack.eql.plan.physical.PhysicalPlan; import org.elasticsearch.xpack.eql.querydsl.container.<API key>; import org.elasticsearch.xpack.eql.session.EqlConfiguration; import org.elasticsearch.xpack.eql.session.EqlSession; import org.elasticsearch.xpack.ql.execution.search.extractor.<API key>; import org.elasticsearch.xpack.ql.execution.search.extractor.HitExtractor; import org.elasticsearch.xpack.ql.expression.Attribute; import org.elasticsearch.xpack.ql.expression.Expression; import org.elasticsearch.xpack.ql.expression.Expressions; import org.elasticsearch.xpack.ql.expression.Order.OrderDirection; import java.util.ArrayList; import java.util.List; import static java.util.Collections.emptyList; public class ExecutionManager { private final EqlSession session; private final EqlConfiguration cfg; public ExecutionManager(EqlSession eqlSession) { this.session = eqlSession; this.cfg = eqlSession.configuration(); } public Executable assemble(List<List<Attribute>> listOfKeys, List<PhysicalPlan> plans, Attribute timestamp, Attribute tiebreaker, OrderDirection direction, TimeValue maxSpan, Limit limit) { <API key> extractorRegistry = new <API key>(); boolean descending = direction == OrderDirection.DESC; // fields HitExtractor tsExtractor = timestampExtractor(hitExtractor(timestamp, extractorRegistry)); HitExtractor tbExtractor = Expressions.isPresent(tiebreaker) ? hitExtractor(tiebreaker, extractorRegistry) : null; // implicit tiebreake, present only in the response and which doesn't have a corresponding field HitExtractor itbExtractor = <API key>.INSTANCE; // NB: since there's no aliasing inside EQL, the attribute name is the same as the underlying field name String timestampName = Expressions.name(timestamp); // secondary criteria List<Criterion<BoxedQueryRequest>> criteria = new ArrayList<>(plans.size() - 1); // build a criterion for each query for (int i = 0; i < plans.size(); i++) { List<Attribute> keys = listOfKeys.get(i); List<HitExtractor> keyExtractors = hitExtractors(keys, extractorRegistry); List<String> keyFields = new ArrayList<>(keyExtractors.size()); // extract top-level fields used as keys to optimize query lookups // this process gets skipped for nested fields for (HitExtractor extractor : keyExtractors) { if (extractor instanceof <API key>) { <API key> hitExtractor = (<API key>) extractor; // no nested fields if (hitExtractor.hitName() == null) { keyFields.add(hitExtractor.fieldName()); } else { keyFields = emptyList(); break; } } } PhysicalPlan query = plans.get(i); // search query if (query instanceof EsQueryExec) { SearchSourceBuilder source = ((EsQueryExec) query).source(session); QueryRequest original = () -> source; BoxedQueryRequest boxedRequest = new BoxedQueryRequest(original, timestampName, keyFields); Criterion<BoxedQueryRequest> criterion = new Criterion<>(i, boxedRequest, keyExtractors, tsExtractor, tbExtractor, itbExtractor, i == 0 && descending); criteria.add(criterion); } else { // until if (i != plans.size() - 1) { throw new <API key>("Expected a query but got [{}]", query.getClass()); } else { criteria.add(null); } } } int completionStage = criteria.size() - 1; SequenceMatcher matcher = new SequenceMatcher(completionStage, descending, maxSpan, limit); TumblingWindow w = new TumblingWindow(new PITAwareQueryClient(session), criteria.subList(0, completionStage), criteria.get(completionStage), matcher); return w; } private HitExtractor timestampExtractor(HitExtractor hitExtractor) { if (hitExtractor instanceof FieldHitExtractor) { FieldHitExtractor fe = (FieldHitExtractor) hitExtractor; return (fe instanceof <API key>) ? hitExtractor : new <API key>(fe); } throw new <API key>("Unexpected extractor [{}]", hitExtractor); } private HitExtractor hitExtractor(Expression exp, <API key> registry) { return RuntimeUtils.createExtractor(registry.fieldExtraction(exp), cfg); } private List<HitExtractor> hitExtractors(List<? extends Expression> exps, <API key> registry) { List<HitExtractor> extractors = new ArrayList<>(exps.size()); for (Expression exp : exps) { extractors.add(hitExtractor(exp, registry)); } return extractors; } }
// dear imgui: Renderer + Platform Backend for Allegro 5 // (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.) // Implemented features: // [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID! // [X] Platform: Clipboard support (from Allegro 5.1.12) // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= <API key>'. // Issues: // [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually. // [ ] Platform: Missing gamepad support. // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. #pragma once #include "imgui.h" // IMGUI_IMPL_API struct ALLEGRO_DISPLAY; union ALLEGRO_EVENT; IMGUI_IMPL_API bool <API key>(ALLEGRO_DISPLAY* display); IMGUI_IMPL_API void <API key>(); IMGUI_IMPL_API void <API key>(); IMGUI_IMPL_API void <API key>(ImDrawData* draw_data); IMGUI_IMPL_API bool <API key>(ALLEGRO_EVENT* event); // Use if you want to reset your rendering device without losing Dear ImGui state. IMGUI_IMPL_API bool <API key>(); IMGUI_IMPL_API void <API key>();
<html><body> <style> body, h1, h2, h3, div, span, p, pre, a { margin: 0; padding: 0; border: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } body { font-size: 13px; padding: 1em; } h1 { font-size: 26px; margin-bottom: 1em; } h2 { font-size: 24px; margin-bottom: 1em; } h3 { font-size: 20px; margin-bottom: 1em; margin-top: 1em; } pre, code { line-height: 1.5; font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; } pre { margin-top: 0.5em; } h1, h2, h3, p { font-family: Arial, sans serif; } h1, h2, h3 { border-bottom: solid #CCC 1px; } .toc_element { margin-top: 0.5em; } .firstline { margin-left: 2 em; } .method { margin-top: 1em; border: solid 1px #CCC; padding: 1em; background: #EEE; } .details { font-weight: bold; font-size: 14px; } </style> <h1><a href="tpu_v1alpha1.html">Cloud TPU API</a> . <a href="tpu_v1alpha1.projects.html">projects</a> . <a href="tpu_v1alpha1.projects.locations.html">locations</a></h1> <h2>Instance Methods</h2> <p class="toc_element"> <code><a href="tpu_v1alpha1.projects.locations.acceleratorTypes.html">acceleratorTypes()</a></code> </p> <p class="firstline">Returns the acceleratorTypes Resource.</p> <p class="toc_element"> <code><a href="tpu_v1alpha1.projects.locations.nodes.html">nodes()</a></code> </p> <p class="firstline">Returns the nodes Resource.</p> <p class="toc_element"> <code><a href="tpu_v1alpha1.projects.locations.operations.html">operations()</a></code> </p> <p class="firstline">Returns the operations Resource.</p> <p class="toc_element"> <code><a href="tpu_v1alpha1.projects.locations.tensorflowVersions.html">tensorflowVersions()</a></code> </p> <p class="firstline">Returns the tensorflowVersions Resource.</p> <p class="toc_element"> <code><a href="#close">close()</a></code></p> <p class="firstline">Close httplib2 connections.</p> <p class="toc_element"> <code><a href="#get">get(name, x__xgafv=None)</a></code></p> <p class="firstline">Gets information about a location.</p> <p class="toc_element"> <code><a href="#list">list(name, filter=None, pageSize=None, pageToken=None, x__xgafv=None)</a></code></p> <p class="firstline">Lists information about the supported locations for this service.</p> <p class="toc_element"> <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> <p class="firstline">Retrieves the next page of results.</p> <h3>Method Details</h3> <div class="method"> <code class="details" id="close">close()</code> <pre>Close httplib2 connections.</pre> </div> <div class="method"> <code class="details" id="get">get(name, x__xgafv=None)</code> <pre>Gets information about a location. Args: name: string, Resource name for the location. (required) x__xgafv: string, V1 error format. Allowed values 1 - v1 error format 2 - v2 error format Returns: An object of the form: { # A resource that represents Google Cloud Platform location. &quot;displayName&quot;: &quot;A String&quot;, # The friendly name for this location, typically a nearby city name. For example, &quot;Tokyo&quot;. &quot;labels&quot;: { # Cross-service attributes for the location. For example {&quot;cloud.googleapis.com/region&quot;: &quot;us-east1&quot;} &quot;a_key&quot;: &quot;A String&quot;, }, &quot;locationId&quot;: &quot;A String&quot;, # The canonical id for this location. For example: `&quot;us-east1&quot;`. &quot;metadata&quot;: { # Service-specific metadata. For example the available capacity at the given location. &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL. }, &quot;name&quot;: &quot;A String&quot;, # Resource name for the location, which may vary between implementations. For example: `&quot;projects/example-project/locations/us-east1&quot;` }</pre> </div> <div class="method"> <code class="details" id="list">list(name, filter=None, pageSize=None, pageToken=None, x__xgafv=None)</code> <pre>Lists information about the supported locations for this service. Args: name: string, The resource that owns the locations collection, if applicable. (required) filter: string, A filter to narrow down results to a preferred subset. The filtering language accepts strings like &quot;displayName=tokyo&quot;, and is documented in more detail in [AIP-160](https://google.aip.dev/160). pageSize: integer, The maximum number of results to return. If not set, the service selects a default. pageToken: string, A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page. x__xgafv: string, V1 error format. Allowed values 1 - v1 error format 2 - v2 error format Returns: An object of the form: { # The response message for Locations.ListLocations. &quot;locations&quot;: [ # A list of locations that matches the specified filter in the request. { # A resource that represents Google Cloud Platform location. &quot;displayName&quot;: &quot;A String&quot;, # The friendly name for this location, typically a nearby city name. For example, &quot;Tokyo&quot;. &quot;labels&quot;: { # Cross-service attributes for the location. For example {&quot;cloud.googleapis.com/region&quot;: &quot;us-east1&quot;} &quot;a_key&quot;: &quot;A String&quot;, }, &quot;locationId&quot;: &quot;A String&quot;, # The canonical id for this location. For example: `&quot;us-east1&quot;`. &quot;metadata&quot;: { # Service-specific metadata. For example the available capacity at the given location. &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL. }, &quot;name&quot;: &quot;A String&quot;, # Resource name for the location, which may vary between implementations. For example: `&quot;projects/example-project/locations/us-east1&quot;` }, ], &quot;nextPageToken&quot;: &quot;A String&quot;, # The standard List next-page token. }</pre> </div> <div class="method"> <code class="details" id="list_next">list_next(previous_request, previous_response)</code> <pre>Retrieves the next page of results. Args: previous_request: The request for the previous page. (required) previous_response: The response from the request for the previous page. (required) Returns: A request object that you can call &#x27;execute()&#x27; on to request the next page. Returns None if there are no more items in the collection. </pre> </div> </body></html>
package test.factory.github1631; import org.testng.*; import org.testng.annotations.Test; import test.SimpleBaseTest; public class GitHub1631Tests extends SimpleBaseTest { @Test( description = "Test @Factory(dataProvider) should implicitly inject data provider class name") public void <API key>() { final <API key> transformer = runTest(<API key>.class); Assert.assertEquals( transformer.<API key>(), <API key>.class); } @Test(description = "Test @Factory(dataProvider) should explicitly set data provider class name") public void <API key>() { final <API key> transformer = runTest(<API key>.class); Assert.assertEquals(transformer.<API key>(), <API key>.class); } private <API key> runTest(final Class<?> cls) { final TestNG tng = create(cls); final <API key> dpt = new <API key>(); tng.addListener(dpt); tng.run(); return dpt; } }
// UIImage+Extension.h // BookStore #import <UIKit/UIKit.h> @interface UIImage (Extension) - (UIImage *)scaleToSize:(CGSize)size; - (UIImage *)scaleToEqualSize:(CGSize)size; - (UIImage *)subImageInRect:(CGRect)rect; - (UIImage *)<API key>:(CGSize)frameSize; - (UIImage *)imageFillSize:(CGSize)viewsize; + (UIImage *)imageWithColor:(UIColor *)color; + (UIImage *)imageWithColor:(UIColor *)color WithSize:(CGSize)size; - (UIImage *)scaleAndRotateImage; - (UIImage *)resizeCanvas:(CGSize)sz alignment:(int)alignment; @end
require 'spec_helper' describe 'nova::db::mysql' do let :required_params do { :password => "qwerty" } end context 'on a Debian osfamily' do let :facts do { :osfamily => "Debian" } end context 'with only required parameters' do let :params do required_params end it { should contain_mysql__db('nova').with( :user => 'nova', :password => 'qwerty', :charset => 'latin1', :require => "Class[Mysql::Config]" )} end context 'when overriding charset' do let :params do { :charset => 'utf8' }.merge(required_params) end it { should contain_mysql__db('nova').with_charset(params[:charset]) } end end context 'on a RedHat osfamily' do let :facts do { :osfamily => 'RedHat' } end context 'with only required parameters' do let :params do required_params end it { should contain_mysql__db('nova').with( :user => 'nova', :password => 'qwerty', :charset => 'latin1', :require => "Class[Mysql::Config]" )} end context 'when overriding charset' do let :params do { :charset => 'utf8' }.merge(required_params) end it { should contain_mysql__db('nova').with_charset(params[:charset]) } end end end
# Contributing to `burrow`: Forked from Docker's [contributing guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) ## Developer Certificate of Origin Please always include "signed-off-by" in your commit message and note this constitutes a developer certification you are contributing a patch under Apache 2.0. Please find a verbatim copy of the Developer Certificate of Origin in this repository [here](.github/<API key>.md) or on [<API key>.org](https://<API key>.org/). ## Bug Reporting A great way to contribute to the project is to send a detailed report when you encounter an issue. We always appreciate a well-written, thorough bug report, and will thank you for it! Check that the issue doesn't already exist before submitting an issue. If you find a match, you can use the "subscribe" button to get notified on updates. Add a :+1: if you've also encountered this issue. If you have ways to reproduce the issue or have additional information that may help resolving the issue, please leave a comment. Also include the steps required to reproduce the problem if possible and applicable. This information will help us review and fix your issue faster. When sending lengthy log-files, post them as a gist (https://gist.github.com). Don't forget to remove sensitive data from your log files before posting (you can replace those parts with "REDACTED"). Our [ISSUE_TEMPLATE.md](ISSUE_TEMPLATE.md) will autopopulate the new issue. ## Contribution Tips and Guidelines Pull requests are always welcome (to `develop` rather than `master`). Not sure if that typo is worth a pull request? Found a bug and know how to fix it? Do it! We will appreciate it. Any significant improvement should be documented as a GitHub issue or discussed in [The Marmot Den](https://slack.monax.io) Slack community prior to beginning. We are always thrilled to receive pull requests (and bug reports!) and we do our best to process them quickly. ## Conventions Fork the repository and make changes on your fork in a feature branch (branched from develop), create an issue outlining your feature or a bug, or use an open one. If it's a bug fix branch, name it something-XXXX where XXXX is the number of the issue. If it's a feature branch, create an enhancement issue to announce your intentions, and name it something-XXXX where XXXX is the number of the issue. Submit unit tests for your changes. Go has a great test framework built in; use it! Take a look at existing tests for inspiration. Run the full test suite on your branch before submitting a pull request. Update the documentation when creating or modifying features. Test your documentation changes for clarity, concision, and correctness, as well as a clean documentation build. Write clean code. Universally formatted code promotes ease of writing, reading, and maintenance. Always run `gofmt -s -w file.go` on each changed file before committing your changes. Most editors have plug-ins that do this automatically. Pull request descriptions should be as clear as possible and include a reference to all the issues that they address. Commit messages must start with a short summary (max. 50 chars) written in the imperative, followed by an optional, more detailed explanatory text which is separated from the summary by an empty line. Code review comments may be added to your pull request. Discuss, then make the suggested modifications and push additional commits to your feature branch. Pull requests must be cleanly rebased on top of develop without multiple branches mixed into the PR. *Git tip:* If your PR no longer merges cleanly, use `git rebase develop` in your feature branch to update your pull request rather than merge develop. Before you make a pull request, squash your commits into logical units of work using `git rebase -i` and `git push -f`. A logical unit of work is a consistent set of patches that should be reviewed together: for example, upgrading the version of a vendored dependency and taking advantage of its now available new feature constitute two separate units of work. Implementing a new function and calling it in another file constitute a single logical unit of work. The very high majority of submissions should have a single commit, so if in doubt: squash down to one. After every commit, make sure the test suite passes. Include documentation changes in the same pull request so that a revert would remove all traces of the feature or fix. Merge approval We use LGTM (Looks Good To Me) in commands on the code review to indicate acceptance. ## Errors and Log Messages Style TODO ## Coding Style Unless explicitly stated, we follow all coding guidelines from the Go community. While some of these standards may seem arbitrary, they somehow seem to result in a solid, consistent codebase. It is possible that the code base does not currently comply with these guidelines. We are not looking for a massive PR that fixes this, since that goes against the spirit of the guidelines. All new contributions should make a best effort to clean up and make the code base better than they left it. Obviously, apply your best judgement. Remember, the goal here is to make the code base easier for humans to navigate and understand. Always keep that in mind when nudging others to comply. * All code should be formatted with `gofmt -s`. * All code should follow the guidelines covered in [Effective Go](https: * Comment the code. Tell us the why, the history and the context. * Document all declarations and methods, even private ones. Declare expectations, caveats and anything else that may be important. If a type gets exported, having the comments already there will ensure it's ready. * Variable name length should be proportional to it's context and no longer. <API key>. In practice, short methods will have short variable names and globals will have longer names. * No underscores in package names. If you need a compound name, step back, and re-examine why you need a compound name. If you still think you need a compound name, lose the underscore. * No utils or helpers packages. If a function is not general enough to warrant its own package, it has not been written generally enough to be a part of a `util` package. Just leave it unexported and well-documented. * All tests should run with `go test` and outside tooling should not be required. No, we don't need another unit testing framework. Assertion packages are acceptable if they provide real incremental value.
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <title><API key>.AbstractGroup (ARX Developer Documentation)</title> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><! if (location.href.indexOf('is-external=true') == -1) { parent.document.title="<API key>.AbstractGroup (ARX Developer Documentation)"; } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar_top"> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/<API key>.AbstractGroup.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/deidentifier/arx/aggregates/<API key>.html" title="class in org.deidentifier.arx.aggregates"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/deidentifier/arx/aggregates/<API key>.Group.html" title="class in org.deidentifier.arx.aggregates"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/deidentifier/arx/aggregates/<API key>.AbstractGroup.html" target="_top">Frames</a></li> <li><a href="<API key>.AbstractGroup.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> </a></div> <div class="header"> <div class="subTitle">org.deidentifier.arx.aggregates</div> <h2 title="Class <API key>.AbstractGroup" class="title">Class <API key>.AbstractGroup</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>org.deidentifier.arx.aggregates.<API key>.AbstractGroup</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>java.io.Serializable</dd> </dl> <dl> <dt>Direct Known Subclasses:</dt> <dd><a href="../../../../org/deidentifier/arx/aggregates/<API key>.Interval.html" title="class in org.deidentifier.arx.aggregates"><API key>.Interval</a>, <a href="../../../../org/deidentifier/arx/aggregates/<API key>.CloseElements.html" title="class in org.deidentifier.arx.aggregates"><API key>.CloseElements</a></dd> </dl> <dl> <dt>Enclosing class:</dt> <dd><a href="../../../../org/deidentifier/arx/aggregates/<API key>.html" title="class in org.deidentifier.arx.aggregates"><API key></a>&lt;<a href="../../../../org/deidentifier/arx/aggregates/<API key>.html" title="type parameter in <API key>">T</a>&gt;</dd> </dl> <hr> <br> <pre>protected abstract static class <span class="strong"><API key>.AbstractGroup</span> extends java.lang.Object implements java.io.Serializable</pre> <div class="block">A group representation to be used by subclasses.</div> <dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../serialized-form.html#org.deidentifier.arx.aggregates.<API key>.AbstractGroup">Serialized Form</a></dd></dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier</th> <th class="colLast" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>protected </code></td> <td class="colLast"><code><strong><a href="../../../../org/deidentifier/arx/aggregates/<API key>.AbstractGroup.html#<API key>.AbstractGroup(java.lang.String)"><API key>.AbstractGroup</a></strong>(java.lang.String&nbsp;label)</code>&nbsp;</td> </tr> </table> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="method_summary"> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>protected java.lang.String</code></td> <td class="colLast"><code><strong><a href="../../../../org/deidentifier/arx/aggregates/<API key>.AbstractGroup.html#getLabel()">getLabel</a></strong>()</code>&nbsp;</td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="<API key>.lang.Object"> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> </a> <h3>Constructor Detail</h3> <a name="<API key>.AbstractGroup(java.lang.String)"> </a> <ul class="blockListLast"> <li class="blockList"> <h4><API key>.AbstractGroup</h4> <pre>protected&nbsp;<API key>.AbstractGroup(java.lang.String&nbsp;label)</pre> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>label</code> - </dd></dl> </li> </ul> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="method_detail"> </a> <h3>Method Detail</h3> <a name="getLabel()"> </a> <ul class="blockListLast"> <li class="blockList"> <h4>getLabel</h4> <pre>protected&nbsp;java.lang.String&nbsp;getLabel()</pre> <dl><dt><span class="strong">Returns:</span></dt><dd></dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <div class="bottomNav"><a name="navbar_bottom"> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/<API key>.AbstractGroup.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/deidentifier/arx/aggregates/<API key>.html" title="class in org.deidentifier.arx.aggregates"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/deidentifier/arx/aggregates/<API key>.Group.html" title="class in org.deidentifier.arx.aggregates"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/deidentifier/arx/aggregates/<API key>.AbstractGroup.html" target="_top">Frames</a></li> <li><a href="<API key>.AbstractGroup.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> </a></div> </body> </html>
using Atomiv.Core.Application; using Atomiv.Template.Core.Application.Commands.Customers; using System.Threading.Tasks; namespace Atomiv.Template.Infrastructure.Commands.Authorization.Customers { public class <API key> : <API key><<API key>> { public override Task<<API key>> AuthorizeAsync(<API key> request) { // TODO: VC: Create <API key> for returning these results var result = Success(); // var result = new <API key>(false, new List<<API key>>()); return Task.FromResult(result); } } }
package javax.swing.event; import java.util.EventObject; /** * ChangeEvent is used to notify interested parties that * state has changed in the event source. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author Jeff Dinkins */ @SuppressWarnings("serial") public class ChangeEvent extends EventObject { /** * Constructs a ChangeEvent object. * * @param source the Object that is the source of the event * (typically <code>this</code>) */ public ChangeEvent(Object source) { super(source); } }
// Orthello 2D Framework Example // Because Orthello is created as a C# framework the C# classes // will only be available as you place them in the /Standard Assets folder. // If you would like to test the JS examples or use the framework in combination // with Javascript coding, you will have to move the /Orthello/Standard Assets folder // to the / (root). // This code was commented to prevent compiling errors when project is // downloaded and imported using a package. // Example 7 // Tweening example // Star 1 class /* private var tween:OTTween; function OnMouseEnter() { if (tween!=null && tween.isRunning) tween.Stop(); tween = new OTTween(GetComponent("OTSprite"), 1f, OTEasing.ElasticOut). Tween("size", new Vector2(80, 80)). Tween("tintColor", new Color(0.5f + Random.value * 0.5f, 0.5f + Random.value * 0.5f, 0.5f + Random.value * 0.5f), OTEasing.StrongOut); } function OnMouseExit() { if (tween!=null && tween.isRunning) tween.Stop(); tween = new OTTween(GetComponent("OTSprite"), 1.5f, OTEasing.ElasticOut). Tween("size", new Vector2(50, 50)). Tween("tintColor", new Color(0.5f,0.5f,0.5f), OTEasing.StrongIn); } */
rem Validations shared by <API key>.bat and rem <API key>.bat echo off rem Notice that the dll goes in "bin". set DLL=%INSTALL_DIR%\bin\libmongoc-1.0.dll if not exist %DLL% ( echo %DLL% is missing! exit /B 1 ) else ( echo libmongoc-1.0.dll check ok ) if not exist %INSTALL_DIR%\lib\pkgconfig\libmongoc-1.0.pc ( echo libmongoc-1.0.pc missing! exit /B 1 ) else ( echo libmongoc-1.0.pc check ok ) if not exist %INSTALL_DIR%\lib\cmake\libmongoc-1.0\libmongoc-1.0-config.cmake ( echo libmongoc-1.0-config.cmake missing! exit /B 1 ) else ( echo libmongoc-1.0-config.cmake check ok ) if not exist %INSTALL_DIR%\lib\cmake\libmongoc-1.0\libmongoc-1.0-config-version.cmake ( echo libmongoc-1.0-config-version.cmake missing! exit /B 1 ) else ( echo libmongoc-1.0-config-version.cmake check ok ) if not exist %INSTALL_DIR%\lib\pkgconfig\libmongoc-static-1.0.pc ( echo libmongoc-static-1.0.pc missing! exit /B 1 ) else ( echo libmongoc-static-1.0.pc check ok ) if not exist %INSTALL_DIR%\lib\cmake\libmongoc-static-1.0\libmongoc-static-1.0-config.cmake ( echo libmongoc-static-1.0-config.cmake missing! exit /B 1 ) else ( echo libmongoc-static-1.0-config.cmake check ok ) if not exist %INSTALL_DIR%\lib\cmake\libmongoc-static-1.0\libmongoc-static-1.0-config-version.cmake ( echo libmongoc-static-1.0-config-version.cmake missing! exit /B 1 ) else ( echo libmongoc-static-1.0-config-version.cmake check ok ) echo on
'use strict' var pageInfo = { setTitle: function (title) { title = title || 'Weex HTML5' try { title = decodeURIComponent(title) } catch (e) {} document.title = title } } pageInfo._meta = { pageInfo: [{ name: 'setTitle', args: ['string'] }] } module.exports = pageInfo