 Block can drop. This method is called when the block gets destroyed. It
     * returns the metadata of the dropped item based on the old metadata of the block.
     */
    public int damageDropped(IBlockState state)
    {
        return this == Blocks.lapis_ore ? EnumDyeColor.BLUE.getDyeDamage() : 0;
    }
}
package net.minecraft.block;

import com.google.common.base.Predicate;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;

public class BlockRailPowered extends BlockRailBase
{
    public static final PropertyEnum<BlockRailBase.EnumRailDirection> SHAPE = PropertyEnum.create("shape", BlockRailBase.EnumRailDirection.class, new Predicate<BlockRailBase.EnumRailDirection>()
    {
        public boolean apply(BlockRailBase.EnumRailDirection p_apply_1_)
        {
            return p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_WEST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_WEST;
        }
    });
    public static final PropertyBool POWERED = PropertyBool.create("powered");

    protected BlockRailPowered()
    {
        super(true);
        this.setDefaultState(this.blockState.getBaseState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH).withProperty(POWERED, Boolean.valueOf(false)));
    }

    @SuppressWarnings("incomplete-switch")
    protected boolean func176566A(World worldIn, BlockPos pos, IBlockState state, boolean p_176566_4_, int p_176566_5_)
    {
        if (p_176566_5_ >= 8)
        {
            return false;
        }
        else
        {
            int i = pos.getX();
            int j = pos.getY();
            int k = pos.getZ();
            boolean flag = true;
            BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(SHAPE);

            switch (blockrailbase$enumraildirection)
            {
                case NORTH_SOUTH:
                    if (p_176566_4_)
                    {
                        ++k;
                    }
                    else
                    {
                        --k;
                    }

                    break;

                case EAST_WEST:
                    if (p_176566_4_)
                    {
                        --i;
                    }
                    else
                    {
                        ++i;
                    }

                    break;

                case ASCENDING_EAST:
                    if (p_176566_4_)
                    {
                        --i;
                    }
                    else
                    {
                        ++i;
                        ++j;
                        flag = false;
                    }

                    blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST;
                    break;

                case ASCENDING_WEST:
                    if (p_176566_4_)
                    {
                        --i;
                        ++j;
                        flag = false;
                    }
                    else
                    {
                        ++i;
                    }

                    blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST;
                    break;

                case ASCENDING_NORTH:
                    if (p_


us_distribution': status_counts
            }

            # GPU状态
            gpu_status = self.memory_manager.get_gpu_status()
            stats['performance_summary'] = {
                'gpu_temperature': gpu_status.temperature,
                'gpu_utilization': gpu_status.gpu_utilization,
                'memory_utilization': gpu_status.memory_utilization,
                'active_models': len([m for m in self.models.values()
                                    if m.status in [ModelStatus.TRAINING, ModelStatus.INFERENCE]])
            }

            return stats

        except Exception as e:
            logger.error(f"获取调度器统计失败: {e}")
            return {}

# 全局GPU模型调度器实例
gpu_model_scheduler = None

def initialize_gpu_scheduler(memory_manager: GPUMemoryManager):
    """初始化GPU模型调度器"""
    global gpu_model_scheduler
    gpu_model_scheduler = GPUModelScheduler(memory_manager)
    return gpu_model_scheduler


ion.
//---------------------------------------------------------------------------//

#define BOOST_TEST_MODULE TestValarray
#include <boost/test/unit_test.hpp>

#include <boost/compute/system.hpp>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/container/valarray.hpp>

#include "check_macros.hpp"
#include "context_setup.hpp"

BOOST_AUTO_TEST_CASE(size)
{
    boost::compute::valarray<float> array;
    BOOST_CHECK_EQUAL(array.size(), size_t(0));

    array.resize(10);
    BOOST_CHECK_EQUAL(array.size(), size_t(10));
}

BOOST_AUTO_TEST_CASE(at)
{
    int data[] = { 1, 2, 3, 4, 5 };
    boost::compute::valarray<int> array(data, 5);
    BOOST_CHECK_EQUAL(array.size(), size_t(5));

    boost::compute::system::finish();
    BOOST_CHECK_EQUAL(int(array[0]), int(1));
    BOOST_CHECK_EQUAL(int(array[1]), int(2));
    BOOST_CHECK_EQUAL(int(array[2]), int(3));
    BOOST_CHECK_EQUAL(int(array[3]), int(4));
    BOOST_CHECK_EQUAL(int(array[4]), int(5));
}

BOOST_AUTO_TEST_CASE(min_and_max)
{
    int data[] = { 5, 2, 3, 7, 1, 9, 6, 5 };
    boost::compute::valarray<int> array(data, 8);
    BOOST_CHECK_EQUAL(array.size(), size_t(8));

    BOOST_CHECK_EQUAL((array.min)(), int(1));
    BOOST_CHECK_EQUAL((array.max)(), int(9));
}

BOOST_AUTO_TEST_CASE(sum)
{
    int data[] = { 1, 2, 3, 4 };
    boost::compute::valarray<int> array(data, 4);
    boost::compute::system::finish();

    BOOST_CHECK_EQUAL(array.size(), size_t(4));
    BOOST_CHECK_EQUAL(array.sum(), int(10));
}

BOOST_AUTO_TEST_CASE(apply)
{
    int data[] = { -1, 2, -3, 4 };
    boost::compute::valarray<int> array(data, 4);

    boost::compute::abs<int> abs;
    boost::compute::valarray<int> result = array.apply(abs);
    boost::compute::system::finish();
    BOOST_CHECK_EQUAL(int(result[0]), int(1));
    BOOST_CHECK_EQUAL(int(result[1]), int(2));
    BOOST_CHECK_EQUAL(int(result[2]), int(3));
    BOOST_CHECK_EQUAL(int(result[3]), int(4));
}

/// \internal_
/// Tests for compound assignment operators that works for floating
/// point types.
#define BOOST_COMPUTE_TEST_VALARRAY_COMPOUND_ASSIGNMENT(op, op_name) \
BOOST_AUTO_TEST_CASE(op_name##_ca_operator_no_fp) \
{ \
    float data[] = { 1, 2, 3, 4 }; \
    boost::compute::valarray<float> array1(data, 4); \
    boost::compute::valarray<float> array2(data, 4); \
    boost::compute::system::finish(); \
    \
    array1 op##= 1; \
    boost::compute::system::finish(); \
    BOOST_CHECK_CLOSE(float(array1[0]), float(1.0f op 1.0f), 1e-4f); \
    BOOST_CHECK_CLOSE(float(array1[1]), float(2.0f op 1.0f), 1e-4f); \
    BOOST_CHECK_CLOSE(float(array1[2]), float(3.0f op 1.0f), 1e-4f); \
    BOOST_CHECK_CLOSE(float(array1[3]), float(4.0f op 1.0f), 1e-4f); \
    \
    array1 = boost::compute::valarray<float>(data, 4); \
    boost::compute::system::finish(); \
    \
    array1 op##= array2; \


                           // ori v1, v1, 2064 SPAD mods
  get_fake_spad_addr(v1, cache.fake_scratchpad_data, 2064, c);
  // Unknown instr: ld a3, L168(fp)
  // L168:
  //    .word 0xff00ff
  //    .word 0x8000ff
  c->gprs[a3].du32[0] = 0xff00ff;
  c->gprs[a3].du32[1] = 0x8000ff;

  c->lui(t0, 4096);                                 // lui t0, 4096
  c->lw(t1, 4, a1);                                 // lw t1, 4(a1)
  c->ori(a1, t0, 54272);                            // ori a1, t0, 54272 = (0x1000D400) SPR TO
  c->lq(t0, 1852, a2);                              // lq t0, 1852(a2)
  c->addiu(t2, t1, 31);                             // addiu t2, t1, 31
  c->lq(t1, 1868, a2);                              // lq t1, 1868(a2)
  c->sra(t3, t2, 5);                                // sra t3, t2, 5
  c->lq(t2, 1884, a2);                              // lq t2, 1884(a2)
  c->sll(t3, t3, 5);                                // sll t3, t3, 5
  c->lq(a2, 1900, a2);                              // lq a2, 1900(a2)

  // wait for DMA to finish, can just remove this
  /*
  block_1:
  c->lw(t5, 0, a1);                                 // lw t5, 0(a1)
  // nop                                            // sll r0, r0, 0
  // nop                                            // sll r0, r0, 0
  // nop                                            // sll r0, r0, 0
  c->andi(t5, t5, 256);                             // andi t5, t5, 256
  // nop                                            // sll r0, r0, 0
  bc = c->sgpr64(t5) != 0;                          // bne t5, r0, L62
  // nop                                            // sll r0, r0, 0
  if (bc) {goto block_1;}                           // branch non-likely
  */

  {
    // c->sw(t4, 16, a1);                                // sw t4, 16(a1)
    u32 madr = c->sgpr64(t4);
    c->daddiu(t3, t3, -32);                           // daddiu t3, t3, -32
    // c->sw(v1, 128, a1);                               // sw v1, 128(a1)
    u32 sadr = c->sgpr64(v1);
    c->addiu(t5, r0, 64);                             // addiu t5, r0, 64
    //c->sw(t5, 32, a1);                                // sw t5, 32(a1)
    u32 qwc = c->sgpr64(t5);
    c->addiu(t5, r0, 256);                            // addiu t5, r0, 256
    // c->sw(t5, 0, a1);                                 // sw t5, 0(a1)
    spad_to_dma(cache.fake_scratchpad_data, madr, sadr, qwc);
    c->daddiu(t4, t4, 1024);                          // daddiu t4, t4, 1024
  }

  block_3:
  c->mov64(t6, v1);                                 // or t6, v1, r0
  c->xori(v1, v1, 1024);                            // xori v1, v1, 1024
  bc = ((s64)c->sgpr64(t3)) <= 0;                   // blez t3, L66
  c->daddiu(t3, t3, -32);                           // daddiu t3, t3, -32
  if (bc) {goto block_7;}                           // branch non-likely

  /*
  block_4:
  c->lw(t5, 0, a1);                                 // lw t5, 0(a1)
  // nop


hors
// SPDX-License-Identifier: Apache-2.0

package signozkafkaexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter"

import (
	"errors"

	"github.com/goccy/go-json"

	"github.com/Shopify/sarama"
	"go.opentelemetry.io/collector/pdata/pcommon"
	"go.opentelemetry.io/collector/pdata/plog"
)

var errUnsupported = errors.New("unsupported serialization")

type rawMarshaler struct {
}

func newRawMarshaler() rawMarshaler {
	return rawMarshaler{}
}

func (r rawMarshaler) Marshal(logs plog.Logs, topic string) ([]*sarama.ProducerMessage, error) {
	var messages []*sarama.ProducerMessage
	for i := 0; i < logs.ResourceLogs().Len(); i++ {
		rl := logs.ResourceLogs().At(i)
		for j := 0; j < rl.ScopeLogs().Len(); j++ {
			sl := rl.ScopeLogs().At(j)
			for k := 0; k < sl.LogRecords().Len(); k++ {
				lr := sl.LogRecords().At(k)
				b, err := r.logBodyAsBytes(lr.Body())
				if err != nil {
					return nil, err
				}
				if len(b) == 0 {
					continue
				}

				messages = append(messages, &sarama.ProducerMessage{
					Topic: topic,
					Value: sarama.ByteEncoder(b),
				})
			}
		}
	}

	return messages, nil
}

func (r rawMarshaler) logBodyAsBytes(value pcommon.Value) ([]byte, error) {
	switch value.Type() {
	case pcommon.ValueTypeStr:
		return r.interfaceAsBytes(value.Str())
	case pcommon.ValueTypeBytes:
		return value.Bytes().AsRaw(), nil
	case pcommon.ValueTypeBool:
		return r.interfaceAsBytes(value.Bool())
	case pcommon.ValueTypeDouble:
		return r.interfaceAsBytes(value.Double())
	case pcommon.ValueTypeInt:
		return r.interfaceAsBytes(value.Int())
	case pcommon.ValueTypeEmpty:
		return []byte{}, nil
	case pcommon.ValueTypeSlice:
		return r.interfaceAsBytes(value.Slice().AsRaw())
	case pcommon.ValueTypeMap:
		return r.interfaceAsBytes(value.Map().AsRaw())
	default:
		return nil, errUnsupported
	}
}

func (r rawMarshaler) interfaceAsBytes(value interface{}) ([]byte, error) {
	if value == nil {
		return []byte{}, nil
	}
	res, err := json.Marshal(value)
	return res, err
}

func (r rawMarshaler) Encoding() string {
	return "raw"
}
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package signozkafkaexporter

import (
	"bytes"
	"testing"

	"github.com/Shopify/sarama"
	"github.com/gogo/protobuf/jsonpb"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"go.opentelemetry.io/collector/pdata/pcommon"
	"go.opentelemetry.io/collector/pdata/ptrace"

	"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger"
)

func TestJaegerMarshaler(t *testing.T) {
	td := ptrace.NewTraces()
	span := td.ResourceSpans().AppendEmpty().ScopeSpans().AppendEmpty().Spans().AppendEmpty()
	span.SetName("foo")
	span.SetStartTimestamp(pcommon.Timestamp(10))
	span.SetEndTimestamp(pcommon.Timestamp(20))
	span


1),d2	; width in pixels
	add.w	12(a1),d3	; height

	move.l	map_buff_pos,a1
	moveq	#0,d4
	moveq	#12-1,d7
.l1
x	set	0
	rept	6
;	tst.w	pop_flag1
;	bne	.return
	move.w	tile_flag+x(a1),d4
;	move.l	.table2(pc,d4.w),a2
	lea	.table2(pc),a2
	add.w	d4,a2
	move.l	(a2),a2

	move.l	a1,a3
	lea	tile_x1+x(a3),a3
	jsr	(a2)
x	set	x+tile_size
	endr
	lea	((tile_size*7)*2)(a1),a1
	dbf	d7,.l1
.return	rts

.return2
	st	force_start_x_flag
	rts

.table2	dc.l	.return
	dc.l	.detect

.detect
	;tst.b	force_start_x_flag
	;bmi	.n1

	movem.w	(a3),d4-d6/a4	; tile coords

	cmp.w	d4,d2	;x1
	blt	.n1
	cmp.w	d5,d3	;y1
	blt.s	.n1

	cmp.w	d6,d0	;x2
	bgt.s	.n1
	cmp.w	a4,d1	;y2
	bgt.s	.n1

	tst.b	attached_flag
	bne.s	.n3

;	tst.b	force_x_correct_flag
;	bne.s	.n2

	btst.b	#1,force_table+2+2+1
;	btst.b	#1,force_bit
	beq	.n2

	move.w	d6,x1(a0)
	addq.w	#1,x1(a0)

	bsr	.copy_coords1

;	add.w	#3+1,x1(a0)
	st	force_x_flag
;	st	force_hit
	addq.l	#4,sp
	bra	check_x_first
;	bra	.s4
.n2
	btst.b	#0,force_table+2+2+1
;	btst.b	#0,force_bit
	beq	.n3

	move.w	d4,x1(a0)
	move.l	spr_ptr1(a0),a2
	addq.w	#6,a2
	move.w	spr_num(a0),d1
	lsl.w	#5,d1
	add.w	d1,a2
	move.w	8(a2),d1
	sub.w	d1,x1(a0)
	subq.w	#2,x1(a0)

	bsr	.copy_coords1
;	sub.w	#3+1,x1(a0)

	sf	force_x_flag
;	st	force_hit

	addq.l	#4,sp
	bra	check_x_first
;	bra	.s4
.n3

	move.w	#-1,pop_flag1

.n1
	rts

.copy_coords1
x	set	0
	rept	12
	move.w	x1(a0),force_table+x
;	bset	#0,force_table+4
;	bclr	#1,force_table+4
x	set	x+6
	endr
	rts

.copy_coords2
x	set	0
	r


 xor \S21, \S21, \T02
    xor  \T01, \T01, \S01
    xor \T02, \S03, \S08
    xor \S03, \S03, \T01
    xor \S08, \S08, \T01
    xor \T02, \T02, \S13
    xor \S13, \S13, \T01
    xor \T02, \T02, \S18
    slli \S01, \T00, 1
    srli \T00, \T00, 63
    xor \S18, \S18, \T01
    xor \T02, \T02, \S23
    xor  \T00, \T00, \S01
    xor \S23, \S23, \T01
    // T00=C0 T03=C1 T04=C4 T02=C3
    xor  \T00, \T00, \T02
    // T00=D4 T03=C1 T04=C4 T02=C3
    slli \T01, \T02, 1
    srli \T02, \T02, 63
    xor \S04, \S04, \T00
    xor \S09, \S09, \T00
    ld  \S01, 8*18(sp)
    xor  \T02, \T02, \T01
    xor \S14, \S14, \T00
    xor \S19, \S19, \T00
    xor  \T02, \T02, \T03
    xor \S24, \S24, \T00
    // T03=C1 T04=C4 T02=D2
    slli \T01, \T03, 1
    srli \T03, \T03, 63
    xor \S02, \S02, \T02
    xor \S07, \S07, \T02
    xor  \T03, \T03, \T01
    xor \S12, \S12, \T02
    xor \S17, \S17, \T02
    xor  \T03, \T03, \T04
    xor \S22, \S22, \T02
    xor \S05, \S05, \T03
    xor \S10, \S10, \T03
    xor \S15, \S15, \T03
    xor \S20, \S20, \T03
    xor \T00, \S00, \T03
    # theta - end
    # Rho & Pi & Chi - start
    slli \T04, \S06, 44
    srli \T01, \S06, 20
    slli \T03, \S02, 62
    xor  \T01, \T01, \T04
    srli \S00, \S02, 2
    slli \T02, \S12, 43
    xor  \S00, \S00, \T03
    srli \S02, \S12, 21
    slli \T04, \S13, 25
    xor  \S02, \S02, \T02
    srli \S12, \S13, 39
    slli \T03, \S19, 8
    xor  \S12, \S12, \T04
    srli \S13, \S19, 56
    slli \T02, \S23, 56
    xor  \S13, \S13, \T03
    srli \S19, \S23, 8
    slli \T04, \S15, 41
    xor  \S19, \S19, \T02
    srli \S23, \S15, 23
    slli \T03, \S01, 1
    xor  \S23, \S23, \T04
    srli \S15, \S01, 63
    slli \T02, \S08, 55
    xor  \S15, \S15, \T03
    srli \S01, \S08, 9


ae}	 # AVX512
	vsqrtsd	xmm30{k7}, xmm29, xmm28, {rz-sae}	 # AVX512
	vsqrtsd	xmm30{k7}, xmm29, QWORD PTR [rcx]	 # AVX512
	vsqrtsd	xmm30{k7}, xmm29, QWORD PTR [rax+r14*8+0x1234]	 # AVX512
	vsqrtsd	xmm30{k7}, xmm29, QWORD PTR [rdx+1016]	 # AVX512 Disp8
	vsqrtsd	xmm30{k7}, xmm29, QWORD PTR [rdx+1024]	 # AVX512
	vsqrtsd	xmm30{k7}, xmm29, QWORD PTR [rdx-1024]	 # AVX512 Disp8
	vsqrtsd	xmm30{k7}, xmm29, QWORD PTR [rdx-1032]	 # AVX512

	vsqrtss	xmm30{k7}, xmm29, xmm28	 # AVX512
	vsqrtss	xmm30{k7}{z}, xmm29, xmm28	 # AVX512
	vsqrtss	xmm30{k7}, xmm29, xmm28, {rn-sae}	 # AVX512
	vsqrtss	xmm30{k7}, xmm29, xmm28, {ru-sae}	 # AVX512
	vsqrtss	xmm30{k7}, xmm29, xmm28, {rd-sae}	 # AVX512
	vsqrtss	xmm30{k7}, xmm29, xmm28, {rz-sae}	 # AVX512
	vsqrtss	xmm30{k7}, xmm29, DWORD PTR [rcx]	 # AVX512
	vsqrtss	xmm30{k7}, xmm29, DWORD PTR [rax+r14*8+0x1234]	 # AVX512
	vsqrtss	xmm30{k7}, xmm29, DWORD PTR [rdx+508]	 # AVX512 Disp8
	vsqrtss	xmm30{k7}, xmm29, DWORD PTR [rdx+512]	 # AVX512
	vsqrtss	xmm30{k7}, xmm29, DWORD PTR [rdx-512]	 # AVX512 Disp8
	vsqrtss	xmm30{k7}, xmm29, DWORD PTR [rdx-516]	 # AVX512

	vsubsd	xmm30{k7}, xmm29, xmm28	 # AVX512
	vsubsd	xmm30{k7}{z}, xmm29, xmm28	 # AVX512
	vsubsd	xmm30{k7}, xmm29, xmm28, {rn-sae}	 # AVX512
	vsubsd	xmm30{k7}, xmm29, xmm28, {ru-sae}	 # AVX512
	vsubsd	xmm30{k7}, xmm29, xmm28, {rd-sae}	 # AVX512
	vsubsd	xmm30{k7}, xmm29, xmm28, {rz-sae}	 # AVX512
	vsubsd	xmm30{k7}, xmm29, QWORD PTR [rcx]	 # AVX512
	vsubsd	xmm30{k7}, xmm29, QWORD PTR [rax+r14*8+0x1234]	 # AVX512
	vsubsd	xmm30{k7}, xmm29, QWORD PTR [rdx+1016]	 # AVX512 Disp8
	vsubsd	xmm30{k7}, xmm29, QWORD PTR [rdx+1024]	 # AVX512
	vsubsd	xmm30{k7}, xmm29, QWORD PTR [rdx-1024]	 # AVX512 Disp8
	vsubsd	xmm30{k7}, xmm29, QWORD PTR [rdx-1032]	 # AVX512

	vsubss	xmm30{k7}, xmm29, xmm28	 # AVX512
	vsubss	xmm30{k7}{z}, xmm29, xmm28	 # AVX51


a: 1}, {b: 2}, {d: 3}])).toEqual({a: 1, b: 2});
    expect(fn(obj1, [{a: 1}, {a: 2}, {a: 5}])).toEqual({a: 5});
    expect(fn(obj1, [{a: 1}, {a: 2}, {a: 12}])).toEqual({});
    expect(fn(obj1, [{a: 12}, {b: undefined}, {c: 3}])).toEqual({});
    expect(fn({}, [{a: 1}, {b: 2}, {d: 3}])).toEqual({});
    expect(fn({a: NaN}, [{a: 1}, {a: NaN}])).toEqual({});
});
test("renameObjKey", () => {
    const fn = cm.renameObjKey;
    expect(fn({a: 12, b: undefined, c: 3}, {test: "a", bb: "b"})).toEqual({test: 12, bb: undefined, c: 3});
    expect(fn({a: 12, b: undefined, c: 3}, {test: "aa" as any, bb: "b"})).toEqual({a: 12, bb: undefined, c: 3});
    expect(fn({a: 1, b: 2}, {a: "a", aa: "a", aaa: "a"})).toEqual({a: 1, aa: 1, aaa: 1, b: 2});
});
test("objKeys", () => {
    const fn = cm.objKeys;
    const obj: any = {a: 1, b: 2, c: 3};
    expect(fn(obj)).toEqual(Object.keys(obj));
    obj[1] = "";
    obj[NaN] = "";
    obj[""] = "";
    obj[null as any] = "";
    obj[0] = "";
    obj[true as any] = "";
    obj[false as any] = "";
    obj[undefined as any] = "";
    expect(fn(obj)).toEqual(Object.keys(obj));
});
test("objValues", () => {
    const fn = cm.objValues;
    const obj: any = {a: 1, b: 2, c: 3};
    expect(fn(obj)).toEqual(Object.values(obj));
    obj[1] = "";
    obj[NaN] = "";
    obj[""] = "";
    obj[null as any] = "";
    obj[0] = "";
    obj[true as any] = "";
    obj[false as any] = "";
    obj[undefined as any] = "";
    expect(fn(obj)).toEqual(Object.values(obj));
});
test("objEntries", () => {
    const fn = cm.objEntries;
    const obj: any = {a: 1, b: 2, c: 3};
    expect(fn(obj)).toEqual(Object.entries(obj));
    obj[1] = "";
    obj[NaN] = "";
    obj[""] = "";
    obj[null as any] = "";
    obj[0] = "";
    obj[true as any] = "";
    obj[false as any] = "";
    obj[undefined as any] = "";
    const result = fn(obj);
    const result2 = Object.entries(obj);
    expect(result).toEqual(result2);
});
test("translateObjPath", () => {
    const fn = cm.translateObjPath;
    expect(fn("a[b][c].d[e][f]")).toBe("a.b.c.d.e.f");
    expect(fn("a.b.c.d.e.f")).toBe("a.b.c.d.e.f");
    expect(fn("a.b.c.d.e.f", "a")).toBe("b.c.d.e.f");
    expect(fn("a[b][c].d.e.f", "a\\[b\\]\\[c\\]")).toBe("d.e.f");
    expect(fn("a.b.c.d.e.f", "a.b.c")).toBe("d.e.f");
    expect(fn("a[][][]")).toBe("a");
    // expect(fn("a%5B%5D", )).toBe("a");
});
test


put User input to rank against
     * @param rankables Set of items to rank
     */
    fun <T> rank(
        description: String,
        userInput: String,
        rankables: Collection<T>,
    ): Rankings<T> where T : Named, T : Described
}

/**
 * Rankings, sorted by score descending
 */
data class Rankings<T>(
    private val rankings: List<Ranking<T>>,
) : HasInfoString where T : Named, T : Described {

    fun rankings(): List<Ranking<T>> = rankings.sortedByDescending { it.score }

    override fun infoString(
        verbose: Boolean?,
        indent: Int,
    ): String =
        rankings().joinToString("\n") { it.infoString(verbose, indent) }
}

/**
 * Ranking choice returned by the ranker
 * @param match The ranked item
 * @param score The confidence score of the ranker in this choice,
 * between 0 and 1
 */
data class Ranking<T>(
    override val match: T,
    override val score: ZeroToOne,
) : HasInfoString, SimilarityResult<T> where T : Named, T : Described {

    override fun infoString(
        verbose: Boolean?,
        indent: Int,
    ): String {
        var s = "${match.name}: ${"%.2f".format(score)}"
        if (verbose == true) {
            s += " - ${match.description}"
        }
        return if (verbose == true) s.indent(indent) else s
    }
}
/*
 * Copyright 2024-2025 Embabel Software, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.embabel.agent.channel

import com.embabel.agent.core.InProcess
import com.embabel.agent.domain.library.HasContent
import com.embabel.chat.Message
import org.slf4j.LoggerFactory

/**
 * Allows agents to interact with the outside world through multiple channels
 */
interface OutputChannel {

    fun send(event: OutputChannelEvent)

    operator fun plus(other: OutputChannel): OutputChannel =
        if (this == DevNullOutputChannel) other else if (other == DevNullOutputChannel) this else MulticastOutputChannel(
            listOf(this, other)
        )
}

object DevNullOutputChannel : OutputChannel {

    private val logger = LoggerFactory.getLogger(javaClass)

    override fun send(event: OutputChannelEvent) {
        logger.warn("DevNullOutputChannel received event: {}", event)
    }
}

interface OutputChannelEvent : InProcess

/**
 * Chat message event relating to this process.
 * Most likely an Assistant message, but could also be a User message in some cases.
 * @param processId Process that generated this message
 */
data class MessageOutputChannelEvent(
    override val processId: String,
    val message: Message,
) : OutputChannelEvent

data class ContentOutputChannelEvent(
    override val processId: String,
    val content: HasContent,
) : OutputChannelEvent

/**
 * Logging or progress event
 */
interface InformativeOutputChannelEvent : OutputChannelEvent {
    val message: String
}

/**
 * Ephemeral message.
 * Not meant to be part of a conversation
 */
data class LoggingOutputChannelEvent @JvmOverloads constructor(
    override val processId: String,
    override val message: String,
    val level: Level = Level.INFO,
    val throwable: Throwable? = null,
) : InformativeOutputChannelEvent {

    enum class Level {
        TRACE, DEBUG, INFO, WARN, ERROR
    }
}

data class ProgressOutputChannelEvent(
    override val processId:


'jsonwebtoken';
import { v4 } from 'uuid';
// app
import { redis } from './app.redis';
import { environment } from '../environments/environment';

/**
 * Methode to generate usertoken from value
 * @param secretToken string Secret String from backend to generate/verify user token
 * @param expire number TimeStampe of token expiration
 * @param doc any Object with value to generate user token
 */
export const getToken = (
  secretToken = null,
  expire = null,
  doc: any = {}
): string => {
  // prevent unexisting value
  if (! doc.uid || !doc.email) return '';
  // prepare payload
  const payload = {uid: doc.uid, email: doc.email};
  // create new token with params
  return jwt.sign(payload, secretToken, {
    expiresIn: +expire // use jwtExpire as number type
  });
};

/**
 * extractToken(): Method to safty extract usertoken from http request
 * @param req express.Request Request Class from Express JS
 */
export const extractToken = (req: Request): string => {
  if (!req) return '';
  // extract data and prevent unexisting proprety `token`
  const {body = {token: null}, query = {token: null}} = req;
  // extract value from one of thoses
  const token = body.token ||
    query.token ||
    req.get('x-access-token') ||
    req.get('authentication') ||
    req.get('authorization') || null;
  // create arrray with empty value posible
  const maps = {
    'NaN': NaN,
    'null': null,
    'undefined': undefined,
    'Infinity': Infinity,
    '-Infinity': -Infinity
  };
  // return value empty or existing token finded
  return ((token in maps) ? maps[token] : token);
};

export const checkAuthentication = async (req: Request) => {
  // look for the token in the incoming request:
  const token = extractToken(req);
  if (!token || token === undefined || token === 'undefined') {
    return null;
  }
  try {
    const decoded = await jwt.verify(token, environment.secretToken);
    (req as any).decoded = decoded;
    return decoded;
  } catch (e) {
    return null;
  }
}

export const confirmEmailLink = async (uid: string): Promise<string> => {
  // get random id
  const id = v4();
  // set data in redis with uniqu key and expire time
  await redis.set(environment.prefix.confirmEmail + id, uid, 'ex', 60 * 60 * 15);
  // return url ready to confirm email
  return `${environment.fronts.pwa}/auth/confirm?token=${id}`;
};
import getLogger from '../../../logger';
import reddit from '../../../reddit';
import generateTopOffendersReport from '../../../reports/topOffenders';
import { createMarkdownTable } from '../../../utils/markdown';

export interface TopOffendersRequestParams {
  limit?: string;
  period?: string;
}

interface TopOffendersReportJobData {
  request: TopOffendersRequestParams;
  subreddit: string;
  messageFullname: string;
}

const logger = getLogger('ReportsQueueConsumer');
const headerRow = [
  'User',
  'Removed comments',
  'Removed submissions',
  'Total removed',
];
const defaultLimit = 10;

export default async function processTopOffendersReport({
  request,
  subreddit,
  messageFullname,
}: TopOffendersReportJobData) {
  const report = await generateTopOffendersReport({
    subreddit,
    limit: request.limit ? parseInt(request.limit, 10) : defaultLimit,
    period: request.period,
  });

  const table = createMarkdownTable(
    headerRow,
    report.offenders.map(offender => [
      offender.username,
      offender.removedComments,
      offender.removedSubmissions,
      offender.totalRemoved,
    ])
  );

  const message = `Hello,

Here


6b3977a516a36ff850a5e914331f7445e86973f5a6cbb590105e933306e240eab6db72d08430cd7316e99481"
                + "a272adef0f2479d0b7c58e89e072364d660fdad1b51a603ff4549a82e8dc914df82bcc6c6c232985450203010001a30f300d"
                + "300b0603551d0f040403020520300d06092a864886f70d01010505000381810048c83e6f45d73a111c67e8f9f9c2d646292b"
                + "75cec52ef0f9ae3e1639504aa1759512c46527fcf5476897d3fb6fc515ff1646f8f8bc09f84ea6e2ad04242d3fb9b190b816"
                + "86b73d334e8b3afa7fb8eb31483efc0c7ccb0f8c1ca94d8be4f0daade4498501d02e6f92dd7b2f4401550896eb511ef14417"
                + "cbb5a1b360d67998d3343115301306092a864886f70d0109153106040401000000303b301f300706052b0e03021a0414c4c0"
                + "4e0c0b0a20e50d58cb5ce565ba7c192d5d3f041479b53fc5f1f1f493a02cf113d563a247462e8726020207d0").HexToByteArray();

            public static byte[] s_RSAKeyTransfer2Cer =
                 ("308201c830820131a00302010202102bce9f9ece39f98044f0cd2faa9a14e7300d06092a864886f70d0101050500301a3118"
                + "30160603550403130f5253414b65795472616e7366657232301e170d3136303332353231323334325a170d31373033323630"
                + "33323334325a301a311830160603550403130f5253414b65795472616e736665723230819f300d06092a864886f70d010101"
                + "050003818d0030818902818100ea5a3834bfb863ae481b696ea7010ba4492557a160a102b3b4d11c120a7128f20b656ebbd2"
                + "4b426f1a6d40be0a55ca1b53ebdca202d258eebb20d5c662819182e64539360461dd3b5dda4085f10250fc5249cf023976b8"
                + "db2bc5f5e628fdb0f26e1b11e83202cbcfc9750efd6bb4511e6211372b60a97adb984779fdae21ce070203010001a30f300d"
                + "300b0603551d0f040403020520300d06092a864886f70d0101050500038181004dc6f9fd6054ae0361d28d2d781be590fa8f"
                + "5685fedfc947e315db12a4c47e220601e8c810e84a39b05b7a89f87425a06c0202ad48b3f2713109f5815e6b5d61732dac45"
                + "41da152963e700a6f37faf7678f084a9fb4fe88f7b2cbc6cdeb0b9fdcc6a8a16843e7bc281a71dc6eb8bbc4092d299bf7599"
                + "a


nericExtensions.deepCopy] instead. '
      'Will be removed in next major version')
  TensorInfo_CooSparse clone() =>
      TensorInfo_CooSparse()..mergeFromMessage(this);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
      'Will be removed in next major version')
  TensorInfo_CooSparse copyWith(void Function(TensorInfo_CooSparse) updates) =>
      super.copyWith((message) => updates(message as TensorInfo_CooSparse))
          as TensorInfo_CooSparse; // ignore: deprecated_member_use
  $pb.BuilderInfo get info_ => _i;
  @$core.pragma('dart2js:noInline')
  static TensorInfo_CooSparse create() => TensorInfo_CooSparse._();
  TensorInfo_CooSparse createEmptyInstance() => create();
  static $pb.PbList<TensorInfo_CooSparse> createRepeated() =>
      $pb.PbList<TensorInfo_CooSparse>();
  @$core.pragma('dart2js:noInline')
  static TensorInfo_CooSparse getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<TensorInfo_CooSparse>(create);
  static TensorInfo_CooSparse? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get valuesTensorName => $_getSZ(0);
  @$pb.TagNumber(1)
  set valuesTensorName($core.String v) {
    $_setString(0, v);
  }

  @$pb.TagNumber(1)
  $core.bool hasValuesTensorName() => $_has(0);
  @$pb.TagNumber(1)
  void clearValuesTensorName() => clearField(1);

  @$pb.TagNumber(2)
  $core.String get indicesTensorName => $_getSZ(1);
  @$pb.TagNumber(2)
  set indicesTensorName($core.String v) {
    $_setString(1, v);
  }

  @$pb.TagNumber(2)
  $core.bool hasIndicesTensorName() => $_has(1);
  @$pb.TagNumber(2)
  void clearIndicesTensorName() => clearField(2);

  @$pb.TagNumber(3)
  $core.String get denseShapeTensorName => $_getSZ(2);
  @$pb.TagNumber(3)
  set denseShapeTensorName($core.String v) {
    $_setString(2, v);
  }

  @$pb.TagNumber(3)
  $core.bool hasDenseShapeTensorName() => $_has(2);
  @$pb.TagNumber(3)
  void clearDenseShapeTensorName() => clearField(3);
}

class TensorInfo_CompositeTensor extends $pb.GeneratedMessage {
  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      const $core.bool.fromEnvironment('protobuf.omit_message_names')
          ? ''
          : 'TensorInfo.CompositeTensor',
      package: const $pb.PackageName(
          const $core.bool.fromEnvironment('protobuf.omit_message_names')
              ? ''
              : 'tensorflow'),
      createEmptyInstance: create)
    ..aOM<$6.TypeSpecProto>(
        1,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'typeSpec',
        subBuilder: $6.TypeSpecProto.create)
    ..pc<TensorInfo>(
        2,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'components',
        $pb.PbFieldType.PM,
        subBuilder: TensorInfo.create)
    ..hasRequiredFields = false;

  TensorInfo_CompositeTensor._() : super();
  factory TensorInfo_CompositeTensor({
    $6.TypeSpecProto? typeSpec,


ackerElement {
  lastX: number;
  lastY: number;

  timeStamp: number;

  velocityX: number;
  velocityY: number;
}

const MAX_POINTERS = 20;

export default class PointerTracker {
  private velocityTracker = new VelocityTracker();
  private trackedPointers: Map<number, TrackerElement> = new Map<
    number,
    TrackerElement
  >();

  private touchEventsIds: Map<number, number> = new Map<number, number>();

  private lastMovedPointerId: number;

  private cachedAverages: { x: number; y: number } = { x: 0, y: 0 };

  public constructor() {
    this.lastMovedPointerId = NaN;

    for (let i = 0; i < MAX_POINTERS; ++i) {
      this.touchEventsIds.set(i, NaN);
    }
  }

  public addToTracker(event: AdaptedEvent): void {
    if (this.trackedPointers.has(event.pointerId)) {
      return;
    }

    this.lastMovedPointerId = event.pointerId;

    const newElement: TrackerElement = {
      lastX: event.x,
      lastY: event.y,
      timeStamp: event.time,
      velocityX: 0,
      velocityY: 0,
    };

    this.trackedPointers.set(event.pointerId, newElement);
    this.mapTouchEventId(event.pointerId);

    this.cachedAverages = {
      x: this.getLastAvgX(),
      y: this.getLastAvgY(),
    };
  }

  public removeFromTracker(pointerId: number): void {
    this.trackedPointers.delete(pointerId);
    this.removeMappedTouchId(pointerId);
  }

  public track(event: AdaptedEvent): void {
    const element: TrackerElement = this.trackedPointers.get(
      event.pointerId
    ) as TrackerElement;

    if (!element) {
      return;
    }

    this.lastMovedPointerId = event.pointerId;

    this.velocityTracker.add(event);
    const [velocityX, velocityY] = this.velocityTracker.getVelocity();

    element.velocityX = velocityX;
    element.velocityY = velocityY;

    element.lastX = event.x;
    element.lastY = event.y;

    this.trackedPointers.set(event.pointerId, element);

    const avgX: number = this.getLastAvgX();
    const avgY: number = this.getLastAvgY();

    this.cachedAverages = {
      x: avgX,
      y: avgY,
    };
  }

  //Mapping TouchEvents ID
  private mapTouchEventId(id: number): void {
    for (const [mappedId, touchId] of this.touchEventsIds) {
      if (isNaN(touchId)) {
        this.touchEventsIds.set(mappedId, id);
        break;
      }
    }
  }

  private removeMappedTouchId(id: number): void {
    const mappedId: number = this.getMappedTouchEventId(id);
    if (!isNaN(mappedId)) {
      this.touchEventsIds.set(mappedId, NaN);
    }
  }

  public getMappedTouchEventId(touchEventId: number): number {
    for (const [key, value] of this.touchEventsIds.entries()) {
      if (value === touchEventId) {
        return key;
      }
    }

    return NaN;
  }

  public getVelocityX(pointerId: number): number {
    return this.trackedPointers.get(pointerId)?.velocityX as number;
  }
  public getVelocityY(pointerId: number): number {
    return this.trackedPointers.get(pointerId)?.velocityY as number;
  }

  /**
   * Returns X coordinate of last moved pointer
   */
  public getLastX(): number;

  /**
   *


WANJ
BF62;BF62;1108 116A 11AD;BF62;1108 116A 11AD; # (뽢; 뽢; 뽢; 뽢; 뽢; ) HANGUL SYLLABLE BBWANH
BF63;BF63;1108 116A 11AE;BF63;1108 116A 11AE; # (뽣; 뽣; 뽣; 뽣; 뽣; ) HANGUL SYLLABLE BBWAD
BF64;BF64;1108 116A 11AF;BF64;1108 116A 11AF; # (뽤; 뽤; 뽤; 뽤; 뽤; ) HANGUL SYLLABLE BBWAL
BF65;BF65;1108 116A 11B0;BF65;1108 116A 11B0; # (뽥; 뽥; 뽥; 뽥; 뽥; ) HANGUL SYLLABLE BBWALG
BF66;BF66;1108 116A 11B1;BF66;1108 116A 11B1; # (뽦; 뽦; 뽦; 뽦; 뽦; ) HANGUL SYLLABLE BBWALM
BF67;BF67;1108 116A 11B2;BF67;1108 116A 11B2; # (뽧; 뽧; 뽧; 뽧; 뽧; ) HANGUL SYLLABLE BBWALB
BF68;BF68;1108 116A 11B3;BF68;1108 116A 11B3; # (뽨; 뽨; 뽨; 뽨; 뽨; ) HANGUL SYLLABLE BBWALS
BF69;BF69;1108 116A 11B4;BF69;1108 116A 11B4; # (뽩; 뽩; 뽩; 뽩; 뽩; ) HANGUL SYLLABLE BBWALT
BF6A;BF6A;1108 116A 11B5;BF6A;1108 116A 11B5; # (뽪; 뽪; 뽪; 뽪; 뽪; ) HANGUL SYLLABLE BBWALP
BF6B;BF6B;1108 116A 11B6;BF6B;1108 116A 11B6; # (뽫; 뽫; 뽫; 뽫; 뽫; ) HANGUL SYLLABLE BBWALH
BF6C;BF6C;1108 116A 11B7;BF6C;1108 116A 11B7; # (뽬; 뽬; 뽬; 뽬; 뽬; ) HANGUL SYLLABLE BBWAM
BF6D;BF6D;1108 116A 11B8;BF6D;1108 116A 11B8; # (뽭; 뽭; 뽭; 뽭; 뽭; ) HANGUL SYLLABLE BBWAB
BF6E;BF6E;1108 116A 11B9;BF6E;1108 116A 11B9; # (뽮; 뽮; 뽮; 뽮; 뽮; ) HANGUL SYLLABLE BBWABS
BF6F;BF6F;1108 116A 11BA;BF6F;1108 116A 11BA; # (뽯; 뽯; 뽯; 뽯; 뽯; ) HANGUL SYLLABLE BBWAS
BF70;BF70;1108 116A 11BB;BF70;1108 116A 11BB; # (뽰; 뽰; 뽰; 뽰; 뽰; ) HANGUL SYLLABLE BBWASS
BF71;BF71;1108 116A 11BC;BF71;1108 116A 11BC; # (뽱; 뽱; 뽱; 뽱; 뽱; ) HANGUL SYLLABLE BBWANG
BF72;BF72;1108 116A 11BD;BF72;1108 116A 11BD; # (뽲; 뽲; 뽲; 뽲; 뽲; ) HANGUL SYLLABLE BBWAJ
BF73;


={0,60,60,50,50,40,40,30,30,20,20,10,10} ;
	int Tope = List.Size();
	int i,move,to,from,score;
	for(i =0; i < Tope;i++)
	{
		move = List.Move(i);
		to = MoveTo(move);
		from = MoveFrom(move);
		if(board[to] != Empty && board[from] != Empty)
		{
			score=piece_values[piece_to_12(board[to])]+aggressor_order[piece_to_12(board[from])];
		}
		else
		{
			score = 0;
			if(MoveIsPromote(move) && PromotePiece(move) == Queen)
				score = PromoteScore;
		}
		if(score < 100) score = 0;
		List.SetScore(i,score);
	}
}

void Board::WeightPstMoves(MoveList &List)
{
	int Tope = List.Size();
	int i,move,to,from,score;
	int Piece;
	isEndGame = (NumWRook+NumWKnight+NumWBishop+NumWQueen) < 3 || (NumBRook+NumBKnight+NumBBishop+NumBQueen) < 3;
	for(i =0; i < Tope;i++)
	{
		move = List.Move(i);
		to = MoveTo(move);
		from = MoveFrom(move);
		Piece = board[from];
		to = sq16x12to64(to);
		from = sq16x12to64(from);
		if(isEndGame)
			score = Pst[Piece][to][1] - Pst[Piece][from][1];
		else
			score = Pst[Piece][to][0] - Pst[Piece][from][0];
		List.SetScore(i,score);
	}
}

void Board::WeightMovesPVS(MoveList &List)
{
	// MVV/LVA
	// PstDiff
	//Mvv-lva
static const int piece_values[16]={0,1000,1000,3000,3000,3000,3000,5000,5000,9000,9000};
static const int aggressor_order[16]={0,60,60,50,50,40,40,30,30,20,20,10,10} ;
	int Tope = List.Size();
	int i,move,to,from,score;
	for(i =0; i < Tope;i++)
	{
		move = List.Move(i);
		to = MoveTo(move);
		from = MoveFrom(move);
		if(board[to] != Empty && board[from] != Empty)
		{
			score=piece_values[piece_to_12(board[to])]+aggressor_order[piece_to_12(board[from])];
		}
		else
		{
			score = 0;
			if(MoveIsPromote(move) && PromotePiece(move) == Queen)
				score = PromoteScore;
		}
		if(score < 100) score = 0;
		// hash move 10000 killers 9000
		if(move == HashJugada)
			score = 10000;
		if(move == Killer[0])
			score = 9000;
		if(move == Killer[1])
			score = 9000;

		List.SetScore(i,score);
	}
}
//    Copyright 2009-2012 Antonio Torrecillas Gonzalez
//
//    This file is part of Rocinante.
//
//    Rocinante is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Rocinante is distributed in the hope that it will be useful,
//    but WITHOUT ANY


NGraph GenerateLoopGraph(const PNGraph& Graph) {
  GenerateNodes(Graph);
  Graph->AddEdge(0, 1);
  Graph->AddEdge(1, 2);
  Graph->AddEdge(2, 3);
  Graph->AddEdge(3, 4);
  Graph->AddEdge(4, 0);
  Graph->AddEdge(4, 0);
  Graph->AddEdge(0, 4);
  return Graph;
}

PNGraph GetTNLoopGraph() {
  return GenerateLoopGraph(TNGraph::New());
}

/////////////////////////////////////////////////
// Main
/////////////////////////////////////////////////

int main(int argc, char* argv[]) {
  PrintCntInDegNodes();
  PrintCntOutDegNodes();
  PrintCntDegNodes();
  PrintCntNonZNodes();
  PrintCntEdgesToSet();

  PrintGetMxDegNId();
  PrintGetMxInDegNId();
  PrintGetMxOutDegNId();

  PrintGetInDegCntInt();
  PrintGetInDegCntFlt();
  PrintGetOutDegCntInt();
  PrintGetOutDegCntFlt();
  PrintGetDegCntInt();
  PrintGetDegCntFlt();
  PrintGetDegSeqV();
  PrintGetDegSeqVWithInOutDegV();

  PrintGetNodeInDegV();
  PrintGetNodeOutDegV();

  PrintCntUniqUndirEdges();
  PrintCntUniqDirEdges();
  PrintCntUniqBiDirEdges();
  PrintCntSelfEdges();

  PrintGetUnDir();
  PrintMakeUnDir();
  PrintAddSelfEdges();
  PrintDelSelfEdges();

  PrintDelNodes();
  PrintDelZeroDegNodes();
  PrintDelDegKNodes();

  PrintIsTree();
  PrintGetTreeRootNId();
  PrintGetTreeSig();
  PrintGetTreeSigWithNodeMap();
}
#include "Snap.h"

// Print graph statistics
void PrintMMNetStats(const char s[], PMMNet Graph) {
  printf("graph %s, modes %d, crossnets %d\n",
      s, Graph->GetModeNets(), Graph->GetCrossNets());
}

// Print graph statistics
void PrintGStats(const char s[], TModeNet Graph) {
  printf("graph %s, nodes %d, edges %d, empty %s\n",
      s, Graph.GetNodes(), Graph.GetEdges(),
      Graph.Empty() ? "yes" : "no");
}

// Print graph statistics
void PrintGStats(const char s[], TCrossNet Graph) {
  printf("graph %s, edges %d\n",
      s, Graph.GetEdges());
}

// Print graph statistics
void PrintGStats(const char s[], PNEANet Graph) {
  printf("graph %s, nodes %d, edges %d, empty %s\n",
      s, Graph->GetNodes(), Graph->GetEdges(),
      Graph->Empty() ? "yes" : "no");
}

// Test the default constructor
void DefaultConstructor() {
  PMMNet Graph;

  Graph = PMMNet::New();
  PrintMMNetStats("DefaultConstructor:Graph",Graph);
}

// Create TMMNet, add modes, crossnets, create subgraphs, covert to TNEANet
void ManipulateMMNet() {
  int NNodes = 1000;
  int NEdges = 1000;
  // Create a multimodal network
  PMMNet Graph;
  Graph = PMMNet::New();
  PrintMMNetStats("Empty MMNet",Graph);

  // Add mode
  TStr TestMode1("TestMode1");
  Graph->AddModeNet(TestMode1);
  TInt TestModeId1 = Graph->GetModeId(TestMode1);

  // Add same-mode crossnet, directed
  TStr TestCross1("TestCross1");
  Graph->AddCrossNet(TestMode1, TestMode1, TestCross1, true);
  TInt TestCrossId1 = Graph->GetCrossId(TestCross1);

  // Add same-mode crossnet, undirected
  TStr TestCross2("TestCross2");
  Graph->AddCrossNet(TestModeId1, TestModeId1, TestCross2, false);
  TInt TestCrossId2 = Graph->GetCrossId(TestCross


utputted
		cnt       int           // Expected number of bytes read
		err       error         // Expected errors that may be raised
	}{{
		input: "",
		cnt:   0,
		err:   io.ErrUnexpectedEOF,
	}, {
		input: "ab",
		cnt:   2,
		err:   io.ErrUnexpectedEOF,
	}, {
		input: strings.Repeat("\x00", 512),
		cnt:   512,
		err:   io.ErrUnexpectedEOF,
	}, {
		input: strings.Repeat("\x00", 511) + "\n",
		cnt:   512,
		err:   ErrHeader,
	}, {
		input: strings.Repeat("\n", 512),
		cnt:   512,
		err:   ErrHeader,
	}, {
		input:     "0\n" + strings.Repeat("\x00", 510) + strings.Repeat("a", 512),
		sparseMap: []sparseEntry{},
		cnt:       512,
	}, {
		input:     strings.Repeat("0", 512) + "0\n" + strings.Repeat("\x00", 510),
		sparseMap: []sparseEntry{},
		cnt:       1024,
	}, {
		input:     strings.Repeat("0", 1024) + "1\n2\n3\n" + strings.Repeat("\x00", 506),
		sparseMap: []sparseEntry{{2, 3}},
		cnt:       1536,
	}, {
		input: strings.Repeat("0", 1024) + "1\n2\n\n" + strings.Repeat("\x00", 509),
		cnt:   1536,
		err:   ErrHeader,
	}, {
		input: strings.Repeat("0", 1024) + "1\n2\n" + strings.Repeat("\x00", 508),
		cnt:   1536,
		err:   io.ErrUnexpectedEOF,
	}, {
		input: "-1\n2\n\n" + strings.Repeat("\x00", 506),
		cnt:   512,
		err:   ErrHeader,
	}, {
		input: "1\nk\n2\n" + strings.Repeat("\x00", 506),
		cnt:   512,
		err:   ErrHeader,
	}, {
		input:     "100\n1\n2\n3\n4\n" + strings.Repeat("54321\n0000000000000012345\n", 98) + strings.Repeat("\x00", 512),
		cnt:       2560,
		sparseMap: sp,
	}}

	for i, v := range vectors {
		r := strings.NewReader(v.input)
		sp, err := readGNUSparseMap1x0(r)
		if !reflect.DeepEqual(sp, v.sparseMap) && !(len(sp) == 0 && len(v.sparseMap) == 0) {
			t.Errorf("test %d, readGNUSparseMap1x0(...): got %v, want %v", i, sp, v.sparseMap)
		}
		if numBytes := len(v.input) - r.Len(); numBytes != v.cnt {
			t.Errorf("test %d, bytes read: got %v, want %v", i, numBytes, v.cnt)
		}
		if err != v.err {
			t.Errorf("test %d, unexpected error: got %v, want %v", i, err, v.err)
		}
	}
}

func TestUninitializedRead(t *testing.T) {
	test := gnuTarTest
	f, err := os.Open(test.file)
	if err != nil {
		t.Fatalf("Unexpected error: %v", err)
	}
	defer f.Close()

	tr := NewReader(f)
	_, err = tr.Read([]byte{})
	if err == nil || err != io.EOF {
		t.Errorf("Unexpected error: %v, wanted %v", err,


/scss/bootstrap-grid.scss';
// Plus imports for other components in your app.

// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// Be sure that you only ever include this mixin once!
@include mat-core();

// Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker
// hue. Available color palettes: https://material.io/design/color/
$bankflix-ng-primary: mat-palette($mat-indigo);
$bankflix-ng-accent: mat-palette($mat-pink, A200, A100, A400);

// The warn palette is optional (defaults to red).
$bankflix-ng-warn: mat-palette($mat-red);

// Create the theme object (a Sass map containing all of the palettes).
$bankflix-ng-theme: mat-light-theme($bankflix-ng-primary, $bankflix-ng-accent, $bankflix-ng-warn);

// Include theme styles for core and each component used in your app.
// Alternatively, you can import and @include the theme mixins for each component
// that you are using.
@include angular-material-theme($bankflix-ng-theme);

/* You can add global styles to this file, and also import other style files */

html, body { height: 100%; }
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; background-color: #ecf0f1 !important; }
/**
* Generated theme by Material Theme Generator
* https://material-theme-generator.travetto.io
*/
// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.

// Fonts
@import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500');

$fontConfig: (
  display-4: mat-typography-level(112px, 112px, 300, 'Roboto', -0.0134em),
  display-3: mat-typography-level(56px, 56px, 400, 'Roboto', -0.0089em),
  display-2: mat-typography-level(45px, 48px, 400, 'Roboto', 0.0000em),
  display-1: mat-typography-level(34px, 40px, 400, 'Roboto', 0.0074em),
  headline: mat-typography-level(24px, 32px, 400, 'Roboto', 0.0000em),
  title: mat-typography-level(20px, 32px, 500, 'Roboto', 0.0075em),
  subheading-2: mat-typography-level(16px, 28px, 400, 'Roboto', 0.0094em),
  subheading-1: mat-typography-level(15px, 24px, 500, 'Roboto', 0.0067em),
  body-2: mat-typography-level(14px, 24px, 500, 'Roboto', 0.0179em),
  body-1: mat-typography-level(14px, 20px, 400, 'Roboto', 0.0179em),
  button: mat-typography-level(14px, 14px, 500, 'Roboto', 0.0893em),
  caption: mat-typography-level(12px, 20px, 400, 'Roboto', 0.0333em),
  input: mat-typography-level(inherit, 1.125, 400, 'Roboto', 1.5px)
);

// Foreground Elements

// Light Theme Text
$dark-text: #000000;
$dark-primary-text: rgba($dark-text, 0.87);
$dark-accent-text: rgba($dark-primary-text, 0.54);
$dark-disable


(-122.3460 47.5924, -122.3457 47.5924))',\n"
                                + "      4326\n"
                                + "    ),\n"
                                + "    ST_GeographyFromText('POINT(-122.3452 47.5925)'),\n"
                                + "    '{\"key\":\"test\"}',\n"
                                + "    '{\"key\":\"test\"}',\n"
                                + "    '<XX:NewSize>test</XX:NewSize>'\n"
                                + "  )");
            }

            statement.executeBatch();
        } catch (SQLException e) {
            throw new RuntimeException("Initializing PostgreSql table failed!", e);
        }
    }

    private Connection getJdbcConnection() throws SQLException {
        return DriverManager.getConnection(
                POSTGRESQL_CONTAINER.getJdbcUrl(),
                POSTGRESQL_CONTAINER.getUsername(),
                POSTGRESQL_CONTAINER.getPassword());
    }

    private List<List<Object>> querySql(String sql) {
        return JdbcUtil.querySql(
                sql,
                () -> {
                    try {
                        return this.getJdbcConnection();
                    } catch (SQLException e) {
                        throw new RuntimeException(e);
                    }
                });
    }

    private void executeSQL(String sql) {
        try (Connection connection = getJdbcConnection()) {
            Statement statement = connection.createStatement();
            statement.execute(sql);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @AfterAll
    @Override
    public void tearDown() {
        if (POSTGRESQL_CONTAINER != null) {
            POSTGRESQL_CONTAINER.stop();
        }
    }

    @Test
    public void testCatalogForSaveMode() {
        String schema = "public";
        String databaseName = POSTGRESQL_CONTAINER.getDatabaseName();
        TablePath tablePathPG = TablePath.of(databaseName, "public", "pg_e2e_source_table");
        TablePath tablePathPgSink = TablePath.of(databaseName, "public", "pg_ide_sink_table_2");
        PostgresCatalog postgresCatalog =
                new PostgresCatalog(
                        DatabaseIdentifier.POSTGRESQL,
                        POSTGRESQL_CONTAINER.getUsername(),
                        POSTGRESQL_CONTAINER.getPassword(),
                        JdbcUrlUtil.getUrlInfo(POSTGRESQL_CONTAINER.getJdbcUrl()),
                        schema,
                        null);
        postgresCatalog.open();
        CatalogTable catalogTable = postgresCatalog.getTable(tablePathPG);
        // sink tableExists ?
        boolean tableExistsBefore = postgresCatalog.tableExists(tablePathPgSink);
        Assertions.assertFalse(tableExistsBefore);
        // create table
        postgresCatalog.createTable(tablePathPgSink, catalogTable, true);
        boolean tableExistsAfter = postgresCatalog.tableExists(tablePathPgSink);
        Assertions.assertTrue(tableExistsAfter);
        // comment
        final CatalogTable table = postgresCatalog.getTable(tablePathPgSink);
        Assertions.assertEquals(
                table.getTableSchema().getColumns().get(1).getComment(),
                "\"#¥%……&*（）;;',,.\\.``````//'@特殊注释'\\\\'\"");
        // isExistsData ?
        boolean existsDataBefore = postgresCatalog.isExistsData(tablePathPgSink);
        Assertions.assertFalse(existsDataBefore);
        // insert one data
        String customSql =
                "INSERT INTO\n"
                        + "  pg_ide_sink_table_2 (gid,\n"
                        + "    text_col,\n"
                        + "    varchar_col,\n"
                        + "


	_patternList = new YQPkgPatternList( vbox,
					     false,	// no autoFill - need to connect to details view first
					     false );	// no autoFilter - filterMatch() is not connected
	Q_CHECK_PTR( _patternList );
        layout->addWidget(_patternList);
        //_patternList->header()->hide();
    }

    if ( _wizard )	// No button box - add "Details..." button here
    {
	//
	// "Details" button
	//

	layout->addSpacing( SPACING );

	QHBoxLayout * hbox = new QHBoxLayout();
	Q_CHECK_PTR( hbox );
        layout->addLayout(hbox);

	QPushButton * details_button = new QPushButton( _( "&Details..." ), vbox );
	Q_CHECK_PTR( details_button );
        hbox->addWidget(details_button);

	connect( details_button, SIGNAL( clicked() ),
		 this,		 SLOT  ( detailedPackageSelection() ) );

	hbox->addStretch();
    }

    return vbox;
}

QWidget *
YQPatternSelector::layoutRightPane( QWidget * parent )
{
    QSplitter * splitter = new QSplitter( Qt::Vertical, parent );
    Q_CHECK_PTR( splitter );
    //splitter->setMargin( MARGIN );

    //
    // Selection / Pattern description
    //
    QWidget *upper_vbox = new QWidget(splitter);
    QVBoxLayout * layout = new QVBoxLayout(upper_vbox);

    Q_CHECK_PTR( upper_vbox );

    _descriptionView = new YQPkgSelDescriptionView( upper_vbox );
    Q_CHECK_PTR( _descriptionView );
    layout->addWidget(_descriptionView);

    //
    // Disk usage
    //

    QWidget *lower_vbox = new QWidget(splitter);
    layout = new QVBoxLayout( lower_vbox);

    Q_CHECK_PTR( lower_vbox );

    _diskUsageList = new YQPkgDiskUsageList( lower_vbox );
    Q_CHECK_PTR( _diskUsageList );
    layout->addWidget(_diskUsageList);

    splitter->setStretchFactor( 0, 3 );
    splitter->setStretchFactor( 0, 1 );

    return splitter;
}

void
YQPatternSelector::layoutButtons( QWidget * parent )
{
    QWidget *button_box = new QWidget(parent);
    Q_CHECK_PTR( button_box );

    parent->layout()->addWidget( button_box );
    QHBoxLayout *layout = new QHBoxLayout(button_box);

    layout->setMargin ( MARGIN  );
    layout->setSpacing( SPACING );

    QPushButton * details_button = new QPushButton( _( "&Details..." ), button_box );
    layout->addWidget(details_button);
    Q_CHECK_PTR( details_button );
    details_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert

    connect( details_button,	SIGNAL( clicked() ),
	     this,		SLOT  ( detailedPackageSelection() ) );

    layout->addStretch();

    QPushButton * cancel_button = new QPushButton( _( "&Cancel" ), button_box );
    Q_CHECK_PTR( cancel_button );
    layout->addWidget(cancel_button);
    cancel_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert

    connect( cancel_button, SIGNAL( clicked() ),
	     this,	    SLOT  ( reject()   ) );

    QPushButton * accept_button = new QPushButton( _( "&Accept" ), button_box );
    Q_CHECK_PTR( accept_button );
    layout->addWidget(accept_button);
    accept_button->setSizePolicy( QSizePolicy( QSizePolicy::F


teNodeValue(Id id, TreeNode node) {
    switch (id.kind) {
      case IdKind.iterator:
      case IdKind.current:
      case IdKind.moveNext:
        return null;
      default:
    }
    TreeNode alias = _sourceLoaderDataForTesting.toOriginal(node);
    if (!_assignedVariables.isTracked(alias)) return null;
    return new _Data(
        _convertVars(_assignedVariables.declaredInNode(alias)),
        _convertVars(_assignedVariables.readInNode(alias)),
        _convertVars(_assignedVariables.readCapturedInNode(alias)),
        _convertVars(_assignedVariables.writtenInNode(alias)),
        _convertVars(_assignedVariables.capturedInNode(alias)));
  }
}

class _AssignedVariablesDataInterpreter implements DataInterpreter<_Data> {
  const _AssignedVariablesDataInterpreter();

  @override
  String getText(_Data actualData, [String? indentation]) {
    var parts = <String>[];
    if (actualData.declared.isNotEmpty) {
      parts.add('declared=${_setToString(actualData.declared)}');
    }
    if (actualData.read.isNotEmpty) {
      parts.add('read=${_setToString(actualData.read)}');
    }
    if (actualData.readCaptured.isNotEmpty) {
      parts.add('readCaptured=${_setToString(actualData.readCaptured)}');
    }
    if (actualData.assigned.isNotEmpty) {
      parts.add('assigned=${_setToString(actualData.assigned)}');
    }
    if (actualData.captured.isNotEmpty) {
      parts.add('captured=${_setToString(actualData.captured)}');
    }
    if (parts.isEmpty) return 'none';
    return parts.join(', ');
  }

  @override
  String? isAsExpected(_Data actualData, String? expectedData) {
    var actualDataText = getText(actualData);
    if (actualDataText == expectedData) {
      return null;
    } else {
      return 'Expected "$expectedData", got "$actualDataText"';
    }
  }

  @override
  bool isEmpty(_Data actualData) =>
      actualData.assigned.isEmpty && actualData.captured.isEmpty;

  String _setToString(Set<String> values) {
    List<String> sortedValues = values.toList()..sort();
    return '{${sortedValues.join(', ')}}';
  }
}

class _Data {
  final Set<String> declared;

  final Set<String> read;

  final Set<String> readCaptured;

  final Set<String> assigned;

  final Set<String> captured;

  _Data(this.declared, this.read, this.readCaptured, this.assigned,
      this.captured);
}
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE.md file.

import 'package:async_helper/async_helper.dart' show asyncTest;

import 'package:expect/expect.dart' show Expect;

import 'package:front_end/src/fasta/builder/invalid_type_declaration_builder.dart';

import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;

import 'package:front_end/src/fasta/dill/dill_library_builder.dart'
    show DillLibraryBuilder;

import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;

import 'package:front_end/src/fasta/kernel/utils.dart';

import 'package:kernel/ast.dart'
    show Field, Library, Name, Component, StringLiteral;

Future<void> main() async {
  await asyncTest(() async {
    Uri uri = Uri.parse("org.dartlang.fasta:library");
    Library library = new Library(uri, fileUri: uri);
    Field field = new Field.immutable(


multiple changes for v4 RoundMaster APIs
v6.13  12/07/2024  Updated to use new mods tables
v6.12  20/05/2024  Corrected invalid use of MIrowref
v6.11  17/05/2024  Corrected Rod of Lordly Might overall functioning
v6.10  31/03/2024  Corrected Rod of Lordly Might charge type and simplified class type
v6.09  08/06/2023  Corrected Staff of Curing: Cure Blindness
v6.08  08/05/2023  Added automatic hiding data
v6.07  30/04/2023  Added default quantities to all items
v6.06  14/04/2023  Changed charge types from charge to discharging where division is inappropriate
v6.05  03/03/2023  Added all remaining wands, staves & rods from the DMG
v6.04  01/12/2022  Added Wand of Fear to support Beholder powers
v6.03  21/10/2022  Added \'on\', \'off\' & \'c\' data attributes for weapons, and Staff-of-Striking
v6.02  12/10/2022  Added more Rods from the DMG
v6.01  25/09/2022  Moved to RPGM Library and updated templates
v5.91  14/07/2022  Removed hard-coded whisper commands on database entries as now directed to correct player(s) programmatically
v5.9  06/04/2022  Adapted to use --display-ability command for chaining abilities
v5.8 & v5.7       Various unrecorded changes
v5.6  01/01/2022  Updated to common release version
v5.2 - 5.5 Skipped to even up version numbers
v5.11  31/10/2021  Merged in Rod of Revitalisation from "The Undiscovered Caverns"
v5.1  31/10/2021  Encoded using machine readable data to support API databases
v5.0  01/10/2021  Split MI-DB into separate databases for different types of Item. See MI-DB for earlier Change Log.',
					root:'MI-DB',
					api:'magic',
					type:'mi',
					avatar:'https://s3.amazonaws.com/files.d20.io/images/310316689/jA220k9-qPy8BLZMScbegA/thumb.png?16663393185',
					version:7.01,
					db:[{name:'Glass-Staff',type:'staff',ct:'1',charge:'recharging',cost:'0',body:'\\amp{template:'+fields.wandTemplate+'Spell}{{title=Glass Staff}}{{splevel=Magic Item}}{{school=Protection}}Specs=[Glass Staff,Staff,1H,Staff]{{components=The Staff}}{{time=[[1]]}}StaffData=[w:Glass Staff,wt:6,sp:1,qty:4+1d6,rc:recharging,loc:left hand|right hand]{{range=[[0]]}}{{duration=Recharges1d6+4 per night, max [[10]] charges}}{{aoe=Creature holding}}{{save=None}}{{Looks Like=The staff seems to be made of clear, blueish/greenish glass, but is as strong as oak.}}{{effects=The staff can have a maximum of [[10]] charges, and uses [[1]] if the wielder casts the spell [*Armour*](!rounds --target-nosave caster|@{selected|token_id}|Armour|99|0|Glass Staff Armour, AC6, for \\amp#91;[16]\\amp#93;HP|bolt-shield --mi-charges @{selected|token_id}|+\\amp#91;[1d6+4]\\amp#93;|Glass-Staff|10) on themselves, or [[2]] for [*Shield*](!rounds --target-nosave caster|@{selected|token_id}|Shield|40|-1|Glass Staff Shield, AC2,3,4|bolt-shield --mi-charges @{selected|token_id}|+\\amp#91;[1d6+4]\\amp#93;|Glass-Staff|10). It regains upto 1d6+4 charges each midnight, but never exceeds its maximum 10}}\n!setattr --charid @{selected|character_id} --silent --casting-leve


  public AboutModDialog() {
    super(Core.bundle.get("dialog.aboutMod.title"));

    addCloseButton();
    shown(this::checkOrDoUpdate);
    hidden(() -> {
      checking = false;
      newVersion = null;
      updateUrl = null;
    });
  }

  public void build(){
    cont.clearChildren();
    cont.defaults().fillY().top();

    cont.table(main -> {
      main.table(SglDrawConst.grayUIAlpha, t -> {
        t.defaults().left().pad(5).growX().height(40);
        t.add(Core.bundle.get("mod.name")).color(Pal.accent);
        t.row();
        t.add(Core.bundle.get("misc.author")).color(Pal.accent);
        t.add(Core.bundle.get("mod.author"));
        t.button(Core.bundle.get("mod.contributor"), SglDrawConst.contributeIcon, Styles.nonet, 28, () -> Sgl.ui.contributors.show()).update(b -> b.setChecked(false)).width(230);
        t.row();
        t.add(Core.bundle.get("misc.version")).color(Pal.accent);
        t.add(Core.bundle.get("mod.version"));
        t.table(update -> {
          update.add(new Element(){
            @Override
            public void draw(){
              Draw.alpha(parentAlpha*color.a);

              if (checking){
                Draw.color(Pal.accent);
                Fill.square(x + width/2, y + height/2, 8, Time.time);
                Fill.square(x + width/2, y + height/2, 8, 45 + 2*Time.time);
              }
              else{
                if (newVersion == null) Draw.color(Pal.heal);
                else Draw.color(Pal.accent, Pal.heal, Mathf.absin(8, 1));

                Fill.square(x + width/2, y + height/2, 8);
                Fill.square(x + width/2, y + height/2, 8, 45);
              }
            }
          }).size(40);
          update.add("").update(l -> l.setText(checking? Core.bundle.get("infos.checkingUpgrade"): newVersion != null? Core.bundle.format("infos.hasUpdate", newVersion): Core.bundle.get("infos.newestVersion")));
        }).width(230);
        t.row();
        t.add(Core.bundle.get("infos.releaseDate")).color(Pal.accent);
        t.add(Core.bundle.get("mod.updateDate"));
        t.button("", Icon.upload, Styles.nonet, 28, this::checkOrDoUpdate)
            .update(b -> b.setText(newVersion != null? Core.bundle.get("misc.update"): Core.bundle.get("infos.checkUpdate"))).width(230);
      }).growX().fillY().padTop(40).margin(4);

      main.row();

      main.pane(t -> {
        t.defaults().growX().height(64).pad(0).padTop(10).margin(0);

        t.add(Core.bundle.get("infos.modPage")).color(Pal.accent).height(24).width(720);
        t.row();
        t.image().color(Pal.accent).width(740).height(4).pad(0).padTop(4);
        t.row();
        for(ButtonEntry item : modPages){
          t.table(Tex.underline, table -> {
            table.table(img -> {
              img.image().height(60).width(40f).update(i -> i.setColor(item.color.get()));
              img.row();
              img.image().height(4).width(40f).update(i -> i.setColor(item.color.get().cpy().mul(0.8


0
  GETUPVAL R3 5
  GETUPVAL R5 6
  LOADB R6 0
  CALL R5 1 -1
  NAMECALL R3 R3 K13 ["dispatch"]
  CALL R3 -1 0
  LOADNIL R3
  JUMPIFNOT R0 [+18]
  GETTABLEKS R4 R0 K3 ["responseBody"]
  JUMPIFNOT R4 [+15]
  GETTABLEKS R4 R0 K3 ["responseBody"]
  LOADK R6 K14 ["statusMessage"]
  NAMECALL R4 R4 K15 ["find"]
  CALL R4 2 1
  JUMPIFNOT R4 [+8]
  GETTABLEKS R4 R0 K3 ["responseBody"]
  LOADK R6 K14 ["statusMessage"]
  NAMECALL R4 R4 K15 ["find"]
  CALL R4 2 1
  MOVE R3 R4
  JUMP [+5]
  JUMPIFEQKS R1 K8 [""] [+3]
  MOVE R3 R1
  JUMP [+1]
  LOADK R3 K16 ["Upload failed with unknown error"]
  GETUPVAL R4 5
  GETUPVAL R6 7
  MOVE R7 R3
  CALL R6 1 -1
  NAMECALL R4 R4 K13 ["dispatch"]
  CALL R4 -1 0
  GETUPVAL R5 8
  GETTABLEKS R4 R5 K17 ["incrementUploadAssetFailure"]
  GETUPVAL R5 9
  CALL R4 1 0
  RETURN R0 0
  GETTABLEKS R3 R0 K18 ["AssetId"]
  SETUPVAL R3 10
  GETUPVAL R3 5
  GETUPVAL R5 11
  GETUPVAL R6 10
  CALL R5 1 -1
  NAMECALL R3 R3 K13 ["dispatch"]
  CALL R3 -1 0
  GETUPVAL R3 12
  CALL R3 0 1
  JUMPIFNOT R3 [+3]
  GETUPVAL R3 13
  GETUPVAL R4 10
  CALL R3 1 0
  GETUPVAL R4 8
  GETTABLEKS R3 R4 K19 ["incrementUploadAssetSuccess"]
  GETUPVAL R4 9
  CALL R3 1 0
  GETUPVAL R4 2
  GETTABLEKS R3 R4 K20 ["saleStatus"]
  GETUPVAL R4 14
  JUMPIFNOT R4 [+12]
  GETUPVAL R4 2
  GETUPVAL R5 10
  SETTABLEKS R5 R4 K21 ["assetId"]
  GETUPVAL R4 5
  GETUPVAL R6 15
  GETUPVAL R7 2
  CALL R6 1 -1
  NAMECALL R4 R4 K13 ["dispatch"]
  CALL R4 -1 0
  RETURN R0 0
  JUMPIF R3 [+8]
  GETUPVAL R5 2
  GETTABLEKS R4 R5 K22 ["iconFile"]
  JUMPIF R4 [+4]
  GETUPVAL R5 2
  GETTABLEKS R4 R5 K23 ["assetMediaUpdateData"]
  JUMPIFNOT R4 [+12]
  GETUPVAL R4 2
  GETUPVAL R5 10
  SETTABLEKS R5 R4 K21 ["assetId"]
  GETUPVAL R4 5
  GETUPVAL R6 15
  GETUPVAL R7 2
  CALL R6 1 -1
  NAMECALL R4 R4 K13 ["dispatch"]
  CALL R4 -1 0
  RETURN R0 0
  GETUPVAL R4 5
  GETUPVAL R6 16
  GETUPVAL R9 17
  GETTABLEKS R8 R9 K24 ["SCREENS"]
  GETTABLEKS R7 R8 K25 ["UPLOADING_ASSET"]
  CALL R6 1 -1
  NAMECALL R4 R4 K13 ["dispatch"]
  CALL R4 -1 0
  GETUPVAL R4 5
  GETUPVAL R6 6
  LOADB R7 1
  CALL R6 1


import googleapiclient
from django.db import transaction

from .models import InfraNode, NodeKind
from .utils import GCPClient, KubernetesClient

CLUSTER_IDENTIFIER = "gke_{project_id}_{zone}_{name}"

def _workload_identifier(cluster, resource_type, resource):
    return f"{cluster}:{resource_type}:{resource.metadata.namespace}/{resource.metadata.name}"

def _map_workloads(workloads, cluster_ctx, cluster_node):
    for resource_type, resources in workloads.items():
        for resource in resources:
            workload_node = InfraNode.get_or_create_node(
                kind=NodeKind.GCP_WORKLOAD_NAME,
                value=_workload_identifier(cluster_ctx, resource_type, resource),
                source=cluster_node,
            )

            if resource_type == "cronjobs":
                containers = resource.spec.job_template.spec.template.spec.containers
            else:
                containers = resource.spec.template.spec.containers

            for container in containers:
                InfraNode.get_or_create_node(
                    kind=NodeKind.DOCKER_IMAGE_UUID,
                    value=container.image,
                    source=workload_node,
                )

@transaction.atomic
def map_to_nodes():
    """Map GCP projects to GCP services.

    Creates records in the InfraNode table of the following kinds:

    - ``gcp.root.proj`` - root node for all GCP projects
    - ``gcp.proj.id`` - GCP project ID
    - ``gcp.ip_rule.name`` - GCP forwarding rule name
    - ``gcp.cluster.name`` - GCP cluster name
    - ``gcp.workload.name`` - GCP workload name (including the namespace)
    - ``docker.image.uuid`` - Docker image UUID
    """
    root = InfraNode.get_or_create_node(kind=NodeKind.GCP_ROOT_PROJ, value="*")
    gcloud = GCPClient()

    for project in gcloud.get_all_projects():
        if project["projectId"].startswith("sys-"):
            # skip "shadow" projects
            # see https://skypicker.slack.com/archives/C1XN8EPAP/p1568641244031000
            continue

        project_node = InfraNode.get_or_create_node(
            kind=NodeKind.GCP_PROJ_ID, value=project["projectId"], source=root
        )

        try:
            # skip projects without billing enabled
            ip_rules = list(gcloud.get_forwarding_rules(project["projectId"]))
        except googleapiclient.errors.HttpError:
            continue

        # currently not used anywhere
        for ip_rule in ip_rules:
            port_range = f":{ip_rule['portRange']}" if "portRange" in ip_rule else ""
            if ip_rule["loadBalancingScheme"] == "EXTERNAL":
                InfraNode.get_or_create_node(
                    kind=NodeKind.GCP_IP_RULE_NAME,
                    value=f"{ip_rule['id']}:{ip_rule['IPAddress']}{port_range}",
                    source=project_node,
                )

        for cluster in gcloud.get_all_clusters(project["projectId"]):
            cluster_ctx = CLUSTER_IDENTIFIER.format(
                project_id=project["projectId"],
                zone=cluster["zone"],
                name=cluster["name"],
            )
            cluster_node = InfraNode.get_or_create_node(
                kind=NodeKind.GCP_CLUSTER_NAME, value=cluster_ctx, source=project_node
            )

            kube = KubernetesClient(cluster)
            workloads = kube.iter_workloads()

            _map_workloads(workloads, cluster_ctx, cluster_node)


@param[in] q Orientation quaternion at t1.
   * @param[in] e_w Bias-free gyro measurement at t1.
   * @param[in] e_a Bias-free accel measurement at t1.
   * @param[in] n_w Gyro noise spectral density.
   * @param[in] n_bw Gyro bias random walk.
   * @param[in] n_a Accel noise spectral density.
   * @param[in] n_ba Accel bias random walk.
   * @return The kSizeCoreErr x kSizeCoreErr discrete process noise
   *         covariance matrix
   */
  [[nodiscard]] CoreCovMatrix discreteProcessNoiseCov(
      double dt, const Quaternion &q, const Vector3 &e_w, const Vector3 &e_a,
      double n_w, double n_bw, double n_a, double n_ba) const;
};
}  // namespace x

#endif  // X_EKF_PROPAGATOR_H_


Map(6, "SWAMPLAND", 0.8,
			0.9, 0xE0FFAE, 0x4E0E4E, 0x4E0E4E);
	public static final BiomeMap RIVER = new BiomeMap(7, "RIVER");
	public static final BiomeMap HELL = new BiomeMap(8, "HELL", 2.0, 0.0);
	public static final BiomeMap SKY = new BiomeMap(9, "SKY");
	public static final BiomeMap FROZEN_OCEAN = new BiomeMap(10, "FROZEN_OCEAN",
			0.0, 0.5);
	public static final BiomeMap FROZEN_RIVER = new BiomeMap(11, "FROZEN_RIVER",
			0.0, 0.5);
	public static final BiomeMap ICE_PLAINS = new BiomeMap(12, "ICE_PLAINS",
			0.0, 0.5);
	public static final BiomeMap ICE_MOUNTAINS = new BiomeMap(13,
			"ICE_MOUNTAINS", 0.0, 0.5);
	public static final BiomeMap MUSHROOM_ISLAND = new BiomeMap(14,
			"MUSHROOM_ISLAND", 0.9, 1.0);
	public static final BiomeMap MUSHROOM_SHORE = new BiomeMap(15,
			"MUSHROOM_SHORE", 0.9, 1.0);
	public static final BiomeMap BEACH = new BiomeMap(16, "BEACH", 0.8, 0.4);
	public static final BiomeMap DESERT_HILLS = new BiomeMap(17, "DESERT_HILLS",
			2.0, 0.0);
	public static final BiomeMap FOREST_HILLS = new BiomeMap(18, "FOREST_HILLS",
			0.7, 0.8);
	public static final BiomeMap TAIGA_HILLS = new BiomeMap(19, "TAIGA_HILLS",
			0.05, 0.8);
	public static final BiomeMap SMALL_MOUNTAINS = new BiomeMap(20,
			"SMALL_MOUNTAINS", 0.2, 0.8);
	public static final BiomeMap JUNGLE = new BiomeMap(21, "JUNGLE", 1.2, 0.9);
	public static final BiomeMap JUNGLE_HILLS = new BiomeMap(22, "JUNGLE_HILLS",
			1.2, 0.9);

	public static final int LAST_WELL_KNOWN = 22;

	private double tmp;
	private double rain;
	private int watercolormult;
	private int grassmult;
	private int foliagemult;
	private final String id;
	private final int index;
	private int biomeindex256; // Standard biome mapping index (for 256 x 256)
	private boolean isDef;

	private static boolean loadDone = false;

	public static void loadWellKnownByVersion(String mcver) {
		if (loadDone)
			return;
		new BiomeMap(23, "JUNGLE_EDGE", 0.95, 0.8);
		new BiomeMap(24, "DEEP_OCEAN");
		new BiomeMap(25, "STONE_BEACH", 0.2, 0.3);
		new BiomeMap(26, "COLD_BEACH", 0.05, 0.3);
		new BiomeMap(27, "BIRCH_FOREST", 0.6, 0.6);
		new BiomeMap(28, "BIRCH_FOREST_HILLS", 0.6, 0.6);
		new BiomeMap(29, "ROOFED_FOREST", 0.7, 0.8);
		new BiomeMap(30, "COLD_TAIGA", -0.5, 0.4);
		new BiomeMap(31, "COLD_TAIGA_HILLS", -0.5, 0.4);
		new BiomeMap(32, "MEGA_TAIGA", 0.3, 0.8);
		new BiomeMap(33, "MEGA_TAIGA_HILLS", 0.3, 0.8);
		new BiomeMap(34, "EXTREME_HILLS_PLUS", 0.2, 0.3);
		new BiomeMap(35, "SAVANNA", 1.2, 0.0);
		new BiomeMap(36, "SAVANNA_PLATEAU", 1.0, 0.0);
		new BiomeMap(37, "MESA", 2.0, 0.0);
		new BiomeMap(38, "MESA_PLATE


Integer.valueOf(10), currentStudy.getId());
        String sql = "select count(all_dn.discrepancy_note_id) as COUNT from (";
        sql += digester.getQuery("findAllSubjectDNByStudy");
        sql += filter;
        sql += " UNION ";
        sql += digester.getQuery("findAllStudySubjectDNByStudy");
        sql += filter;
        sql += " UNION ";
        sql += digester.getQuery("findAllStudyEventDNByStudy");
        sql += filter;
        sql += " UNION ";
        sql += digester.getQuery("findAllEventCrfDNByStudy");
        if (currentStudy.isSite(currentStudy.getParentStudyId())) {
            sql += " and ec.event_crf_id not in ( " + this.findSiteHiddenEventCrfIdsString(currentStudy) + " ) ";
        }
        sql += filter;
        sql += " UNION ";
        sql += digester.getQuery("findAllItemDataDNByStudy");
        if (currentStudy.isSite(currentStudy.getParentStudyId())) {
            sql += " and ec.event_crf_id not in ( " + this.findSiteHiddenEventCrfIdsString(currentStudy) + " ) ";
        }
        sql += filter;
        if ("oracle".equalsIgnoreCase(CoreResources.getDBName())) {
            sql += " ) all_dn";
        } else {
            sql += " ) as all_dn";
        }

        ArrayList rows = select(sql, variables);
        Iterator it = rows.iterator();
        if (it.hasNext()) {
            Integer count = (Integer) ((HashMap) it.next()).get("count");
            return count;
        } else {
            return null;
        }
    }

    /*
     * public ArrayList<DiscrepancyNoteBean> getViewNotesWithFilterAndSort(StudyBean currentStudy, ListNotesFilter
     * filter, ListNotesSort sort, int rowStart,
     * int rowEnd) {
     * ArrayList<DiscrepancyNoteBean> discNotes = new ArrayList<DiscrepancyNoteBean>();
     * setTypesExpected();
     * this.setTypeExpected(12, TypeNames.STRING);
     * this.setTypeExpected(13, TypeNames.INT);
     * this.setTypeExpected(14, TypeNames.INT);
     * this.setTypeExpected(15, TypeNames.INT);
     *
     * HashMap variables = new HashMap();
     * variables.put(Integer.valueOf(1), currentStudy.getId());
     * variables.put(Integer.valueOf(2), currentStudy.getId());
     * variables.put(Integer.valueOf(3), currentStudy.getId());
     * variables.put(Integer.valueOf(4), currentStudy.getId());
     * variables.put(Integer.valueOf(5), currentStudy.getId());
     * variables.put(Integer.valueOf(6), currentStudy.getId());
     * variables.put(Integer.valueOf(7), currentStudy.getId());
     * variables.put(Integer.valueOf(8), currentStudy.getId());
     * variables.put(Integer.valueOf(9), currentStudy.getId());
     * variables.put(Integer.valueOf(10), currentStudy.getId());
     *
     * String sql = "";
     * if ("oracle".equalsIgnoreCase(CoreResources.getDBName())) {
     * sql = sql + "SELECT * FROM ( SELECT x.*, ROWNUM as rnum FROM (";
     * }
     * sql = sql + digester.getQuery("findAllSubjectDNByStudy");
     * sql = sql + filter.execute("");
     * sql += " UNION ";
     * sql += digester.getQuery("findAllStudySubjectDNByStudy");
     * sql += filter.execute("");
     * sql += " UNION ";
     * sql += digester.getQuery("findAllStudyEventDNByStudy");
     * sql += filter.execute("");
     * sql += " UNION ";
     * sql += digester.getQuery("findAllEventCrfDNByStudy");
     * if (currentStudy.isSite(currentStudy.getParentStudyId())) {
     * sql += " and ec.event_crf_id not in ( " + this.findSiteHiddenEventCrfIdsString(currentStudy) + " ) ";
     * }
     * sql += filter.


= ep.Namespace()
	if err != nil {
		return err
	}

	// 获取 ep 的 serviceName
	svcName := ep.ServiceName()

	// 通过 service lister 获取 ns 和 name 对应的 service 资源对象
	svc, err := c.svcLister.Services(namespace).Get(svcName)
	if err != nil {
		// 为空则推送空的 ep 结构
		if k8serrors.IsNotFound(err) {
			return c.syncEmptyEndpoint(ctx, ep)
		}
		return err
	}

	switch c.Kubernetes.APIVersion {
	case config.ApisixV2beta3:
		...
		// beta 就不分析了.

	case config.ApisixV2:
		// 获取 subsets, 这里的subsets 可以理解为服务对应的标签, 比如 v1, v2.
		var subsets []configv2.ApisixUpstreamSubset
		subsets = append(subsets, configv2.ApisixUpstreamSubset{})
		auKube, err := c.apisixUpstreamLister.V2(namespace, svcName)
		if err != nil {
			if !k8serrors.IsNotFound(err) {
				return err
			}
		} else if auKube.V2().Spec != nil && len(auKube.V2().Spec.Subsets) > 0 {
			subsets = append(subsets, auKube.V2().Spec.Subsets...)
		}

		// 从 apisix 接口拿到所有的 cluster 对象
		clusters := c.APISIX.ListClusters()

		for _, port := range svc.Spec.Ports {
			for _, subset := range subsets {
				// 把 endpoints 和 labels 选择标签转换成 UpstreamNodes 数据结构
				nodes, err := c.translator.TranslateEndpoint(ep, port.Port, subset.Labels)
				...
				// 获取格式化的 name, 其实就是由这些参数拼凑了一个 name.
				name := apisixv1.ComposeUpstreamName(namespace, svcName, subset.Name, port.Port, types.ResolveGranularity.Endpoint)

				// 同步配置
				for _, cluster := range clusters {
					if err := c.SyncUpstreamNodesChangeToCluster(ctx, cluster, nodes, name); err != nil {
						return err
					}
				}
			}
		}
	default:
		panic(fmt.Errorf("unsupported ApisixUpstream version %v", c.Kubernetes.APIVersion))
	}
	return nil
}
```

从 apisix 中获取当前已有的 `upstream` 对象, 然后赋值新的 nodes 结构, 接着调用 `SyncManifests` 同步配置.

```go
func (c *Common) SyncUpstreamNodesChangeToCluster(ctx context.Context, cluster apisix.Cluster, nodes apisixv1.UpstreamNodes, upsName string) error {
	// 从 apisix 中获取该 name 的 upstream 对象.
	upstream, err := cluster.Upstream().Get(ctx, upsName)
	if err != nil {
		if err == apisixcache.ErrNotFound {
			return nil
		} else {
			return err
		}
	}

	// 更新 upstream 的 nodes 主机列表字段.
	upstream.Nodes = nodes

	updated := &utils.Manifest{
		Upstreams: []*apisixv1.Upstream{upstream},
	}

	// 调用 SyncManifests 只处理 updated 更新的数据.


 --fa: "\e4f9";
  --fa--fa: "\e4f9\e4f9"; }

.fa-file-invoice-dollar {
  --fa: "\f571";
  --fa--fa: "\f571\f571"; }

.fa-plane-circle-exclamation {
  --fa: "\e556";
  --fa--fa: "\e556\e556"; }

.fa-x-ray {
  --fa: "\f497";
  --fa--fa: "\f497\f497"; }

.fa-spell-check {
  --fa: "\f891";
  --fa--fa: "\f891\f891"; }

.fa-slash {
  --fa: "\f715";
  --fa--fa: "\f715\f715"; }

.fa-computer-mouse {
  --fa: "\f8cc";
  --fa--fa: "\f8cc\f8cc"; }

.fa-mouse {
  --fa: "\f8cc";
  --fa--fa: "\f8cc\f8cc"; }

.fa-arrow-right-to-bracket {
  --fa: "\f090";
  --fa--fa: "\f090\f090"; }

.fa-sign-in {
  --fa: "\f090";
  --fa--fa: "\f090\f090"; }

.fa-shop-slash {
  --fa: "\e070";
  --fa--fa: "\e070\e070"; }

.fa-store-alt-slash {
  --fa: "\e070";
  --fa--fa: "\e070\e070"; }

.fa-server {
  --fa: "\f233";
  --fa--fa: "\f233\f233"; }

.fa-virus-covid-slash {
  --fa: "\e4a9";
  --fa--fa: "\e4a9\e4a9"; }

.fa-shop-lock {
  --fa: "\e4a5";
  --fa--fa: "\e4a5\e4a5"; }

.fa-hourglass-start {
  --fa: "\f251";
  --fa--fa: "\f251\f251"; }

.fa-hourglass-1 {
  --fa: "\f251";
  --fa--fa: "\f251\f251"; }

.fa-blender-phone {
  --fa: "\f6b6";
  --fa--fa: "\f6b6\f6b6"; }

.fa-building-wheat {
  --fa: "\e4db";
  --fa--fa: "\e4db\e4db"; }

.fa-person-breastfeeding {
  --fa: "\e53a";
  --fa--fa: "\e53a\e53a"; }

.fa-right-to-bracket {
  --fa: "\f2f6";
  --fa--fa: "\f2f6\f2f6"; }

.fa-sign-in-alt {
  --fa: "\f2f6";
  --fa--fa: "\f2f6\f2f6"; }

.fa-venus {
  --fa: "\f221";
  --fa--fa: "\f221\f221"; }

.fa-passport {
  --fa: "\f5ab";
  --fa--fa: "\f5ab\f5ab"; }

.fa-thumbtack-slash {
  --fa: "\e68f";
  --fa--fa: "\e68f\e68f"; }

.fa-thumb-tack-slash {
  --fa: "\e68f";
  --fa--fa: "\e68f\e68f"; }

.fa-heart-pulse {
  --fa: "\f21e";
  --fa--fa: "\f21e\f21e"; }

.fa-heartbeat {
  --fa: "\f21e";
  --fa--fa: "\f21e\f21e"; }


.GL_DEPTH_TEST);
            }
        }
        if (!Keyboard.isKeyDown(Keyboard.KEY_B)) {
            bp = false;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_F) && !fp) {
            fp = true;
            filter += 1;
            if (filter > 2) {
                filter = 0;
            }
        }
        if (!Keyboard.isKeyDown(Keyboard.KEY_F)) {
            fp = false;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_PRIOR)) {
            z -= 0.02f;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_NEXT)) {
            z += 0.02f;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {

            xpos -= (float) Math.sin(heading * piover180) * 0.05f;
            zpos -= (float) Math.cos(heading * piover180) * 0.05f;
            if (walkbiasangle >= 359.0f) {
                walkbiasangle = 0.0f;
            }
            else {
                walkbiasangle += 10;
            }
            walkbias = (float) Math.sin(walkbiasangle * piover180) / 20.0f;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
            xpos += (float) Math.sin(heading * piover180) * 0.05f;
            zpos += (float) Math.cos(heading * piover180) * 0.05f;
            if (walkbiasangle <= 1.0f) {
                walkbiasangle = 359.0f;
            }
            else {
                walkbiasangle -= 10;
            }
            walkbias = (float) Math.sin(walkbiasangle * piover180) / 20.0f;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
            heading -= 1.0f;
            yrot = heading;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
            heading += 1.0f;
            yrot = heading;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_PRIOR)) {
            lookupdown -= 1.0f;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_NEXT)) {
            lookupdown += 1.0f;
        }
    }
    private void switchMode() {
        fullscreen = !fullscreen;
        try {
            Display.setFullscreen(fullscreen);
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }

    private boolean render() {
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);  // Clear The Screen And The Depth Buffer
        GL11.glLoadIdentity();                                  // Reset The View

        float x_m, y_m, z_m, u_m, v_m;
        float xtrans = -xpos;
        float ztrans = -zpos;
        float ytrans = -walkbias-0.25f;
        float sceneroty = 360.0f - yrot;

        int numTriangles;

        GL11.glRotatef(lookupdown,1.0f,0,0);
        GL11.glRotatef(sceneroty,0,1.0f,0);

        GL11.glTranslatef(xtrans, ytrans, ztrans);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture[filter]);

        numTriangles = sector1.numTriangles;

        // Process Each Triangle
        for (int loop_m = 0; loop_m < numTriangles; loop_m++)
        {
            GL11.glBegin(GL11.GL_TRIANGLES);
                GL11.glNormal3f( 0.0f, 0.0f, 1.0f);
                x_m = sector1.triangle[loop_m].vertex[0].x;
                y_m = sector1.triangle[loop_m].vertex[0].y;
                z_m = sector1.triangle[loop_m].vertex[0].z;
                u_m = sector1.triangle[loop_m].vertex[0].u;
                v_m = sector1.


Array &array) const
{
   int num = 0;
   int pos = -1;
   if (m_data->m_size > 500 && array.m_data->m_size > 5) {
      ByteArrayMatcher matcher(array);
      while ((pos = matcher.indexIn(*this, pos + 1)) != -1) {
         ++num;
      }
   } else {
      while ((pos = indexOf(array, pos + 1)) != -1) {
         ++num;
      }
   }
   return num;
}

int ByteArray::count(const char *array) const
{
   return count(ByteArray::fromRawData(array, pdk::strlen(array)));
}

int ByteArray::count(char c) const
{
   int num = 0;
   const char *i = m_data->getData() + m_data->m_size;
   const char *b = m_data->getData();
   while (i != b) {
      if (*--i == c) {
         ++num;
      }
   }
   return num;
}

ByteArray ByteArray::left(int length) const
{
   if (length >= m_data->m_size) {
      return *this;
   }
   if (length < 0) {
      length = 0;
   }
   return ByteArray(m_data->getData(), length);
}

ByteArray ByteArray::right(int length) const
{
   if (length >= m_data->m_size) {
      return *this;
   }
   if (length < 0) {
      length = 0;
   }
   return ByteArray(m_data->getData() + m_data->m_size - length, length);
}

ByteArray ByteArray::mid(int index, int length) const
{
   using namespace pdk::ds::internal;
   ContainerImplHelper::CutResult result = ContainerImplHelper::mid(size(), &index, &length);
   if (result == ContainerImplHelper::CutResult::Null) {
      return ByteArray();
   } else if (result == ContainerImplHelper::CutResult::Empty) {
      ByteArrayDataPtr empty = { Data::allocate(0) };
      return ByteArray(empty);
   } else if (result == ContainerImplHelper::CutResult::Full) {
      return *this;
   } else {
      return ByteArray(m_data->getData() + index, length);
   }
}

bool ByteArray::startsWith(const ByteArray &array) const
{
   if (m_data == array.m_data || array.m_data->m_size == 0) {
      return true;
   }
   if (m_data->m_size < array.m_data->m_size) {
      return false;
   }
   return std::memcmp(m_data->getData(), array.m_data->getData(), array.m_data->m_size) == 0;
}

bool ByteArray::startsWith(const char *str) const
{
   if (!str || !*str) {
      return true;
   }
   const int length = static_cast<int>(std::strlen(str));
   if (m_data->m_size < length) {
      return false;
   }
   return pdk::strncmp(m_data->getData(), str, length) == 0;
}

bool ByteArray::startsWith(char c) const
{
   if (m_data->m_size == 0) {
      return false;
   }
   return m_data->getData()[0] == c;
}

bool ByteArray::endsWith(const ByteArray &array) const
{
   if (m_data == array.m_data || array.m_data->m_size == 0) {
      return true;
   }
   if (m_data->m_size < array.m_data->m_size) {
      return false;
   }
   return std::memcmp(m_data->getData() + m_data->m_size - array.m_data->m_size,


2de0aabcdc3a7c93",
        "SHA384": "50d55882cb1aa3a572baa998c671c40f0392128aa5cab9bc753776db07e0ad86fb050acc523a0a0dc642243d8e259d1d"
      },
      "ValidFrom": "2014-05-20 00:00:00",
      "ValidTo": "2015-06-03 00:00:00",
      "Version": 3
    },
    {
      "CertificateType": "Leaf (Code Signing)",
      "IsCA": false,
      "IsCertificateAuthority": false,
      "IsCodeSigning": true,
      "SerialNumber": "0ef5eca7bd31cfc3a7f8e6259b423359",
      "Signature": "28dd038a8b1824ec13bb52ab16db006635fa9e07b6a3949d67a660fb46e38bcbef83aeeab5bbc0a0e92ef7f64a04c9647d000c66c4a3fbced041e347bfccb1dcac87a0ee04423b5419f1023142565d7f4f168f3e545b0c8d549bf702fd40cc5e22bf2728876072963a3c79cd7c0125473339b923a053ad14d6d56fb6693a1598995c47ab681f32f36f0ce8a49b0b93f61dbe5d0aaa1dab8f9ee928794e43ed0defe3d1b5834345ece88408deae457f7a990c5ed000f53ed5d70815aa08e3e2b6b72d5c48a30339fd204e1c8619e120ce5d21cba14ec2f299cedb4f02075489b1ed3d6a6bf266d1db1fdfb2d36f480dd5b05211185adf06e6745115e8c0b58600",
      "SignatureAlgorithmOID": "1.2.840.113549.1.1.5",
      "Subject": "C=CZ, L=Praha 4, O=AVAST Software a.s., CN=AVAST Software a.s.",
      "TBS": {
        "MD5": "a174efe24e7df3e8690e8c4ce8411cc6",
        "SHA1": "191c63936fab86e7d3d618c583c63e82c7ca4749",
        "SHA256": "c83b811214d81590d30916b415a8ba7df9f25a467fb9431c46a6cf70b8459189",
        "SHA384": "6f24c9264b1b1c240ed172101c32d11ca71c0a133c1484d403337475fc1bc68e9ab3656b14046cb5c4ff1a1dfeda301f"
      },
      "ValidFrom": "2013-07-12 00:00:00",
      "ValidTo": "2016-09-14 12:00:00",
      "Version": 3
    },
    {
      "CertificateType": "CA",
      "IsCA": true,
      "IsCertificateAuthority": true,
      "IsCodeSigning": true,
      "SerialNumber": "02c4d1e58a4a680c568da3047e7e4d5f",
      "Signature": "49eb7c60beaeefc97cb3c5ba4b64df1669e286fa29d9de98857d406626332f4455aaaa90e935700a34bed3ae542e8e6500d67a32203e6c26b898a939b1bc95c7aae9f5ee4666c6b3e812f8b3979dff74588234997550ac448fe892ce7d8b0f3196c7


claveAux, TxObfuscated};
use client_common::Result;
use parity_scale_codec::Encode;
use secp256k1::recovery::{RecoverableSignature, RecoveryId};
use secp256k1::schnorrsig::SchnorrSignature;

/// Default implementation of `Signer`
#[derive(Debug, Clone)]
pub struct DummySigner();

impl DummySigner {
    /// pad payload to the multiples of 128bits
    fn pad_payload(&self, plain_txaux: PlainTxAux) -> Vec<u8> {
        // https://tools.ietf.org/html/rfc8452
        vec![0; plain_txaux.encode().len() + 16]
    }

    /// Creates a mock merkletree
    fn mock_merkletree(
        &self,
        raw_pubkey: RawXOnlyPubkey,
        tree_length: usize,
    ) -> Result<MerkleTree<RawXOnlyPubkey>> {
        let tree = vec![raw_pubkey; tree_length];
        Ok(MerkleTree::new(tree))
    }

    /// Signs transaction with the mock key pair
    fn sign_tx(&self, total_pubkeys_len: usize) -> Result<TxInWitness> {
        let raw_pk = RawXOnlyPubkey::from([0_u8; 32] as H256);
        let merkle_tree = self.mock_merkletree(raw_pk.clone(), total_pubkeys_len)?;
        let proof = merkle_tree
            .generate_proof(raw_pk)
            .expect("generate proof error in mocked merkle tree");
        let mock_signature =
            SchnorrSignature::from_default(&[0_u8; 64]).expect("set mock signature failed");
        Ok(TxInWitness::TreeSig(mock_signature, proof))
    }

    /// Schnorr sign consecutive imaginary inputs of provided length
    pub fn schnorr_sign_inputs_len(&self, inputs: &[WitnessedUTxO]) -> Result<TxWitness> {
        Ok(inputs
            .iter()
            .map(|x| {
                self.sign_tx(x.threshold as usize)
                    .expect("would that ever fail? why this dummy has results?")
            })
            .collect::<Vec<TxInWitness>>()
            .into())
    }

    /// Mock the txaux for transactions
    pub fn mock_txaux_for_tx(&self, tx: Tx, witness: TxWitness) -> TxAux {
        let plain_payload = PlainTxAux::TransferTx(tx.clone(), witness);
        let padded_payload = self.pad_payload(plain_payload);
        // mock the enclave encrypted result
        let tx_enclave_aux = TxEnclaveAux::TransferTx {
            inputs: tx.inputs.clone(),
            no_of_outputs: tx.outputs.len() as TxoSize,
            payload: TxObfuscated {
                txid: [0; 32],
                key_from: BlockHeight::genesis(),
                init_vector: [0u8; 12],
                txpayload: padded_payload,
            },
        };
        TxAux::EnclaveTx(tx_enclave_aux)
    }

    /// Mock the txaux for deposit transactions
    pub fn mock_txaux_for_deposit(&self, inputs: &[WitnessedUTxO]) -> Result<TxAux> {
        let witness = self.schnorr_sign_inputs_len(inputs)?;
        let plain_payload = PlainTxAux::DepositStakeTx(witness);
        let padded_payload = self.pad_payload(plain_payload);
        let deposit_bond_tx = DepositBondTx {
            inputs: vec![TxoPointer {
                id: TxId::default(),
                index: TxoSize::default(),
            }],
            to_staked_account: StakedStateAddress::BasicRedeem(RedeemAddress::default()),
            attributes: StakedStateOpAttributes::default(),
        };
        let payload = TxObfuscated {


0" -> MusicQuality.manual
            "1" -> MusicQuality._hires
            "2" -> MusicQuality._flac
            "3" -> MusicQuality._320Kbps
            "4" -> MusicQuality._ogg
            "5" -> MusicQuality._128Kbps
            else -> MusicQuality._320Kbps
        }
    }

    private fun playTextToQuality(data: String?): MusicQuality {
        return when (data) {
            "0" -> MusicQuality._320Kbps
            "1" -> MusicQuality._ogg
            "2" -> MusicQuality._128Kbps
            "3" -> MusicQuality._96Kbps
            else -> MusicQuality._128Kbps
        }
    }
}package com.qmd.jzen.api.entities

import com.google.gson.annotations.SerializedName
import com.qmd.jzen.database.entity.Music
import com.qmd.jzen.entity.MusicEntity

/**
 * Create by OJun on 2022/1/19.
 *
 */
data class MusicInfo(
    @SerializedName("mid") val musicId: String,
    val title: String,
    val singer: ArrayList<SingerInfo>,
    val album: AlbumInfo,
    val file: MusicFileInfo,
    val subtitle: String,
    val pay: PayInfo,
    @SerializedName("time_public") val publishDate: String,
) {
    fun toMusic(): Music {
        val singerList = ArrayList<String>()
        singer.forEach {
            singerList.add(it.title)
        }
        val isBuy = pay.payMonth == 1

        return Music(
            musicId,
            file.mediaId,
            title,
            singerList,
            album.title,
            album.mid,
            isBuy,
            publishDate,
            file.size128,
            file.size192,
            file.size320,
            file.sizeFlac,
            file.sizeHires
        )
    }

    fun isBuy() = pay.payMonth != 0 || pay.priceAlbum == 0

    fun getSingerName() = StringBuilder().let { sb ->
        singer.forEach {
            sb.append(it.title + "_")
        }
        sb.removeSuffix("_").toString()
    }

    fun toMusicEntity(): MusicEntity {
        val isBuy = pay.payMonth == 1

        return MusicEntity(
            musicId,
            file.mediaId,
            title,
            getSingerName(),
            album.title,
            album.mid,
            isBuy,
            publishDate,
            file.size128,
            file.size192,
            file.size320,
            file.sizeFlac,
            file.sizeHires,
            ""
        )
    }
}

// Autogenerated from Pigeon (v26.0.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")

package dev.flutter.plugins.nfcmanager

import android.util.Log
import io.flutter.plugin.common.BasicMessageChannel
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.MessageCodec
import io.flutter.plugin.common.StandardMethodCodec
import io.flutter.plugin.common.StandardMessageCodec
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer
private object PigeonPigeonUtils {

  fun createConnectionError(channelName: String): FlutterError {
    return FlutterError("channel-error",  "Un


// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.

using Stride.Core.Assets;
using Stride.Core.Assets.Compiler;
using Stride.Core.BuildEngine;
using Stride.Assets.Models;
using Stride.Editor.Thumbnails;
using Stride.Engine;
using Stride.Rendering;

namespace Stride.Assets.Presentation.Thumbnails
{
    // TODO: shall we set the same/similar priority as Model asset?
    [AssetCompiler(typeof(ProceduralModelAsset), typeof(ThumbnailCompilationContext))]
    public class ProceduralModelThumbnailCompiler : ThumbnailCompilerBase<ProceduralModelAsset>
    {
        public ProceduralModelThumbnailCompiler()
        {
            IsStatic = false;
        }

        protected override void CompileThumbnail(ThumbnailCompilerContext context, string thumbnailStorageUrl, AssetItem assetItem, Package originalPackage, AssetCompilerResult result)
        {
            result.BuildSteps.Add(new ThumbnailBuil


360deg)}}@keyframes form-spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ui.form .required.field>.checkbox:after,.ui.form .required.field>label:after,.ui.form .required.fields.grouped>label:after,.ui.form .required.fields:not(.grouped)>.field>.checkbox:after,.ui.form .required.fields:not(.grouped)>.field>label:after{margin:-.2em 0 0 .2em;content:'*';color:#DB2828}.ui.form .required.field>label:after,.ui.form .required.fields.grouped>label:after,.ui.form .required.fields:not(.grouped)>.field>label:after{display:inline-block;vertical-align:top}.ui.form .required.field>.checkbox:after,.ui.form .required.fields:not(.grouped)>.field>.checkbox:after{position:absolute;top:0;left:100%}.ui.form .inverted.segment .ui.checkbox .box,.ui.form .inverted.segment .ui.checkbox label,.ui.form .inverted.segment label,.ui.inverted.form .inline.field>label,.ui.inverted.form .inline.field>p,.ui.inverted.form .inline.fields .field>label,.ui.inverted.form .inline.fields .field>p,.ui.inverted.form .inline.fields>label,.ui.inverted.form .ui.checkbox .box,.ui.inverted.form .ui.checkbox label,.ui.inverted.form label{color:rgba(255,255,255,.9)}.ui.inverted.form input:not([type]),.ui.inverted.form input[type=text],.ui.inverted.form input[type=email],.ui.inverted.form input[type=search],.ui.inverted.form input[type=password],.ui.inverted.form input[type=date],.ui.inverted.form input[type=datetime-local],.ui.inverted.form input[type=tel],.ui.inverted.form input[type=time],.ui.inverted.form input[type=file],.ui.inverted.form input[type=url],.ui.inverted.form input[type=number]{background:#FFF;border-color:rgba(255,255,255,.1);color:rgba(0,0,0,.87);box-shadow:none}.ui.form .grouped.fields{display:block;margin:0 0 1em}.ui.form .grouped.fields:last-child{margin-bottom:0}.ui.form .grouped.fields>label{margin:0 0 .28571429rem;color:rgba(0,0,0,.87);font-size:.92857143em;font-weight:700;text-transform:none}.ui.form .grouped.fields .field,.ui.form .grouped.inline.fields .field{display:block;margin:.5em 0;padding:0}.ui.form .fields{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;margin:0 -.5em 1em}.ui.form .fields>.field{-webkit-box-flex:0;-webkit-flex:0 1 auto;-ms-flex:0 1 auto;flex:0 1 auto;padding-left:.5em;padding-right:.5em}.ui.form .fields>.field:first-child{border-left:none;box-shadow:none}.ui.form .two.fields>.field,.ui.form .two.fields>.fields{width:50%}.ui.form .three.fields>.field,.ui.form .three.fields>.fields{width:33.33333333%}.ui.form .four.fields>.field,.ui.form .four.fields>.fields{width:25%}.ui.form .five.fields>.field,.ui.form .five.fields>.fields