blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
3846cf0cf84510c4bad43190ba836cdf8c9b37f4
d396ea52ed253c0053f580f2906c12b3408319d1
/Hmwk/Assignment2-3/Chapter2/Savitch_9thEd_Chap2_ProgProj9/main.cpp
f54ef2be59c23f78a32e4b09f046a823b95e03dc
[]
no_license
ty2437309/YostTaylor_CSC5_40718
9ef1cf1da502282f64774e730f64103bb9191e70
5ac5f5e41a4e86d8ee6c798ebe210776a46056be
refs/heads/master
2020-04-16T07:53:54.194178
2015-02-13T06:56:34
2015-02-13T06:56:34
28,896,949
0
0
null
null
null
null
UTF-8
C++
false
false
1,072
cpp
main.cpp
/* * File: main.cpp * Author: Taylor Yost * Created on January 15, 2015, 19:22 * Purpose: Assignment 2 Homework */ //System Libraries #include <cstdlib> #include <iostream> #include <iomanip> using namespace std; //User Libraries //Global Constants //Function Prototypes //Execution Begins Here! int main(int argc, char** argv) { //Declare Variables int input; int sum = 0, sumPos = 0, sumNeg = 0, sumEven = 0, sumOdd = 0; //Prompt User for(int count = 1;count <= 10;count ++){ cout<<"Enter an integer!"<<endl; cin>> input; sum += input; if(input>0)sumPos += input; else sumNeg += input; if (input%2)sumOdd += input; else sumEven += input; } //Output Result cout<<"The sum = "<<setw(4)<<sum<<endl; cout<<"The positive sum = "<<setw(4)<<sumPos<<endl; cout<<"The negative sum = "<<setw(4)<<sumNeg<<endl; cout<<"The even sum = "<<setw(4)<<sumEven<<endl; cout<<"The odd sum = "<<setw(4)<<sumOdd<<endl; //Exit Stage Right! return 0; }
39c112a366388e65c21588a6d87b63c43afa3b9a
1bbf0f087abe2a2c1522f7a5aa422cb75bb6d319
/Tecnicas de programação 1/Programas TP/Lista 2B/4braba.cxx
599871a0fd1df8ca88ec56299fa1318a3c35fc95
[]
no_license
xfelipealves/SecondSemester
0f0839a40e08319f454d3e5f414df581b2614e25
0777d76dbbf7b6369963b09996d37f5a614cb101
refs/heads/main
2023-06-21T19:26:09.783376
2021-07-21T03:10:29
2021-07-21T03:10:29
387,977,596
0
0
null
null
null
null
UTF-8
C++
false
false
932
cxx
4braba.cxx
#include <iostream> using namespace std; string* func (char* s, char a, int* b) { int i=0; int cont=0; for (; s[i]!='\0'; i++) { if (s[i]==a) { cont++; } } //cont vai indicar quantos caracteres tem, logo ele vai determinar quantas strings serao alocadas string* ret=new string[cont+1]; char ind[cont+1][i]; int k=0; int h=0; int letra=0; for (; s[k]!='\0'; k++) { if (s[k]!=a) { ind[h][letra]=s[k]; letra++; //passar pra proxima letra da string if (s[k+1]==a or s[k+1]=='\0') { ind[h][letra]='\0'; } } else { h++; //passar pra proxima string letra=0; } } *b=cont+1; //alterando o valor por referencia int t=0; int y=0; for (; t<cont+1; t++) { ret[t]=ind[t]; } return ret; } int main() { char s[100]; cin>>s; char a; cin>>a; int b=0; string* f; f=func(s,a,&b); for (int i=0; i<b; i++) { cout<<"''"<<f[i]<<"''"<< ", "; } cout<<endl; return 0; }
50edce409db63ec35493f54a2f5453baa5b0e7b9
e8a574873c2d0655bfb15cf3c43a62d8deae9761
/MVC/DownloadProgress/mainwindow.h
c99c093112638b879f61f7fca94ab838629e0c76
[]
no_license
lzdbh/qt-test
20687959be3eb82d9f48361d8429bb979d27e47b
cc6f6871b1a79ac114cad6716228d851b390505c
refs/heads/master
2020-05-18T05:40:44.699888
2014-06-11T10:22:20
2014-06-11T10:22:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,163
h
mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QtNetwork> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); void startRequest(QUrl url); QString getFileMd5(const QString filePath); bool copyFile(const QString fromSrc,QString toSrc,bool coverIfExist=false); bool copyDir(const QString &fromDir,const QString &toDir,bool coverIfExist=false); bool deleteEmptyDir(const QString &dirPath); /** * @brief deleteDirWithContent * @param dirPatn 文件路径,相对 或者绝对 * @return */ void deleteDirWithContent(const QString &dirPath); protected: void changeEvent(QEvent *); private slots: void on_pushButton_clicked();//按钮单击事件 void httpFinished();//完成下载后处理 void httpReadyRead();//接收数据时处理 void updateDataReadProgress(qint64,qint64);//更新进度条 private: Ui::MainWindow *ui; QNetworkAccessManager *httpManager; QNetworkReply *httpReply; QUrl url; QFile *file; }; #endif // MAINWINDOW_H
ab5edf227eacbca5f75e69f162def327ced165c4
d86dee3a88a619603bd3b7ea265373d1f6fb71cc
/Codeforces/1245D.cpp
6dd8648de2df4709d79f3917ecabccaec0f82257
[]
no_license
vzsky/submissions
17ca8b096450170cc077b70a9efb4c7d7e21479d
78211da43e9b51b98bb7f42a294330507af92a65
refs/heads/master
2023-04-02T03:44:04.193078
2021-04-19T05:57:52
2021-04-19T05:57:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,311
cpp
1245D.cpp
#include <bits/stdc++.h> using namespace std; const long long N = 2000; long long n; pair<long long,long long> a[N]; long long b[N],c[N]; pair<long long,long long> res[N]; vector<long long> used; long long ans; vector<long long> built; vector<pair<long long,long long> > cnct; long long dist(long long x,long long y){ return abs(a[x].first-a[y].first)+abs(a[x].second-a[y].second); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(long long i = 0;i < n;i++) cin >> a[i].first >> a[i].second; for(long long i = 0;i < n;i++) cin >> b[i],res[i] = {b[i],i}; for(long long i = 0;i < n;i++) cin >> c[i]; sort(res,res+n); for(long long i = 0;i < n;i++) { long long x = res[i].second; long long old = LLONG_MAX; long long aa,bb; for(long long y : used) if(dist(x,y)*(c[x]+c[y])<old) old = dist(x,y)*(c[x]+c[y]),aa = x,bb = y; if(b[x]<old) built.push_back(x); else cnct.push_back({aa,bb}); ans+=min(old,b[x]); used.push_back(x); } cout << ans << '\n'; cout << built.size() << '\n'; for(long long x : built) cout << x+1 << ' '; cout << '\n' << cnct.size() << '\n'; for(auto x : cnct) cout << x.first+1 << ' ' << x.second+1 << '\n'; }
1cd96b9bcf635b188e7f4673c4ea203659cddbb7
2ae24f623e15dd329873eec6fb052dfc148fcfc5
/math.h
d78ab0fcabc8b4ef59f7f78bdce605f400283325
[]
no_license
wangscript007/vise3d
c66545f72e1c1decd02c894134fcb6940422740f
25242396b4f3db154db0c56af36d329bb1a7fe1b
refs/heads/master
2021-05-30T16:32:09.210681
2016-02-23T08:18:15
2016-02-23T08:18:15
null
0
0
null
null
null
null
GB18030
C++
false
false
8,100
h
math.h
/* Copyright (c) 2009 AxonEngine Team This file is part of the AxonEngine project, and may only be used, modified, and distributed under the terms of the AxonEngine project license, license.txt. By continuing to use, modify, or distribute this file you indicate that you have read the license and understand and accept it fully. */ #ifndef AX_CORE_MATH_H #define AX_CORE_MATH_H /* Definitions of useful mathematical constants * AX_E - e * AX_LOG2E - log2(e) * AX_LOG10E - log10(e) * AX_LN2 - ln(2) * AX_LN10 - ln(10) * AX_PI - pi * AX_PI_2 - pi/2 * AX_PI_4 - pi/4 * AX_1_PI - 1/pi * AX_2_PI - 2/pi * AX_2_SQRTPI - 2/sqrt(pi) * AX_SQRT2 - sqrt(2) * AX_SQRT1_2 - 1/sqrt(2) * AX_D2R - pi/180 * AX_R2D - 180/pi */ #define AX_E 2.71828182845904523536f #define AX_LOG2E 1.44269504088896340736f #define AX_LOG10E 0.434294481903251827651f #define AX_LN2 0.693147180559945309417f #define AX_LN10 2.30258509299404568402f #define AX_PI 3.14159265358979323846f #define AX_PI_2 1.57079632679489661923f #define AX_PI_4 0.785398163397448309616f #define AX_1_PI 0.318309886183790671538f #define AX_2_PI 0.636619772367581343076f #define AX_2_SQRTPI 1.12837916709551257390f #define AX_SQRT2 1.41421356237309504880f #define AX_SQRT1_2 0.707106781186547524401f #define AX_D2R 0.0174532925199432957692f /* == PI / 180 */ #define AX_R2D 57.295779513082320876798f /* == 180 / PI */ #define FLOATSIGNBITSET(f) ((*(const unsigned long *)&(f)) >> 31) #define FLOATSIGNBITNOTSET(f) ((~(*(const unsigned long *)&(f))) >> 31) #define FLOATNOTZERO(f) ((*(const unsigned long *)&(f)) & ~(1<<31) ) #define INTSIGNBITSET(i) (((const unsigned long)(i)) >> 31) #define INTSIGNBITNOTSET(i) ((~((const unsigned long)(i))) >> 31) AX_BEGIN_NAMESPACE // forward declaration struct Vector2; struct Vector3; struct Vector4; struct Plane; struct Matrix2; struct Matrix3; struct Matrix4; struct Point; struct Rect; struct Quaternion; struct Angles; struct BoundingBox; struct Matrix; struct Rgb; struct Rgba; struct Color3; struct Color4; #if 0 struct Bgr; struct Bgra; #endif struct AX_API Math { enum Constant { IEEE_FLT_MANTISSA_BITS = 23, IEEE_FLT_EXPONENT_BITS = 8, IEEE_FLT_EXPONENT_BIAS = 127, IEEE_FLT_SIGN_BIT = 31 }; static void initialize(); static float rsqrt(float x); static void sincos(float a, float &s, float &c); // sine and cosine with 32 bits precision static void sincos16(float a, float &s, float &c); // sine and cosine with 16 bits precision static void sincos64(float a, double &s, double &c); // sine and cosine with 64 bits precision static float normalizeDegree(float degree); static float d2r(float in); static float r2d(float in); static int nextPowerOfTwo(int x); static int previousPowerOfTwo(const int v); static int nearestPowerOfTwo(const int v); static bool isPowerOfTwo(int n); static int countMipmaps(int w, int h, int d); // map a value to range [0, width) static int mapToRange(int v, int l, int h); static int mapToBound(int n, int width); // 获取checkPoint到线段p1, p2的最短距离 timlly add static float getNearstDistanceSegment(const Vector3 &p1, const Vector3 &p2, const Vector3 &checkPoint); // 获取checkPoint到直线p1, p2的最短距离 timlly add static float getNearstDistanceLine(const Vector3 &p1, const Vector3 &p2, const Vector3 &checkPoint); // clamp static int clampSbyte(int n); static int clampByte(int n); static int clampUshort(int n); static float saturate(float f); static int floatToBits(float f, int exponentBits, int mantissaBits); static float bitsToFloat(int i, int exponentBits, int mantissaBits); static int angleToByte(float angle) { return (int)(angle * 256.0f / 360.0f ) & 255; } static float byteToAngle(int x) { return (x) * ( 360.0f / 256.0f );} static int angleToShort(float angle) { return (int)(angle * 65536.0f / 360.0f ) & 65535; } static float shortToAngle(int x) { return (x) * ( 360.0f / 65536.0f );} template<typename T> static T abs(T x); template<typename T> static T clamp(T v, T l, T h); template<typename T> static T sign(T x); static size_t distant(size_t baseline, size_t pos) { if (pos >= baseline) return pos - baseline; return pos + ~baseline + 1; } }; // 1 / sqrt(x) inline float Math::rsqrt(float x) { long i; float y, r; y = x * 0.5f; i = *reinterpret_cast<long *>(&x); i = 0x5f3759df - (i >> 1); r = *reinterpret_cast<float *>(&i); r = r * (1.5f - r * r * y); return r; } inline void Math::sincos(float a, float &s, float &c) { #ifdef _WIN32 _asm { fld a fsincos mov ecx, c mov edx, s fstp dword ptr [ecx] fstp dword ptr [edx] } #else s = sinf(a); c = cosf(a); #endif } inline void Math::sincos16(float a, float &s, float &c) { float t, d; const float pi2 = AX_PI * 2.0f; if ((a < 0.0f) || (a >= pi2)) { a -= floorf(a / pi2) * pi2; } if (a < AX_PI) { if (a > AX_PI_2) { a = AX_PI - a; d = -1.0f; } else { d = 1.0f; } } else { if (a > AX_PI + AX_PI_2) { a = a - pi2; d = 1.0f; } else { a = AX_PI - a; d = -1.0f; } } t = a * a; s = a * (((((-2.39e-08f * t + 2.7526e-06f) * t - 1.98409e-04f) * t + 8.3333315e-03f) * t - 1.666666664e-01f) * t + 1.0f); c = d * (((((-2.605e-07f * t + 2.47609e-05f) * t - 1.3888397e-03f) * t + 4.16666418e-02f) * t - 4.999999963e-01f) * t + 1.0f); } inline void Math::sincos64(float a, double &s, double &c) { #ifdef _WIN32 _asm { fld a fsincos mov ecx, c mov edx, s fstp qword ptr [ecx] fstp qword ptr [edx] } #else s = sin(a); c = cos(a); #endif } inline int Math::mapToRange(int v, int l, int h) { v = v - l; int len = h - l; int mod = v % len; if (mod >= 0) return mod; return len + mod; } inline float Math::d2r(float in) { return in * AX_D2R; } inline float Math::r2d(float in) { return in * AX_R2D; } /** Return the next power of two. * @see http://graphics.stanford.edu/~seander/bithacks.html * @warning Behaviour for 0 is undefined. * @note isPowerOfTwo(x) == true -> nextPowerOfTwo(x) == x * @note nextPowerOfTwo(x) = 2 << log2(x-1) */ inline int Math::nextPowerOfTwo(int x) { if(!x) return 1; // On modern CPUs this is as fast as using the bsr instruction. x--; x |= x >> 1; x |= x >> 2; x |= x >> 4; x |= x >> 8; x |= x >> 16; return x+1; } /// Return true if @a n is a power of two. inline bool Math::isPowerOfTwo(int n) { return (n & (n-1)) == 0; } inline int Math::countMipmaps(int w, int h, int d) { int mipmap = 0; while (w != 1 || h != 1 || d != 1) { w = std::max(1, w / 2); h = std::max(1, h / 2); d = std::max(1, d / 2); mipmap++; } return mipmap + 1; } // 1 -> 1, 2 -> 2, 3 -> 2, 4 -> 4, 5 -> 4, ... inline int Math::previousPowerOfTwo(const int v) { return nextPowerOfTwo(v + 1) / 2; } inline int Math::nearestPowerOfTwo(const int v) { const int np2 = nextPowerOfTwo(v); const int pp2 = previousPowerOfTwo(v); if (np2 - v <= v - pp2) { return np2; } else { return pp2; } } // map a value to range [0, width) inline int Math::mapToBound(int n, int width) { n = n % width; if (n < 0) n += width; return n; } inline int Math::clampByte(int n) { return clamp<int>(n, 0, 255); } inline int Math::clampSbyte(int n) { return clamp<int>(n, -128, 127); } inline int Math::clampUshort(int n) { return clamp<int>(n, 0, 0xffff); } inline float Math::saturate(float f) { return clamp(f, 0.0f, 1.0f); } template<typename T> T Math::abs(T x) { return x > 0 ? x : -x; } template<typename T> T Math::clamp(T v, T l, T h) { return ((v) < (l) ? (l) : (v) > (h) ? (h) : (v)); } template<typename T> T Math::sign(T x) { if (x > 0) return 1; if (x < 0) return -1; return 0; } AX_END_NAMESPACE #include "vector2.h" #include "vector3.h" #include "vector4.h" #include "color.h" #include "quaternion.h" #include "matrix2.h" #include "matrix3.h" #include "bounds.h" #include "plane.h" #include "matrix4.h" #include "point.h" #include "size.h" #include "rect.h" #include "angles.h" #include "vertex.h" #include "rotation.h" #include "matrix.h" #include "simd.h" #include "perlinnoise.h" #include "spline.h" #endif // AX_CORE_MATH_H
9f209300cb73cbda27da62e84d38734bc1fcb140
df547195fccd7ae602b9db1ad9c9fd940b8e0576
/Kaynak Kod/grup19.cpp
8233fc84c85052c31d35eb818c6f6d4a6e275b04
[]
no_license
cambazm/imageToPuzzle
568ea58249fc135a9aee09206477a9ab86600e64
0efc616e0cab8179a0e871af2635149a19ae70b5
refs/heads/master
2020-08-12T16:27:12.593003
2019-10-16T16:21:04
2019-10-16T16:21:04
214,800,018
0
1
null
null
null
null
UTF-8
C++
false
false
1,179
cpp
grup19.cpp
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop //--------------------------------------------------------------------------- USEFORM("proje3.cpp", ResimAc); USEFORM("islem.cpp", Yapboz); //--------------------------------------------------------------------------- WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { Application->Initialize(); Application->CreateForm(__classid(TResimAc), &ResimAc); Application->CreateForm(__classid(TYapboz), &Yapboz); Application->Run(); } catch (Exception &exception) { Application->ShowException(&exception); } catch (...) { try { throw Exception(""); } catch (Exception &exception) { Application->ShowException(&exception); } } return 0; } //---------------------------------------------------------------------------
2316949c5a4755e922fcb29291b14ce0cdd6f50c
b3500e7215b0c0c203e6dc84b4f1649579cee4eb
/MFC/CharsMap/CharsMap/CntrItem.cpp
4c51fd0bb0581db3e96e7dd87a60b95758eb98c4
[]
no_license
Sears-Tian/Laboratory
fd1530745202683629bbbc02f75522c1faa390d7
81455ac3a0944281e902f4853ead71f37ded28e2
refs/heads/master
2021-04-12T08:54:51.287198
2020-01-02T10:58:10
2020-01-02T10:58:10
126,679,969
0
0
null
null
null
null
UTF-8
C++
false
false
779
cpp
CntrItem.cpp
 // CntrItem.cpp: CCharsMapCntrItem 类的实现 // #include "stdafx.h" #include "CharsMap.h" #include "CharsMapDoc.h" #include "CharsMapView.h" #include "CntrItem.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CCharsMapCntrItem 实现 IMPLEMENT_SERIAL(CCharsMapCntrItem, CRichEditCntrItem, 0) CCharsMapCntrItem::CCharsMapCntrItem(REOBJECT* preo, CCharsMapDoc* pContainer) : CRichEditCntrItem(preo, pContainer) { // TODO: 在此添加一次性构造代码 } CCharsMapCntrItem::~CCharsMapCntrItem() { // TODO: 在此处添加清理代码 } // CCharsMapCntrItem 诊断 #ifdef _DEBUG void CCharsMapCntrItem::AssertValid() const { CRichEditCntrItem::AssertValid(); } void CCharsMapCntrItem::Dump(CDumpContext& dc) const { CRichEditCntrItem::Dump(dc); } #endif
efb1c9ee29a5343cd1cd0255e88d141d3c182000
ca9b8cd510c72ef9c4d453d6f6a050c2d4994da7
/cpp 10.3_practice/cpp 10.3_practice/Teacher.h
8bd747538bbfd5db96017da99c81d4f04e384aeb
[]
no_license
younkyounghwan/cpp_in_lecture
823501a4fadbf6ac52e665cb493f4f31bf1188fc
3bade2002359509174587e47cb1f2d55f850bb33
refs/heads/master
2023-07-01T10:03:39.504969
2021-08-01T14:56:02
2021-08-01T14:56:02
347,647,314
0
0
null
null
null
null
UTF-8
C++
false
false
373
h
Teacher.h
#pragma once #include <iostream> #include <string> using namespace std; class Teacher { private: string teacher_name ; public: Teacher(string name_in = "No name") :teacher_name(name_in) {} void setName(string name_in) { teacher_name = name_in; } friend ostream& operator << (ostream& out, const Teacher tec) { out << tec.teacher_name; return out; } };
b74b23718d3cb48a507e1e346a1ec0d31a333eee
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_login_handler_browsertest.cc
2922fd35e3bd9477c6c10c0b3b4df5e60c49c40f
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
10,526
cc
edu_coexistence_login_handler_browsertest.cc
// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_login_handler.h" #include <memory> #include <string> #include "base/functional/callback_helpers.h" #include "base/test/metrics/histogram_tester.h" #include "base/time/time.h" #include "base/values.h" #include "chrome/browser/ash/child_accounts/edu_coexistence_tos_store_utils.h" #include "chrome/browser/ash/login/test/logged_in_user_mixin.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_state_tracker.h" #include "chrome/test/base/fake_gaia_mixin.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/mixin_based_in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/prefs/pref_service.h" #include "components/signin/public/identity_manager/access_token_info.h" #include "components/signin/public/identity_manager/account_info.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_web_ui.h" #include "google_apis/gaia/google_service_auth_error.h" namespace ash { namespace { constexpr char kResponseCallback[] = "cr.webUIResponse"; } // namespace class EduCoexistenceLoginHandlerBrowserTest : public MixinBasedInProcessBrowserTest { public: EduCoexistenceLoginHandlerBrowserTest() = default; EduCoexistenceLoginHandlerBrowserTest( const EduCoexistenceLoginHandlerBrowserTest&) = delete; EduCoexistenceLoginHandlerBrowserTest& operator=( const EduCoexistenceLoginHandlerBrowserTest&) = delete; ~EduCoexistenceLoginHandlerBrowserTest() override = default; void SetUp() override { MixinBasedInProcessBrowserTest::SetUp(); } void SetUpOnMainThread() override { MixinBasedInProcessBrowserTest::SetUpOnMainThread(); logged_in_user_mixin_.LogInUser(); } void TearDown() override { MixinBasedInProcessBrowserTest::TearDown(); } std::unique_ptr<EduCoexistenceLoginHandler> SetUpHandler() { auto handler = std::make_unique<EduCoexistenceLoginHandler>(base::DoNothing()); handler->set_web_ui_for_test(web_ui()); handler->RegisterMessages(); return handler; } void VerifyJavascriptCallResolved(const content::TestWebUI::CallData& data, const std::string& event_name, const std::string& call_type) { EXPECT_EQ(call_type, data.function_name()); ASSERT_TRUE(data.arg1()->is_string()); EXPECT_EQ(event_name, data.arg1()->GetString()); } void SimulateAccessTokenFetched(EduCoexistenceLoginHandler* handler, bool success = true) { GoogleServiceAuthError::State state = success ? GoogleServiceAuthError::NONE : GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS; handler->OnOAuthAccessTokensFetched( GoogleServiceAuthError(state), signin::AccessTokenInfo("access_token", base::Time::Now() + base::Minutes(1), "")); } void ExpectEduCoexistenceState( EduCoexistenceStateTracker::FlowResult result) { const EduCoexistenceStateTracker::FlowState* state = EduCoexistenceStateTracker::Get()->GetInfoForWebUIForTest(web_ui()); EXPECT_EQ(state->flow_result, result); } void ExpectEduCoexistenceStateHistogram( EduCoexistenceStateTracker::FlowResult result) { histograms_.ExpectUniqueSample( EduCoexistenceStateTracker::Get()->GetInSessionHistogramNameForTest(), result, /* expected count */ 1); } protected: content::TestWebUI* web_ui() { return &web_ui_; } private: LoggedInUserMixin logged_in_user_mixin_{&mixin_host_, LoggedInUserMixin::LogInType::kChild, embedded_test_server(), this}; base::HistogramTester histograms_; content::TestWebUI web_ui_; }; IN_PROC_BROWSER_TEST_F(EduCoexistenceLoginHandlerBrowserTest, HandleInitializeEduCoexistenceArgs) { constexpr char kCallbackId[] = "coexistence-data-init"; std::unique_ptr<EduCoexistenceLoginHandler> handler = SetUpHandler(); ExpectEduCoexistenceState(EduCoexistenceStateTracker::FlowResult::kLaunched); base::Value::List list_args; list_args.Append(kCallbackId); web_ui()->HandleReceivedMessage("initializeEduArgs", list_args); SimulateAccessTokenFetched(handler.get()); EXPECT_EQ(web_ui()->call_data().size(), 1u); const content::TestWebUI::CallData& second_call = *web_ui()->call_data()[0]; // TODO(yilkal): verify the exact the call arguments. VerifyJavascriptCallResolved(second_call, kCallbackId, kResponseCallback); handler.reset(); // The recorded state should be "launched" state. ExpectEduCoexistenceStateHistogram( EduCoexistenceStateTracker::FlowResult::kLaunched); } IN_PROC_BROWSER_TEST_F(EduCoexistenceLoginHandlerBrowserTest, ErrorCallsFromWebUI) { std::unique_ptr<EduCoexistenceLoginHandler> handler = SetUpHandler(); base::Value::List call_args; call_args.Append("error message 1"); call_args.Append("error message 2"); web_ui()->HandleReceivedMessage("error", call_args); EXPECT_TRUE(handler->in_error_state()); handler.reset(); ExpectEduCoexistenceStateHistogram( EduCoexistenceStateTracker::FlowResult::kError); } IN_PROC_BROWSER_TEST_F(EduCoexistenceLoginHandlerBrowserTest, OAuth2AccessTokensFetchFailed) { std::unique_ptr<EduCoexistenceLoginHandler> handler = SetUpHandler(); SimulateAccessTokenFetched(handler.get(), /* success */ false); // Error messages are not sent until initialize message is sent from js to // C++ handler. EXPECT_EQ(web_ui()->call_data().size(), 0u); base::Value::List call_args; call_args.Append("coexistence-data-init"); web_ui()->HandleReceivedMessage("initializeEduArgs", call_args); EXPECT_EQ(web_ui()->call_data().size(), 1u); EXPECT_EQ(web_ui()->call_data()[0]->function_name(), "cr.webUIListenerCallback"); const base::Value* arg1 = web_ui()->call_data()[0]->arg1(); std::string method_call = arg1 ? arg1->GetString() : std::string(); constexpr char kWebUICallErrorCallback[] = "show-error-screen"; EXPECT_EQ(method_call, kWebUICallErrorCallback); handler.reset(); ExpectEduCoexistenceStateHistogram( EduCoexistenceStateTracker::FlowResult::kError); } IN_PROC_BROWSER_TEST_F(EduCoexistenceLoginHandlerBrowserTest, HandleConsentLogged) { constexpr char kConsentLoggedCallback[] = "consent-logged-callback"; constexpr char kToSVersion[] = "12345678"; std::unique_ptr<EduCoexistenceLoginHandler> handler = SetUpHandler(); SimulateAccessTokenFetched(handler.get()); base::Value::List call_args; call_args.Append(FakeGaiaMixin::kFakeUserEmail); call_args.Append(kToSVersion); base::Value::List list_args; list_args.Append(kConsentLoggedCallback); list_args.Append(std::move(call_args)); web_ui()->HandleReceivedMessage("consentLogged", list_args); const EduCoexistenceStateTracker::FlowState* tracker = EduCoexistenceStateTracker::Get()->GetInfoForWebUIForTest(web_ui()); // Expect that the tracker gets the appropriate update. EXPECT_NE(tracker, nullptr); EXPECT_TRUE(tracker->received_consent); EXPECT_EQ(tracker->email, FakeGaiaMixin::kFakeUserEmail); EXPECT_EQ(tracker->flow_result, EduCoexistenceStateTracker::FlowResult::kConsentLogged); // Simulate account added. CoreAccountInfo account; account.email = FakeGaiaMixin::kFakeUserEmail; account.gaia = FakeGaiaMixin::kFakeUserGaiaId; handler->OnRefreshTokenUpdatedForAccount(account); const std::string& accepted_tos = edu_coexistence::GetAcceptedToSVersion( ProfileManager::GetActiveUserProfile(), FakeGaiaMixin::kFakeUserGaiaId); EXPECT_EQ(accepted_tos, std::string(kToSVersion)); EXPECT_EQ(web_ui()->call_data().size(), 1u); const content::TestWebUI::CallData& second_call = *web_ui()->call_data()[0]; // TODO(yilkal): verify the exact the call arguments. VerifyJavascriptCallResolved(second_call, kConsentLoggedCallback, kResponseCallback); handler.reset(); ExpectEduCoexistenceStateHistogram( EduCoexistenceStateTracker::FlowResult::kAccountAdded); } IN_PROC_BROWSER_TEST_F(EduCoexistenceLoginHandlerBrowserTest, TestUpdateAcceptedToSVersionPrefAccount) { constexpr char kVersion1[] = "123"; constexpr char kVersion2[] = "234"; constexpr char kUser1GaiaId[] = "user1-gaia-id"; constexpr char kUser2GaiaId[] = "user2-gaia-id"; constexpr char kUser3GaiaId[] = "user3-gaia-id"; Profile* profile = ProfileManager::GetActiveUserProfile(); edu_coexistence::UpdateAcceptedToSVersionPref( profile, edu_coexistence::UserConsentInfo(kUser1GaiaId, kVersion1)); EXPECT_EQ(edu_coexistence::GetAcceptedToSVersion(profile, kUser1GaiaId), std::string(kVersion1)); edu_coexistence::UpdateAcceptedToSVersionPref( profile, edu_coexistence::UserConsentInfo(kUser2GaiaId, kVersion1)); EXPECT_EQ(edu_coexistence::GetAcceptedToSVersion(profile, kUser2GaiaId), std::string(kVersion1)); edu_coexistence::UpdateAcceptedToSVersionPref( profile, edu_coexistence::UserConsentInfo(kUser3GaiaId, kVersion1)); EXPECT_EQ(edu_coexistence::GetAcceptedToSVersion(profile, kUser3GaiaId), std::string(kVersion1)); edu_coexistence::UpdateAcceptedToSVersionPref( profile, edu_coexistence::UserConsentInfo(kUser2GaiaId, kVersion2)); EXPECT_EQ(edu_coexistence::GetAcceptedToSVersion(profile, kUser2GaiaId), std::string(kVersion2)); EXPECT_EQ(edu_coexistence::GetAcceptedToSVersion(profile, kUser1GaiaId), std::string(kVersion1)); EXPECT_EQ(edu_coexistence::GetAcceptedToSVersion(profile, kUser3GaiaId), std::string(kVersion1)); edu_coexistence::UpdateAcceptedToSVersionPref( profile, edu_coexistence::UserConsentInfo(kUser1GaiaId, kVersion2)); EXPECT_EQ(edu_coexistence::GetAcceptedToSVersion(profile, kUser1GaiaId), std::string(kVersion2)); } } // namespace ash
bcf20b93ea14ea0eb3bc35c93aef32853c2a5261
60b40b5d6b59235478786443bf8cbd144734303f
/lab6/src/Tablica.h
2f3c4a5e4a2728b48b4ef3452d7de111eb4b6a46
[]
no_license
226284/PAMSI
2b9fe96c8548634a535a8639235c17ddff419975
4a6b31a4a63b0357d930f8e307b1573ee5217ef8
refs/heads/master
2021-01-18T16:34:25.421953
2017-06-22T13:34:28
2017-06-22T13:34:28
84,352,575
0
2
null
null
null
null
UTF-8
C++
false
false
1,286
h
Tablica.h
/* * Tablica.h * * Created on: 17 mar 2017 * Author: michal */ #ifndef TABLICA_H_ #define TABLICA_H_ #include "IProgram.h" #include <iostream> #include <cstdlib> class Tablica: public IProgram { // tablica która może zmieniać swój rozmiar public: Tablica(int r = 10); // konstruktor - domyślnie rozmiar = 10 ~Tablica(); // dekonstruktor int przypisanie(int pozycja, int wartosc); // przypisanie indeksowi tablicy sprecyzowaniej wartości int odczytanie(int pozycja); // zwraca wartosc elementu przypisanego do indeksu tablicy int rozmiar(); // zwraca rozmiar tablicy int wypelnienie(); // zwraca zapelnienie tablicy void wyswietlanie(); void algorytm_n1(int ilosc); void algorytm_2n(int ilosc); virtual void wykonaj_obliczenia(int typ_alg, int ilosc); // zapisuje podaną ilość elementów do tablicy (konkretnym algorytmem) private: int ROZMIAR; // pole przechowuje informację na temat aktualnego rozmiaru tablicy int WYPELNIENIE; // aktualne wypełnienie tablicy int *TABLICA; // wskaźnik na tablicę int *powieksz_tablice(int rozmiar, int stara_tablica[]); // powiększa tablicę o zadaną wielkość int *zmniejsz_tablice(int rozmiar, int wypelnienie, int stara_tablica[]); // usuwa pustą przestrzeń w tablicy }; #endif /* TABLICA_H_ */
6e926c7faf0746b4932699425887d4ce4650d81d
59f00d4f6fccb6b1103c5aa54f43a6e4d4f8bfc5
/src/common-lib/WindowManager/ListEditPanel.cpp
6e4f6925af906df3fe24dd367ed0dba5cc5ced84
[]
no_license
tomas-pluskal/masspp
9c9492443bb796533bcb27fe52a0a60e4ba62160
808bf095215e549e7eb5317c02c04dfb2ceaba15
refs/heads/master
2021-01-01T05:33:44.483127
2015-06-07T12:54:17
2015-06-07T12:54:17
33,917,190
0
1
null
null
null
null
SHIFT_JIS
C++
false
false
50,735
cpp
ListEditPanel.cpp
/** * @file ListEditPanel.cpp * @brief implements of ListEditPanel class * * @author S.Tanaka * @date 2007.09.03 * * Copyright(C) 2006-2014 Eisai Co., Ltd. All rights reserved. */ #include "stdafx.h" #include "ListEditPanel.h" #include "SettingsPageDialog.h" #include "ListTool.h" #include "RawDataFileDialog.h" #include "SettingsPanel.h" #include "WindowTool.h" #include "list_add16x16.xpm" #include "list_color16x16.xpm" #include "list_del16x16.xpm" #include "list_edit16x16.xpm" #include "list_up16x16.xpm" #include "list_down16x16.xpm" #include "list_del_disabled16x16.xpm" #include "setting_color_disabled16x16.xpm" #include "list_edit_disabled16x16.xpm" #include "list_up_disabled16x16.xpm" #include "list_down_disabled16x16.xpm" #include <set> #include <wx/colordlg.h> using namespace kome::window; #include <crtdbg.h> #ifdef _DEBUG #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ ) #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ ) #endif // _DEBUG #define BORDER_SIZE 3 #define GRID_GAP 3 #define ALL_BUTTON_CNT 5 #define BUTTON_SPACE 10 #define LIST_WIDTH 200 #define LIST_HEIGHT 80 #define ID_LIST_CTRL 65 #define ID_ADD_BUTTON 66 #define ID_EDIT_BUTTON 67 #define ID_DEL_BUTTON 68 #define ID_UP_BUTTON 69 #define ID_DOWN_BUTTON 70 #define ID_COLOR_BUTTON 71 #define ID_IMPORT_BUTTON 72 #define ID_EXPORT_BUTTON 73 #define FILE_EXPORT_CAPTION "Save As" #define FILE_IMPORT_CAPTION "Select Files" BEGIN_EVENT_TABLE( ListEditPanel, HelpGetterPanel ) EVT_MENU( ID_ADD_BUTTON, ListEditPanel::onAdd ) EVT_MENU( ID_EDIT_BUTTON, ListEditPanel::onEdit ) // @date 2012/11/29 <Add> OKADA EVT_MENU( ID_UP_BUTTON, ListEditPanel::onUp ) // @date 2012/11/29 <Add> OKADA EVT_MENU( ID_DOWN_BUTTON, ListEditPanel::onDown ) // @date 2012/11/29 <Add> OKADA EVT_MENU( ID_DEL_BUTTON, ListEditPanel::onDelete ) // @date 2012.12.17 <Add> M.Izumi EVT_LIST_ITEM_ACTIVATED( wxID_ANY, ListEditPanel::onEditDoubleClick ) EVT_BUTTON( ID_ADD_BUTTON, ListEditPanel::onAdd ) EVT_BUTTON( ID_EDIT_BUTTON, ListEditPanel::onEdit ) EVT_BUTTON( ID_DEL_BUTTON, ListEditPanel::onDelete ) EVT_BUTTON( ID_UP_BUTTON, ListEditPanel::onUp ) EVT_BUTTON( ID_DOWN_BUTTON, ListEditPanel::onDown ) EVT_BUTTON( ID_COLOR_BUTTON, ListEditPanel::onColor ) EVT_BUTTON( ID_IMPORT_BUTTON, ListEditPanel::onImport ) EVT_BUTTON( ID_EXPORT_BUTTON, ListEditPanel::onExport ) EVT_UPDATE_UI( ID_EDIT_BUTTON, ListEditPanel::onUpdateSelection ) EVT_UPDATE_UI( ID_DEL_BUTTON, ListEditPanel::onUpdateSelection ) EVT_UPDATE_UI( ID_UP_BUTTON, ListEditPanel::onUpdateSelection ) EVT_UPDATE_UI( ID_DOWN_BUTTON, ListEditPanel::onUpdateSelection ) EVT_UPDATE_UI( ID_EXPORT_BUTTON, ListEditPanel::onUpdateSelection ) EVT_LIST_ITEM_SELECTED( ID_LIST_CTRL, ListEditPanel::onListItemsSelected ) EVT_LIST_ITEM_DESELECTED( ID_LIST_CTRL, ListEditPanel::onListItemsSelected ) EVT_LIST_ITEM_FOCUSED( ID_LIST_CTRL, ListEditPanel::onListItemsSelected ) EVT_LIST_ITEM_ACTIVATED( ID_LIST_CTRL, ListEditPanel::onListItemDoubleClicked ) EVT_CONTEXT_MENU( EditGridListCtrl::onContextMenu ) END_EVENT_TABLE() // constructor ListEditPanel::ListEditPanel( wxWindow* parent, const int id, kome::plugin::SettingsForm* form, kome::objects::SettingParameterValues* settings, const bool titleFlg, const bool singleSel, const bool hideAllCheckbox ) : HelpGetterPanel( parent, id ), m_params( NULL, false ) { // initialize m_form = form; m_settings = settings; m_titleFlg = titleFlg; m_singleSel = singleSel; m_hideAllCheckbox = hideAllCheckbox; m_valueType = VALUES_NORMAL; m_page = NULL; m_colorIdx = -1; m_list = NULL; m_color = kome::img::ColorTool::BLACK; m_addButton = NULL; m_editButton = NULL; m_delButton = NULL; m_upButton = NULL; m_downButton = NULL; m_colorButton = NULL; m_importButton = NULL; m_exportButton = NULL; m_iSelectedItem = -1; kome::plugin::SettingsParam* param = ( form == NULL ? NULL : form->getParam() ); kome::plugin::SettingsValue* val = ( param == NULL ? NULL : param->getValue() ); val = ( val == NULL ? NULL : val->getChildValue( 0 ) ); if( val != NULL ) { val->getEnumeration( m_enumeration ); } // page createPage(); // control createControls(); } // destructor ListEditPanel::~ListEditPanel() { } // get value std::string ListEditPanel::getValue( const unsigned int listIdx, const unsigned int elmIdx ) { // return value std::string ret; // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); // manager kome::plugin::PluginManager& plgMgr = kome::plugin::PluginManager::getInstance(); // check the list index if( listIdx >= m_values.size() ) { return ret; } // separate std::vector< std::string > vals; kome::plugin::SettingsValue::separateListValue( m_values[ listIdx ].c_str(), vals ); if( elmIdx < vals.size() ) { ret = vals[ elmIdx ]; } ret = kome::plugin::SettingsValue::convertToDisplayingString( ret.c_str() ); // function item if( value != NULL ) { kome::plugin::SettingsValue* subVal = value->getChildValue( elmIdx ); if( subVal != NULL && subVal->getEnumType() == kome::plugin::SettingsValue::ENUM_PLUGIN ) { std::string itemType = subVal->getEnumKey(); std::string itemName = ret; std::string subParams; std::string::size_type pos = ret.find( "[" ); if( pos != ret.npos ) { itemName = ret.substr( 0, pos ); subParams = ret.substr( pos ); subParams = removeBrackets( subParams.c_str() ); subParams = kome::plugin::SettingsValue::removeOuterBracket( subParams.c_str() ); } // item kome::plugin::PluginFunctionItem* item = plgMgr.getFunctionItem( itemType.c_str(), itemName.c_str() ); if( item != NULL ) { ret = item->getLongName(); if( !subParams.empty() ) { ret = FMT( "%s [%s]", ret.c_str(),subParams.c_str() ); } } } } return ret; } // get integer value int ListEditPanel::getIntValue( const unsigned int listIdx, const unsigned int elmIdx ) { // string value std::string str = getValue( listIdx, elmIdx ); // integer value int val = toint( str.c_str(), 10, -1 ); return val; } // get double value double ListEditPanel::getDoubleValue( const unsigned int listIdx, const unsigned elmIdx ) { // string value std::string str = getValue( listIdx, elmIdx ); // double value double val = todouble( str.c_str(), -1.0 ); return val; } // get value std::string ListEditPanel::getValue() { // get from the list std::vector< std::string > values; if( m_valueType & VALUES_ENUM ) { // checked CheckGridListCtrl* checkedList = (CheckGridListCtrl*)m_list; for( unsigned int i = 0; i < checkedList->getNumberOfData(); i++ ) { long long data = checkedList->getData( i ); if( checkedList->isSelected( data ) ) { std::string val = getEnumValue( data ); values.push_back( val ); } } } else { // normal list for( unsigned int i = 0; i < m_list->getNumberOfData(); i++ ) { long long data = m_list->getData( i ); values.push_back( m_values[ data ] ); } } // return value std::string ret; for( unsigned int i = 0; i < values.size(); i++ ) { std::string val = values[ i ]; val = kome::plugin::SettingsValue::removeOuterBracket( val.c_str() ); if( !ret.empty() ) { ret.append( LIST_VALUES_DELIMITER ); } if( val.find( "," ) != val.npos || val.find( "\\" ) != val.npos || val.find( "[" ) != val.npos || val.find( "]" ) != val.npos || val.find( ":" ) != val.npos || val.find( "$" ) != val.npos || val.find( "\"" ) != val.npos ) { val = FMT( "[%s]", val.c_str() ); } ret.append( val ); } return ret; } // set value void ListEditPanel::setValue( const char* value ) { // clear if( !m_values.empty() ) { m_values.clear(); } std::string s( NVL( value, "" ) ); // seperate kome::plugin::SettingsValue::separateListValue( s.c_str(), m_values ); // refresh if( m_list != NULL ) { updateList(); } } // get the number of values unsigned int ListEditPanel::getNumberOfValues() { return m_values.size(); } // get the number of columns unsigned int ListEditPanel::getNumberOfColumns() { return m_colNames.size(); } // get the column name const char* ListEditPanel::getColumnName( const unsigned int idx ) { if( idx >= m_colNames.size() ) { return NULL; } return m_colNames[ idx ].first.c_str(); } // get column type kome::plugin::SettingsValue::ValueType ListEditPanel::getColumnType( const unsigned int idx ) { // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); if( value == NULL ) { return kome::plugin::SettingsValue::TYPE_UNKNOWN; } // type if( idx >= value->getNumberOfChildValues() ) { return kome::plugin::SettingsValue::TYPE_UNKNOWN; } return value->getChildValue( idx )->getType(); } // get the enumeration size unsigned int ListEditPanel::getEnumSize() { return m_enumeration.size(); } // get the enumeration name const char* ListEditPanel::getEnumName( const unsigned int idx ) { return m_enumeration[ idx ].name.c_str(); } // get the enumeration value const char* ListEditPanel::getEnumValue( const unsigned int idx ) { return m_enumeration[ idx ].value.c_str(); } // get color index int ListEditPanel::getColorIndex() { return m_colorIdx; } // get color COLOR ListEditPanel::getColor( const unsigned int idx ) { // return value COLOR ret = kome::img::ColorTool::BLACK; if( m_colorIdx < 0 ) { return ret; } // get the color std::string str = getValue( idx, m_colorIdx ); ret = kome::img::ColorTool::getColor( str.c_str() ); return ret; } // create page void ListEditPanel::createPage() { // initialize if( m_page != NULL ) { delete m_page; } m_page = NULL; m_colNames.clear(); m_values.clear(); // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); if( value == NULL ) { return; } // set value const char* defaultVal = ( m_settings == NULL ? "" : m_settings->getParameterValue( param->getName() ) ); if( defaultVal == NULL ) { defaultVal = value->getDefaultValue(); } setValue( defaultVal ); // get number of child const unsigned int num = value->getNumberOfChildValues(); // type count int colorCnt = 0; int fileCnt = 0; int enumCnt = 0; for( unsigned int i = 0; i < num; i++ ) { kome::plugin::SettingsValue* child = value->getChildValue( i ); if( child->getType() == kome::plugin::SettingsValue::TYPE_COLOR ) { colorCnt++; m_colorIdx = (int)i; } else if( child->getType() == kome::plugin::SettingsValue::TYPE_INPUT || child->getType() == kome::plugin::SettingsValue::TYPE_RAWDATA ) { fileCnt++; } if( child->getType() == kome::plugin::SettingsValue::TYPE_BOOL && child->isEnumValue() ) { enumCnt++; } } // value type m_valueType = VALUES_NORMAL; if( colorCnt == 1 ) { m_valueType = VALUES_WITH_COLOR; } else { m_colorIdx = -1; } if( fileCnt == 1 && colorCnt + fileCnt == (int)num ) { m_valueType |= VALUES_FILE; } if( num == 1 && enumCnt == 1 ) { m_valueType = VALUES_ENUM; } // page m_page = new kome::plugin::SettingsPage( m_params ); for( unsigned int i = 0; i < num; i++ ) { // child value kome::plugin::SettingsValue* child = value->getChildValue( i ); // page of value kome::plugin::SettingsValue* val = m_params.addValue(); val->setType( child->getType() ); val->setEnumType( child->getEnumType() ); val->setEnumKey( child->getEnumKey() ); val->setRequired( child->isRequired() ); std::vector< kome::plugin::SettingsValue::EnumItem > enumeration; child->getEnumeration( enumeration ); for( unsigned int j = 0; j < enumeration.size(); j++ ) { val->addEnumItem( enumeration[ j ].name.c_str(), enumeration[ j ].value.c_str(), enumeration[ j ].desc.c_str(), enumeration[ j ].section.c_str() ); } kome::core::NumberRestriction& r0 = child->getNumberRestriction(); kome::core::NumberRestriction& r1 = val->getNumberRestriction(); if( r0.hasExclusiveMinValue() ) { r1.setExclusiveMinValue( r0.getExclusiveMinValue() ); } if( r0.hasExclusiveMaxValue() ) { r1.setExclusiveMaxValue( r0.getExclusiveMaxValue() ); } if( r0.hasInclusiveMinValue() ) { r1.setInclusiveMinValue( r0.getInclusiveMinValue() ); } if( r0.hasInclusiveMaxValue() ) { r1.setInclusiveMaxValue( r0.getInclusiveMaxValue() ); } // parameter kome::plugin::SettingsParam* param = m_params.addParam(); std::string name = child->getName(); if( name.empty() ) { name = FMT( "value%d", i ); } std::string itemName; if( val->getEnumType() == kome::plugin::SettingsValue::ENUM_PLUGIN ) { itemName = val->getEnumKey(); } m_colNames.push_back( std::make_pair( name, itemName ) ); param->setName( name.c_str() ); param->setValue( val ); // form kome::plugin::SettingsForm* form = m_page->addForm(); form->setParam( param ); form->setTitle( name.c_str() ); } } // update list void ListEditPanel::updateList() { // update if( m_valueType & VALUES_ENUM ) { // check list EditCheckGridListCtrl* checkList = (EditCheckGridListCtrl*)m_list; // set std::set< std::string > valSet; for( unsigned int i = 0; i < m_values.size(); i++ ) { valSet.insert( m_values[ i ] ); } // select for( unsigned int i = 0; i < checkList->getNumberOfData(); i++ ) { long long data = checkList->getData( i ); std::string val = getEnumValue( data ); checkList->setSelected( data, ( valSet.find( val ) != valSet.end() ) ); } checkList->Refresh(); } else { // normal list // clear m_list->clearData( false ); m_list->clearDataColor(); // add data for( int i = 0; i < (int)m_values.size(); i++ ) { if( m_values[i].compare( "none" ) != 0 ){ m_list->addData( i, false ); if( m_valueType & VALUES_WITH_COLOR ) { m_list->setDataColor( i, getColor( i ) ); } } } // update m_list->updateList(); } } // update enumeration void ListEditPanel::updateEnumeration( const char* section ) { // get value m_values.clear(); CheckGridListCtrl* checkList = dynamic_cast< CheckGridListCtrl* >( m_list ); if( checkList != NULL ) { std::vector< long long > selectedData; checkList->getSelectedData( selectedData ); for( unsigned int i = 0; i < selectedData.size(); i++ ) { m_values.push_back( m_enumeration[ selectedData[ i ] ].value ); } } // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* val = ( param == NULL ? NULL : param->getValue() ); val = ( val == NULL ? NULL : val->getChildValue( 0 ) ); if( val != NULL ) { m_enumeration.clear(); val->getEnumeration( m_enumeration, section ); } // update list m_list->clearData( false ); for( unsigned int i = 0; i < m_enumeration.size(); i++ ) { m_list->addData( i, false ); } m_list->updateList(); updateList(); // refresh Refresh(); } // process event void ListEditPanel::processEvent() { // parent SettingsPanel* panel = dynamic_cast< SettingsPanel* >( GetParent() ); // event if( panel != NULL ) { panel->processEvent( m_form ); } } // set values void ListEditPanel::setValues( const bool update ) { // manager kome::plugin::PluginManager& plgMgr = kome::plugin::PluginManager::getInstance(); // settings kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); kome::objects::SettingParameterValues settings; m_page->setParameters( settings ); // selected items std::vector< int > items; ListTool::getSelectedItems( m_list, items ); // default value if( update ) { std::vector< std::string > defaultValues; defaultValues.resize( m_colNames.size() ); std::string subParam; for( unsigned int i = 0; i < items.size(); i++ ) { int idx = m_list->getData( items[ i ] ); for( unsigned int j = 0; j < m_colNames.size(); j++ ) { subParam = getValue( idx, j ); std::string tmp = getEnumPluginName( idx, j ); if( i == 0 ) { defaultValues[ j ] = tmp; } else if( tmp.compare( defaultValues[ j ] ) != 0 ) { defaultValues[ j ] = ""; } } } for( unsigned int j = 0; j < m_colNames.size(); j++ ) { settings.setValue( m_colNames[ j ].first.c_str(), defaultValues[ j ].c_str() ); } } // dialog SettingsPageDialog dlg( this, m_page, &settings ); if( dlg.ShowModal() != wxID_OK ) { return; } // value std::string strVal; for( unsigned int j = 0; j < m_colNames.size(); j++ ) { // child value kome::plugin::SettingsValue* childVal = value->getChildValue( j ); // separate if( j > 0 ) { strVal.append( ELEMENT_VALUES_DELIMITER ); } std::string name = m_colNames[ j ].first; std::string itemName = m_colNames[ j ].second; const char* v = settings.getParameterValue( name.c_str() ); std::string val = NVL( v, "" ); bool bflg = false; if( !itemName.empty() ) { kome::plugin::PluginFunctionItem* item = plgMgr.getFunctionItem( itemName.c_str(), v ); if( item != NULL ) { val = item->getShortName(); kome::plugin::SettingsPage* page = item->getSettingsPage(); if( page != NULL ) { kome::objects::SettingParameterValues* subSettings = settings.getSubParameterValues( name.c_str(), v ); std::string subVal = page->getParameterString( *subSettings ); val = FMT( "%s%s", val.c_str(), subVal.c_str() ); } } bflg = true; } else { kome::plugin::SettingsValue::ValueType t = childVal->getType(); if( t == kome::plugin::SettingsValue::TYPE_DIR || t == kome::plugin::SettingsValue::TYPE_EMAIL || t == kome::plugin::SettingsValue::TYPE_INPUT || kome::plugin::SettingsValue::TYPE_OUTPUT || t == kome::plugin::SettingsValue::TYPE_PASSWD || t == kome::plugin::SettingsValue::TYPE_RAWDATA || t == kome::plugin::SettingsValue::TYPE_STRING ) { val = kome::plugin::SettingsValue::convertToSavingString( val.c_str() ); } } // @date 2012.06.14 <Add> M.Izumi int index = val.find_first_of(ELEMENT_VALUES_DELIMITER); if( index != -1 && !bflg ){ val.replace( index, 1, ":" ); } strVal.append( FMT( "[%s]", val.c_str() ) ); } // update if( update ) { // edit for( unsigned int i = 0; i < items.size(); i++ ) { int idx = m_list->getData( items[ i ] ); m_values[ idx ] = strVal; if( m_colorIdx >= 0 ) { m_list->setDataColor( idx, getColor( idx ) ); } } } else { // add int idx = (int)m_values.size(); m_values.push_back( strVal ); m_list->addData( idx, false ); if( m_colorIdx >= 0 ) { m_list->setDataColor( idx, getColor( idx ) ); } } // event processEvent(); } // add files void ListEditPanel::addFiles() { // file index int fileIdx = ( m_colorIdx == 0 ? 1 : 0 ); // file map std::map< std::string, int > fileMap; for( unsigned int i = 0; i < m_values.size(); i++ ) { fileMap[ getValue( i, fileIdx ) ] = (int)i; } // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); if( value == NULL ) { return; } // files std::set< std::string > fileSet; for( unsigned int i = 0; i < m_list->getNumberOfData(); i++ ) { int idx = m_list->getData( i ); std::string path = getValue( idx, fileIdx ); fileSet.insert( path ); } // color std::string clStr; if( m_colorIdx >= 0 ) { clStr = kome::img::ColorTool::getString( m_color ); } // dialog std::vector< std::string > paths; if( value->getChildValue( fileIdx )->getType() == kome::plugin::SettingsValue::TYPE_INPUT ) { wxFileDialog dlg( this, wxT( FILE_IMPORT_CAPTION ), wxEmptyString, wxEmptyString, wxT( "*.*" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE ); if( dlg.ShowModal() == wxID_OK ) { // paths wxArrayString pathArray; dlg.GetPaths( pathArray ); for( unsigned int i = 0; i < pathArray.Count(); i++ ) { paths.push_back( pathArray.Item( i ).c_str() ); } } } else { RawDataFileDialog dlg( this ); if( dlg.ShowModal() == wxID_OK ) { for( unsigned int i = 0; i < dlg.getNumberOfPaths(); i++ ) { std::string p = dlg.getPath( i ); paths.push_back( kome::plugin::SettingsValue::convertToSavingString( p.c_str() ) ); } } } for( unsigned int i = 0; i < paths.size(); i++ ) { std::string path = paths[ i ]; if( fileSet.find( path ) == fileSet.end() ) { // search the map int idx = -1; if( fileMap.find( path ) != fileMap.end() ) { idx = fileMap[ path ]; } // value std::string val = path; if( m_colorIdx == 0 ) { val = FMT( "%s%s[%s]", clStr.c_str(), ELEMENT_VALUES_DELIMITER, path.c_str() ); } else if( m_colorIdx == 1 ) { val = FMT( "[%s]%s%s", path.c_str(), ELEMENT_VALUES_DELIMITER, clStr.c_str() ); } // add if( idx < 0 ) { idx = (int)m_values.size(); m_values.push_back( val ); } else { m_values[ idx ] = val; } m_list->addData( idx, false ); if( m_colorIdx >= 0 ) { m_list->setDataColor( idx, getColor( idx ) ); } fileSet.insert( path ); } } // event if( paths.size() > 0 ) { processEvent(); } } // get selected items void ListEditPanel::getSelectedValues( std::vector< std::string >& values ) { // get from the list if( m_valueType & VALUES_ENUM ) { // checked CheckGridListCtrl* checkedList = (CheckGridListCtrl*)m_list; for( unsigned int i = 0; i < checkedList->getNumberOfData(); i++ ) { long long data = checkedList->getData( i ); if( checkedList->isSelected( data ) ) { values.push_back( getEnumValue( data ) ); } } } else { // normal list for( unsigned int i = 0; i < m_list->getNumberOfData(); i++ ) { if( ListTool::isSelected( m_list, i ) ) { long long data = m_list->getData( i ); values.push_back( m_values[ data ] ); } } } } // on select item void ListEditPanel::onSelectItem() { // Spec No. 86207 Mass++ crashes when adding the default charge in the Simple Charge Detect @date 2012.06.19 <Add> M.Izumi // check the value type if( m_valueType & VALUES_ENUM ) { return; } const long lSelectedItem = m_iSelectedItem; if( m_editButton != NULL ) { m_editButton->Enable(); } if( m_delButton != NULL ) { m_delButton->Enable(); } if( m_upButton != NULL ) { m_upButton->Enable( lSelectedItem > 0 ); } if( m_downButton != NULL ) { m_downButton->Enable( lSelectedItem < (m_list->GetItemCount() - 1 )); } if( m_valueType == ( VALUES_FILE | VALUES_WITH_COLOR ) && m_colorButton != NULL ) { m_colorButton->Enable(); } } // on double-click item void ListEditPanel::onDoubleClickItem() { } // create main sizer wxSizer* ListEditPanel::createMainSizer() { // sizer wxSizer* sizer = NULL; if( m_titleFlg ) { sizer = new wxStaticBoxSizer( wxVERTICAL, this, wxT( m_form == NULL ? "" : m_form->getTitle() ) ); } else { sizer = new wxBoxSizer( wxVERTICAL ); } wxSizer* buttonSizer = createButtonSizer(); wxFlexGridSizer* innerSizer = new wxFlexGridSizer( ( buttonSizer == NULL ? 1 : 2 ), 1, 0, 0 ); innerSizer->AddGrowableRow( 0 ); innerSizer->AddGrowableCol( 0 ); // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); if( value == NULL || m_colNames.size() == 0 ) { return sizer; } // list wxWindow* wnd = NULL; if( m_valueType == VALUES_ENUM ) { CheckGridListPanel* panel = NULL; if( getEnumSize() > ALL_BUTTON_CNT ) { if (m_hideAllCheckbox) { panel = new CheckGridListPanel( this, wxID_ANY, CheckGridListPanel::BOTTOM_ALL, "" ); } else { panel = new CheckGridListPanel( this, wxID_ANY, CheckGridListPanel::BOTTOM_ALL ); } panel->setDescription( m_form->getDesc() ); panel->setImageFilePath( m_form->getImageFilePath() ); } m_list = new EditCheckGridListCtrl( panel == NULL ? (wxWindow*)this : (wxWindow*)panel ); wnd = ( panel == NULL ? (wxWindow*)m_list : (wxWindow*)panel ); } else { // Context Menu m_listEditGridListCtrl = new EditGridListCtrl( this, m_singleSel ); m_list = (GridListCtrl*) m_listEditGridListCtrl; wnd = m_list; std::string strEditMenuName = m_form->getEditMenuName(); // Context Menu std::string strAddMenuName = m_form->getAddMenuName(); bool flgUpDown = m_form->hasUpDownMenuItem(); EditGridListCtrl* ptrEditGridListCtrl = (EditGridListCtrl*)m_listEditGridListCtrl; // Context Menu int nPopupMenuFlags = 0; if( m_form->hasEditMenuItem() ){ nPopupMenuFlags |= POPUP_EDIT; ptrEditGridListCtrl->setEditMenuName( strEditMenuName ); } if( m_form->hasAddMenuItem() ){ nPopupMenuFlags |= POPUP_ADD; ptrEditGridListCtrl->setAddMenuName( strAddMenuName ); } if( m_form->hasUpDownMenuItem() ){ ptrEditGridListCtrl->setUpDown( flgUpDown ); nPopupMenuFlags |= POPUP_UP; // 必要? nPopupMenuFlags |= POPUP_DOWN; // 必要? } if( m_form->hasDeleteMenuItem() ){ nPopupMenuFlags |= POPUP_DELETE; } if( m_form->hasCopyMenuItem() ){ nPopupMenuFlags |= POPUP_COPY; } if( m_form->hasSaveAllMenuItem() ){ nPopupMenuFlags |= POPUP_SAVE; } if( m_form->hasSelectAllMenuItem() ){ nPopupMenuFlags |= POPUP_SELECT; nPopupMenuFlags |= POPUP_DESELECT; } if( m_form->hasFilterMenuItem() ){ nPopupMenuFlags |= POPUP_FILTER; } ptrEditGridListCtrl->setPopupMenuFlag( nPopupMenuFlags ); } if( m_list != NULL ) { m_list->create(); } innerSizer->Add( wnd, 1, wxALL | wxGROW, 0 ); // button sizer if( buttonSizer != NULL ) { innerSizer->Add( buttonSizer, 0, wxBOTTOM | wxLEFT, BORDER_SIZE ); } sizer->Add( innerSizer, 1, wxALL | wxGROW, 0 ); return sizer; } // create button sizer wxSizer* ListEditPanel::createButtonSizer() { // check the value type if( m_valueType & VALUES_ENUM ) { return NULL; } // sizer wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL ); // add button wxBitmap addBmp( list_add16x16_xpm ); m_addButton = new wxBitmapButton( this, ID_ADD_BUTTON, addBmp ); m_addButton->SetToolTip("Add new item"); sizer->Add( m_addButton, 0, wxALIGN_CENTER_VERTICAL, BORDER_SIZE ); // edit button if( !( m_valueType & VALUES_FILE ) ) { wxBitmap editBmp( list_edit16x16_xpm ); m_editButton = new wxBitmapButton( this, ID_EDIT_BUTTON, editBmp ); m_editButton->SetToolTip("Edit selected item"); wxBitmap editDisableBmp( item_edit_disabled16x16_xpm ); m_editButton->SetBitmapDisabled( editDisableBmp ); m_editButton->Enable( false ); sizer->Add( m_editButton, 0, wxALIGN_CENTER_VERTICAL, BORDER_SIZE ); } // delete button wxBitmap delBmp( list_del16x16_xpm ); m_delButton = new wxBitmapButton( this, ID_DEL_BUTTON, delBmp ); m_delButton->SetToolTip("Delete selected item"); wxBitmap delDisableBmp( list_del_disabled16x16_xpm ); m_delButton->SetBitmapDisabled( list_del_disabled16x16_xpm ); m_delButton->Enable( false ); sizer->Add( m_delButton, 0, wxALIGN_CENTER_VERTICAL, BORDER_SIZE ); sizer->AddSpacer( BUTTON_SPACE ); // up button wxBitmap upBmp( list_up16x16_xpm ); m_upButton = new wxBitmapButton( this, ID_UP_BUTTON, upBmp ); m_upButton->SetToolTip("Move selected item up"); wxBitmap upDisableBmp( list_up_disabled16x16_xpm ); m_upButton->SetBitmapDisabled( upDisableBmp ); m_upButton->Enable( false ); sizer->Add( m_upButton, 0, wxALIGN_CENTER_VERTICAL, BORDER_SIZE ); // down button wxBitmap dwnBmp( list_down16x16_xpm ); m_downButton = new wxBitmapButton( this, ID_DOWN_BUTTON, dwnBmp ); m_downButton->SetToolTip("Move selected item down"); wxBitmap dwnDisableBmp( list_down_disabled16x16_xpm ); m_downButton->SetBitmapDisabled( dwnDisableBmp ); m_downButton->Enable( false ); sizer->Add( m_downButton, 0, wxALIGN_CENTER_VERTICAL, BORDER_SIZE ); // color button if( m_valueType == ( VALUES_FILE | VALUES_WITH_COLOR ) ) { sizer->AddSpacer( BUTTON_SPACE ); wxBitmap clBmp( list_color16x16_xpm ); m_colorButton = new wxBitmapButton( this, ID_COLOR_BUTTON, clBmp ); wxBitmap clDisableBmp( setting_color_disabled16x16_xpm ); m_colorButton->SetBitmapDisabled( clDisableBmp ); m_colorButton->Enable( false ); sizer->Add( m_colorButton, 0, wxALIGN_CENTER_VERTICAL, BORDER_SIZE ); } // import button m_importButton = new wxButton( this, ID_IMPORT_BUTTON, wxT( "Import..." ) ); sizer->Add( m_importButton, 0, wxALIGN_CENTER_VERTICAL, BORDER_SIZE ); // export button m_exportButton = new wxButton( this, ID_EXPORT_BUTTON, wxT( "Export..." ) ); sizer->Add( m_exportButton, 0, wxALIGN_CENTER_VERTICAL, BORDER_SIZE ); return sizer; } // get help std::string ListEditPanel::getDescription( wxWindow* wnd ) { // description std::string ret = ( m_form == NULL ? "" : m_form->getDesc() ); return ret; } // get image file path std::string ListEditPanel::getImageFilePath( wxWindow* wnd ) { std::string ret; return ret; } // data -> window bool ListEditPanel::TransferDataToWindow() { // default if( !HelpGetterPanel::TransferDataToWindow() ) { return false; } // list if( m_valueType & VALUES_ENUM ) { // check list // initialize CheckGridListCtrl* checkList = (CheckGridListCtrl*)m_list; checkList->deselectAll(); // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); value = ( value == NULL ? NULL : value->getChildValue( 0 ) ); if( value != NULL ) { // value set std::set< std::string > valueSet; for( unsigned int i = 0; i < m_values.size(); i++ ) { valueSet.insert( m_values[ i ] ); } // select for( unsigned int i = 0; i < m_enumeration.size(); i++ ) { std::string val = m_enumeration[ i ].value; checkList->setSelected( i, ( valueSet.find( val ) != valueSet.end() ) ); } } } else { // normal list updateList(); } return true; } // window -> data bool ListEditPanel::TransferDataFromWindow() { // default if( !HelpGetterPanel::TransferDataFromWindow() ) { return false; } // list if( m_valueType & VALUES_ENUM ) { // check list CheckGridListCtrl* checkList = (CheckGridListCtrl*)m_list; // clear m_values.clear(); // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); value = ( value == NULL ? NULL : value->getChildValue( 0 ) ); if( value != NULL ) { // get selection for( unsigned int i = 0; i < m_enumeration.size(); i++ ) { if( checkList->isSelected( i ) ) { m_values.push_back( m_enumeration[ i ].value ); } } } } else { // normal list // displayed data std::vector< std::string > values; for( unsigned int i = 0; i < m_list->getNumberOfData(); i++ ) { int idx = m_list->getData( i ); values.push_back( m_values[ idx ] ); } // update m_values.clear(); for( unsigned int i = 0; i < values.size(); i++ ) { m_values.push_back( values[ i ] ); } } return true; } // on add void ListEditPanel::onAdd( wxCommandEvent& evt ) { // deselect all ListTool::unselectAll( m_list ); // add if( m_valueType & VALUES_FILE ) { addFiles(); } else { setValues( false ); } // update m_list->updateList(); // Automatically select the last item added. if (m_list->getNumberOfData() > 0) { ListTool::selectItem( m_list, m_list->getNumberOfData() - 1 ); } m_list->Refresh(); } // on edit double click void ListEditPanel::onEditDoubleClick( wxListEvent& evt ){ wxCommandEvent evtDummy; onEdit( evtDummy ); } // on edit void ListEditPanel::onEdit( wxCommandEvent& evt ) { // edit setValues( true ); // selected items std::vector< int > items; ListTool::getSelectedItems( m_list, items ); ListTool::unselectAll( m_list ); // update m_list->updateList(); for( unsigned int i = 0; i < items.size(); i++ ) { ListTool::selectItem( m_list, items[ i ] ); } m_list->Refresh(); } // remove value void ListEditPanel::removeValue( const long long data ){ if( m_values.size() < data ){ return; } m_values.erase( m_values.begin() + data ); // @date 2012.06.28 <Add> M.Izumi } // on delete void ListEditPanel::onDelete( wxCommandEvent& evt ) { // selected items std::vector< int > items; ListTool::getSelectedItems( m_list, items ); ListTool::unselectAll( m_list ); int iItemToSelect = 999999; // delete for( int i = (int)items.size() - 1; i >= 0; i-- ) { // Set iItemToSelect to the index of the first item selected. if ( items[ i ] < iItemToSelect) { iItemToSelect = items[ i ]; } m_list->deleteData( iItemToSelect, false ); // @date 2012.12.17 <Mod> M.Izumi } updateList(); // After a deletion, select the item at the same position, or the last item. if (iItemToSelect > m_list->GetItemCount() - 1) { iItemToSelect = m_list->GetItemCount() - 1; } if (iItemToSelect >= 0) { ListTool::selectItem( m_list, iItemToSelect ); } // update m_list->Refresh(); // event processEvent(); } // on up void ListEditPanel::onUp( wxCommandEvent& evt ) { // get the selection std::vector< int > items; ListTool::getSelectedItems( m_list, items ); m_list->deselectAll(); // move int prev = (int)m_list->getNumberOfData(); for( int i = (int)items.size() - 1; i >= 0; i-- ) { // index int idx0 = items[ i ]; int idx1 = idx0 - 1; // move if( idx1 == prev ) { // cannot move prev = idx0; } else { m_list->swapData( idx0, idx1, false ); items[ i ] = idx1; prev = idx1; } } // update m_list->updateList(); // selection for( unsigned int i = 0; i < items.size(); i++ ) { ListTool::selectItem( m_list, items[ i ] ); } m_list->Refresh(); // event processEvent(); } // on down void ListEditPanel::onDown( wxCommandEvent& evt ) { // get the selection std::vector< int > items; ListTool::getSelectedItems( m_list, items ); m_list->deselectAll(); // move int prev = (int)m_list->getNumberOfData(); for( int i = (int)items.size() - 1; i >= 0; i-- ) { // index int idx0 = items[ i ]; int idx1 = idx0 + 1; // move if( idx1 == prev ) { // cannot move prev = idx0; } else { m_list->swapData( idx0, idx1, false ); items[ i ] = idx1; prev = idx1; } } // update m_list->updateList(); // selection for( unsigned int i = 0; i < items.size(); i++ ) { ListTool::selectItem( m_list, items[ i ] ); } m_list->Refresh(); // event processEvent(); } // on color void ListEditPanel::onColor( wxCommandEvent& evt ) { // get color wxColourDialog dlg( this ); if( dlg.ShowModal() != wxID_OK ) { return; } wxColour colour = dlg.GetColourData().GetColour(); m_color = kome::img::ColorTool::getColor( colour.Red(), colour.Green(), colour.Blue() ); std::string clStr = kome::img::ColorTool::getString( m_color ); // selected items std::vector< int > items; ListTool::getSelectedItems( m_list, items ); ListTool::unselectAll( m_list ); if( items.size() == 0 ) { return; } // column int clCol = m_colorIdx; int pathCol = ( clCol == 0 ? 1 : 0 ); // edit value for( unsigned int i = 0; i < items.size(); i++ ) { int idx = m_list->getData( items[ i ] ); std::string path = getValue( idx, pathCol ); std::string value; if( clCol == 0 ) { value = FMT( "%s%s[%s]", clStr.c_str(), ELEMENT_VALUES_DELIMITER, path.c_str() ); } else { value = FMT( "[%s]%s%s", path.c_str(), ELEMENT_VALUES_DELIMITER, clStr.c_str() ); } m_values[ idx ] = value; m_list->setDataColor( idx, m_color ); } // update m_list->updateList(); for( unsigned int i = 0; i < items.size(); i++ ) { ListTool::selectItem( m_list, items[ i ] ); } m_list->Refresh(); // event processEvent(); } // on import void ListEditPanel::onImport( wxCommandEvent& evt ){ // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); if( value == NULL ) { return; } wxFileDialog dlg( this, wxT( FILE_IMPORT_CAPTION ), wxEmptyString, wxEmptyString, wxT( "*.txt" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE ); std::vector< std::string > paths; if( dlg.ShowModal() == wxID_OK ){ // paths wxArrayString pathArray; dlg.GetPaths( pathArray ); for( unsigned int i = 0; i < pathArray.Count(); i++ ) { paths.push_back( pathArray.Item( i ).c_str() ); } } std::string msg; for( unsigned int i = 0; i < paths.size() && msg.empty(); i++ ) { FILE* fp = fileopen( paths[ i ].c_str(), "r" ); if( fp == NULL ){ return; } // buffer char buff[ 4096 ]; while( fgets( buff, sizeof(buff), fp ) != NULL && msg.empty() ){ std::vector< std::string > tmp; stringtoken( buff, "\t", tmp ); std::string v; for( unsigned int i = 0; i < value->getNumberOfChildValues(); i++ ) { kome::plugin::SettingsValue* childVal = value->getChildValue( i ); std::string val = ( i < tmp.size() ? tmp[ i ] : "" ); std::string name = childVal->getName(); if( name.empty() ) { name = FMT( "Value%d", i ); } msg = childVal->checkValue( val.c_str(), name.c_str(), childVal->isRequired() ); if( !v.empty() ) { v.append( ":" ); } val = FMT( "[%s]", val.c_str() ); v.append( val ); } if( msg.empty() ) { m_values.push_back( v ); } } // close fclose( fp ); } updateList(); // error message if( !msg.empty() ) { kome::window::WindowTool::showInfo( msg.c_str() ); } // event if( paths.size() > 0 ) { processEvent(); } } // on export void ListEditPanel::onExport( wxCommandEvent& evt ){ wxFileDialog dialog( kome::window::WindowTool::getMainWindow(), wxT( FILE_EXPORT_CAPTION ), wxEmptyString, wxEmptyString, wxT( "*.txt" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dialog.ShowModal() == wxID_OK ) { // get path std::string strPath = dialog.GetPath(); // save FILE* fp = fileopen( strPath.c_str(), "w" ); if( fp == NULL ){ return; } std::string str = kome::plugin::SettingsValue::removeOuterBracket( getValue().c_str() ); std::vector< std::string > tokens; kome::plugin::SettingsValue::separateListValue( str.c_str(), tokens ); std::string s; for( unsigned int i=0; i < tokens.size(); i++ ){ std::string line = kome::plugin::SettingsValue::removeOuterBracket( tokens[ i ].c_str() ); std::vector< std::string > elms; kome::plugin::SettingsValue::separateListValue( line.c_str(), elms ); for( unsigned int j = 0; j < elms.size(); j++ ) { std::string elm = kome::plugin::SettingsValue::removeOuterBracket( elms[ j ].c_str() ); if( j > 0 ) { fprintf( fp, "\t" ); } fprintf( fp, "%s", elm.c_str() ); } fprintf( fp, "\n" ); } // close fflush( fp ); fclose( fp ); } // event processEvent(); } // update selection void ListEditPanel::onUpdateSelection( wxUpdateUIEvent& evt ) { // get the selection std::vector< int > items; ListTool::getSelectedItems( m_list, items ); // update evt.Enable( items.size() > 0 ); } // on list item selected void ListEditPanel::onListItemsSelected( wxListEvent& evt ) { m_iSelectedItem = evt.GetIndex(); // check the color if( m_colorIdx >= 0 ) { // selected items std::vector< int > items; ListTool::getSelectedItems( m_list, items ); // get color COLOR color = kome::img::ColorTool::BLACK; bool flg = true; for( unsigned int i = 0; i < items.size() && flg; i++ ) { int idx = m_list->getData( items[ i ] ); COLOR c = getColor( idx ); if( i == 0 ) { color = c; } else if( flg && c != color ) { flg = false; color = kome::img::ColorTool::BLACK; } } // set the button color m_color = color; } // select onSelectItem(); // event processEvent();//@date 2013.03.28 <Add> M.Izumi } // on list item double-clicked void ListEditPanel::onListItemDoubleClicked( wxListEvent& evt ) { onDoubleClickItem(); } // remove brackets std::string ListEditPanel::removeBrackets( const char* s ) { // string std::string str = NVL( s, "" ); // count int commaCnt = 0; for( unsigned int i = 0; i < str.length(); i++ ) { if( str[ i ] == ',' ) { commaCnt += 1; } } // separate str = kome::plugin::SettingsValue::removeOuterBracket( str.c_str() ); std::vector< std::string > vals; kome::plugin::SettingsValue::separateListValue( str.c_str(), vals ); int commaCnt2 = 0; for( unsigned int i = 0; i < vals.size(); i++ ) { std::string val = vals[ i ]; for( unsigned int j = 0; j < val.length(); j++ ) { if( val[ j ] == ',' ) { commaCnt2 += 1; } } } // return value std::string ret ; for( unsigned int i = 0; i < vals.size(); i++ ) { if( !ret.empty() ) { if( commaCnt2 < commaCnt ) { ret.append( "," ); } else { ret.append( ":" ); } } std::string val = vals[ i ]; if( vals.size() > 1 ) { val = removeBrackets( val.c_str() ); } ret.append( val ); } if( vals.size() > 1 ) { ret = FMT( "[%s]", ret.c_str() ); } return ret; } // gets the enumeration plug-in name std::string ListEditPanel::getEnumPluginName( const unsigned int listIdx, const unsigned int elmIdx ){ // return value std::string ret; // value kome::plugin::SettingsParam* param = ( m_form == NULL ? NULL : m_form->getParam() ); kome::plugin::SettingsValue* value = ( param == NULL ? NULL : param->getValue() ); // check the list index if( listIdx >= m_values.size() ) { return ret; } // separate std::vector< std::string > vals; kome::plugin::SettingsValue::separateListValue( m_values[ listIdx ].c_str(), vals ); if( elmIdx < vals.size() ) { ret = vals[ elmIdx ]; } // function item if( value != NULL ) { kome::plugin::SettingsValue* subVal = value->getChildValue( elmIdx ); if( subVal != NULL && subVal->getEnumType() == kome::plugin::SettingsValue::ENUM_PLUGIN ) { std::string itemType = subVal->getEnumKey(); std::string itemName = ret; std::string::size_type pos = ret.find( "[" ); if( pos != ret.npos ) { itemName = ret.substr( 0, pos ); } ret = itemName; } } return ret; } // // EditGridListCtrl // BEGIN_EVENT_TABLE( EditGridListCtrl, GridListCtrl ) END_EVENT_TABLE() // constructor EditGridListCtrl::EditGridListCtrl( wxWindow* parent, const bool singleSel ) : GridListCtrl( parent, ID_LIST_CTRL, LIST_WIDTH, LIST_HEIGHT, false, true, singleSel ) { // initialize m_panel = dynamic_cast< ListEditPanel* >( parent ); // Context Menu m_strEditMenuName = ""; /** name of the Edit menu */ m_strAddMenuName = "Add"; /** name of the Add menu */ m_flgUpDown = false; /** up-down menu exists or not */ } // destructor EditGridListCtrl::~EditGridListCtrl() { } // on create void EditGridListCtrl::onCreate() { // columns int num = (int)( m_panel == NULL ? 0 : m_panel->getNumberOfColumns() ); int colorIdx = m_panel->getColorIndex(); for( int i = 0; i < num; i++ ) { if( i != colorIdx ) { // type kome::plugin::SettingsValue::ValueType valType = m_panel->getColumnType( i ); GridListCtrl::ColumnDataType type = GridListCtrl::TYPE_STRING; if( valType == kome::plugin::SettingsValue::TYPE_INT ) { type = GridListCtrl::TYPE_UINT; } else if( valType == kome::plugin::SettingsValue::TYPE_DOUBLE ) { type = GridListCtrl::TYPE_UDOUBLE; } // add addColumn( m_panel->getColumnName( i ), type ); } } } // get int value int EditGridListCtrl::getInt( const long long data, const int column ) const { // return value int val = -1; // column number int colorIdx = m_panel->getColorIndex(); int col = column; if( colorIdx >= 0 && column >= colorIdx ) { col = column + 1; } // value val = m_panel->getIntValue( data, col ); return val; } // get double value double EditGridListCtrl::getDouble( const long long data, const int column ) const { // return value double val = -1.0; // column number int colorIdx = m_panel->getColorIndex(); int col = column; if( colorIdx >= 0 && column >= colorIdx ) { col = column + 1; } // value val = m_panel->getDoubleValue( data, col ); return val; } // get string std::string EditGridListCtrl::getString( const long long data, const int column ) const { // return value std::string val; // column number int colorIdx = m_panel->getColorIndex(); int col = column; if( colorIdx >= 0 && column >= colorIdx ) { col = column + 1; } // value val = m_panel->getValue( data, col ); return val; } // The name of the Edit menu is set. The Edit menu is not displayed when a null character is set. void EditGridListCtrl::setEditMenuName( std::string strEditMenuName ){ m_strEditMenuName = strEditMenuName; }; // This function gets the name of the Edit menu. std::string EditGridListCtrl::getEditMenuName( void ){ return m_strEditMenuName; }; // The name of the Add menu is set. The Add menu is not displayed when a null character is set. void EditGridListCtrl::setAddMenuName( std::string strAddMenuName ){ m_strAddMenuName = strAddMenuName; }; // This function gets the name of the Add menu. std::string EditGridListCtrl::getAddMenuName( void ){ return m_strAddMenuName; }; // This function set whether a up-down menu exists or not. void EditGridListCtrl::setUpDown( bool flgUpDown ){ m_flgUpDown = flgUpDown; }; // This function returns whether a up-down menu exists or not. bool EditGridListCtrl::canUpDown( void ){ return m_flgUpDown; }; // create menu wxMenu* EditGridListCtrl::createMenu() { // menu wxMenu* menu = NULL; size_t uiInsertLocation = 0; int nSelectedItemCount = GetSelectedItemCount(); // リストで項目が何個選択されているかを返す // リストで項目が1個も選択されていない場合は Add に相当するメニューのみを表示する if(nSelectedItemCount == 0){ // Add に相当するメニューのみを表示 menu = new wxMenu(); }else{ menu = GridListCtrl::createMenu(); // 親クラスのcreateMenu()を呼び出し } bool flgMenuDisp=false; // menuを1項目でもセットしたらtrue。SEPARATOR表示判別用。 if(nSelectedItemCount == 0){ // Add に相当するメニューのみを表示 }else{ if( getActivateName().empty() ){ ; // 文字列が指定されていない uiInsertLocation = 0; }else{ // 文字列が指定されています->先頭に特別menuがある uiInsertLocation = 2; } } if(nSelectedItemCount == 0){ // Add に相当するメニューのみを表示 }else{ // EDIT if( getEditMenuName().empty() ){ // EDIT menu 表示しない }else{ menu->Insert( uiInsertLocation, ID_EDIT_BUTTON, wxT( getPopupMenuName(POPUP_EDIT).c_str() ) ); uiInsertLocation++; flgMenuDisp = true; } // SEPARATOR ////////////////////////////// if( flgMenuDisp ){ menu->InsertSeparator( uiInsertLocation ); uiInsertLocation++; flgMenuDisp = false; } } // Add or New if( getAddMenuName().empty() ){ // ADD menu 表示しない }else{ menu->Insert( uiInsertLocation, ID_ADD_BUTTON, wxT( getPopupMenuName(POPUP_ADD).c_str() ) ); uiInsertLocation++; flgMenuDisp = true; } if(nSelectedItemCount == 0){ // Add に相当するメニューのみを表示 }else{ // SEPARATOR ////////////////////////////// if( flgMenuDisp ){ menu->InsertSeparator( uiInsertLocation ); uiInsertLocation++; flgMenuDisp = false; } // UP/DOWN if( canUpDown() ){ // UP/DOWN menu 表示する menu->Insert( uiInsertLocation, ID_UP_BUTTON, wxT( getPopupMenuName(POPUP_UP).c_str() ) ); uiInsertLocation++; menu->Insert( uiInsertLocation, ID_DOWN_BUTTON, wxT( getPopupMenuName(POPUP_DOWN).c_str() ) ); uiInsertLocation++; flgMenuDisp = true; }else{ ; // UP/DOWN menu 表示しない } // SEPARATOR ////////////////////////////// if( flgMenuDisp ){ menu->InsertSeparator( uiInsertLocation ); uiInsertLocation++; flgMenuDisp = false; } } return menu; } // on context menu void EditGridListCtrl::onContextMenu( wxContextMenuEvent& evt ){ GridListCtrl::onContextMenu( evt ); } // get popup menu name std::string EditGridListCtrl::getPopupMenuName( PopupMenuFlg flgPopupMenu ){ std::string strPopupMenuName; switch( flgPopupMenu ){ case POPUP_DELETE: strPopupMenuName = "&Delete"; break; case POPUP_COPY: strPopupMenuName = "&Copy"; break; case POPUP_SAVE: strPopupMenuName = "&Save All..."; break; case POPUP_SELECT: strPopupMenuName = "Select &All"; break; case POPUP_DESELECT: strPopupMenuName = "&Deselect All"; break; case POPUP_FILTER: strPopupMenuName = "&Filter...\t(Ctrl+F)"; break; case POPUP_ADD: strPopupMenuName = getAddMenuName(); break; case POPUP_UP: strPopupMenuName = "&Up"; break; case POPUP_DOWN: strPopupMenuName = "&Down"; break; case POPUP_EDIT: strPopupMenuName = getEditMenuName(); break; default: break; }; return strPopupMenuName; }; // @date 2012/12/05 <Add> OKADA -------> // Context menu // on delete data bool EditGridListCtrl::onDeleteData( const long long data ) { m_panel->removeValue( getData( data ) ); m_panel->updateList(); return false; } // @date 2012/12/05 <Add> OKADA <------- // // EditCheckGridListCtrl // BEGIN_EVENT_TABLE( EditCheckGridListCtrl, CheckGridListCtrl ) END_EVENT_TABLE() // constructor EditCheckGridListCtrl::EditCheckGridListCtrl( wxWindow* parent ) : CheckGridListCtrl( parent, ID_LIST_CTRL, LIST_WIDTH, LIST_HEIGHT, false ) { // initialize m_panel = NULL; if( parent != NULL ) { m_panel = dynamic_cast< ListEditPanel* >( parent ); if( m_panel == NULL ) { m_panel = dynamic_cast< ListEditPanel* >( parent->GetParent() ); } } } // destructor EditCheckGridListCtrl::~EditCheckGridListCtrl() { } // on create void EditCheckGridListCtrl::onCreate() { // column addColumn( m_panel->getColumnName( 0 ), GridListCtrl::TYPE_STRING ); // data for( unsigned int i = 0; i < m_panel->getEnumSize(); i++ ) { addData( i, false ); } } // get string std::string EditCheckGridListCtrl::getString( const long long data, const int column ) const { // return value std::string val = m_panel->getEnumName( data ); return val; }
da5da1e5d07bec4f3df500b6482652d6e6990625
4470864361a86773c4526276eecd83bc2b9d3a79
/BallCatcher/Circle.cpp
4cdcd6f7fe44f6764e8a77fae0b8a0939af45eef
[]
no_license
ParimalPatel1/BallCatcher
c24d4441bdee8defecc345ae2f227e8ed2c4dd3b
dcb05617402e069e5c910941d946be71014933d4
refs/heads/master
2021-01-22T09:55:58.031195
2016-02-12T00:53:10
2016-02-12T00:53:10
37,103,692
0
0
null
null
null
null
UTF-8
C++
false
false
6,028
cpp
Circle.cpp
// Circle.cpp: implementation of the Circle class. // ////////////////////////////////////////////////////////////////////// #include "Circle.hpp" using namespace cv; using namespace std; #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// Circle::Circle() { this->m_dRadius=-1; // error checking } Circle::~Circle() { } Circle::Circle(vector<Point> pointlist) { if (pointlist.size() < 3) // need 3 or more points to create a circle for this method { this->~Circle(); // this proper way to exit constructor?? destruct externally? return; } points = pointlist; // does this copy or is by reference?? if (this->IsPerpendicular(points) >= 0) this->CalcCircle(points); else { //this proper way to exit constructor ?? this->m_dRadius = -1; return; } } Circle::Circle(Point &V1, Point &V2, Point &V3) { this->m_dRadius=-1; // error checking Point pt1 = Point(V1.x, V1.y); Point pt2 = Point(V2.x, V2.y); Point pt3 = Point(V3.x, V3.y); if (!this->IsPerpendicular(pt1, pt2, pt3) ) this->CalcCircle(pt1, pt2, pt3); else if (!this->IsPerpendicular(pt1, pt3, pt2) ) this->CalcCircle(pt1, pt3, pt2); else if (!this->IsPerpendicular(pt2, pt1, pt3) ) this->CalcCircle(pt2, pt1, pt3); else if (!this->IsPerpendicular(pt2, pt3, pt1) ) this->CalcCircle(pt2, pt3, pt1); else if (!this->IsPerpendicular(pt3, pt2, pt1) ) this->CalcCircle(pt3, pt2, pt1); else if (!this->IsPerpendicular(pt3, pt1, pt2) ) this->CalcCircle(pt3, pt1, pt2); else { // TRACE("\nThe three pts are perpendicular to axis\n"); // pt1->trace(); pt2->trace(); pt3->trace(); //delete pt1; delete pt2; delete pt3; this->m_dRadius=-1; return ; } // delete pt1; delete pt2; delete pt3; } // returns point and the next if they are perindicular, otherwise, return -1 if no perpindicular points int Circle::IsPerpendicular(vector<Point> points) { double yDelta = 0; double xDelta = 0; int i; for (i = 0; i < points.size() - 1; i++) { yDelta = points[i + 1].y - points[i].y; xDelta = points[i + 1].x - points[i].x; if (fabs(yDelta) <= 0.0000001 || fabs(xDelta) <= 0.0000001) {return i;} } return -1;// not } bool Circle::IsPerpendicular(Point &pt1, Point &pt2, Point &pt3) // Check the given point are perpendicular to x or y axis { double yDelta_a= pt2.y - pt1.y; double xDelta_a= pt2.x - pt1.x; double yDelta_b= pt3.y - pt2.y; double xDelta_b= pt3.x - pt2.x; // TRACE(" yDelta_a: %f xDelta_a: %f \n",yDelta_a,xDelta_a); // TRACE(" yDelta_b: %f xDelta_b: %f \n",yDelta_b,xDelta_b); // checking whether the line of the two pts are vertical if (fabs(xDelta_a) <= 0.000000001 && fabs(yDelta_b) <= 0.000000001){ //TRACE("The points are pependicular and parallel to x-y axis\n"); return false; } if (fabs(yDelta_a) <= 0.0000001){ // TRACE(" A line of two point are perpendicular to x-axis 1\n"); return true; } else if (fabs(yDelta_b) <= 0.0000001){ // TRACE(" A line of two point are perpendicular to x-axis 2\n"); return true; } else if (fabs(xDelta_a)<= 0.000000001){ // TRACE(" A line of two point are perpendicular to y-axis 1\n"); return true; } else if (fabs(xDelta_b)<= 0.000000001){ // TRACE(" A line of two point are perpendicular to y-axis 2\n"); return true; } else return false ; } double Circle::CalcCircle(vector<Point> points) { double yDelta_a = 0; double xDelta_a = 0; double yDelta_b = 0; double xDelta_b = 0; Point pt1, pt2, pt3; /// for every circle, check if it has an 'orignal' center/radius, if it is orginal add it to the circle list, if not orginal, bump for (int i = 0; i < points.size() - 2; i++) { pt1 = points[i]; pt2 = points[i + 1]; pt3 = points[i + 2]; yDelta_a = pt2.y - pt1.y; xDelta_a = pt2.x - pt1.x; yDelta_b = pt3.y - pt2.y; xDelta_b = pt3.x - pt2.x; // CASE 1:: if (fabs(xDelta_a) <= 0.000000001 && fabs(yDelta_b) <= 0.000000001) { this->m_Center.x = 0.5*(pt2.x + pt3.x); this->m_Center.y = 0.5*(pt1.y + pt2.y); this->m_dRadius = cv::norm(m_Center - pt1); // calc. radius return this->m_dRadius; } // IsPerpendicular() assure that xDelta(s) are not zero // CASE 2:: double aSlope = yDelta_a / xDelta_a; // double bSlope = yDelta_b / xDelta_b; if (fabs(aSlope - bSlope) <= 0.000000001) { // checking whether the given points are colinear. return -1; } // calc center this->m_Center.x = (aSlope*bSlope*(pt1.y - pt3.y) + bSlope*(pt1.x + pt2.x) - aSlope*(pt2.x + pt3.x)) / (2 * (bSlope - aSlope)); this->m_Center.y = -1 * (m_Center.x - (pt1.x + pt2.x) / 2) / aSlope + (pt1.y + pt2.y) / 2; this->m_dRadius = cv::norm(m_Center - points[i]); // calc. radius } return this->m_dRadius; } double Circle::CalcCircle(Point &pt1, Point &pt2, Point &pt3) { double yDelta_a= pt2.y - pt1.y; double xDelta_a= pt2.x - pt1.x; double yDelta_b= pt3.y - pt2.y; double xDelta_b= pt3.x - pt2.x; if (fabs(xDelta_a) <= 0.000000001 && fabs(yDelta_b) <= 0.000000001){ this->m_Center.x= 0.5*(pt2.x + pt3.x); this->m_Center.y= 0.5*(pt1.y + pt2.y); this->m_dRadius= cv::norm(m_Center - pt1); // calc. radius return this->m_dRadius; } // IsPerpendicular() assure that xDelta(s) are not zero double aSlope=yDelta_a/xDelta_a; // double bSlope=yDelta_b/xDelta_b; if (fabs(aSlope-bSlope) <= 0.000000001){ // checking whether the given points are colinear. //TRACE("The three pts are colinear\n"); return -1; } // calc center this->m_Center.x= (aSlope*bSlope*(pt1.y - pt3.y) + bSlope*(pt1.x + pt2.x)- aSlope*(pt2.x+pt3.x) )/(2* (bSlope-aSlope) ); this->m_Center.y = -1*(m_Center.x - (pt1.x+pt2.x)/2)/aSlope + (pt1.y+pt2.y)/2; this->m_dRadius= cv::norm(m_Center - pt1); // calc. radius return this->m_dRadius; } Point Circle::GetCenter() { return this->m_Center; } double Circle::GetRadius() { return this->m_dRadius; }
fe4d55ec8a79f3648901fc75c083c20f819d0591
ad229db0a318a7e699640cc610773f90f29abe87
/playfield.h
e1a5a98c48418edc6f4e1f49a1062710d6d98fa5
[]
no_license
theCodeBench/csc300-MonsterDash
74cfe472164549e49b55c524eeacd1c3672a4b71
567f13cff70aff9a6ec9e65f0421a2442476f8d6
refs/heads/master
2020-04-15T19:04:24.481891
2019-01-09T20:57:19
2019-01-09T20:57:19
164,936,659
0
0
null
null
null
null
UTF-8
C++
false
false
828
h
playfield.h
#ifndef __PLAYFIELD_H #define __PLAYFIELD_H #include <iostream> #include <string> #include "site.h" using namespace std; class Playfield { bool **Room; // is v-w a room site? bool **Corridor; // is v-w a corridor site? int N; // dimension of dungeon Site* playerSite; Site* monsterSite; public: Playfield(char **board, int N); int size() { return N ; } bool isCorridor(Site *v); bool isRoom(Site *v); bool isWall(Site *v); bool isLegalMove(Site* v, Site* w); void setPlayerSite(Site *v); void setMonsterSite(Site *v); Site* getPlayerSite() { return playerSite ; } Site* getMonsterSite() { return monsterSite ; } friend ostream& operator<<(ostream &os, Playfield *); }; #endif
9562608ab5fab702c916a048623894a237054fd7
86ef676c5e97fa34c5168aa3cd8cca94b1bd3705
/grammar/functor/functor.cpp
b85a2cb0b6bb7f87a81ce727444f7606d16b1fff
[]
no_license
kyn0v/basic-practice
3dfb17f572d11aac85dc4d0fe658ce6236719170
0b6673638701b9f966eff479f2afdd95f99db7a7
refs/heads/master
2023-03-05T12:47:19.529127
2021-02-16T08:15:31
2021-02-16T08:15:31
283,651,393
0
0
null
null
null
null
UTF-8
C++
false
false
586
cpp
functor.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; template <typename T> class greaterCustom { public: greaterCustom(T x) { threshold = x; } bool operator()(T x) const { return x > threshold; } private: T threshold; }; int main() { int n, threshold, cnt; cin>>n>>threshold; vector<int> nums(n); for (int i = 0; i < n; i++) { cin >> nums[i]; } // greaterCustom<int> functor(threshold); cnt = count_if(nums.begin(), nums.end(), greaterCustom<int> (threshold)); cout << cnt << endl; return 0; }
93c5ecd4d7142ab08e24f152065897dc7d4fcfb3
f739df1f252d7c961ed881be3b8babaf62ff4170
/softs/SCADAsoft/5.3.2/inc/ecomlib/devicelistener.h
0f7b7fd445017b9cf3357ab33afc38b5b6ebe9ef
[]
no_license
billpwchan/SCADA-nsl
739484691c95181b262041daa90669d108c54234
1287edcd38b2685a675f1261884f1035f7f288db
refs/heads/master
2023-04-30T09:15:49.104944
2021-01-10T21:53:10
2021-01-10T21:53:10
328,486,982
0
0
null
2023-04-22T07:10:56
2021-01-10T21:53:19
C++
UTF-8
C++
false
false
709
h
devicelistener.h
/** @file devicelistener.h Allows the user of the ecomlib to define functions that will be called every time a specific operation on a device is performed. */ #ifndef __SCS_ecomlib_DEVICELISTENER_H__ #define __SCS_ecomlib_DEVICELISTENER_H__ #include <dac.h> #include <ecomlib/ecomlib_exports.h> namespace ecomlib { class ECOMLIBIF_EXPORT DeviceListener { public: /** Called when a specific EIV is updated. */ virtual void hdleSpecificEiv(const DacEIV *) = 0; /** Called when a specific EOV is updated, after the ecomlib has checked the line state. */ virtual void hdleSpecificEov(const DacEOV *) = 0; }; } #endif // __SCS_ecomlib_DEVICELISTENER_H__
5d9edeba64d54fda5e3acbe8514cc91f7563fe13
fcb7ae81b94e4ca1622a50bac42c1f4123ba7eca
/Lemon01/HttpClient.cpp
688e718e8607179099db5e7d159dc203cd610dc5
[]
no_license
BigMouseFive/lemon01
4dd126cd8ef0a65c66f5599526d6f3a47177da3f
3ada0af2db7bd43379f055f2cd2f9ec91f4af8e4
refs/heads/master
2022-07-14T00:34:44.184880
2022-07-03T10:55:29
2022-07-03T10:55:29
144,717,391
0
0
null
null
null
null
GB18030
C++
false
false
9,677
cpp
HttpClient.cpp
#include "HttpClient.h" #include "qnetworkrequest.h" #include "qnetworkreply.h" #include "qdebug.h" #include "QJsonParseError" #include "QJsonObject" #include "QJsonArray" #include "QAuthenticator" #include "QHttpMultiPart" /* reply handle demo if (reply->error() != QNetworkReply::NoError){ //处理中的错误信息 qDebug() << "reply error:" << reply->errorString(); } else{ //获取响应信息 const QByteArray reply_data = reply->readAll(); qDebug() << "read all:" << reply_data; //解析json QJsonParseError json_error; QJsonDocument doucment = QJsonDocument::fromJson(reply_data, &json_error); if (json_error.error == QJsonParseError::NoError) { if (doucment.isObject()) { const QJsonObject obj = doucment.object(); qDebug() << obj; if (obj.contains("args")) { QJsonValue value = obj.value("args"); qDebug() << value; } } } else{ qDebug() << "json error:" << json_error.errorString(); } } reply->deleteLater(); */ HttpClient::HttpClient(QObject *parent) : QNetworkAccessManager(parent) { // finished connect(this, &QNetworkAccessManager::finished, [=](QNetworkReply* reply){ auto method = reply->operation(); auto url = reply->url(); if (url.toString().contains(url_payment)){ if (method == QNetworkAccessManager::GetOperation) Q_EMIT getPriceInfoReply(reply); else if (method == QNetworkAccessManager::PostOperation) Q_EMIT requestPaymentReply(reply); } else if (url.toString().contains(url_payment_order)){ if (method == QNetworkAccessManager::GetOperation) Q_EMIT getOrderInfoReply(reply); else if (method == QNetworkAccessManager::PostOperation) Q_EMIT closeOrderReply(reply); } else if (url.toString().contains(url_update)){ if (method == QNetworkAccessManager::PostOperation){ QString update_data_path = ""; bool valid = true; QString msg = ""; if (reply->error() != QNetworkReply::NoError){ //处理中的错误信息 qDebug() << "[url_update] reply error:" << reply->errorString(); } else{ //获取响应信息 const QByteArray reply_data = reply->readAll(); qDebug() << "[url_update] read all : " << reply_data; //解析json QJsonParseError json_error; QJsonDocument document = QJsonDocument::fromJson(reply_data, &json_error); if (json_error.error == QJsonParseError::NoError) { if (document.isObject()) { valid = false; const QJsonObject obj = document.object(); if (obj.contains("data")) { QJsonObject data_obj = obj.value("data").toObject(); if (data_obj.contains("update_data_path")) update_data_path = data_obj.value("update_data_path").toString(); if (data_obj.contains("valid")) valid = data_obj.value("valid").toBool(); if (data_obj.contains("msg")) msg = data_obj.value("msg").toString(); } } } else{ qDebug() << "[url_update] json error:" << json_error.errorString(); } } Q_EMIT getUpdateInfoReply(update_data_path, valid, msg); } return; } else if (url.toString().contains(url_network_time)){ if (method == QNetworkAccessManager::GetOperation){ int network_time = 0; if (reply->error() != QNetworkReply::NoError){ //处理中的错误信息 qDebug() << "[url_network_time] reply error:" << reply->errorString(); } else{ //获取响应信息 const QByteArray reply_data = reply->readAll(); qDebug() << "[url_network_time] read all : " << reply_data; //解析json QJsonParseError json_error; QJsonDocument document = QJsonDocument::fromJson(reply_data, &json_error); if (json_error.error == QJsonParseError::NoError) { if (document.isObject()) { const QJsonObject obj = document.object(); if (obj.contains("data")) { QJsonObject data_obj = obj.value("data").toObject(); if (data_obj.contains("t")){ network_time = data_obj.value("t").toString().toDouble() / 1000; } } } } else{ qDebug() << "[url_network_time] json error:" << json_error.errorString(); } } Q_EMIT getNetworkTimeReply(network_time); } return; } else if (url.toString().contains(url_auth)){ bool is_shop_valid = true; if (method == QNetworkAccessManager::PostOperation){ if (reply->error() != QNetworkReply::NoError){ //处理中的错误信息 qDebug() << "[url_auth] reply error:" << reply->errorString(); } else{ //获取响应信息 const QByteArray reply_data = reply->readAll(); qDebug() << "[url_auth] read all : " << reply_data; //解析json QJsonParseError json_error; QJsonDocument document = QJsonDocument::fromJson(reply_data, &json_error); if (json_error.error == QJsonParseError::NoError) { if (document.isObject()) { const QJsonObject obj = document.object(); if (obj.contains("data")) { QJsonObject data_obj = obj.value("data").toObject(); if (data_obj.contains("valid")) is_shop_valid = data_obj.value("valid").toBool(); } } } else{ qDebug() << "[url_auth] json error:" << json_error.errorString(); } } Q_EMIT isShopValidReply(is_shop_valid); } return; } if (reply->error() != QNetworkReply::NoError){ //处理中的错误信息 qDebug() << "reply error:" << reply->errorString(); } else{ //获取响应信息 const QByteArray reply_data = reply->readAll(); qDebug() << "read all:" << reply_data; //解析json QJsonParseError json_error; QJsonDocument doucment = QJsonDocument::fromJson(reply_data, &json_error); if (json_error.error == QJsonParseError::NoError) { if (doucment.isObject()) { const QJsonObject obj = doucment.object(); qDebug() << obj; if (obj.contains("args")) { QJsonValue value = obj.value("args"); qDebug() << value; } } } else{ qDebug() << "json error:" << json_error.errorString(); } } reply->deleteLater(); }); // authenticationRequired connect(this, &QNetworkAccessManager::authenticationRequired, [=](QNetworkReply *reply, QAuthenticator *authenticator){ qDebug() << "authenticationRequired"; }); // encrypted connect(this, &QNetworkAccessManager::encrypted, [=](QNetworkReply *reply){ qDebug() << "encrypted"; }); // sslErrors connect(this, &QNetworkAccessManager::sslErrors, [=](QNetworkReply *reply, const QList<QSslError> &errors){ qDebug() << "sslErrors"; }); } // 获取更新信息 int HttpClient::getUpdateInfo(const std::string& register_code, const std::vector<std::string>& shop_names){ QJsonObject j_data{ { "time", QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") }, { "register_code", QString::fromStdString(register_code) } }; QJsonArray j_shop_names; for (auto& shop_name : shop_names) j_shop_names.append(QString::fromStdString(shop_name)); j_data["shop_names"] = j_shop_names; QNetworkRequest request(QUrl(QString(host_name) + url_update)); request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/json")); post(request, QJsonDocument(j_data).toJson()); qDebug() << "[HttpClient] getUpdateInfo post: " << j_data; return 0; } // 获取更新数据 int HttpClient::getUpdateData(const QString& update_data_url){ return 0; } // 账户是否可用 int HttpClient::isAcountValid(){ return 0; } // 店铺是否可用 int HttpClient::isShopValid(const std::string& shop_name){ QJsonObject j_data{ { "time", QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") }, { "shop_name", QString::fromStdString(shop_name) }, }; QNetworkRequest request(QUrl(QString(host_name) + url_auth)); request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/json")); post(request, QJsonDocument(j_data).toJson()); qDebug() << "[HttpClient] isShopValid post: " << j_data; return 0; } // 获取定价信息 int HttpClient::getPriceInfo(){ get(QNetworkRequest(QUrl(QString(host_name) + url_payment))); return 0; } // 请求付款 int HttpClient::requestPayment(const int& shop_num, const QString& mac, const int& price){ QJsonObject j_data{ { "time", QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") }, { "shop_num", shop_num }, { "mac", mac }, { "price", price } }; QNetworkRequest request(QUrl(QString(host_name) + url_payment)); request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/json")); post(request, QJsonDocument(j_data).toJson()); return 0; } // 获取付款二维码 int HttpClient::requestQRCode(){ return 0; } // 获取付款结果 int HttpClient::requestPaymentResult(){ return 0; } // 获取订单信息 int HttpClient::getOrderInfo(const QString& payjs_order_id){ QUrl url(QString(host_name) + url_payment_order); QUrlQuery url_query; url_query.addQueryItem("payjs_order_id", payjs_order_id); url.setQuery(url_query); QNetworkRequest request(url); get(request); return 0; } // 关闭订单 int HttpClient::closeOrder(const QString& payjs_order_id){ QHttpPart text_part1; text_part1.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"payjs_order_id\"")); text_part1.setBody(payjs_order_id.toUtf8()); QHttpPart text_part2; text_part2.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"method\"")); text_part2.setBody("close"); QHttpMultiPart *multi_part = new QHttpMultiPart(QHttpMultiPart::FormDataType); multi_part->append(text_part1); multi_part->append(text_part2); QNetworkRequest request(QUrl(QString(host_name) + url_payment_order)); post(request, multi_part); return 0; }
eecbc18c3addfa990d2e0a0f4428d1df81c0add6
bbd43f03357df3e669c710f03c3d6d1d39da9b7a
/globals.h
2c10e807983dc1f3d22cba56b5ab1b9e0789369a
[]
no_license
jclaar/zork
5d4f0c79b2df038038010c7f7d6e0a97d7a4a03a
05cd986e8eba8119c4e36f6730a8c5057d24fd93
refs/heads/master
2023-04-27T02:54:50.935535
2023-04-24T23:16:32
2023-04-24T23:16:32
108,916,481
36
8
null
2019-12-06T18:58:20
2017-10-30T22:43:15
C++
UTF-8
C++
false
false
1,730
h
globals.h
#pragma once #include <limits> #include <limits.h> #include <string> #include <bitset> #include <chrono> #include "defs.h" int score_max(); void inc_score_max(int inc); extern int eg_score_max; const int bigfix = INT_MAX; extern std::string inbuf; extern std::string inbuf1; extern std::chrono::steady_clock::time_point start_time; extern ObjectP last_it; enum FlagId { null_flag, rug_moved, troll_flag, low_tide, dome_flag, glacier_flag, glacier_melt, echo_flag, riddle_flag, lld_flag, xb, xc, cyclops_flag, magic_flag, rainbow, gnome_door, carousel_flip, carousel_zoom, cage_solve, bank_solve, egg_solve, sing_song, cpsolve, palan_solve, slide_solve, light_load, egypt_flag, empty_handed, deflate, cpout, mirror_open, wood_open, grate_revealed, grunlock, end_game_flag, tell_flag, parse_won, lucky, no_obj_print, mr1, mr2, mrswpush, mud, brflag1, brflag2, brief_flag, super_brief, thief_engrossed, dead, zgnome, cpblock, cppush, dead_flag, gate_flag, mirror_mung, plook, ptouch, punlock, cage_top, on_pole, buoy_flag, bucket_top, blab, gnome_flag, folflag, inqstartflag, safe_flag, num_flag_bits }; // Puzzle room extern int cphere; typedef std::array<ObjList, 64> PuzzleContents; extern PuzzleContents cpobjs; extern std::array<int, 64> cpuvec; typedef std::tuple<ObjectP, int> cpwall_val; typedef std::array<cpwall_val, 4> cpwall_vec; extern cpwall_vec cpwalls; extern std::bitset<num_flag_bits> flags; int load_max(); void load_max(int new_load);
94ade617d8f18b7804f762ddb41544ffe9d9d44c
d5123fdf9bbff1af09f839ca3f26fa03bd8ff9ed
/4-1/prac/4-23/4/4/소스.cpp
c8e2421f8d3226533992ad7c4c03da04bd1bf2d9
[]
no_license
wsm4287/SKKU
319ce04b2b4c5e6238efef7eacb96a69baef12fa
cc888f7b940de7c8e8b1e215cf3db987fcffdb2a
refs/heads/master
2023-07-04T10:09:58.137175
2021-07-31T05:09:31
2021-07-31T05:09:31
385,451,392
0
0
null
null
null
null
UTF-8
C++
false
false
1,830
cpp
소스.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int n, m, K; int a[11][11]; vector <int> tree[11][11]; int ans; int map[11][11]; int dx[] = { -1,0,1,-1,1,-1,0,1 }; int dy[] = { -1, -1,-1,0,0,1,1,1 }; void run(int k) { if (k == K) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { ans += tree[i][j].size(); } } return; } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (tree[i][j].size() == 0) continue; sort(tree[i][j].begin(), tree[i][j].end()); vector <int> temp; int d = 0; for (int k = 0; k < tree[i][j].size(); k++) { int age = tree[i][j][k]; if (map[i][j] >= age) { map[i][j] = map[i][j] - age; temp.push_back(age+1); } else { d += age / 2; } } tree[i][j].clear(); for (int k = 0; k < temp.size(); k++) tree[i][j].push_back(temp[k]); map[i][j] += d; } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (tree[i][j].size() == 0) continue; for (int k = 0; k < tree[i][j].size(); k++) { if (tree[i][j][k] % 5) continue; if (tree[i][j][k]) { for (int q = 0; q < 8; q++) { int ny = i + dy[q]; int nx = j + dx[q]; if (nx < 0 || ny < 0 || nx >= n || ny >= n) continue; tree[ny][nx].push_back(1); } } } } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { map[i][j] += a[i][j]; } } run(k + 1); } int main() { cin >> n >> m >> K; int q; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> a[i][j]; map[i][j] = 5; } } int x, y, z; for (int i = 0; i < m; i++) { cin >> x >> y >> z; tree[x - 1][y - 1].push_back(z); } run(0); cout << ans; return 0; }
df22e1b62e8b0d0392db99ab1c4430c3ded44eda
190bdcd053c90f625d41de6b46536978046615f2
/radioapp/radiouiengine/src/radiomonitorservice.cpp
f60203182e183b849837a8f3aa86b8a0fdd5b19a
[]
no_license
SymbianSource/oss.FCL.sf.app.radio
bfd6b82e78d91ac33b342b0ad80a63521c4bcdee
ebab77d7c81b621c9404bfaa5ba50e95c11c5076
refs/heads/master
2021-01-11T01:03:54.491540
2010-10-15T13:26:27
2010-10-15T13:26:27
70,846,387
0
0
null
null
null
null
UTF-8
C++
false
false
11,162
cpp
radiomonitorservice.cpp
/* * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ // System includes #include <QTimer> #include <QRegExp> // User includes #include "radiomonitorservice.h" #include "radiouiengine.h" #include "radiouiengine_p.h" #include "radiostationmodel.h" #include "radioenginewrapper.h" #include "radioscannerengine.h" #include "radiostation.h" #include "radioservicedef.h" #include "radionotificationdata.h" #include "radiologger.h" // Constants const int NOTIFICATION_DELAY = 200; #define RUN_NOTIFY( type, data ) \ do { \ QVariant variant; \ variant.setValue( RadioNotificationData( RadioServiceNotification::type, data ) ); \ notify( variant ); \ } while ( 0 ) /*! * */ RadioMonitorService::RadioMonitorService( RadioUiEnginePrivate& engine ) : XQServiceProvider( RADIO_SERVICE +"."+ RADIO_MONITOR_SERVICE, &engine.api() ), mUiEngine( engine ), mRadioStatus( RadioStatus::UnSpecified ), mNotificationTimer( new QTimer( this ) ) { mNotificationTimer->setSingleShot( true ); mNotificationTimer->setInterval( NOTIFICATION_DELAY ); Radio::connect( mNotificationTimer, SIGNAL(timeout()), this, SLOT(sendNotifications()) ); publishAll(); } /*! * */ RadioMonitorService::~RadioMonitorService() { } /*! * */ void RadioMonitorService::init() { RadioStationModel* stationModel = &mUiEngine.api().stationModel(); Radio::connect( stationModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(notifyFavoriteCount()) ); Radio::connect( stationModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(notifyLocalCount()) ); Radio::connect( stationModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(notifyFavoriteCount()) ); Radio::connect( stationModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(notifyLocalCount()) ); Radio::connect( stationModel, SIGNAL(favoriteChanged(RadioStation)), this, SLOT(notifyFavoriteCount()) ); Radio::connect( stationModel, SIGNAL(favoriteChanged(RadioStation)), this, SLOT(notifyLocalCount()) ); Radio::connect( stationModel, SIGNAL(stationDataChanged(RadioStation)), this, SLOT(notifyStationChange(RadioStation)) ); Radio::connect( stationModel, SIGNAL(radioTextReceived(RadioStation)), this, SLOT(notifyStationChange(RadioStation)) ); Radio::connect( stationModel, SIGNAL(dynamicPsChanged(RadioStation)), this, SLOT(notifyStationChange(RadioStation)) ); RadioUiEngine* uiEngine = &mUiEngine.api(); Radio::connect( uiEngine, SIGNAL(seekingStarted(int)), this, SLOT(notifyRadioStatus()) ); Radio::connect( uiEngine, SIGNAL(muteChanged(bool)), this, SLOT(notifyRadioStatus()) ); Radio::connect( uiEngine, SIGNAL(antennaStatusChanged(bool)), this, SLOT(notifyRadioStatus()) ); // Radio::connect( uiEngine, SIGNAL(powerOffRequested()), // this, SLOT(notifyRadioStatus()) ); mUiEngine.wrapper().addObserver( this ); notifyRadioStatus(); } /*! * Public slot * */ void RadioMonitorService::requestNotifications() { //TODO: Uncomment when vendor id can be read from the client // if ( requestInfo().clientVendorId() == NOKIA_VENDORID ) { mRequestIndexes.append( setCurrentRequestAsync() ); // } } /*! * Public slot * */ void RadioMonitorService::requestAllData() { RadioStationModel& stationModel = mUiEngine.api().stationModel(); const RadioStation station = stationModel.currentStation(); QVariantList notificationList; QVariant notification; notification.setValue( RadioNotificationData( RadioServiceNotification::Region, mUiEngine.api().region() ) ); notificationList.append( notification ); RadioStatus::Status radioStatus = determineRadioStatus(); notification.setValue( RadioNotificationData( RadioServiceNotification::RadioStatus, radioStatus ) ); notificationList.append( notification ); notification.setValue( RadioNotificationData( RadioServiceNotification::FavoriteCount, stationModel.favoriteCount() ) ); notificationList.append( notification ); notification.setValue( RadioNotificationData( RadioServiceNotification::LocalCount, stationModel.localCount() ) ); notificationList.append( notification ); notification.setValue( RadioNotificationData( RadioServiceNotification::Frequency, RadioStation::parseFrequency( station.frequency() ) ) ); notificationList.append( notification ); if ( !station.name().isEmpty() ) { notification.setValue( RadioNotificationData( RadioServiceNotification::Name, station.name() ) ); notificationList.append( notification ); } if ( station.genre() > 0 ) { notification.setValue( RadioNotificationData( RadioServiceNotification::Genre, station.genre() ) ); notificationList.append( notification ); } if ( !station.radioText().isEmpty() ) { const QString trimmedRadioText = trimHtmlTags( station.radioText() ); notification.setValue( RadioNotificationData( RadioServiceNotification::RadioText, trimmedRadioText ) ); notificationList.append( notification ); } if ( !station.dynamicPsText().isEmpty() ) { notification.setValue( RadioNotificationData( RadioServiceNotification::DynamicPS, station.dynamicPsText() ) ); notificationList.append( notification ); } checkIfCurrentStationIsFavorite(); completeRequest( setCurrentRequestAsync(), notificationList ); } /*! * Private slot */ void RadioMonitorService::notifyRadioStatus() { RadioStatus::Status radioStatus = determineRadioStatus(); if ( radioStatus != mRadioStatus ) { if ( radioStatus == RadioStatus::Seeking ) { RadioScannerEngine* scannerEngine = mUiEngine.api().scannerEngine(); if ( scannerEngine ) { Radio::connect( scannerEngine, SIGNAL(destroyed()), this, SLOT(notifyRadioStatus()) ); } } mRadioStatus = radioStatus; RUN_NOTIFY( RadioStatus, radioStatus ); } } /*! * Private slot * */ void RadioMonitorService::notifyFavoriteCount() { const int favoriteCount = mUiEngine.api().stationModel().favoriteCount(); RUN_NOTIFY( FavoriteCount, favoriteCount ); checkIfCurrentStationIsFavorite(); } /*! * Private slot * */ void RadioMonitorService::notifyLocalCount() { const int localCount = mUiEngine.api().stationModel().localCount(); RUN_NOTIFY( LocalCount, localCount ); } /*! * Private slot * */ void RadioMonitorService::notifyStationChange( const RadioStation& station ) { RadioUiEngine& uiEngine = mUiEngine.api(); if ( uiEngine.isScanning() ) { return; } QVariantList list; QVariant notification; if ( station.hasDataChanged( RadioStation::GenreChanged ) ) { notification.setValue( RadioNotificationData( RadioServiceNotification::Genre, station.genre() ) ); list.append( notification ); } if ( station.hasDataChanged( RadioStation::DynamicPsChanged ) ) { notification.setValue( RadioNotificationData( RadioServiceNotification::DynamicPS, station.dynamicPsText() ) ); list.append( notification ); } if ( station.hasDataChanged( RadioStation::NameChanged ) ) { notification.setValue( RadioNotificationData( RadioServiceNotification::Name, station.name() ) ); list.append( notification ); } if ( station.hasDataChanged( RadioStation::RadioTextChanged ) ) { const QString trimmedRadioText = trimHtmlTags( station.radioText() ); notification.setValue( RadioNotificationData( RadioServiceNotification::RadioText, trimmedRadioText ) ); list.append( notification ); } notify( list ); } /*! * Private slot * */ void RadioMonitorService::sendNotifications() { if ( !mNotificationQueue.isEmpty() ) { notifyList( mNotificationQueue.dequeue() ); } if ( !mNotificationQueue.isEmpty() ) { mNotificationTimer->start(); } } /*! * \reimp */ void RadioMonitorService::tunedToFrequency( uint frequency, int reason ) { Q_UNUSED( reason ); if ( !mUiEngine.api().isScanning() ) { // frequency changed, cancel any pending notification as it has become invalid mNotificationTimer->stop(); mNotificationQueue.clear(); RUN_NOTIFY( Frequency, RadioStation::parseFrequency( frequency ) ); RadioStation station; if ( mUiEngine.api().stationModel().findFrequency( frequency, station ) && !station.name().isEmpty() ) { RUN_NOTIFY( Name, station.name() ); } const int favoriteCount = mUiEngine.api().stationModel().favoriteCount(); checkIfCurrentStationIsFavorite(); } } /*! * */ RadioStatus::Status RadioMonitorService::determineRadioStatus() const { RadioUiEngine& uiEngine = mUiEngine.api(); if ( uiEngine.isPoweringOff() ) { return RadioStatus::PoweringOff; } else if ( uiEngine.isScanning() ) { return RadioStatus::Seeking; } else if ( !uiEngine.isAntennaAttached() ) { return RadioStatus::NoAntenna; } else if ( uiEngine.isMuted() ) { return RadioStatus::Muted; } return RadioStatus::Playing; } /*! * */ void RadioMonitorService::checkIfCurrentStationIsFavorite() { const bool currentIsFavorite = mUiEngine.api().stationModel().currentStation().isFavorite(); RUN_NOTIFY( CurrentIsFavorite, currentIsFavorite ); } /*! * */ QString RadioMonitorService::trimHtmlTags( const QString& html ) { QString trimmed = html; QRegExp rex( "<.+>" ); rex.setMinimal( true ); trimmed.remove( rex ); return trimmed; } /*! * */ void RadioMonitorService::notify( const QVariant& notification ) { QVariantList list; list.append( notification ); notify( list ); } /*! * */ void RadioMonitorService::notify( const QVariantList& list ) { mNotificationQueue.enqueue( list ); if ( !mNotificationTimer->isActive() ) { mNotificationTimer->start(); } } /*! * */ void RadioMonitorService::notifyList( const QVariantList& list ) { if ( mRequestIndexes.count() > 0 && list.count() > 0 ) { foreach ( int requestIndex, mRequestIndexes ) { completeRequest( requestIndex, list ); } mRequestIndexes.clear(); } }
b26c1b6f0c1124500d4fb1d27d8058b6cc8b2e5d
8a8968d88a2928c5d4f0328dc4306a98832a0bcd
/(033)Search In Rotated Sorted Array/main.cpp
9089a0ef821ee2055d7c48924a624c7a635a69ae
[]
no_license
muzichao/LeetCode
accd0341777efcbd371792ed0575a718d7bbd795
4e54f2a17a4587fec503785dcaeb892f44048e99
refs/heads/master
2021-01-19T20:14:52.828069
2015-04-23T01:32:41
2015-04-23T01:32:41
26,360,415
0
0
null
null
null
null
UTF-8
C++
false
false
3,127
cpp
main.cpp
#include <iostream> using namespace std; int search(int A[], int n, int target) { int i = 0; for (; i < n; i++) { if (target == A[i]) return i; } if (i == n) return -1; } int searchOpt(int A[], int n, int target) { int i = 0; if (target >= A[0]) { for (; i < n; i++) { if (target == A[i]) return i; else if (A[i] > A[i + 1]) { return -1; } } } else { for (i = n - 1; i > 0; --i) { if (target == A[i]) return i; else if (A[i] < A[i - 1]) { return -1; } } } return -1; } int searchOpt2(int A[], int n, int target) { int iLeft = 0; // 区间起始位置 int iRight = n - 1; // 区间终止位置 int iHalf = 0; // 区间结束位置 // 如果等于起始位置元素或终止位置元素,直接返回 if (target == A[0]) { return 0; } else if (target == A[n - 1]) { return n - 1; } if (A[0] > A[n - 1]) { // 二分查找转折点 while (iRight != iLeft) { iHalf = (iRight + iLeft) >> 1; if (A[iHalf] > A[iLeft]) { iLeft = iHalf; } else if (A[iHalf] < A[iLeft]) { iRight = iHalf; } else { iRight = iHalf; iLeft = iHalf; } } // 查找target所属的区间 if (target == A[iHalf]) { return iHalf; } else if (target < A[iHalf] && target > A[0]) // target属于转折点左侧区域 { iLeft = 0; iRight = iHalf; } else if (target == A[iHalf + 1]) { return iHalf + 1; } else if (target > A[iHalf + 1] && target < A[n - 1]) // target属于转折点右侧区域 { iLeft = iHalf + 1; iRight = n - 1; } else // target 不在数组中 { return -1; } } // 在target属于的区间里使用二分法查找 while (iRight != iLeft) { iHalf = (iRight + iLeft) >> 1; if (target > A[iHalf]) { iLeft = iHalf; } else if (target < A[iHalf]) { iRight = iHalf; } else { return iHalf; } if (iRight - iLeft == 1 && target != A[iLeft]) return -1; } return -1; } int main() { // int A[] = {6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5}; // int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; int A[] = {1, 3}; // cout << search(A, 11, 1) << endl; // cout << searchOpt(A, 11, 1) << endl; cout << searchOpt2(A, 2, 2) << endl; return 0; }
88dcc080f8796465b3d0a494be00fdbee6b5234a
44d9004ec1015aa812a820b94efaefa372d371bc
/courses/prog_base_3/project/coursework/witch/WitchBackCard.cpp
a88ef92b2ce7140a050f6e9758c311a705d29b2b
[]
no_license
ValeronMEN/pervii
77d605874405ea5f7320eae41ff249224ccaf8ca
2f86d97c57bfb529052497b136bc3c162c7b63a8
refs/heads/master
2021-08-13T23:58:27.985369
2021-08-07T00:25:21
2021-08-07T00:25:21
41,976,888
0
0
null
null
null
null
UTF-8
C++
false
false
1,870
cpp
WitchBackCard.cpp
#include "WitchBackCard.h" WitchBackCard::WitchBackCard(){ this->width = 139; this->currwidth = 23; this->height = 216; this->highlighted = false; } void WitchBackCard::setHighlighted(bool b){ this->highlighted = b; } bool WitchBackCard::getHighlighted(){ return this->highlighted; } bool WitchBackCard::isClicked(int x, int y){ if ((this->posX < x) && (this->posX + this->width >= x) && (this->posY + this->height > y) && (this->posY < y)){ return true; } return false; } void WitchBackCard::setCoordinates(int x, int y){ this->posX = x; this->posY = y; } bool WitchBackCard::isClickedCurr(int x, int y){ if (((this->posX + 116) < x) && ((this->posX + 139) >= x) && (this->posY + this->height > y) && (this->posY < y)){ return true; } return false; } void WitchBackCard::setTexture(){ this->texture.loadFromFile("textures/jackBackTex.png"); this->texture.setSmooth(true); this->sprite.setTexture(this->texture); this->sprite.setTextureRect(sf::IntRect(0, 0, (float)139, (float)216)); } /* void WitchBackCard::setCutTexture(){ this->texture.loadFromFile("textures/jackBackTex.png"); this->texture.setSmooth(true); this->sprite.setTexture(this->texture); this->sprite.setTextureRect(sf::IntRect(116, 0, (float)23, (float)216)); } */ void WitchBackCard::setCurrTexture(){ this->texture.loadFromFile("textures/jackBackTexCurr.png"); this->texture.setSmooth(true); this->sprite.setTexture(this->texture); this->sprite.setTextureRect(sf::IntRect(0, 0, (float)139, (float)216)); } void WitchBackCard::setCurrCutTexture(){ this->texture.loadFromFile("textures/jackBackTexCurrCut.png"); this->texture.setSmooth(true); this->sprite.setTexture(this->texture); this->sprite.setTextureRect(sf::IntRect(0, 0, (float)139, (float)216)); }
f3959675c52652702328db06ef248058a16fde0a
1af3ece40dbd345faebe934f1cf75d520647f1b9
/staple/crkit_build/crkit/release-1.5.2/tools/code/crlZeroImage.h
fe4d238c6d2177f8899eb55ea0a581e748423517
[]
no_license
ImageGuidedTherapyLab/ExLib
987fa9d7ac09b3664ad7f1edb0a47d6a3aff8772
b01e5347a624225a086c4c46ed59a0a303d95b18
refs/heads/master
2023-04-03T18:11:05.424078
2023-04-02T16:20:00
2023-04-02T16:20:00
13,075,319
7
1
null
null
null
null
UTF-8
C++
false
false
2,609
h
crlZeroImage.h
#ifndef _CRL_ZEROIMAGE_INCLUDED #define _CRL_ZEROIMAGE_INCLUDED 1 #include <itkImage.h> #include <itkImageFileWriter.h> #include <iostream> class ITK_EXPORT crlZeroImageBase : public itk::LightObject { public: typedef crlZeroImageBase Self; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; /** Run-time type information (and related methods). */ itkTypeMacro(crlZeroImageBase, LightObject); crlZeroImageBase() {}; ~crlZeroImageBase() {}; void SetOutputFileName(std::string name) { m_OutputFileName = name; }; virtual void SetStartIndex(unsigned int i, unsigned int index) = 0; virtual void SetSize(unsigned int i, unsigned int size) = 0; virtual void SetSpacing(unsigned int i, float spacing) = 0; virtual void SetOrigin(unsigned int i, float origin) = 0; virtual void SetValue(double value) = 0; virtual int Execute() = 0; protected: std::string m_OutputFileName; private: crlZeroImageBase(const crlZeroImageBase &); // purposely not implemented void operator=(const crlZeroImageBase &); // purposely not implemented }; template <unsigned int Dimension, class PixelType> class ITK_EXPORT crlZeroImage : public crlZeroImageBase { public: /** Standard class typedefs. */ typedef crlZeroImage Self; typedef crlZeroImageBase Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; typedef itk::Image< PixelType, Dimension> ImageType; typedef itk::ImageFileWriter< ImageType > ImageWriterType; /** Method for creation through the object factory. */ itkNewMacro(Self); crlZeroImage() { m_Image = ImageType::New(); m_Value = 0.0;}; ~crlZeroImage() { m_Image = 0; }; void SetStartIndex(unsigned int i, unsigned int index) { m_Start[i] = index; }; void SetSize(unsigned int i, unsigned int size) { m_Size[i] = size; }; void SetSpacing(unsigned int i, float spacing) { m_Spacing[i] = spacing; }; void SetOrigin(unsigned int i, float origin) { m_Origin[i] = origin; }; void SetValue(double value) { m_Value = value; }; int Execute(); private: crlZeroImage(const Self&); // purposely not implemented void operator=(const Self&); //purposely not implemented typename ImageType::Pointer m_Image; typename ImageType::IndexType m_Start; typename ImageType::SizeType m_Size; typename ImageType::SpacingType m_Spacing; typename ImageType::PointType m_Origin; typename ImageType::PixelType m_Value; }; #ifndef ITK_MANUAL_INSTANTIATION #include "crlZeroImage.txx" #endif #endif
a6a6ed5b5610e9241045520ac2a0c825f921bd94
6442babb4e05d6a5d58e14d29ae25a7913180bbe
/CS3A - Object Oriented Programming/Final Hunter and Prey/HunterPrey/world.h
2ebf1eec77e0ad52f91f731d6f50fd4020a92c83
[]
no_license
SpencerYoungCS/CS-Projects
34859b29c663c5fa255917415711e17b12b612fd
8eaef5cc666a91be473d7c601c21bfbdb8f8fcf2
refs/heads/master
2020-03-07T21:55:55.227506
2019-10-30T00:45:36
2019-10-30T00:45:36
127,740,601
0
0
null
null
null
null
UTF-8
C++
false
false
340
h
world.h
#ifndef WORLD_H #define WORLD_H #include "ants.h" #include "doodlebugs.h" #include "wall.h" class world { public: world(); organism* NewWorld[MAX_j][MAX_i]; void randomize(); void step(); bool checkant(int j, int i); bool checkprey(int j, int i); void print(); void circle(); private: }; #endif // WORLD_H
b41f6099dc3ac3d77017514fc536be5e6ec641c0
15f5d66f6774b22b4b4951d0b193d1c015ab30eb
/gs_mysqlobject.cpp
13eaba6adc5c85495e64dd69114a2bc820c76fea
[]
no_license
fdwfjl/-
75ea44a0365a06784860d5d2d4e09f70d08097ac
d5028a924f6274b6fc514eef70413e96c35d2521
refs/heads/master
2021-04-15T23:17:02.272260
2020-11-17T02:44:47
2020-11-17T02:44:47
249,309,000
0
0
null
null
null
null
UTF-8
C++
false
false
5,888
cpp
gs_mysqlobject.cpp
#include "gs_mysqlobject.h" #include <QDebug> #include <QSqlQuery> #include <QTimer> gs_mysqlObject::gs_mysqlObject(QObject *parent) : QObject(parent) { m_iCount=0; m_pTimer1sStart=new QTimer(this); m_pTimer1sStart->setInterval(1000); InitSlot(); } void gs_mysqlObject::InitMySlot() { qDebug()<<"MySqlSlot"; m_mysqlDatabase=QSqlDatabase::addDatabase("QMYSQL"); m_mysqlDatabase.setHostName("127.0.0.1"); m_mysqlDatabase.setUserName("root"); m_mysqlDatabase.setPassword("abc123456789"); m_mysqlDatabase.setDatabaseName("mydatas"); if(!m_mysqlDatabase.open()) { emit LinkMySqlFailSignal(); qDebug()<<"openFail!"; } else { emit LinkMySqlSuccessSignal(); m_pTimer1sStart->start(); qDebug()<<"openSuccess!"; } } void gs_mysqlObject::InitSlot() { connect(this,SIGNAL(ProcessFinishSignal()),this,SLOT(TwentyTimesSlot())); connect(this,SIGNAL(ProcessFinishTwentySignal()),this,SLOT(WriteIntoTheMySqlSlot())); connect(this,SIGNAL(LinkMySqlSuccessSignal()),this,SLOT(ReadTheDefaultParaSlot())); connect(m_pTimer1sStart,SIGNAL(timeout()),this,SLOT(InitTheDeviceParaSlot())); } void gs_mysqlObject::ProcessDataSlot(double* sdataOne,double* sdataTwo,int SectionLength,int ChannelCountOne,int ChannelCountTwo) { double*p=sdataOne; double*pp=sdataTwo; for(int i=0;i<SectionLength*ChannelCountOne/4;++i) { OneList<<sdataOne[5*i]; TwoList<<sdataOne[5*i+1]; ThreeList<<sdataOne[5*i+2]; FourList<<sdataOne[5*i+3]; FiveList<<sdataTwo[5*i+4]; } for(int i=0;i<SectionLength*ChannelCountTwo/4;++i) { SixList<<sdataTwo[2*i]; SevenList<<sdataTwo[2*i+1]; } delete[]p; delete[]pp; sdataOne=nullptr; sdataTwo=nullptr; p=nullptr; pp=nullptr; emit ProcessFinishSignal(); } void gs_mysqlObject::TwentyTimesSlot() { m_iCount=m_iCount+1; if(m_iCount==20) { emit ProcessFinishTwentySignal(); m_iCount=0; } else { emit ContinueGetThedataSignal(); } } void gs_mysqlObject::WriteIntoTheMySqlSlot() { QSqlQuery query(m_mysqlDatabase); query.exec("SET autocommit=0;"); query.prepare("INSERT INTO mytable VALUES(?,?,?,?,?,?,?)"); query.addBindValue(SixList); query.addBindValue(SevenList); query.addBindValue(OneList); query.addBindValue(TwoList); query.addBindValue(ThreeList); query.addBindValue(FourList); query.addBindValue(FiveList); query.execBatch(); bool ret=query.exec("COMMIT"); if(ret==true) { OneList.clear(); TwoList.clear(); ThreeList.clear(); FourList.clear(); FiveList.clear(); SixList.clear(); SevenList.clear(); emit WriteIntoMySqlSuccessSignal(); emit ContinueGetThedataSignal(); } } void gs_mysqlObject::ReadTheDefaultParaSlot() { } void gs_mysqlObject::WriteTheDeviceToMySqlSlot(QString Name, QString Parameter) { QSqlQuery query(m_mysqlDatabase); } void gs_mysqlObject::BeginThisObjectSlot() { emit ContinueGetThedataSignal(); } void gs_mysqlObject::InitTheDeviceParaSlot() { m_pTimer1sStart->stop(); QSqlQuery query(m_mysqlDatabase); bool ret=query.exec("SELECT*FROM devicepara;"); if(ret==true) { qDebug()<<"SQLOK"; query.seek(0); m_struct_DefaultPara.qString_theWorkSpeed=query.value(1).toString(); m_struct_DefaultPara.qString_theWorkAccelerate=query.value(2).toString(); m_struct_DefaultPara.qString_theWorkDecelerate=query.value(3).toString(); m_struct_DefaultPara.qString_theJogSpeed=query.value(4).toString(); m_struct_DefaultPara.qString_theAcquisitionOne_Frequency=query.value(5).toString(); m_struct_DefaultPara.qString_theAcquisitionOne_SectionLength=query.value(6).toString(); m_struct_DefaultPara.qString_theAcquisitionOne_ChannelCount=query.value(7).toString(); m_struct_DefaultPara.qString_theAcquisitionOne_ChannelStart=query.value(8).toString(); m_struct_DefaultPara.qString_theAcquisitionTwo_Frequency=query.value(9).toString(); m_struct_DefaultPara.qString_theAcquisitionTwo_SectionLength=query.value(10).toString(); m_struct_DefaultPara.qString_theAcquisitionTwo_ChannelCount=query.value(11).toString(); m_struct_DefaultPara.qString_theAcquisitionTwo_ChannelStart=query.value(12).toString(); emit DeviceDefaultParaSignal(m_struct_DefaultPara); query.seek(1); m_struct_NowPara.qString_theWorkSpeed=query.value(1).toString(); m_struct_NowPara.qString_theWorkAccelerate=query.value(2).toString(); m_struct_NowPara.qString_theWorkDecelerate=query.value(3).toString(); m_struct_NowPara.qString_theJogSpeed=query.value(4).toString(); m_struct_NowPara.qString_theAcquisitionOne_Frequency=query.value(5).toString(); m_struct_NowPara.qString_theAcquisitionOne_SectionLength=query.value(6).toString(); m_struct_NowPara.qString_theAcquisitionOne_ChannelCount=query.value(7).toString(); m_struct_NowPara.qString_theAcquisitionOne_ChannelStart=query.value(8).toString(); m_struct_NowPara.qString_theAcquisitionTwo_Frequency=query.value(9).toString(); m_struct_NowPara.qString_theAcquisitionTwo_SectionLength=query.value(10).toString(); m_struct_NowPara.qString_theAcquisitionTwo_ChannelCount=query.value(11).toString(); m_struct_NowPara.qString_theAcquisitionTwo_ChannelStart=query.value(12).toString(); emit DeviceNowParaSignal(m_struct_NowPara); } else { emit InitTheDeviceFailSignal(); } }
f1211eb4e5936a80ab60d08c6b1a81cbef9750d7
21ac11baff59ea3deab4e390f8f4ba71fc1e32f5
/src/UrlFrontier.cpp
2fafe7c62923ae0a57caeaa60e946ce55443894a
[]
no_license
henrysdev/AddressHarvester
e0ede1c157ceaf61d117a71d842dfe4727c57966
d3d38a4c0c0310498dc0776bcf6a0d805523890b
refs/heads/master
2020-03-11T06:14:46.216476
2018-04-17T16:35:41
2018-04-17T16:35:41
129,825,394
0
0
null
null
null
null
UTF-8
C++
false
false
341
cpp
UrlFrontier.cpp
// // Created by crackerjacks on 4/16/18. // #include "UrlFrontier.h" UrlFrontier::UrlFrontier() { } bool UrlFrontier::is_empty() { return queue_ds.empty(); } void UrlFrontier::add_url(string url) { queue_ds.push(url); } string UrlFrontier::next_url() { string next = queue_ds.front(); queue_ds.pop(); return next; }
1c188197785a7cebeb5f1aaca9972352e5fa5681
e8e655cfc3aeb494f514995c838d23acb3631421
/gproxy/socket.cpp
145c225ee97c510211676655243e80260b91a477
[]
no_license
Karolson/gproxyplusplus
133218f90d5d3fcef5b280d3374f8177358efc26
91a64fa0ebb3463e32a4770613d5cf77bbf3a017
refs/heads/master
2021-06-30T14:08:05.479819
2021-06-25T15:31:08
2021-06-25T15:31:08
230,941,016
0
0
null
2019-12-30T15:47:50
2019-12-30T15:47:49
null
UTF-8
C++
false
false
16,554
cpp
socket.cpp
/* Copyright 2010 Trevor Hogan Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "gproxy.h" #include "util.h" #include "socket.h" #include <string.h> // // CSocket // CSocket::CSocket() { m_Socket = INVALID_SOCKET; memset(&m_SIN, 0, sizeof(m_SIN)); m_HasError = false; m_Error = 0; } CSocket::CSocket(SOCKET nSocket, struct sockaddr_in nSIN) { m_Socket = nSocket; m_SIN = nSIN; m_HasError = false; m_Error = 0; } CSocket::~CSocket() { if (m_Socket != INVALID_SOCKET) closesocket(m_Socket); } uint16_t CSocket::GetPort() { return m_SIN.sin_port; } BYTEARRAY CSocket::GetIP() { return UTIL_CreateByteArray((uint32_t)m_SIN.sin_addr.s_addr, false); } std::string CSocket::GetIPString() { return inet_ntoa(m_SIN.sin_addr); } std::string CSocket::GetErrorString() { if (!m_HasError) return "NO ERROR"; switch (m_Error) { case EWOULDBLOCK: return "EWOULDBLOCK"; case EINPROGRESS: return "EINPROGRESS"; case EALREADY: return "EALREADY"; case ENOTSOCK: return "ENOTSOCK"; case EDESTADDRREQ: return "EDESTADDRREQ"; case EMSGSIZE: return "EMSGSIZE"; case EPROTOTYPE: return "EPROTOTYPE"; case ENOPROTOOPT: return "ENOPROTOOPT"; case EPROTONOSUPPORT: return "EPROTONOSUPPORT"; case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT"; case EOPNOTSUPP: return "EOPNOTSUPP"; case EPFNOSUPPORT: return "EPFNOSUPPORT"; case EAFNOSUPPORT: return "EAFNOSUPPORT"; case EADDRINUSE: return "EADDRINUSE"; case EADDRNOTAVAIL: return "EADDRNOTAVAIL"; case ENETDOWN: return "ENETDOWN"; case ENETUNREACH: return "ENETUNREACH"; case ENETRESET: return "ENETRESET"; case ECONNABORTED: return "ECONNABORTED"; case ECONNRESET: return "ECONNRESET"; case ENOBUFS: return "ENOBUFS"; case EISCONN: return "EISCONN"; case ENOTCONN: return "ENOTCONN"; case ESHUTDOWN: return "ESHUTDOWN"; case ETOOMANYREFS: return "ETOOMANYREFS"; case ETIMEDOUT: return "ETIMEDOUT"; case ECONNREFUSED: return "ECONNREFUSED"; case ELOOP: return "ELOOP"; case ENAMETOOLONG: return "ENAMETOOLONG"; case EHOSTDOWN: return "EHOSTDOWN"; case EHOSTUNREACH: return "EHOSTUNREACH"; case ENOTEMPTY: return "ENOTEMPTY"; case EUSERS: return "EUSERS"; case EDQUOT: return "EDQUOT"; case ESTALE: return "ESTALE"; case EREMOTE: return "EREMOTE"; } return "UNKNOWN ERROR (" + UTIL_ToString(m_Error) + ")"; } void CSocket::SetFD(fd_set *fd, fd_set *send_fd, int *nfds) { if (m_Socket == INVALID_SOCKET) return; FD_SET(m_Socket, fd); FD_SET(m_Socket, send_fd); } void CSocket::Allocate(int type) { m_Socket = socket(AF_INET, type, 0); if (m_Socket == INVALID_SOCKET) { m_HasError = true; m_Error = GetLastError(); CONSOLE_Print("[SOCKET] error (socket) - " + GetErrorString()); return; } } void CSocket::Reset() { if (m_Socket != INVALID_SOCKET) closesocket(m_Socket); m_Socket = INVALID_SOCKET; memset(&m_SIN, 0, sizeof(m_SIN)); m_HasError = false; m_Error = 0; } // // CTCPSocket // CTCPSocket::CTCPSocket() : CSocket() { Allocate(SOCK_STREAM); m_Connected = false; m_LastRecv = GetTime(); m_LastSend = GetTime(); // make socket non blocking int iMode = 1; ioctlsocket(m_Socket, FIONBIO, (u_long FAR *)&iMode); } CTCPSocket::CTCPSocket(SOCKET nSocket, struct sockaddr_in nSIN) : CSocket(nSocket, nSIN) { m_Connected = true; m_LastRecv = GetTime(); m_LastSend = GetTime(); // make socket non blocking int iMode = 1; ioctlsocket(m_Socket, FIONBIO, (u_long FAR *)&iMode); } CTCPSocket::~CTCPSocket() { } void CTCPSocket::Reset() { CSocket::Reset(); Allocate(SOCK_STREAM); m_Connected = false; m_RecvBuffer.clear(); m_SendBuffer.clear(); m_LastRecv = GetTime(); m_LastSend = GetTime(); // make socket non blocking int iMode = 1; ioctlsocket(m_Socket, FIONBIO, (u_long FAR *)&iMode); if (!m_LogFile.empty()) { std::ofstream Log; Log.open(m_LogFile.c_str(), std::ios::app); if (!Log.fail()) { Log << "----------RESET----------" << std::endl; Log.close(); } } } void CTCPSocket::PutBytes(std::string bytes) { m_SendBuffer += bytes; } void CTCPSocket::PutBytes(BYTEARRAY bytes) { m_SendBuffer += std::string(bytes.begin(), bytes.end()); } void CTCPSocket::DoRecv(fd_set *fd) { if (m_Socket == INVALID_SOCKET || m_HasError || !m_Connected) return; if (FD_ISSET(m_Socket, fd)) { // data is waiting, receive it char buffer[1024]; int c = recv(m_Socket, buffer, 1024, 0); if (c == SOCKET_ERROR && GetLastError() != EWOULDBLOCK) { // receive error m_HasError = true; m_Error = GetLastError(); CONSOLE_Print("[TCPSOCKET] error (recv) - " + GetErrorString()); return; } else if (c == 0) { // the other end closed the connection CONSOLE_Print("[TCPSOCKET] closed by remote host"); m_Connected = false; } else if (c > 0) { // success! add the received data to the buffer if (!m_LogFile.empty()) { std::ofstream Log; Log.open(m_LogFile.c_str(), std::ios::app); if (!Log.fail()) { Log << " RECEIVE <<< " << UTIL_ByteArrayToHexString(UTIL_CreateByteArray((unsigned char *)buffer, c)) << std::endl; Log.close(); } } m_RecvBuffer += std::string(buffer, c); m_LastRecv = GetTime(); } } } void CTCPSocket::DoSend(fd_set *send_fd) { if (m_Socket == INVALID_SOCKET || m_HasError || !m_Connected || m_SendBuffer.empty()) return; if (FD_ISSET(m_Socket, send_fd)) { // socket is ready, send it int s = send(m_Socket, m_SendBuffer.c_str(), (int)m_SendBuffer.size(), MSG_NOSIGNAL); if (s == SOCKET_ERROR && GetLastError() != EWOULDBLOCK) { // send error m_HasError = true; m_Error = GetLastError(); CONSOLE_Print("[TCPSOCKET] error (send) - " + GetErrorString()); return; } else if (s > 0) { // success! only some of the data may have been sent, remove it from the buffer if (!m_LogFile.empty()) { std::ofstream Log; Log.open(m_LogFile.c_str(), std::ios::app); if (!Log.fail()) { Log << "SEND >>> " << UTIL_ByteArrayToHexString(BYTEARRAY(m_SendBuffer.begin(), m_SendBuffer.begin() + s)) << std::endl; Log.close(); } } m_SendBuffer = m_SendBuffer.substr(s); m_LastSend = GetTime(); } } } void CTCPSocket::Disconnect() { if (m_Socket != INVALID_SOCKET) shutdown(m_Socket, SHUT_RDWR); m_Connected = false; } void CTCPSocket::SetNoDelay(bool noDelay) { int OptVal = 0; if (noDelay) OptVal = 1; setsockopt(m_Socket, IPPROTO_TCP, TCP_NODELAY, (const char *)&OptVal, sizeof(int)); } // // CTCPClient // CTCPClient::CTCPClient() : CTCPSocket() { m_Connecting = false; } CTCPClient::~CTCPClient() { } void CTCPClient::Reset() { CTCPSocket::Reset(); m_Connecting = false; } void CTCPClient::Disconnect() { CTCPSocket::Disconnect(); m_Connecting = false; } void CTCPClient::Connect(std::string localaddress, std::string address, uint16_t port) { if (m_Socket == INVALID_SOCKET || m_HasError || m_Connecting || m_Connected) return; if (!localaddress.empty()) { struct sockaddr_in LocalSIN; memset(&LocalSIN, 0, sizeof(LocalSIN)); LocalSIN.sin_family = AF_INET; if ((LocalSIN.sin_addr.s_addr = inet_addr(localaddress.c_str())) == INADDR_NONE) LocalSIN.sin_addr.s_addr = INADDR_ANY; LocalSIN.sin_port = htons(0); if (bind(m_Socket, (struct sockaddr *)&LocalSIN, sizeof(LocalSIN)) == SOCKET_ERROR) { m_HasError = true; m_Error = GetLastError(); CONSOLE_Print("[TCPCLIENT] error (bind) - " + GetErrorString()); return; } } // get IP address struct hostent *HostInfo; uint32_t HostAddress; HostInfo = gethostbyname(address.c_str()); if (!HostInfo) { m_HasError = true; // m_Error = h_error; CONSOLE_Print("[TCPCLIENT] error (gethostbyname)"); return; } memcpy(&HostAddress, HostInfo->h_addr, HostInfo->h_length); // connect m_SIN.sin_family = AF_INET; m_SIN.sin_addr.s_addr = HostAddress; m_SIN.sin_port = htons(port); if (connect(m_Socket, (struct sockaddr *)&m_SIN, sizeof(m_SIN)) == SOCKET_ERROR) { if (GetLastError() != EINPROGRESS && GetLastError() != EWOULDBLOCK) { // connect error m_HasError = true; m_Error = GetLastError(); CONSOLE_Print("[TCPCLIENT] error (connect) - " + GetErrorString()); return; } } m_Connecting = true; } bool CTCPClient::CheckConnect() { if (m_Socket == INVALID_SOCKET || m_HasError || !m_Connecting) return false; fd_set fd; FD_ZERO(&fd); FD_SET(m_Socket, &fd); struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 0; // check if the socket is connected if (select(1, NULL, &fd, NULL, &tv) == SOCKET_ERROR) { m_HasError = true; m_Error = GetLastError(); return false; } if (FD_ISSET(m_Socket, &fd)) { m_Connecting = false; m_Connected = true; return true; } return false; } // // CTCPServer // CTCPServer::CTCPServer() : CTCPSocket() { // set the socket to reuse the address in case it hasn't been released yet int optval = 1; setsockopt(m_Socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&optval, sizeof(int)); } CTCPServer::~CTCPServer() { } bool CTCPServer::Listen(std::string address, uint16_t port) { if (m_Socket == INVALID_SOCKET || m_HasError) return false; m_SIN.sin_family = AF_INET; if (!address.empty()) { if ((m_SIN.sin_addr.s_addr = inet_addr(address.c_str())) == INADDR_NONE) m_SIN.sin_addr.s_addr = INADDR_ANY; } else m_SIN.sin_addr.s_addr = INADDR_ANY; m_SIN.sin_port = htons(port); if (bind(m_Socket, (struct sockaddr *)&m_SIN, sizeof(m_SIN)) == SOCKET_ERROR) { m_HasError = true; m_Error = GetLastError(); CONSOLE_Print("[TCPSERVER] error (bind) - " + GetErrorString()); return false; } // listen, queue length 8 if (listen(m_Socket, 8) == SOCKET_ERROR) { m_HasError = true; m_Error = GetLastError(); CONSOLE_Print("[TCPSERVER] error (listen) - " + GetErrorString()); return false; } return true; } CTCPSocket *CTCPServer::Accept(fd_set *fd) { if (m_Socket == INVALID_SOCKET || m_HasError) return NULL; if (FD_ISSET(m_Socket, fd)) { // a connection is waiting, accept it struct sockaddr_in Addr; int AddrLen = sizeof(Addr); SOCKET NewSocket; if ((NewSocket = accept(m_Socket, (struct sockaddr *)&Addr, &AddrLen)) == INVALID_SOCKET) { // accept error, ignore it } else { // success! return the new socket return new CTCPSocket(NewSocket, Addr); } } return NULL; } // // CUDPSocket // CUDPSocket::CUDPSocket() : CSocket() { Allocate(SOCK_DGRAM); // enable broadcast support int OptVal = 1; setsockopt(m_Socket, SOL_SOCKET, SO_BROADCAST, (const char *)&OptVal, sizeof(int)); // set default broadcast target m_BroadcastTarget.s_addr = INADDR_BROADCAST; } CUDPSocket::~CUDPSocket() { } bool CUDPSocket::SendTo(struct sockaddr_in sin, BYTEARRAY message) { if (m_Socket == INVALID_SOCKET || m_HasError) return false; std::string MessageString = std::string(message.begin(), message.end()); if (sendto(m_Socket, MessageString.c_str(), MessageString.size(), 0, (struct sockaddr *)&sin, sizeof(sin)) == -1) return false; return true; } bool CUDPSocket::SendTo(std::string address, uint16_t port, BYTEARRAY message) { if (m_Socket == INVALID_SOCKET || m_HasError) return false; // get IP address struct hostent *HostInfo; uint32_t HostAddress; HostInfo = gethostbyname(address.c_str()); if (!HostInfo) { m_HasError = true; // m_Error = h_error; CONSOLE_Print("[UDPSOCKET] error (gethostbyname)"); return false; } memcpy(&HostAddress, HostInfo->h_addr, HostInfo->h_length); struct sockaddr_in sin; sin.sin_family = AF_INET; sin.sin_addr.s_addr = HostAddress; sin.sin_port = htons(port); return SendTo(sin, message); } bool CUDPSocket::Broadcast(uint16_t port, BYTEARRAY message) { if (m_Socket == INVALID_SOCKET || m_HasError) return false; struct sockaddr_in sin; sin.sin_family = AF_INET; sin.sin_addr.s_addr = m_BroadcastTarget.s_addr; sin.sin_port = htons(port); std::string MessageString = std::string(message.begin(), message.end()); if (sendto(m_Socket, MessageString.c_str(), MessageString.size(), 0, (struct sockaddr *)&sin, sizeof(sin)) == -1) { CONSOLE_Print("[UDPSOCKET] failed to broadcast packet (port " + UTIL_ToString(port) + ", size " + UTIL_ToString((u_int)MessageString.size()) + " bytes)"); return false; } return true; } void CUDPSocket::SetBroadcastTarget(std::string subnet) { if (subnet.empty()) { CONSOLE_Print("[UDPSOCKET] using default broadcast target"); m_BroadcastTarget.s_addr = INADDR_BROADCAST; } else { // this function does not check whether the given subnet is a valid subnet the user is on // convert std::string representation of ip/subnet to in_addr CONSOLE_Print("[UDPSOCKET] using broadcast target [" + subnet + "]"); m_BroadcastTarget.s_addr = inet_addr(subnet.c_str()); // if conversion fails, inet_addr( ) returns INADDR_NONE if (m_BroadcastTarget.s_addr == INADDR_NONE) { CONSOLE_Print("[UDPSOCKET] invalid broadcast target, using default broadcast target"); m_BroadcastTarget.s_addr = INADDR_BROADCAST; } } } void CUDPSocket::SetDontRoute(bool dontRoute) { int OptVal = 0; if (dontRoute) OptVal = 1; // don't route packets; make them ignore routes set by routing table and send them to the interface // belonging to the target address directly setsockopt(m_Socket, SOL_SOCKET, SO_DONTROUTE, (const char *)&OptVal, sizeof(int)); } // // CUDPServer // CUDPServer::CUDPServer() : CUDPSocket() { // make socket non blocking int iMode = 1; ioctlsocket(m_Socket, FIONBIO, (u_long FAR *)&iMode); // set the socket to reuse the address // with UDP sockets this allows more than one program to listen on the same port int optval = 1; setsockopt(m_Socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&optval, sizeof(int)); } CUDPServer::~CUDPServer() { } bool CUDPServer::Bind(struct sockaddr_in sin) { if (m_Socket == INVALID_SOCKET || m_HasError) return false; m_SIN = sin; if (bind(m_Socket, (struct sockaddr *)&m_SIN, sizeof(m_SIN)) == SOCKET_ERROR) { m_HasError = true; m_Error = GetLastError(); CONSOLE_Print("[UDPSERVER] error (bind) - " + GetErrorString()); return false; } return true; } bool CUDPServer::Bind(std::string address, uint16_t port) { if (m_Socket == INVALID_SOCKET || m_HasError) return false; struct sockaddr_in sin; sin.sin_family = AF_INET; if (!address.empty()) { if ((sin.sin_addr.s_addr = inet_addr(address.c_str())) == INADDR_NONE) sin.sin_addr.s_addr = INADDR_ANY; } else sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons(port); return Bind(sin); } void CUDPServer::RecvFrom(fd_set *fd, struct sockaddr_in *sin, std::string *message) { if (m_Socket == INVALID_SOCKET || m_HasError || !sin || !message) return; int AddrLen = sizeof(*sin); if (FD_ISSET(m_Socket, fd)) { // data is waiting, receive it char buffer[1024]; int c = recvfrom(m_Socket, buffer, 1024, 0, (struct sockaddr *)sin, &AddrLen); if (c == SOCKET_ERROR && GetLastError() != EWOULDBLOCK) { // receive error m_HasError = true; m_Error = GetLastError(); CONSOLE_Print("[UDPSERVER] error (recvfrom) - " + GetErrorString()); } else if (c > 0) { // success! *message = std::string(buffer, c); } } }
d05a87cf6b501784fd381c5ab0ec89b06d62cab7
b2606b52eef17302387ea34e6298f19f2d1852c1
/Neuria.h
a13bffdab1634cdc577873e9f86a5dc8fba9b31e
[]
no_license
zhenyouluo/Neuria_old
e8f23b60b1d29417f2b384b922a18957e5a45f0d
90e1ea7b631a780fda43a0165867ac8fc87add79
refs/heads/master
2021-01-24T15:14:58.056810
2012-09-26T16:51:13
2012-09-26T16:51:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
162
h
Neuria.h
#pragma once //Neuria:20120905 #include "ByteArray.h" #include "network/Network.h" #include "database/DataBase.h" #include "utility/Utility.h" namespace nr { }
7198dc654b7b3c3cbe86eb628f822f61b16881b2
4cada364446c1ec28767f3febc666a4d59b3a0cb
/reliable-req-rep/paranoid-pirate-broker.cpp
8b4906a006d7467589307a605fef2d184a5a725a
[]
no_license
ugovaretto/zmq-scratch
40397cde5fc5fbb52f0a5104c6e7ea10934946a8
528af7359031e763d794e74be54c1a125d2f2862
refs/heads/master
2020-04-06T07:02:23.377191
2016-08-30T15:36:37
2016-08-30T15:36:37
11,503,247
0
0
null
null
null
null
UTF-8
C++
false
false
8,330
cpp
paranoid-pirate-broker.cpp
//Load balanced broker from Ch3/4 ZGuide, added support for <seq id, payload> //message format; in a real-world scenario use the functions in multipart.h //to avoid dealing with the message format detail. //Author: Ugo Varetto //use with *lazy* pirate client and *simple* pirate worker #include <iostream> #include <vector> #include <algorithm> #include <set> //we have a timestamp in the record data' now //data is automatically sorted by timestamp //from highest to lowest #include <chrono> #include <cassert> #ifdef __APPLE__ #include <ZeroMQ/zmq.h> #else #include <zmq.h> #endif namespace { const int WORKER_READY = 123; const int HEARTBEAT = 111; typedef std::chrono::time_point< std::chrono::steady_clock > timepoint; typedef std::chrono::duration< long int > duration; const duration EXPIRATION_INTERVAL = std::chrono::duration_cast< duration >( std::chrono::milliseconds(15 * 1000)); const duration HEARTBEAT_INTERVAL = std::chrono::duration_cast< duration >( std::chrono::milliseconds(1 * 1000)); const int TIMEOUT = 1 * 1000; } //------------------------------------------------------------------------------ class worker_info { public: bool operator >(const worker_info& wi) const { return timestamp_ > wi.timestamp_; } operator int() const { return id_; } worker_info(int id = -1) : id_(id), timestamp_(std::chrono::steady_clock::now()) {} const timepoint& timestamp() const { return timestamp_; } int id() const { return id_; } private: int id_; timepoint timestamp_; }; typedef std::set< worker_info > Workers; //------------------------------------------------------------------------------ //elements are ordered from highest to lowest //1) find the first element which has a time > expiration time //2) remove all elements from that element to last element is set void purge(Workers& workers, const duration& cutoff) { typedef Workers::iterator WI; WI start = std::find_if( workers.begin(), workers.end(), [&cutoff](const worker_info& wi) { return std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::steady_clock::now() - wi.timestamp() ) > cutoff; }); if(start == workers.end()) return; workers.erase(start, workers.end()); } //------------------------------------------------------------------------------ //if worker already present remove it and re-insert it in the right //position void push(Workers& workers, int id) { Workers::iterator it = std::find_if(workers.begin(), workers.end(), [id](const worker_info& wi){ return wi.id() == id; }); if(it != workers.end()) workers.erase(it); workers.insert(worker_info(id)); } //------------------------------------------------------------------------------ int pop(Workers& workers) { assert(workers.size() > 0); std::set< worker_info >::iterator back = --workers.end(); const int ret = back->id(); workers.erase(back); return ret; } //------------------------------------------------------------------------------ int main(int argc, char** argv) { if(argc < 3) { std::cout << "usage: " << argv[0] << " <frontend address> <backend address>" << std::endl; return 0; } const char* FRONTEND_URI = argv[1]; const char* BACKEND_URI = argv[2]; const int MAX_REQUESTS = 100; //create communication objects void* context = zmq_ctx_new(); assert(context); void* frontend = zmq_socket(context, ZMQ_ROUTER); assert(frontend); void* backend = zmq_socket(context, ZMQ_ROUTER); assert(backend); assert(zmq_bind(frontend, FRONTEND_URI) == 0); assert(zmq_bind(backend, BACKEND_URI) == 0); //workers ordered queue Workers workers; int worker_id = -1; int client_id = -1; int rc = -1; std::vector< char > request(0x100, 0); std::vector< char > reply(0x100, 0); int serviced_requests = 0; //loop until max requests servided while(serviced_requests < MAX_REQUESTS) { zmq_pollitem_t items[] = { {backend, 0, ZMQ_POLLIN, 0}, {frontend, 0, ZMQ_POLLIN, 0}}; //remove all workers that have not been active for a //time > expiration interval //XXX TODO: TEST purge(workers, EXPIRATION_INTERVAL); //XXX //poll for incoming requests: if no workers are available //only poll for workers(backend) since there is no point //in trying to service a client request without active //workers rc = zmq_poll(items, workers.size() > 0 ? 2 : 1, TIMEOUT); if(rc == -1) break; //data from workers if(items[0].revents & ZMQ_POLLIN) { assert(zmq_recv(backend, &worker_id, sizeof(worker_id), 0) > 0); assert(zmq_recv(backend, 0, 0, 0) == 0); assert(zmq_recv(backend, &client_id, sizeof(client_id), 0) > 0); //add worker to list of available workers push(workers, worker_id); assert(workers.size() > 0); //of not a 'ready' message forward message to frontend //workers send 'ready' messages when either if(client_id != WORKER_READY) { int seq_id = -1; assert(zmq_recv(backend, 0, 0, 0) == 0); rc = zmq_recv(backend, &seq_id, sizeof(seq_id), 0); assert(rc > 0); rc = zmq_recv(backend, &reply[0], reply.size(), 0); assert(rc > 0); zmq_send(frontend, &client_id, sizeof(client_id), ZMQ_SNDMORE); zmq_send(frontend, 0, 0, ZMQ_SNDMORE); zmq_send(frontend, &seq_id, sizeof(seq_id), ZMQ_SNDMORE); zmq_send(frontend, &reply[0], rc, 0); ++serviced_requests; } } //request from clients if(items[1].revents & ZMQ_POLLIN) { int seq_id = -1; //receive request |client id|<null>|request id|data| zmq_recv(frontend, &client_id, sizeof(client_id), 0); zmq_recv(frontend, 0, 0, 0); rc = zmq_recv(frontend, &seq_id, sizeof(seq_id), 0); assert(rc > 0); const int req_size = zmq_recv(frontend, &request[0], request.size(), 0); assert(req_size > 0); //take worker from list and forward request to it worker_id = pop(workers); assert(worker_id > 0); zmq_send(backend, &worker_id, sizeof(worker_id), ZMQ_SNDMORE); zmq_send(backend, 0, 0, ZMQ_SNDMORE); zmq_send(backend, &client_id, sizeof(client_id), ZMQ_SNDMORE); zmq_send(backend, 0, 0, ZMQ_SNDMORE); zmq_send(backend, &seq_id, sizeof(seq_id), ZMQ_SNDMORE); zmq_send(backend, &request[0], req_size, 0); } const int hb = HEARTBEAT; //capturing HEARTBEAT directly generates //a warning because the lambda function should //not capture a variable with non-automatic //storage //send heartbeat request to all workers: workers reply to such request //with a 'ready' message std::for_each(workers.begin(), workers.end(), [backend, hb](const worker_info& wi) { const int id = wi.id(); zmq_send(backend, &id, sizeof(id), ZMQ_SNDMORE); zmq_send(backend, 0, 0, ZMQ_SNDMORE); zmq_send(backend, &hb, sizeof(hb), 0); }); } zmq_close(frontend); zmq_close(backend); zmq_ctx_destroy(context); return 0; }
8f5df78547bb9681813b645a04cc22ca94013786
b24de71866f5768921eef27245bf12d51ebb635e
/CubePP/Rng.cpp
513d620c89d19638606992ab968c7048b18e657f
[ "MIT" ]
permissive
drblah/CubePP
df49d136f6cc4e071835924c8db00af314485c76
9a343e67a307523cbb1466067a591453d2de6509
refs/heads/master
2020-05-18T01:26:43.680656
2015-06-21T18:20:14
2015-06-21T18:20:14
37,668,884
0
0
null
null
null
null
UTF-8
C++
false
false
435
cpp
Rng.cpp
/* * Rng.cpp * * Created: 11/06/2015 20:03:06 * Author: drblah */ #include "Rng.h" unsigned short rngSeed; unsigned short rngCounter; // default constructor Rng::Rng() { rngSeed = 38; rngCounter = 0; } //Rng unsigned short Rng::NextNumber() { rngSeed = (43*rngSeed+rngCounter) % 255; if (rngCounter < 255) { rngCounter++; } else { rngCounter = 0; } return rngSeed; } // default destructor Rng::~Rng() { } //~Rng
d1306ac397ec99b72d65c04e59045ba5eb8e238c
5af4757ce7238e80598be799116d2ec9aeaa01b5
/Lab 9/Lab_1.cpp
a734457da914f43692a254f6a00ff6fd87892c42
[]
no_license
Jhecks/ITMO-Algorithms-and-Data-Structures
8c6ed74f4c2ede2743a524b2bb2990baadf5c1bb
3bac17cf096e3e6b565c63224babf1a5e5ec7b8b
refs/heads/main
2023-06-18T01:16:59.586981
2021-07-07T13:14:32
2021-07-07T13:14:32
383,477,614
1
0
null
null
null
null
UTF-8
C++
false
false
1,236
cpp
Lab_1.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; vector <vector <int>> Graph; vector <int> TopSeq; vector <char> Color; struct Pair { int first; int second; }; void BuildGraph() { Pair input; cin >> input.first >> input.second; Graph.resize(input.first); for (int i = 0; i < input.second; i++) { Pair input1; cin >> input1.first >> input1.second; input1.first--; input1.second--; Graph[input1.first].push_back(input1.second); } } void DFS(int v) { Color[v] = 1; for (int i : Graph[v]) { if (Color[i] == 0) DFS(i); else if (Color[i] == 1) { cout << -1; exit(0); } } TopSeq.push_back(v); Color[v] = 2; } void TopologicalSort() { Color.resize(Graph.size(), 0); for (int i = 0; i < Graph.size(); i++) { if (Color[i] == 0) DFS(i); } reverse(TopSeq.begin(), TopSeq.end()); } int main() { freopen("topsort.in", "r", stdin); freopen("topsort.out", "w", stdout); BuildGraph(); TopologicalSort(); for (int i : TopSeq) cout << i + 1 << ' '; return 0; }
ea4b2d9bb6b9f92b8db7a0c04b35797f70590470
185e1f5986dabf604e2824b4a636a127557ef32c
/src/io/input.hpp
c4642e9cb9b0495fcbb44729c091b680f8d7882b
[]
no_license
inxanedev/InxaneUtils
9c6d63d53d61a565eb70e1567879b3b66d47fe4d
cb7cb86b49bcbadcd681f6503b69efc840bbdec5
refs/heads/master
2023-03-05T22:58:43.963074
2021-02-19T22:09:31
2021-02-19T22:09:31
316,826,682
1
0
null
null
null
null
UTF-8
C++
false
false
663
hpp
input.hpp
#pragma once #include <string> #include <iostream> namespace inx { namespace io { template <typename T> T input() { T result; std::cin >> result; std::cin.ignore(); return result; } template <> std::string input<std::string>() { std::string result; std::getline(std::cin, result); return result; } template <typename T> void input(T& var) { std::cin >> var; std::cin.ignore(); } template <> void input(std::string& var) { std::getline(std::cin, var); } template <> void input(void) { std::cin.get(); } void wait() { input<void>(); } } }
56c8b6b1dd3960379aabd63b7c1f7000162b8d49
28b09415f991b8edcff8b32d91e812e028497783
/src/main.cpp
5701b78219f304eee91ccabc5f03152811da4e92
[]
no_license
MalcolmWilliams/Umbrella
664876cbe9160259aad45d05d21b41e3a8e148e2
961902ca6c1226b77651cdbc1d163b4c2d8c99bc
refs/heads/master
2021-01-12T06:39:19.741796
2017-01-29T21:41:06
2017-01-29T21:41:06
77,405,569
0
0
null
2017-01-13T15:35:12
2016-12-26T20:31:40
Arduino
UTF-8
C++
false
false
1,835
cpp
main.cpp
/* * Only ESP plus small LED: * Average power consumption: 32.5mW * Max: 240mW */ #include "ESP8266WiFi.h" #include "BrightnessMap.h" unsigned long start_time; // = micros(); unsigned long end_time; // = micros(); int nets; int LEDpin = 0; void setBrightness(int val); void printScanResult(int networksFound); void printScanResult(int networksFound) { int val = 0; //Serial.println(); Serial.printf("%d network(s) found\n", networksFound); for (int i = 0; i < networksFound; i++) { //Serial.printf("%d: %s, Ch:%d (%ddBm) %s\n", i + 1, WiFi.SSID(i).c_str(), WiFi.channel(i), WiFi.RSSI(i), WiFi.encryptionType(i) == ENC_TYPE_NONE ? "open" : ""); Serial.printf("%s, (%ddBm)\n", WiFi.SSID(i).c_str(), WiFi.RSSI(i)); /* * -20 is the closest * -80 is the farthest * * Need to come up with an algorythm that has the desired effect */ //if(WiFi.SSID(i).c_str() == "ESP-AP") val += 100 - WiFi.RSSI(i); //if(WiFi.SSID(i).c_str() == "ESP-AP\n") val += 100 - WiFi.RSSI(i); if(WiFi.SSID(i) == "ESP-AP") val += 100 + WiFi.RSSI(i); //if(WiFi.SSID(i) == "ESP-AP\n") val += 100 - WiFi.RSSI(i); } setBrightness(val); } void setBrightness(int val) { if (val > 100) val = 100; Serial.println(val); val = BrightnessMap[val]; //map the brightness to make the led brightness change appear linear (normally it will look logarithmic) analogWrite(LEDpin, (100-val)*PWMRANGE/100); } void setup() { Serial.begin(115200); Serial.println(); WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100); pinMode(LEDpin, OUTPUT); analogWrite(LEDpin, 0); } void loop() { start_time = micros(); int nets = WiFi.scanNetworks(); printScanResult(nets); end_time = micros(); Serial.print("Run Time: "); Serial.println((end_time - start_time)/1000000.0); }
2a497fcc9f2b92ce242a4d7668ec1eb9500b07ff
b77b470762df293be67877b484bb53b9d87b346a
/game/AObject.h
159c06347f8ae08865b4958bbf986a85bdf8e283
[ "BSD-3-Clause" ]
permissive
Sheph/af3d
9b8b8ea41f4e439623116d70d14ce5f1ee1fae25
4697fbc5f9a5cfb5d54b06738de9dc44b9f7755f
refs/heads/master
2023-08-28T16:41:43.989585
2021-09-11T19:09:45
2021-09-11T19:09:45
238,231,399
1
1
null
null
null
null
UTF-8
C++
false
false
4,626
h
AObject.h
/* * Copyright (c) 2020, Stanislav Vorobiov * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _AOBJECT_H_ #define _AOBJECT_H_ #include "AClass.h" namespace af3d { enum AObjectFlags { AObjectEditable = 1 << 0, AObjectMarkerObject = 1 << 1, AObjectMarkerLight = 1 << 2, AObjectMarkerJoint = 1 << 3 }; class AObject : boost::noncopyable { public: virtual ~AObject(); static const AClass& staticKlass(); static ACookie allocCookie(); static AObject* getByCookie(ACookie value); static size_t getCount(); virtual AObjectPtr sharedThis() = 0; inline const AClass& klass() const { return *klass_; } // WARNING! Only call this if you're 100% sure what you're doing. inline void setKlass(const AClass& value) { klass_ = &value; } bool isSubClassOf(const AClass& value) const; inline ACookie cookie() const { return cookie_; } void setCookie(ACookie value); inline const std::string& name() const { return name_; } virtual void setName(const std::string& value) { name_ = value; } inline std::uint32_t aflags() const { return aflags_; } inline void aflagsSet(std::uint32_t value) { aflags_ |= value; } inline void aflagsClear(std::uint32_t value) { aflags_ &= ~value; } bool propertyCanGet(const std::string& key) const; bool propertyCanSet(const std::string& key) const; const AProperty* propertyFind(const std::string& key) const; APropertyValue propertyGet(const std::string& key) const; ACommandPtr propertySet(const std::string& key, const APropertyValue& value); ACommandPtr propertySetOneOf(const std::string& key1, const std::string& key2, const APropertyValue& value); void propertiesSet(const APropertyValueMap& propVals); APropertyValue propertyNameGet(const std::string&) const { return name(); } void propertyNameSet(const std::string&, const APropertyValue& value) { setName(value.toString()); } protected: explicit AObject(const AClass& klass); private: const AClass* klass_; ACookie cookie_; std::string name_; std::uint32_t aflags_ = 0; }; extern const APropertyTypeObject APropertyType_AObject; extern const APropertyTypeArray APropertyType_ArrayAObject; ACLASS_DECLARE(AObject) template <class T> inline T* aobjectCast(AObject* obj) { return (obj && obj->isSubClassOf(T::staticKlass())) ? static_cast<T*>(obj) : nullptr; } template <class T> inline std::shared_ptr<T> aobjectCast(const AObjectPtr& obj) { return (obj && obj->isSubClassOf(T::staticKlass())) ? std::static_pointer_cast<T>(obj) : std::shared_ptr<T>(); } template <class T> inline std::shared_ptr<T> aweakObjectCast(const AWeakObject& weakObj) { return aobjectCast<T>(weakObj.lock()); } template <class T> std::shared_ptr<T> APropertyValue::toObject() const { switch (type_) { case Object: return aobjectCast<T>(obj_); case WeakObject: return aweakObjectCast<T>(wobj_); default: return std::shared_ptr<T>(); } } } #endif
fcb02d60ae1b3eb32d249be34d993e93eeccbeb3
5648967e25d9604dd5fb87776c25b9da345c4a27
/EventHandler.h
53227c00cf915c680467d2ba473d698cc588edea
[]
no_license
AmirHosseinCH/EventHandler
83a03239fe9664c4ab2fdf26677d12966b9db00c
05f11565bce25f9f3a4f9088f4b3b27912870ea7
refs/heads/main
2023-06-14T22:46:04.087853
2021-07-14T11:27:00
2021-07-14T11:27:00
385,910,332
7
1
null
null
null
null
UTF-8
C++
false
false
2,494
h
EventHandler.h
#ifndef EVENTHANDLER_H #define EVENTHANDLER_H #include <map> #include <queue> #include <memory> #include <functional> #include <thread> #include <mutex> #include <condition_variable> #include <atomic> struct BaseHandler { virtual ~BaseHandler() {} }; template<typename... Args> struct Handler : public BaseHandler { using func_t = std::function<void(Args...)>; func_t handler; Handler(func_t&& f) : handler{std::move(f)} {} Handler(func_t& f) : handler{f} {} void operator()(Args... args) { handler(args...); } }; struct BaseEvent { virtual void operator()() = 0; virtual ~BaseEvent() {} }; template<typename Func> struct Event : BaseEvent { Func func; Event(Func&& f) : func{std::forward<Func>(f)} {} void operator()() { func(); } }; class EventHandler final { public: EventHandler() { handlerThread = std::thread{&EventHandler::run, this}; } ~EventHandler() { handlerThread.join(); } template<typename... Args, typename Func> EventHandler& on(std::string eventName, Func&& f) { std::lock_guard lock{mtx}; std::function<void(Args...)> func = std::forward<Func>(f); eventMap[eventName] = std::make_unique<Handler<Args...>>(std::move(func)); return *this; } template<typename... Args> void emit(std::string eventName, Args... args) { std::lock_guard lock{mtx}; auto baseHandler = eventMap[eventName].get(); Handler<Args...>* handler = dynamic_cast<Handler<Args...>*> (baseHandler); auto bindedHandler = std::bind(&Handler<Args...>::operator(), handler, args...); eventQueue.push(std::make_unique<Event<decltype(bindedHandler)>>(std::move(bindedHandler))); cv.notify_one(); } void run() { while(!done) { std::unique_lock lock{mtx}; cv.wait(lock, [this] { return !eventQueue.empty() || done; }); if (!eventQueue.empty()) { auto handler = std::move(eventQueue.front()); eventQueue.pop(); lock.unlock(); (*handler)(); } } } void exit() { done = true; cv.notify_one(); } private: std::map<std::string, std::unique_ptr<BaseHandler>> eventMap; std::queue<std::unique_ptr<BaseEvent>> eventQueue; std::mutex mtx; std::condition_variable cv; std::atomic<bool> done{false}; std::thread handlerThread; }; #endif
d8d80b3c971dfb4746c49f97661b1d7c34988e7a
fcae89324819ae90a1741dc11dd4a5fd6885142d
/inet-integration/src/physicallayer/radio/detailed/decider/Decider80211MultiChannel.cc
0f39bdf70c173d16c8a1468ff82055650d7de47d
[]
no_license
faridachy/INET
133d3b6654cbb21ea41a0ac5139abee1896fa94f
671933df6869d3ff5adaf8ded903754f490b1bff
refs/heads/master
2020-05-30T18:44:31.854050
2014-07-16T18:13:43
2014-07-16T18:13:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,084
cc
Decider80211MultiChannel.cc
/* * Decider80211MultiChannel.cpp * * Created on: Mar 22, 2011 * Author: karl */ #include "IRadio.h" #include "Decider80211MultiChannel.h" #include "DeciderToPhyInterface.h" #include "DeciderResult80211.h" #include "Ieee80211Consts.h" Decider80211MultiChannel::~Decider80211MultiChannel() { } DeciderResult* Decider80211MultiChannel::createResult(const DetailedRadioFrame* frame) const { DeciderResult80211* result = static_cast<DeciderResult80211*>(Decider80211::createResult(frame)); IRadio *radio = check_and_cast<IRadio *>(phy); if(result->isSignalCorrect() && frame->getChannel() != radio->getRadioChannel()) { EV << "Channel changed during reception. packet is lost!\n"; DeciderResult80211* oldResult = result; result = new DeciderResult80211(false, oldResult->getBitrate(), oldResult->getSnr()); delete oldResult; } return result; } void Decider80211MultiChannel::channelChanged(int newChannel) { assert(1 <= newChannel && newChannel <= 14); centerFrequency = CENTER_FREQUENCIES[newChannel]; Decider80211::channelChanged(newChannel); }
ea5eb6b625386dc2fc6b3d3ed6f9bb440f3c6015
22e1c1147d5f935a00adb7e3b811f64d9f368cca
/zaino.hpp
5a02e9595bcfec0f8bf958e2e1ca8a0c2e40349d
[]
no_license
salvomob/Codemons
baa9566331bbaf2c3d513c3c114b4311daa1dec8
687f2cdf8b5f0bae3dae3d3c80d5b0918aeeaa84
refs/heads/master
2023-07-02T18:07:40.699599
2021-07-27T15:24:40
2021-07-27T15:24:40
368,429,245
1
0
null
null
null
null
UTF-8
C++
false
false
2,226
hpp
zaino.hpp
#ifndef ZAINO_HPP #define ZAINO_HPP class Zaino{ private: Codecube **cubes; Item **items; Itemb **itembs; int max; // max mi idrà quanti slot oggetto posso avere all'interno dello zaino, poi per settare il numero, devo usare i metodi relativi nelle classi relative //max deve essere ben decisa in un secondo momento, quando si penserà alla reale implementazione del gioco, in modo da non avere più slot del numero di oggetti possibili //e magari creare diverse variabili max relative al numero di codecubes, itm e itemBase relativi int nc; int it; int itb; public: Zaino(){ this->max = 50; this->cubes = new Codecube*[max]; this->items = new Item*[max]; this->itembs = new Itemb*[max]; for(int i = 0; i < this->max; i++){ cubes[i] = NULL; items[i] = NULL; itembs[i] = NULL; } this->nc = 0; this->it = 0; this->itb = 0; } //metodi set void insCube(Codecube& c){ if(this->nc < this->max){ this->nc = this->nc+1; this->cubes[nc-1] = &c; } else{ std::cout << "NON POSSIBILE, RAGGIUNTO MASSIMO"; return; } } void insItem(Item& i){ if(this->it < this->max){ this->it = this->it+1; this->items[it-1] = &i; } else{ std::cout << "NON POSSIBILE, RAGGIUNTO MASSIMO"; return; } } void insItemb(Itemb& ib){ if(this->itb < this->max){ this->itb = this->itb+1; this->itembs[itb-1] = &ib; } else{ std::cout << "NON POSSIBILE, RAGGIUNTO MASSIMO"; return; } } //metodi get Codecube* getCubes(){ return *this->cubes; } Item* getItems(){ return *this->items; } Itemb* getItembs(){ return *this->itembs; } void show(std::ostream& out){ out << "Item Presenti : " << this->it << "\n"; out << "Item Base Presenti : " << this->itb << "\n"; out << "CodeCubes Presenti " << this->nc << "\n"; out << "Ecco Gli ITEM : \n"; for(int i = 0; i< it; i++){ items[i]->show(out); } out << "Ecco Gli ITEM BASE: \n"; for(int i = 0; i< itb; i++){ itembs[i]->show(out); } out << "Ecco Le Codecubes : \n"; for(int i = 0; i< nc; i++){ cubes[i]->show(out); } } int getIt(){ return this->it; } int getNc(){ return this->nc; } int getItb(){ return this->itb; } }; #endif
fc918f7e82bd693aff7fd548b707acbc3d9e89cf
d2fcf9142c2a35065271848d0bf0b2ef38c7643b
/cf/1263/q3.cpp
5d9999f6ef7481e5eb461d5f5a445a6ce5086c79
[]
no_license
yashrsharma44/cp-archive
ede0e3cb67a388f760ef18907ad64b46e6223b9a
1baea4d1614fa637d9e4acf9dbaa261aec9f906e
refs/heads/master
2020-11-24T04:53:07.055089
2019-12-14T05:53:22
2019-12-14T05:53:22
227,973,288
0
0
null
null
null
null
UTF-8
C++
false
false
1,757
cpp
q3.cpp
#include <bits/stdc++.h> using namespace std; void SieveOfEratosthenes(long long int n) { // Create a boolean array "prime[0..n]" and initialize // all entries it as true. A value in prime[i] will // finally be false if i is Not a prime, else true. bool prime[n+1]; vector<long long int> arr; memset(prime, true, sizeof(prime)); for (long long int p=2; p*p<=n; p++) { // If prime[p] is not changed, then it is a prime if (prime[p] == true) { // Update all multiples of p greater than or // equal to the square of it // numbers which are multiple of p and are // less than p^2 are already been marked. for (long long int i=p*p; i<=n; i += p) prime[i] = false; } } // Print all prime numbers for (long long int p=2; p<=n; p++) if (prime[p]) arr.push_back(p); set<long long int> res; res.insert(n); for(long long int i=0;i<arr.size();i++) { long long int k = arr[i]; long long int v = n/k; res.insert(v); } res.insert(0); cout<<res.size()<<endl; // set <long long int> :: iterator itr; for(auto elem : res){ cout<<elem<<" "; } cout<<endl; return; } void getFactors(long long int n) { vector<long long int> arr; arr.push_back(0); arr.push_back(1); if(n<=2) { cout<<arr.size()<<endl; for(long long int i=0;i<arr.size();i++) { cout<<arr[i]<<" "; } cout<<endl; return; } for(long long int i=3;i<=sqrt(n);i+=2) { if(n%i!=0) { } } } int main() { int t; cin>>t; for(int i=0;i<t;i++) { long long int n; cin>>n; SieveOfEratosthenes(n); } }
97c193043fab3812fc57efa59a3aa2c5cacc44ea
bbdd63f4403ad2e15dce8dfd5ef35263d2f2bd86
/common/x64/dependency/include/coorTransfer/CTCommon.h
a9034eedd4142b1a01b887b0be950dd08d19476a
[]
no_license
MelodyD/pytest_API
a7d4dcb1bd8ba9b1981ca640080c27e2b5aaa0b7
77e11924e3fec6e3ddbf65f07d05cf77a4fe94ea
refs/heads/main
2023-07-18T10:02:15.382032
2021-09-11T12:57:08
2021-09-11T12:57:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,294
h
CTCommon.h
/** ******************************************************************************* * RoadDB Confidential * Copyright (c) Continental AG. 2016-2018, RoadDB 2019-2020 * * This software is furnished under license and may be used or * copied only in accordance with the terms of such license. ******************************************************************************* * @file CTCommon.h * @brief This class is used to do coordinate transform for Common Objects ******************************************************************************* */ #ifndef __CT_COMMON_H__ #define __CT_COMMON_H__ #include <vector> #include <opencv2/imgproc.hpp> #include "typeDef.h" #include "errorCode/serverSysErrorCode.h" #include "segment/Segment.h" #include "segment/CoordsTransferAlgo.h" namespace roadDBCore { struct LmObject_t; struct LmVolume_t; namespace coorTrans { uint32_t getSegOffset(const SegmentID_t &destSegID, const SegmentID_t &srcSegID, Point3d_t &offset); //bool transCVMat(cv::Mat &pos, const Point3d_t &offset); //calculate the origin segment id from a position; template<typename T> SegmentID_t calOriginSegment(const SegmentID_t refSeg, const Point3_t<T> &pos) { Point3d_t absPosition; Segment segment; segment.seg2Gps(refSeg, pos, absPosition); SegmentID_t segID = segment.getSegID(absPosition); if (segID == INVALID_TILE_ID) { COM_LOG_ERROR << errorCode(CAL_SECTION_SEGID_FAILED) << "Cal segment id of section failed, ref seg=" << refSeg << ", relative pos=" << pos.relLon << "," << pos.relLat << "," << pos.relAlt << ", absolute pos=" << absPosition.relLon << "," << absPosition.relLat << "," << absPosition.relAlt; return INVALID_TILE_ID; } return segID; } void transLmVolume(const GpsOffsetTransfer &offsetTrans, std::shared_ptr<LmVolume_t> &spVolume); void transLmObject(const GpsOffsetTransfer &offsetTrans, LmObject_t &lmObject); void transLowPrecisionRT(const GpsOffsetTransfer &offsetTrans, float32_t rotation[9], float32_t translation[3]); }//coorTrans }//roadDBCore #endif
846ed3c447de42e3756a0df7efe87aeb7af40f52
faabc5a481244aa56a2c5879e928c908531ae6be
/GameSources/Player.cpp
8edc66afc9c90b4087d027b2065280b2e915236c
[]
no_license
sanosuke3/SourceTreeSP
178ddc16b59fdc6f920ef684329534ced4087928
5024af0dc0a2e406741d39b50b80177ce4e0d805
refs/heads/master
2023-02-26T04:14:15.260894
2021-02-02T06:38:47
2021-02-02T06:38:47
335,173,233
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
1,347
cpp
Player.cpp
/*! @file Player.cpp @brief プレイヤーなど実体 */ #include "stdafx.h" #include "Project.h" namespace basecross{ void Player::OnCreate() { auto drawComp = AddComponent<PNTStaticDraw>(); drawComp->SetMeshResource(L"DEFAULT_SPHERE"); auto transComp = AddComponent<Transform>(); auto matrix = transComp->GetWorldMatrix(); PsBoxParam param(matrix, 1.0f, false, PsMotionType::MotionTypeActive); auto rigidComp = AddComponent<RigidbodyBox>(param); } void Player::OnUpdate() { auto& app = App::GetApp(); // アプリケーションオブジェクトを取得する auto device = app->GetInputDevice(); const auto& pad = device.GetControlerVec()[0]; auto transComp = GetComponent<Transform>(); auto pos = transComp->GetPosition(); if (pad.wPressedButtons & XINPUT_GAMEPAD_DPAD_LEFT) { pos += Vec3(-1.0f, 0.0f, 0.0f); // プレイヤーを左に移動させる } if (pad.wPressedButtons & XINPUT_GAMEPAD_DPAD_RIGHT) { pos += Vec3(1.0f, 0.0f, 0.0f); // プレイヤーを左に移動させる } if (pad.wPressedButtons & XINPUT_GAMEPAD_DPAD_UP) { pos += Vec3(0.0f, 1.0f, 0.0f); // プレイヤーを左に移動させる } if (pad.wPressedButtons & XINPUT_GAMEPAD_DPAD_DOWN) { pos += Vec3(0.0f, -1.0f, 0.0f); // プレイヤーを左に移動させる } } } //end basecross
0d55b1b0380cd11e948412a9a8cbd411985a4b1a
34c81af880b0012bbe03d4fd99b3b012cacaf857
/V_Engine/PhysBody3D.cpp
94dc70099990f57f6b487eb23c873db66248f33d
[]
no_license
Vulpem/V_Terrains
f8783f60fe437cc446add5db107cd2fc4814ebac
d680d2f0373a0a545bf27d68809b3f986e0bd96d
refs/heads/master
2021-07-16T07:37:50.461246
2018-11-26T15:38:44
2018-11-26T15:38:44
109,832,995
0
0
null
2018-03-07T12:53:52
2017-11-07T12:30:34
C
UTF-8
C++
false
false
2,168
cpp
PhysBody3D.cpp
#include "PhysBody3D.h" #include "Bullet\include\btBulletDynamicsCommon.h" // ================================================= PhysBody3D::PhysBody3D(btRigidBody* body) : m_body(body) { body->setUserPointer(this); } // --------------------------------------------------------- PhysBody3D::~PhysBody3D() { delete m_body; } // --------------------------------------------------------- void PhysBody3D::Push(float x, float y, float z) { m_body->applyCentralImpulse(btVector3(x, y, z)); } // --------------------------------------------------------- void PhysBody3D::GetTransform(float* matrix) const { if(m_body != nullptr && matrix != NULL) { m_body->getWorldTransform().getOpenGLMatrix(matrix); } } // --------------------------------------------------------- void PhysBody3D::SetTransform(const float* matrix) { if(m_body != nullptr && matrix != NULL) { btTransform t; t.setFromOpenGLMatrix(matrix); m_body->setWorldTransform(t); } } // --------------------------------------------------------- void PhysBody3D::SetPos(float x, float y, float z) { btTransform t = m_body->getWorldTransform(); t.setOrigin(btVector3(x, y, z)); m_body->setWorldTransform(t); } void PhysBody3D::GetPos(float* x, float* y, float* z) const { btTransform t = m_body->getWorldTransform(); btVector3 pos = t.getOrigin(); btVector3FloatData posFloat; pos.serializeFloat(posFloat); *x = posFloat.m_floats[0]; *y = posFloat.m_floats[1]; *z = posFloat.m_floats[2]; } // --------------------------------------------------------- void PhysBody3D::SetAsSensor(bool is_sensor) { if(this->m_isSensor != is_sensor) { this->m_isSensor = is_sensor; if(is_sensor == true) m_body->setCollisionFlags(m_body->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE); else m_body->setCollisionFlags(m_body->getCollisionFlags() &~ btCollisionObject::CF_NO_CONTACT_RESPONSE); } } // --------------------------------------------------------- bool PhysBody3D::IsSensor() const { return m_isSensor; } bool PhysBody3D::IsResting() const { return !m_body->isActive(); } void PhysBody3D::SetInactive() { m_body->setActivationState(WANTS_DEACTIVATION); }
2d0a9e460cfc75eafb71021fe86bac0ab768e8d2
7f6670f6a2a5a37d27a6f4b13206c7323d852813
/disks.hpp
05b7875fa1e04ca674ce86d91797a5b390ba63da
[ "MIT" ]
permissive
Jenniferwyqq/Alternating-Disk-Problem
495b67a08bcb715006e08e081d357fe01cc581d1
485bd8fd2c7f5efe57b99df54f758cc430b7adc8
refs/heads/main
2023-04-06T00:10:28.515706
2021-04-21T21:26:45
2021-04-21T21:26:45
360,309,379
0
0
null
null
null
null
UTF-8
C++
false
false
5,729
hpp
disks.hpp
/////////////////////////////////////////////////////////////////////////////// // disks.hpp // // Definitions for two algorithms that each solve the alternating disks // problem. // // As provided, this header has four functions marked with TODO comments. // You need to write in your own implementation of these functions. // /////////////////////////////////////////////////////////////////////////////// #pragma once #include <algorithm> #include <cassert> #include <cstddef> #include <sstream> #include <string> #include <vector> // TODO #include <functional> #include <iostream> enum disk_color { DISK_DARK, DISK_LIGHT}; class disk_state { private: std::vector<disk_color> _colors; public: disk_state(size_t light_count) : _colors(light_count * 2, DISK_DARK) { assert(light_count > 0); for (size_t i = 0; i < _colors.size(); i += 2) { _colors[i] = DISK_LIGHT; } } bool operator== (const disk_state& rhs) const { return std::equal(_colors.begin(), _colors.end(), rhs._colors.begin()); } size_t total_count() const { return _colors.size(); } size_t light_count() const { return total_count() / 2; } size_t dark_count() const { return light_count(); } bool is_index(size_t i) const { return (i < total_count()); } disk_color get(size_t index) const{ assert(is_index(index)); return _colors[index]; } void swap(size_t left_index) { assert(is_index(left_index)); auto right_index = left_index + 1; assert(is_index(right_index)); std::swap(_colors[left_index], _colors[right_index]); } std::string to_string() const { std::stringstream ss; bool first = true; for (auto color : _colors) { if (!first) { ss << " "; } if (color == DISK_LIGHT) { ss << "L"; } else { ss << "D"; } first = false; } return ss.str(); } // Return true when this disk_state is in alternating format. That means // that the first disk at index 0 is light, the second disk at index 1 // is dark, and so on for the entire row of disks. bool is_initialized(/*int i*/) const { int tc = total_count(); for (int i = 0; i < tc - 2; i+=2) { if (_colors[i] != DISK_LIGHT) return false; } tc = total_count(); for (int i = 1;i <= tc -1 ; i+=2) { if (_colors[i] != DISK_DARK) return false; } return true; } // Return true when this disk_state is fully sorted, with all dark disks // on the left (low indices) and all light disks on the right (high // indices). bool is_sorted() const { int tc = total_count(); for (int i = 0; i < tc / 2 - 1; i ++) { if (_colors[i] != DISK_DARK) return false; } for (int i = tc / 2; i <= tc - 1; i ++) { if (_colors[i] != DISK_LIGHT) return false; } return true; } }; // Data structure for the output of the alternating disks problem. That // includes both the final disk_state, as well as a count of the number // of swaps performed. class sorted_disks { private: disk_state _after; unsigned _swap_count; public: sorted_disks(const disk_state& after, unsigned swap_count) : _after(after), _swap_count(swap_count) { } sorted_disks(disk_state&& after, unsigned swap_count) : _after(after), _swap_count(swap_count) { } const disk_state& after() const { return _after; } unsigned swap_count() const { return _swap_count; } }; //This function sorts disk_state by using alternating algorithm. //It will return the disk_state after sorted and the number of swap counts. sorted_disks sort_alternate(const disk_state& before) { auto after = before; int swap_count = 0; int tc = after.total_count(); //From left to right and , repeated for (int k = 0; k <= tc/2 - 1; k++) { //From left to right, swap only if left disk is light && right disk is dark. for (int i = 0; i <= tc - 2; i += 2) { disk_color ic = after.get(i); disk_color icp = after.get(i + 1); if (ic == DISK_LIGHT && icp == DISK_DARK) { after.swap(i); swap_count++; } } //From left to right, swap only if left disk is light && right disk is dark. for (int i = 1; i <= tc - 3;i += 2) { disk_color ic = after.get(i); disk_color icp = after.get(i + 1); if (ic == DISK_LIGHT && icp == DISK_DARK) { after.swap(i); swap_count++; } } } return sorted_disks(after, swap_count); } //This function sorts disk_state by using lawnmower algorithm. //It will return the disk_state after sorted and the number of swap counts. sorted_disks sort_lawnmower(const disk_state& before) { auto after = before; int swap_count = 0; int tc = after.total_count(); //From left to right, and start from second leftmost to second rightmost, repeated for (int k = 0; k <= tc/2 - 1 ; k++) { //From left to right, swap only if left disk is light && right disk is dark. for (int i = 0; i <= tc - 2; i = i + 2) { disk_color ic = after.get(i); disk_color icp = after.get(i + 1); if (ic == DISK_LIGHT && icp == DISK_DARK) { after.swap(i); swap_count++; } } //From right to left, swap only if left disk is light && right disk is dark. for (int i = tc-3; i >= 1;i = i - 2) { disk_color ic = after.get(i); disk_color icp = after.get(i + 1); if (ic == DISK_LIGHT && icp == DISK_DARK) { after.swap(i); swap_count++; } } } return sorted_disks(after, swap_count); }
a1a975559cd17ddfa0d3bd34c6d632501be3a871
ec28bd88618c19e5ca1ea5fc406ab544e75742bd
/Neuron.cpp
4b26f9dbbc1421c2c8726f63915cd3d4dc40269f
[]
no_license
lukaszwek/soft-computing-1
66a54e7cf2864970a149023456eb86f255bc923e
7d8e431840e44065db88511074cfcf4b0364e4f1
refs/heads/master
2021-01-13T01:58:03.896036
2015-03-20T19:21:42
2015-03-20T19:21:42
32,144,627
0
0
null
null
null
null
UTF-8
C++
false
false
1,446
cpp
Neuron.cpp
// // Created by Michał Gutowski on 13.03.15. // #include "Neuron.h" Neuron::Neuron(ActivationFunction *func, int inputNumber, DataType defaultWeight, DataType learningRate) : function(func), inputWeights(inputNumber, defaultWeight), learningRate(learningRate) { } DataType Neuron::output(DataVector const &inputs) const { checkInputNumber(inputs); DataType weightedSum = 0; for(unsigned long i =0; i< inputs.size(); ++i){ weightedSum += inputs[i] * inputWeights[i]; } return function->compute(weightedSum); } DataVector Neuron::train(DataVector const &inputs, DataType const &desiredOutput) { checkInputNumber(inputs); DataVector deltas(inputs.size(), 0); for(unsigned long i=0; i< inputs.size(); ++i){ DataType outputError = desiredOutput-output(inputs); DataType x = inputs[i]; DataType derivativeValue = function->computeDervative(computeH(x)); deltas[i] = learningRate * outputError * function->computeDervative(computeH(x)) * x; inputWeights[i] += deltas[i]; } return deltas; } void Neuron::checkInputNumber(DataVector const &inputs) const { if(inputs.size() != inputWeights.size()){ throw std::invalid_argument("input number mismatch"); } } DataType inline Neuron::computeH(DataType x) { DataType h =0; for(unsigned int i=0 ;i< inputWeights.size(); ++i){ h += x*inputWeights[i]; } return h; }
3c14e612917a17ca99cd2ab6823c16fe641dea36
4a6ad1761777f0257b8e9dc2f8baf37e5f5faa1c
/uva 13109 Elephants.cpp
0e397a004fb135c9a7effedc19e013e74d257167
[]
no_license
oporajita1/My-UVA-Solutions-
c1733ce65525352fdccd4ff50d46587849e8463d
00e27b5a8aaef22996e2ed726af18387d0ab7ba7
refs/heads/master
2020-06-10T06:58:19.702467
2016-12-09T01:22:01
2016-12-09T01:22:01
75,989,174
0
0
null
null
null
null
UTF-8
C++
false
false
577
cpp
uva 13109 Elephants.cpp
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; int main() { int m,m1[100000],t,w,i; scanf("%d",&t); while(t--) { scanf("%d %d",&m,&w); for(i=0;i<m;i++) { scanf("%d",&m1[i]); } sort(m1,m1+m); int flag=1; int res=0; for(i=0;i<m;i++) { res+=m1[i]; if(res>w){ printf("%d\n",i); flag=0; break;} } if(flag==1)printf("%d\n",m); } return 0; }
97d50940abdb5f2ac23bb33ad1ac30a6ab56f9e6
b9d873f27991b5da6e98fcd7be858871e7a286b6
/CppModule/23-optimize-target/Sample4.cpp
a6d6ac605583801455100ceaea7a7df354769fea
[]
no_license
yishengma/C-Cpp-Sample
9eabbca68bcb47fb256f0271dcff09efb9d12d0e
37c24a308f9fd6bcab26cd92117102fe4df606c8
refs/heads/master
2022-11-08T08:08:37.130989
2020-06-28T12:00:06
2020-06-28T12:00:06
268,240,603
1
1
null
null
null
null
UTF-8
C++
false
false
3,879
cpp
Sample4.cpp
// // Created by 海盗的帽子 on 2020/6/16. // #include <iostream> #include <vector> using namespace std; //左值:有内存、有名字 //右值:没内存、没名字 class Text { }; class CMyString { public: CMyString(const char *str = nullptr) { cout << "CMyString(const char*)" << endl; if (str != nullptr) { mptr = new char[strlen(str) + 1]; strcpy(mptr, str); } else { mptr = new char[1]; *mptr = '\0'; } } ~CMyString() { cout << "~CMyString" << endl; delete[]mptr; mptr = nullptr; } CMyString(const CMyString &str) { cout << "CMyString(const CMyString&)" << endl; mptr = new char[strlen(str.mptr) + 1]; strcpy(mptr, str.mptr); } CMyString(CMyString &&str) // { cout << "CMyString(CMyString&&)" << endl; //把临时对象的资源移动过来 mptr = str.mptr; str.mptr = nullptr; } CMyString& operator=(const CMyString &str) { cout << "operator=(const CMyString&)" << endl; if (this == &str) return *this; delete[]mptr; mptr = new char[strlen(str.mptr) + 1]; strcpy(mptr, str.mptr); return *this; } //临时对象直接匹配到右值引用赋值构造函数 // CMyString& operator=(CMyString &&str) { cout << "operator=(CMyString&&)" << endl; if (this == &str) return *this; delete[]mptr; //这里直接将字符串指向的对象赋值给这个对象 //将原本的对象销毁,避免资源的拷贝 //即把临时对象的资源移动过来 mptr = str.mptr; str.mptr = nullptr; return *this; } const char* c_str()const { return mptr; } private: friend CMyString operator+(const CMyString &lhs, const CMyString &rhs); char *mptr; }; //new 之后没有delete 内存泄露 //CMyString operator+(const CMyString &lhs, // const CMyString &rhs) //{ // char *ptmp = new char[strlen(lhs.mptr) + strlen(rhs.mptr) + 1]; // strcpy(ptmp, lhs.mptr); // strcat(ptmp, rhs.mptr); // return CMyString(ptmp); // //} //方法内一次new delete ,返回时拷贝又一次 //CMyString operator+(const CMyString &lhs, // const CMyString &rhs) //{ // char *ptmp = new char[strlen(lhs.mptr) + strlen(rhs.mptr) + 1]; // CMyString tmpStr; // tmpStr.mptr = new char[strlen(lhs.mptr) + strlen(rhs.mptr) + 1]; // strcpy(tmpStr.mptr, lhs.mptr); // strcat(tmpStr.mptr, rhs.mptr); // delete []ptmp; // return tmpStr; //} //直接使用右值引用,只有一次拷贝,没有 new delete CMyString operator+(const CMyString &lhs, const CMyString &rhs) { //char *ptmp = new char[strlen(lhs.mptr) + strlen(rhs.mptr) + 1]; CMyString tmpStr; tmpStr.mptr = new char[strlen(lhs.mptr) + strlen(rhs.mptr) + 1]; strcpy(tmpStr.mptr, lhs.mptr); strcat(tmpStr.mptr, rhs.mptr); //delete []ptmp;// return tmpStr; // //return CMyString(ptmp); } int main () { int a = 10;//10在寄存器,无内存,右值 int &b = a;// // int &&c = a;//无法将左值绑定到右值 // int &c = 10;//不能用一个左值引用绑定右值 const int &c = 20;//可以,因为默认生成 //int tmp = 20; //const int &c = tmp; int &&d = 20;//可以把一个右值绑定到右值引用 Text &&e = Text();//把临时变量当作右值 //一个右值引用变量是一个左值,有内存有名字 // CMyString str1 = "aaa"; vector<CMyString> vec; vec.push_back(str1);//左值引用的拷贝构造 vec.push_back(CMyString("vvv"));//右值引用拷贝构造 }
4b86ab48418b3e41000d9f55564038e4a9fc2442
456d0675848b8b11bfec8d052590bdf7eab3a20d
/codes/raulcr-p2196-Accepted-s488360.cpp
237f9c2ed2b55a3c7bc9e690741868a5b7fd26f9
[ "MIT" ]
permissive
iocodz/coj-solutions
7dfa34ec0b7c830cca00cb0171ee6de18e6553a5
b8c4d6009869b76a67d7bc1d5328b9bd6bfc33ca
refs/heads/master
2022-11-07T09:10:58.938466
2020-06-23T06:21:28
2020-06-23T06:21:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
346
cpp
raulcr-p2196-Accepted-s488360.cpp
#include <iostream> #include <string> using namespace std; int main() { string n; int a; cin >> a; while(a > 0){ cin >> n; a--; if (n[n.length() - 1] % 2 == 0){ cout << "even"<<endl; } else{ cout << "odd"<<endl; } } return 0; }
2c876e2f83104be72e4590bc146e2e59cb1d8abf
5674a9f897c2aeff2706840c036cb8709800c45b
/ContinuumCrowds_1.0/Files/main.cpp
0a78e2e94e94038e7019e9e01ea8c03c11118deb
[]
no_license
sanoonan/ContinuumCrowds_1.0
133f23cd356cf08a87f654bd1c5c112102aea23d
48e2b112973c2ac52b75d5af8ed7aea974b74b67
refs/heads/master
2021-01-01T16:59:46.300625
2015-03-30T23:00:05
2015-03-30T23:00:05
32,598,130
1
0
null
null
null
null
UTF-8
C++
false
false
13,504
cpp
main.cpp
#define _CRT_SECURE_NO_DEPRECATE //Some Windows Headers (For Time, IO, etc.) #include <windows.h> #include <mmsystem.h> #include <GL/glew.h> #include <GL/freeglut.h> #include <iostream> // Assimp includes #include <assimp/cimport.h> // C importer #include <assimp/scene.h> // collects data #include <assimp/postprocess.h> // various extra operations #include <stdio.h> #include <math.h> #include <vector> // STL dynamic memory. #include <stdlib.h> #include "assert.h" // Header includes #include <time.h> #include "Camera.h" #include "Shaders.h" #include "PopulationManager.h" #include "DensityField.h" #include "Grid.h" #include "SpeedField.h" #include "PotentialField.h" #include "AntTweakBar.h" using namespace std; int width = 1200; int height = 900; #define VS_LINE "../Shaders/lineVS.txt" #define FS_LINE "../Shaders/lineFS.txt" #define VS_MINMAX "../Shaders/minMaxVS.txt" #define FS_MINMAX "../Shaders/minMaxFS.txt" int oldTime = 0; Camera camera(glm::vec3(0.0f, 0.0f, 20.0f)); glm::mat4 proj_mat, view_mat; bool is_paused = false; float fps = 0.0f; Shaders line_shader("Line", VS_LINE, FS_LINE); Shaders density_shader("Density", VS_MINMAX, FS_MINMAX); Shaders height_shader("Height", VS_MINMAX, FS_MINMAX); Shaders potential_shader("Potential", VS_MINMAX, FS_MINMAX); Shaders discomfort_shader("Discomfort", VS_MINMAX, FS_MINMAX); PopulationManager popManager; //VORTEX SCENARTIO SharedGrid mainGrid(32, 32); Group groupA(10, glm::vec3(1.0f, 0.5f, 0.0f)); Group groupB(10, glm::vec3(0.0f, 1.0f, 1.0f)); Group groupC(10, glm::vec3(1.0f, 0.0f, 0.0f)); Group groupD(10, glm::vec3(1.0f, 1.0f, 0.0f)); DensityField densityField; SpeedField speedField; PotentialField potentialField; float draw_scale = 0.7f; bool draw_densities = false; bool draw_heights = true; bool draw_potentials = false; bool draw_discomfort = false; #pragma region DENSITY SHADER STUFF float min_density, max_density; glm::vec3 max_density_col, min_density_col; void updateDensityShaderValues() { glUseProgram(density_shader.id); int max_col_location = glGetUniformLocation (density_shader.id, "max_colour"); int min_col_location = glGetUniformLocation (density_shader.id, "min_colour"); glUniform3fv (max_col_location, 1, glm::value_ptr(max_density_col)); glUniform3fv (min_col_location, 1, glm::value_ptr(min_density_col)); int max_dens_location = glGetUniformLocation (density_shader.id, "max_value"); int min_dens_location = glGetUniformLocation (density_shader.id, "min_value"); glUniform1f (max_dens_location, max_density); glUniform1f (min_dens_location, min_density); } void initDensityShaderValues() { max_density = 8.0f; min_density = 1.0f; max_density_col = glm::vec3(1.0f, 0.0f, 0.0f); min_density_col = glm::vec3(0.0f, 1.0f, 0.0f); updateDensityShaderValues(); } #pragma endregion #pragma region HEIGHT SHADER STUFF float min_height, max_height; glm::vec3 max_height_col, min_height_col; void updateHeightShaderValues() { glUseProgram(height_shader.id); int max_col_location = glGetUniformLocation (height_shader.id, "max_colour"); int min_col_location = glGetUniformLocation (height_shader.id, "min_colour"); glUniform3fv (max_col_location, 1, glm::value_ptr(max_height_col)); glUniform3fv (min_col_location, 1, glm::value_ptr(min_height_col)); int max_height_loc = glGetUniformLocation (height_shader.id, "max_value"); int min_height_loc = glGetUniformLocation (height_shader.id, "min_value"); glUniform1f (max_height_loc, max_height); glUniform1f (min_height_loc, min_height); } void initHeightShaderValues() { max_height = 10.0f; min_height = 0.0f; max_height_col = glm::vec3(0.2f, 0.1f, 0.0f); min_height_col = glm::vec3(1.0f, 1.0f, 1.0f); updateHeightShaderValues(); } #pragma endregion #pragma region POTENTIAL SHADER STUFF float min_potential, max_potential; glm::vec3 max_pot_col, min_pot_col; void updatePotentialShaderValues() { glUseProgram(potential_shader.id); int max_col_location = glGetUniformLocation (potential_shader.id, "max_colour"); int min_col_location = glGetUniformLocation (potential_shader.id, "min_colour"); glUniform3fv (max_col_location, 1, glm::value_ptr(max_pot_col)); glUniform3fv (min_col_location, 1, glm::value_ptr(min_pot_col)); int max_pot_loc = glGetUniformLocation (potential_shader.id, "max_value"); int min_pot_loc = glGetUniformLocation (potential_shader.id, "min_value"); glUniform1f (max_pot_loc, max_potential); glUniform1f (min_pot_loc, min_potential); } void initPotentialShaderValues() { max_potential = 5.0f; min_potential = 0.0f; max_pot_col = glm::vec3(0.0f, 0.0f, 1.0f); min_pot_col = glm::vec3(1.0f, 1.0f, 1.0f); updatePotentialShaderValues(); } #pragma endregion #pragma region DISCOMFORT SHADER STUFF float min_discomfort, max_discomfort; glm::vec3 max_disc_col, min_disc_col; void updateDiscomfortShaderValues() { glUseProgram(discomfort_shader.id); int max_col_location = glGetUniformLocation (discomfort_shader.id, "max_colour"); int min_col_location = glGetUniformLocation (discomfort_shader.id, "min_colour"); glUniform3fv (max_col_location, 1, glm::value_ptr(max_disc_col)); glUniform3fv (min_col_location, 1, glm::value_ptr(min_disc_col)); int max_disc_loc = glGetUniformLocation (discomfort_shader.id, "max_value"); int min_disc_loc = glGetUniformLocation (discomfort_shader.id, "min_value"); glUniform1f (max_disc_loc, max_discomfort); glUniform1f (min_disc_loc, min_discomfort); } void initDiscomfortShaderValues() { max_discomfort = 5.0f; min_discomfort = 0.0f; max_disc_col = glm::vec3(1.0f, 1.0f, 1.0f); min_disc_col = glm::vec3(1.0f, 1.0f, 1.0f); updateDiscomfortShaderValues(); } #pragma endregion #pragma region TWEAK BAR STUFF void TW_CALL reset(void *) { // popManager.assignRandomLocs(); groupA.assignRandomLeftLoc(); groupB.assignRandomRightLoc(); } void TW_CALL drawDensity(void *) { draw_densities = true; draw_heights = false; draw_potentials = false; draw_discomfort = false; } void TW_CALL drawHeight(void *) { draw_densities = false; draw_heights = true; draw_potentials = false; draw_discomfort = false; } void TW_CALL drawPotential(void *) { draw_densities = false; draw_heights = false; draw_potentials = true; draw_discomfort = false; } void TW_CALL drawDiscomfort(void *) { draw_densities = false; draw_heights = false; draw_potentials = false; draw_discomfort = true; } void TW_CALL pause(void *) { is_paused = !is_paused; } void init_tweak() { TwInit(TW_OPENGL, NULL); TwWindowSize(width, height); TwBar *bar; bar = TwNewBar("Continuum Crowds"); TwAddVarRO(bar, "FPS", TW_TYPE_FLOAT, &fps, ""); TwAddVarRW(bar, "Scale", TW_TYPE_FLOAT, &draw_scale, ""); // TwAddVarRW(bar, "Draw Direction?", TW_TYPE_BOOLCPP, &draw_teapots, ""); TwAddButton(bar, "Reset", reset, NULL, ""); // TwAddVarRW(bar, "Run?", TW_TYPE_BOOLCPP, &are_moving, ""); TwAddButton(bar, "Pause", pause, NULL, ""); TwAddButton(bar, "Show Potentials", drawPotential, NULL, ""); TwAddVarRW(bar, "Max Potential", TW_TYPE_FLOAT, &max_potential, ""); TwAddVarRW(bar, "Min Potential", TW_TYPE_FLOAT, &min_potential, ""); camera.addTBar(bar); TwAddButton(bar, "Show Densities", drawDensity, NULL, ""); TwAddVarRW(bar, "Max Density", TW_TYPE_FLOAT, &max_density, ""); TwAddVarRW(bar, "Min Density", TW_TYPE_FLOAT, &min_density, ""); // TwAddVarRW(bar, "Density Coefficient", TW_TYPE_FLOAT, &density_coeff, ""); TwAddButton(bar, "Show Heights", drawHeight, NULL, ""); // TwAddVarRW(bar, "Max Height", TW_TYPE_FLOAT, &max_height, ""); // TwAddVarRW(bar, "Min Height", TW_TYPE_FLOAT, &min_height, ""); // TwAddVarRW(bar, "Max Density Colour", TW_TYPE_COLOR3F, &max_density_col, ""); // TwAddVarRW(bar, "Min Denisty Colour", TW_TYPE_COLOR3F, &min_density_col, ""); camera.addTBar(bar); // TwAddButton(bar, "Show Discomfort", drawDiscomfort, NULL, ""); // TwAddVarRW(bar, "Max Discomfort", TW_TYPE_FLOAT, &max_discomfort, ""); // TwAddVarRW(bar, "Min Discomfort", TW_TYPE_FLOAT, &min_discomfort, ""); popManager.addTBar(bar); } void draw_tweak() { TwDraw(); } #pragma endregion void init() { line_shader.CompileShaders(); density_shader.CompileShaders(); height_shader.CompileShaders(); potential_shader.CompileShaders(); discomfort_shader.CompileShaders(); initDensityShaderValues(); initHeightShaderValues(); initPotentialShaderValues(); initDiscomfortShaderValues(); mainGrid.setupGridCells(); // mainGrid.assignRandomHeights(max_height); // mainGrid.makeMiddleMountain(max_height, 0.4f); mainGrid.assignDiscomfortToBottom(2.0f); popManager.addGroup(groupA); popManager.addGroup(groupB); // popManager.addGroup(groupC); // popManager.addGroup(groupD); popManager.setupGroupGrids(mainGrid); // popManager.assignRandomLocs(); groupA.assignRandomLeftLoc(); // groupA.assignRandomBottomLeftLoc(); // groupA.assignRandomTopLeftLoc(); groupB.assignRandomRightLoc(); // groupB.assignRandomTopRightLoc(); // groupB.assignRandomBottomRightLoc(); groupC.assignRandomBottomLeftLoc(); groupD.assignRandomTopRightLoc(); groupA.setSpeeds(0.01f, 2.0f); groupB.setSpeeds(0.01f, 2.0f); groupC.setSpeeds(0.1f, 0.2f); groupD.setSpeeds(0.1f, 0.2f); groupA.setRightSideGoal(); // groupA.setBottomRightCornerGoal(); groupB.setLeftSideGoal(); // groupB.setTopLeftCornerGoal(); groupC.setTopRightCornerGoal(); groupD.setBottomLeftCornerGoal(); densityField.m_grid = &mainGrid; densityField.popManager = &popManager; speedField.shared_grid = &mainGrid; speedField.popManager = &popManager; speedField.assignDensityField(&densityField); // speedField.assignTopoSpeeds(); potentialField.shared_grid = &mainGrid; potentialField.popManager = &popManager; // potentialField.assignCosts(); init_tweak(); } void display() { // tell GL to only draw onto a pixel if the shape is closer to the viewer glEnable (GL_DEPTH_TEST); // enable depth-testing glDepthFunc (GL_LESS); // depth-testing interprets a smaller value as "closer" glClearColor (0.5f, 0.5f, 0.5f, 1.0f); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); proj_mat = glm::perspective(45.0f, (float)width/(float)height, 0.1f, 200.0f); view_mat = camera.getRotationMat(); line_shader.setViewProj(view_mat, proj_mat); density_shader.setViewProj(view_mat, proj_mat); height_shader.setViewProj(view_mat, proj_mat); potential_shader.setViewProj(view_mat, proj_mat); glUseProgram(line_shader.id); int colour_location = glGetUniformLocation (line_shader.id, "colour"); glUniform3fv (colour_location, 1, glm::value_ptr(glm::vec3(0.0f, 0.0f, 0.0f))); if(draw_densities) mainGrid.drawDensities(draw_scale, line_shader.id, density_shader.id); else if (draw_heights) mainGrid.drawHeights(draw_scale, line_shader.id, height_shader.id); else if (draw_discomfort) mainGrid.drawDiscomfort(draw_scale, line_shader.id, discomfort_shader.id); else if (draw_potentials) groupA.m_grid.drawPotentials(draw_scale, line_shader.id, potential_shader.id); glUseProgram(line_shader.id); glUniform3fv (colour_location, 1, glm::value_ptr(glm::vec3(1.0f, 0.5f, 0.0f))); popManager.draw(draw_scale, line_shader.id); // int model_mat_location = glGetUniformLocation (line_shader.id, "model"); // glUniform3fv (colour_location, 1, glm::value_ptr(glm::vec3(1.0f, 0.0f, 0.0f))); // glUniformMatrix4fv (model_mat_location, 1, GL_FALSE, glm::value_ptr(glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, 0.0f)))); // glutSolidSphere(0.1f, 5, 5); // glUniformMatrix4fv (model_mat_location, 1, GL_FALSE, glm::value_ptr(glm::translate(glm::mat4(), glm::vec3(10.5f, 0.0f, 10.5f)))); // glutSolidSphere(0.1f, 5, 5); draw_tweak(); glutSwapBuffers(); } void updateScene() { int time = glutGet(GLUT_ELAPSED_TIME); int delta_time = time-oldTime; oldTime = time; //time since last frame in seconds double elapsed_seconds = (double)delta_time/1000; if(is_paused) elapsed_seconds = 0; fps = 1/elapsed_seconds; densityField.assignMinMax(min_density, max_density); densityField.update(); speedField.update(); potentialField.update(); speedField.assignDirSpeeds(); speedField.assignPeopleVels(); popManager.move(elapsed_seconds); updateDensityShaderValues(); updateHeightShaderValues(); updatePotentialShaderValues(); updateDiscomfortShaderValues(); glutPostRedisplay(); } int main(int argc, char** argv) { srand(time(NULL)); // Set up the window glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB); glutInitWindowSize(width, height); glutCreateWindow("Continuum Crowds"); // Tell glut where the display function is glutDisplayFunc(display); glutIdleFunc(updateScene); glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT); glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT); glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT); // same as MouseMotion glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardGLUT); glutSpecialFunc((GLUTspecialfun)TwEventSpecialGLUT); // send the ''glutGetModifers'' function pointer to AntTweakBar TwGLUTModifiersFunc(glutGetModifiers); // A call to glewInit() must be done after glut is initialized! GLenum res = glewInit(); // Check for any errors if (res != GLEW_OK) { fprintf(stderr, "Error: '%s'\n", glewGetErrorString(res)); return 1; } // Set up your objects and shaders init(); // Begin infinite event loop glutMainLoop(); return 0; }
26e328024fe4a6e634d71d96462b89685da979ad
df7e1d7ecd7fd831e5d64a61b3001630790ba5c2
/ui_agregar_venta.cpp
ff00765ee1c8b77144e9352e187106ab0a5ddc6d
[]
no_license
rodety/OpticalManager
003a2a9c21ccaa7ccabe5d44e1879f7413e27be0
16ce37f2e16454fe7ef2b71ebf566823966a5a5b
refs/heads/master
2016-09-09T20:36:35.945815
2013-01-07T17:50:55
2013-01-07T17:50:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,964
cpp
ui_agregar_venta.cpp
#include "ui_agregar_venta.h" #include "ui_ui_agregar_venta.h" #include <QMessageBox> #include <QDebug> ui_agregar_venta::ui_agregar_venta(QWidget *parent) : QDialog(parent), ui(new Ui::ui_agregar_venta) { ui->setupUi(this); model_actual=new QSqlQueryModel; //llena primero el table model_actual=Luna::buscar(""); ui->tv_productos->setModel(model_actual); idluna=0; } ui_agregar_venta::~ui_agregar_venta() { delete ui; } void ui_agregar_venta::on_pushButton_Cancelar_clicked() { this->close(); delete this; } void ui_agregar_venta::on_pushButton_Cancelar_4_clicked() { this->close(); } void ui_agregar_venta::on_pushButton_Cancelar_3_clicked() { this->close(); } void ui_agregar_venta::on_pushButton_Cancelar_7_clicked() { this->close(); } void ui_agregar_venta::on_pushButton_Aceptar_clicked() { if(idluna!=0) { QSqlQuery query1; query1.prepare("SELECT idproducto FROM luna WHERE idluna="+QString::number(idluna)); query1.exec(); query1.next(); int id = query1.value(0).toInt(); qDebug()<<"el id selectcionado"<<id; QString idd=QString::number(id); QString fecha=ui->dateEdit_fecha->text(); QString precio=ui->le_total->text(); QSqlQuery query; query.prepare("INSERT INTO linea_venta(idproducto,precio,fecha) VALUES("+idd+","+precio+" ,'"+fecha+"')"); if(query.exec()==false) QMessageBox::warning(this,"error","Error al vender!"); else QMessageBox::information(this,"Mensaje","se vendio con exito"); emit senial(); this->close(); } else { return; } } void ui_agregar_venta::on_pb_buscar_clicked() { receta nueva_receta; //nueva_receta.setfecha(ui->dateEdit_fecha->date()); //nueva_receta.setid(1); nueva_receta.settipodoc("1"); nueva_receta.setnombres(ui->le_nombres->text()); nueva_receta.setprimer_apellido(ui->le_primerApellido->text()); nueva_receta.setsegundo_apellido(ui->le_segundoApellido->text()); nueva_receta.setoi_lejos(ui->sb_oilejos->value()); nueva_receta.setoi_cerca(ui->sb_oicerca->value()); nueva_receta.setod_lejos(ui->sb_odlejos->value()); nueva_receta.setod_cerca(ui->sb_odcerca->value()); nueva_receta.setoi_esferico(ui->sb_oiesferico->value()); nueva_receta.setod_esferico(ui->sb_odesferico->value()); nueva_receta.setoi_cilidrico(ui->sb_oicilindrico->value()); nueva_receta.setod_cilindrico(ui->sb_odcilindrico->value()); nueva_receta.setoi_eje(ui->sb_oieje->value()); nueva_receta.setod_eje(ui->sb_odeje->value()); nueva_receta.setdist_pupilar(ui->sb_distpupilar->value()); if (nueva_receta.agregar()==true) { QMessageBox::information(this,"Mensaje","Su receta fue agregada con exito!!"); } else { QMessageBox::warning(this,"Error", "Hubo un error al agregar la receta"); } } void ui_agregar_venta::on_pb_buscaprod_clicked() { qDebug()<<"bueno voy a incialisar"; ui_producto_datos* ventana=new ui_producto_datos; qDebug()<<"es escrbit"; this->connect(ventana,SIGNAL(enviar_resultado(QSqlQueryModel*)),this,SLOT(recibir_model(QSqlQueryModel*))); ventana->show(); qDebug()<<"noseeee"; } void ui_agregar_venta::recibir_model(QSqlQueryModel* model) { qDebug()<<"si enviada señal"; model_actual=model; ui->tv_productos->setModel(model_actual); } void ui_agregar_venta::actualizar_table() { } void ui_agregar_venta::on_tv_productos_doubleClicked(const QModelIndex &index) { QMessageBox::StandardButton resultado; resultado = QMessageBox::question(this,"Vender","¡Desea escoger este prodcuto para la venta?",QMessageBox::Yes | QMessageBox::No); qDebug()<<index.row(); if(resultado==QMessageBox::Yes) { idluna= model_actual->data(model_actual->index(index.row(),0)).toInt(); } else { return; } } void ui_agregar_venta::on_pushButton_Aceptar_3_clicked() { }
b33ed51a2d24f403235b493c0eb73b3df30289da
fbdef09b8a259674517906b69001b06d4b627e26
/cubo.h
32ecb1e7db4a756a64e0bd53ecc32d5ceed6ff14
[]
no_license
caballeroalba/Practica-1-Inform-tica-Gr-fica
df28007707ae2f3b77773f810998583a75d13c7f
18559718e61a3b608a50f8256637451c5871e409
refs/heads/master
2016-08-11T19:00:36.504050
2015-11-23T17:37:40
2015-11-23T17:37:40
44,237,267
0
0
null
null
null
null
UTF-8
C++
false
false
167
h
cubo.h
#ifndef CUBO_H #define CUBO_H #include <vertex.h> #include "objeto3d.h" class Cubo : public Objeto3D { private: public: Cubo(); }; #endif // CUBO_H
660d64e786046293361959d550bf933f843b2499
00b445b38ddce9d1d370e2dc0d16ad46b610b511
/urllineedit.cpp
51ff305d63ee5457ddb46d6e8d07344d803bccd8
[]
no_license
isahakv/ISOWebBrowser
90b8ea6f113a7697935baec85cff4985e24aa8e5
7824dc8efdd27f81eed3c559636317a83beb65e9
refs/heads/master
2020-12-03T03:44:45.791439
2017-06-29T10:36:29
2017-06-29T10:36:29
95,767,902
1
0
null
null
null
null
UTF-8
C++
false
false
5,740
cpp
urllineedit.cpp
#include "urllineedit.h" #include "webview.h" #include "browsermainwindow.h" #include <QApplication> #include <QtCore/QEvent> #include <QtGui/QPainter> #include <QtGui/QMouseEvent> #include <QtGui/QFocusEvent> #include <QtWidgets/QLineEdit> #include <QtWidgets/QLayout> #include <QtWidgets/QPushButton> #include <QtWidgets/QMenu> #include <QtWidgets/QStyle> #include <QtWidgets/QStyleOptionFrame> #include <QLabel> #include <QStringListModel> #include <QSettings> #include <QtCore/QUrl> #include <QtCore/QUrlQuery> #include <QtSvg> SearchButton::SearchButton(QWidget *parent, int _size) : QAbstractButton(parent) , menu(0) , size(_size) { #ifndef QT_NO_CURSOR setCursor(Qt::ArrowCursor); #endif // QT_NO_CURSOR setToolTip(tr("Recent Searches")); setFocusPolicy(Qt::NoFocus); } void SearchButton::paintEvent(QPaintEvent* event) { Q_UNUSED(event) /* QSvgRenderer svgRenderer(QString("D:/Qt5.7/Projects/ISOWebBrowser/data/search.svg")); //QPixmap pix(QSize(16, 16)); //QPainter pixPainter( &pix ); //svgRenderer.load(QString(":Images/Vector/search.svg")); //svgRenderer.render( &pixPainter ); QImage image(16, 16, QImage::Format_ARGB32); QPainter painter(&image); svgRenderer.render(&painter);*/ //generator.setFileName(":Images/Vector/search.svg"); //generator.setSize(QSize(size, size)); //generator.setViewBox(QRect(0, 0, size, size)); QPainter painter(this); //painter.begin(&generator); //painter.end(); QPixmap pixmap(":Images/Vector/search.svg"); painter.drawPixmap(0, 0, size, size, pixmap); } QSize SearchButton::sizeHint() const { return QSize(size, size); } void SearchButton::mousePressEvent(QMouseEvent* event) { if (menu && event->button() == Qt::LeftButton) { QWidget* parent = parentWidget(); if (parent) { QPoint r = parent->mapToGlobal(QPoint(0, parent->height())); menu->exec(QPoint(r.x(), r.y())); } event->accept(); } QAbstractButton::mousePressEvent(event); } // ClearButton ClearButton::ClearButton(QWidget *parent, int _size) : QAbstractButton(parent) , size(_size) { #ifndef QT_NO_CURSOR setCursor(Qt::ArrowCursor); #endif // QT_NO_CURSOR setToolTip(tr("Clear")); setVisible(false); setFocusPolicy(Qt::NoFocus); } void ClearButton::paintEvent(QPaintEvent* event) { Q_UNUSED(event) QPainter painter(this); painter.setRenderHint(QPainter::HighQualityAntialiasing, true); painter.drawPixmap(0, 0, size, size, QPixmap(":Images/Vector/cancel-button.svg")); } QSize ClearButton::sizeHint() const { return QSize(size, size); } void ClearButton::TextChanged(const QString& text) { setVisible(!text.isEmpty()); } // BrowserLineEdit BrowserLineEdit::BrowserLineEdit(QWidget *parent) : QWidget(parent) , lineEdit(new QLineEdit(this)) , leftWidget(0) , clearButton(0) { heightOfLineEdit = 35; setFocusPolicy(lineEdit->focusPolicy()); setAttribute(Qt::WA_InputMethodEnabled); // setup size policies QSizePolicy sizePolicy = lineEdit->sizePolicy(); sizePolicy.setVerticalPolicy(QSizePolicy::Preferred); lineEdit->setSizePolicy(sizePolicy); setSizePolicy(sizePolicy); setBackgroundRole(lineEdit->backgroundRole()); setMouseTracking(true); setAcceptDrops(true); setAttribute(Qt::WA_MacShowFocusRect, true); //setPalette(lineEdit->palette()); // line edit lineEdit->setFrame(true); lineEdit->setFocusProxy(this); lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); QFont font = lineEdit->font(); font.setPointSize(10); lineEdit->setFont(font); //lineEdit->setEchoMode(QLineEdit::Normal); // clearButton clearButton = new ClearButton(this); connect(clearButton, SIGNAL(clicked(bool)), lineEdit, SLOT(clear())); connect(lineEdit, SIGNAL(textChanged(QString)), clearButton, SLOT(TextChanged(QString))); } QSize BrowserLineEdit::sizeHint() const { //lineEdit->setFrame(true); QSize size = lineEdit->sizeHint(); //lineEdit->setFrame(false); return QSize(size.width(), heightOfLineEdit); } QVariant BrowserLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const { return lineEdit->inputMethodQuery(property); } void BrowserLineEdit::focusInEvent(QFocusEvent* event) { // qWarning("focusInEvent"); lineEdit->event(event); //if (event->) { lineEdit->selectAll(); } QWidget::focusInEvent(event); } void BrowserLineEdit::focusOutEvent(QFocusEvent* event) { lineEdit->event(event); QWidget::focusOutEvent(event); } void BrowserLineEdit::keyPressEvent(QKeyEvent* event) { lineEdit->event(event); } void BrowserLineEdit::resizeEvent(QResizeEvent* event) { QWidget::resizeEvent(event); } void BrowserLineEdit::inputMethodEvent(QInputMethodEvent* event) { lineEdit->event(event); } // UrlLineEdit UrlLineEdit::UrlLineEdit(QWidget *parent) : BrowserLineEdit(parent) , webView(0) { QHBoxLayout* layout = new QHBoxLayout(this); layout->setSpacing(0); layout->setMargin(5); layout->addWidget(lineEdit); layout->addWidget(clearButton); lineEdit->setPlaceholderText(QString("Enter Url")); } void UrlLineEdit::SetWebView(WebView* _webView) { Q_ASSERT(_webView); if (webView) { disconnect(webView, SIGNAL(urlChanged(QUrl)), this, SLOT(WebViewUrlChanged(QUrl))); disconnect(webView, SIGNAL(loadProgress(int)), this, SLOT(update())); } webView = _webView; connect(webView, SIGNAL(urlChanged(QUrl)), this, SLOT(WebViewUrlChanged(QUrl))); connect(webView, SIGNAL(loadProgress(int)), this, SLOT(update())); } void UrlLineEdit::focusOutEvent(QFocusEvent* event) { BrowserLineEdit::focusOutEvent(event); if (webView && lineEdit->text().isEmpty()) lineEdit->setText(QString::fromUtf8(webView->url().toEncoded())); } void UrlLineEdit::WebViewUrlChanged(const QUrl& url) { qWarning(url.toString().toStdString().c_str()); lineEdit->setText(QString::fromUtf8(url.toEncoded())); }
b91bc613c116258380e9db9c6ce6c735f67c99fe
83b1df1d1b1f725f655bde2c43cab58f5131f6d9
/test/compareoutput.cpp
f63aa3496c1de8afc005fd2cf1870f80eb68609d
[]
no_license
LazarusID/experiencetable
1fc1b24fcce0b8f36b55c36a6ade6d2e8d89fb10
3fc82f7c7127b8fddfd2cad175fbc0c28525174d
refs/heads/master
2023-06-09T17:31:30.734901
2021-07-04T00:18:50
2021-07-04T00:18:50
262,884,894
0
0
null
2021-07-04T00:18:50
2020-05-10T22:13:12
C++
UTF-8
C++
false
false
965
cpp
compareoutput.cpp
#include <fstream> #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, const char **argv) { string actual; string expected; if (argc != 2) { cerr << "usage: program_under_test.exe | " << argv[0] << " expected.txt" << endl; return EXIT_FAILURE; } ifstream expectedstream(argv[1]); while(cin && expectedstream) { getline(cin, actual); getline(expectedstream, expected); if (actual != expected) { cerr << "Expected: \"" << expected << "\"" << endl; cerr << "Actual: \"" << actual << "\"" << endl; return EXIT_FAILURE; } } if (cin) { cerr << "Actual continues after expected end." << endl; return EXIT_FAILURE; } if (expectedstream) { cerr << "Expected continues after actual end." << endl; return EXIT_FAILURE; } return EXIT_SUCCESS; }
0f2db54183bb151dfcac9369e7c17caefa445f29
9b143d707d19e821eac25076511248e47573ff24
/progcomp/maratona/B.cpp
fbb1f84c9118fe8020dc7901153da047e38a60d5
[]
no_license
Joao-Luz/graduacao
d43870959c59c8b82795ad44e79a43bf74180aff
17829b8a7c137d983e9364705ee3386ed6ee0171
refs/heads/main
2023-04-26T04:20:04.062711
2021-05-22T19:51:22
2021-05-22T19:51:22
322,866,507
0
0
null
null
null
null
UTF-8
C++
false
false
653
cpp
B.cpp
#include <iostream> using namespace std; int mat[10][10]; int main(){ int n; cin >> n; for(int i = 0; i < n; i++){ int d, l, r, c; cin >> d >> l >> r >> c; if(d){ if(c + l - 1 > 9 || c < 0) cout << "N" << endl; for(int j = c; j < c + l - 1; j++) mat[r][j] = 1; } else{ if(r + l - 1 > 9 || r < 0) cout << "N" << endl; for(int j = r; j < r + l - 1; j++) mat[j][c] = 1; } } for(int i = 0; i < 10; i++){ for(int j = 0; j < 10; j++){ if(mat[i][j] >= 2) cout << "N" << endl; } } cout << "Y" << endl; }
5efa6e963a0185beedad6066a5da2ff61fa0e621
d8c4fcdc8fd3d3081f50a64d805582bec6488464
/00_ari_V3/55_sensoriDistanza.ino
bc67312ea6dfbf7664611814516e47d6e4b67a7e
[]
no_license
stuffcube/02_fwArianna
4c1904d200b61280e70cf137a7d5d418d4bc1fd1
3825096a79cee0ff1bf07f45518262c57374ae3c
refs/heads/master
2020-04-18T04:56:02.754197
2019-03-10T11:08:34
2019-03-10T11:08:34
167,257,626
0
0
null
null
null
null
UTF-8
C++
false
false
2,223
ino
55_sensoriDistanza.ino
/** @brief riporta al controller la distanza letta dal lidar, la risposta ha formato "mis;" + distanza in cm". aggiorna anche la il valore "lidardist" ogni 250 ms. */ void testOstacoli(){ static int i; if (monitorDati) return; // if ((millis()-timeLidar) > 1000){ timeLidar = millis(); if (sensore_ost==1){ //ho il laser anteriore attivo VL53L0X_RangingMeasurementData_t measure; lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout! if (measure.RangeStatus != 4) { // phase failures have incorrect data vl53dist = measure.RangeMilliMeter/10; //risposta = "ost;" + String(measure.RangeMilliMeter/10); //sendAnswer2(port); } else{ vl53dist=999; } } //risposta = "mis;" + String(lidarDistance); //sendAnswer2(port); } } /** @brief libreria lettura lidar viene usata solo dalla funzione di scan.. la funzione tfmini.getDistance() aspetta un pacchetto da seriale chiamare tutta lka funzione lidar è inutile da rivedere */ String lidar() { if (!LIDAR_PRESENT){ return String("9999"); } // Take one TF Mini distance measurement uint16_t dist = tfmini.getDistance()/divLidar; // dist = tfmini.getDistance(); // dist = tfmini.getDistance(); // dist = tfmini.getDistance(); uint16_t strength = tfmini.getRecentSignalStrength(); //Serial.print("forza"); //Serial.println(strength); return String(dist); } /** @brief legge il lidar e prepara la stringa di risposta. inizializza la stringa di risposta come "echo-"+String(ang)+"-"; effettua dapprima 10 letture a vuoto, appende "numeroMisure" misure alla risposta ognuna separata da "-" @param numeroMisure su cui viene @param ang */ String lidarMisuraAmb(int numeroMisure,int ang ){ float distance = 0; String risp = "echo-"+String(ang)+"-"; for (int i = 0; i < numeroMisure+10; i++){ // Read in times pulse if(i<10){// svuoto il lidar delay(25); // tempo assestamento pan lidar(); } else{ delay(25); // tempo assestamento pan risp += lidar(); risp += "-"; } } risp += "+"; return(risp); }
acf676c6af2f100ae3859c02fba79ac82950dcd1
2c1e98a71a4763b091c41c9a2b86aa88cf55f1de
/ledPisca1-2-2-1/ledPisca1-2-2-1.ino
1425cfaf0a74fd4bac5d19a17a39fc0431265c17
[]
no_license
rafaelmfox/Arduino
7958c47d9755c9b3c3293581babd30f9bdae849d
18221ae2480eca4a774569fa3a4f46a3b4d19ab3
refs/heads/master
2021-09-02T15:13:01.713561
2018-01-03T11:27:31
2018-01-03T11:27:31
109,044,348
0
0
null
null
null
null
UTF-8
C++
false
false
684
ino
ledPisca1-2-2-1.ino
//Variavel Global int vLed1 = 10; //porta 10 int vLed2 = 9; //porta 9 int vDelay = 200; //delay entre eles int vPisca = 0; //variavel sendo uma bolean liga e desliga void setup() { // faz com que a porta fique como saida pinMode(vLed1,OUTPUT); pinMode(vLed2,OUTPUT); } void loop() { // chama o void Sirene(); } //se vPisca = 1 ele liga a led 10 e apaga a 9 // senao liga a 9 e apaga a 10 void Sirene() { if (vPisca == 1) { digitalWrite(vLed1, HIGH); digitalWrite(vLed2, LOW); delay(vDelay); vPisca = 2; } else { digitalWrite(vLed2, HIGH); digitalWrite(vLed1, LOW); delay(vDelay); vPisca = 1; } }
809ef1cbeaaf8f6266e607a7de5aec101f9da2a3
fdca6afb1d25c8d00236cf6f6466c9dc03c8395a
/src/Utilities.h
97e4e81ba789c80374568eb5d8a81c0257922ba1
[]
no_license
dannyli0109/OpenGL_2D_Rendering_Boilerplate
246a988899f23a2a111412948c0d1bc3d2e82628
4ebf1d209c528ae5b35d928f29b4cce6fdeb1037
refs/heads/master
2023-03-26T09:32:40.235138
2021-03-25T10:05:45
2021-03-25T10:05:45
349,262,830
0
0
null
null
null
null
UTF-8
C++
false
false
141
h
Utilities.h
#pragma once #include <string> #include <fstream> #include <sstream> #include <iostream> std::string LoadFileAsString(std::string filename);
51d89b4270bd53f4e360eaeb1d51bbb0db52673c
9f16ceb7f674234889f796a5b99d342f9edf3399
/decodeWays.cpp
8bda12efb8284afde49243b1d1293afa431ee018
[]
no_license
Segfred/leetcode
382297025b790790a38f079d5938e158c3bd8260
b102c4d9abea9caad0b08b7df0d9e89bc6dbc115
refs/heads/master
2021-06-11T05:10:21.853331
2021-04-03T02:42:59
2021-04-03T02:42:59
87,050,255
2
0
null
null
null
null
UTF-8
C++
false
false
957
cpp
decodeWays.cpp
#include <iostream> #include <string> using namespace std; class Solution { public: int numDecodings(string s) { if (s.empty()||s[0]=='0') return 0; int w2 (1); int w1 (1); int w=w1;//w=w1+w2 but w2 is unvisible now,so w=0,w+=w1 for (size_t i=2; i<=s.size(); i++) {//begin from the third number w = (s[i-1] == '0') ? 0 : w1; if (s[i-2] == '1' || (s[i-2] == '2' && s[i-1] >= '0' && s[i-1] <= '6')) w += w2; w2 = w1; w1 = w; } return w; } }; class Solution { public: int numDecodings(string str) { if(str.empty()||str[0]=='0') return 0; int cur=1,pre1=1,pre2=1;//注意pre2不能初始化为0,否则全是0,pre=1,默认第一位合法,所以cur也可以默认合法 for(size_t i=2;i<=str.size();++i){ cur=str[i-1]=='0'? 0:pre1; if(str[i-2]=='1'||str[i-2]=='2'&&str[i-1]>='0'&&str[i-1]<='6') cur+=pre2; pre2=pre1, pre1=cur;//别忘了滚动 } return cur; } };
c6530664056e9c7a4e6068db634fa93d846f42bb
0f91c5db2cd3bb6d49d8de2a55bdf8b0d6f21b3f
/src/MultiActionInitialization.cc
14e9e24ad7f4b6338a04369da5550bb93f073cd0
[]
no_license
BetterWang/g4e
21b5268e0471a5d425ae13f3152c8f688ec74281
8975765867984cba814efe301789b481054b58fb
refs/heads/master
2023-04-21T15:36:05.128795
2020-10-08T17:54:17
2020-10-08T17:54:17
263,122,401
1
0
null
null
null
null
UTF-8
C++
false
false
4,193
cc
MultiActionInitialization.cc
#include <G4MultiSteppingAction.hh> #include <G4MultiTrackingAction.hh> #include <G4MultiEventAction.hh> #include <G4MultiRunAction.hh> #include "MultiActionInitialization.hh" #include <VolumeChangeSteppingAction.hh> /** * A C++ standard library function shall not directly or indirectly modify objects (1.10) accessible by threads * other than the current thread unless the objects are accessed directly or indirectly via the function’s * non- const arguments, including this. */ void g4e::MultiActionInitialization::Build() const { mBuildIsDone = true; // Add Generator action SetUserAction(mGeneratorAction); // Event actions if(!mEventActionGenerators.empty()) { auto eventActions = new G4MultiEventAction(); // Using generators to generate event actions for(const auto& generator: mEventActionGenerators) { eventActions->push_back(G4UserEventActionUPtr(generator())); } SetUserAction(eventActions); } // Stepping actions if(!mSteppingActionGenerators.empty()) { auto multiSteppingAction = new G4MultiSteppingAction(); // Using generators to generate event actions for(const auto& generator: mSteppingActionGenerators) { auto action = generator(); auto volumeChangeAction = dynamic_cast<VolumeChangeSteppingAction*>(action); if(volumeChangeAction != nullptr) { std::lock_guard<std::mutex> lock(mBuildMutex); auto id = std::this_thread::get_id(); mVolChangeActionsByThread[id]= volumeChangeAction; } multiSteppingAction->push_back(G4UserSteppingActionUPtr(action)); } SetUserAction(multiSteppingAction); } // Tracking actions if(!mTrackingActionGenerators.empty()) { auto multiTrackingAction = new G4MultiTrackingAction(); // Using generators to generate event actions for(const auto& generator: mTrackingActionGenerators) { multiTrackingAction->push_back(G4UserTrackingActionUPtr(generator())); } SetUserAction(multiTrackingAction); } } void g4e::MultiActionInitialization::BuildForMaster() const { if(!mRunActionGenerators.empty()) { auto runActions = new G4MultiRunAction(); // Using generators to generate event actions for(const auto& generator: mRunActionGenerators) { runActions->push_back(G4UserRunActionUPtr(generator())); } SetUserAction(runActions); } } G4VUserPrimaryGeneratorAction *g4e::MultiActionInitialization::GetGeneratorAction() const { return mGeneratorAction; } void g4e::MultiActionInitialization::SetGeneratorAction(G4VUserPrimaryGeneratorAction *mGeneratorAction) { MultiActionInitialization::mGeneratorAction = mGeneratorAction; } void g4e::MultiActionInitialization::AddEnterVolumeSteppingAction(G4VPhysicalVolume *vol, std::function<void(const G4Step *)> func) { ThrowOnWrongInitializationOrder("AddEnterVolumeSteppingAction"); VolumeChangeSteppingAction* steppingAction = mVolChangeActionsByThread[std::this_thread::get_id()]; steppingAction->OnEnterVolumeAction(vol, std::move(func)); } void g4e::MultiActionInitialization::AddExitVolumeSteppingAction(G4VPhysicalVolume *vol, std::function<void(const G4Step *)> func) { ThrowOnWrongInitializationOrder("AddExitVolumeSteppingAction"); VolumeChangeSteppingAction* steppingAction = mVolChangeActionsByThread[std::this_thread::get_id()]; steppingAction->OnExitVolumeAction(vol, std::move(func)); } void g4e::MultiActionInitialization::OnEnterVolumeWriteHit(G4VPhysicalVolume *vol) { ThrowOnWrongInitializationOrder("OnEnterVolumeWriteHit"); VolumeChangeSteppingAction* steppingAction = mVolChangeActionsByThread[std::this_thread::get_id()]; steppingAction->OnEnterVolumeWriteHit(vol); } void g4e::MultiActionInitialization::OnExitVolumeWriteHit(G4VPhysicalVolume *vol) { ThrowOnWrongInitializationOrder("OnExitVolumeWriteHit"); VolumeChangeSteppingAction* steppingAction = mVolChangeActionsByThread[std::this_thread::get_id()]; steppingAction->OnExitVolumeWriteHit(vol); }
0bef225b0e112abf2a1c5ebb3b2c03537aaad21a
3ff7d2fe08b38a7a5dcf885e23a3acc673f8a11a
/tests/verilog_simple_modules_test.cpp
9d38cc058add3f871d2939427fb702e7934e264a
[ "MIT" ]
permissive
HardwareIR/netlistDB
eae65c470c12685f3c9ea577ecd66b65760318fd
2c52a1c88b7be712d6cdc9146f1a9dbf26441198
refs/heads/master
2021-06-12T17:21:53.085258
2021-03-17T13:10:16
2021-03-17T13:10:16
160,362,215
21
3
null
null
null
null
UTF-8
C++
false
false
5,065
cpp
verilog_simple_modules_test.cpp
#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN #define BOOST_TEST_MODULE netlistDB_verilog_simple_modules_test #include <boost/test/unit_test.hpp> #include <functional> #include <iostream> #include <fstream> #include <stdint.h> #include <sstream> #include <netlistDB/netlist.h> #include <netlistDB/statement_if.h> #include <netlistDB/hw_type/common.h> #include <netlistDB/serializer/verilog.h> #include <netlistDB/transform/to_hdl_friendly.h> #include "components/wire.h" #include "components/ff.h" #include "components/mux.h" #include "components/bram.h" using namespace std; using namespace netlistDB; using namespace netlistDB::hw_type; using namespace netlistDB::serializer; using namespace netlistDB::transform; BOOST_AUTO_TEST_SUITE( netlistDB_verilog_simple_modules_testsuite ) BOOST_AUTO_TEST_CASE( simple_wire_module ) { Wire ctx(hw_int32); TransformToHdlFriendly t; t.apply(ctx); { stringstream str; Verilog2001 ser(str); stringstream ref; ref << "module wire_module(" << endl; ref << " input signed [32-1:0] a_in," << endl; ref << " output signed [32-1:0] a_out);" << endl; ref << endl; ref << " assign a_out = a_in;" << endl; ref << endl; ref << "endmodule"; ser.serialize(ctx); BOOST_CHECK_EQUAL(str.str(), ref.str()); } } BOOST_AUTO_TEST_CASE( simple_ff_module ) { FF ctx(hw_int32); TransformToHdlFriendly t; t.apply(ctx); { stringstream str; Verilog2001 ser(str); stringstream ref; ref << "module ff_module(" << endl; ref << " input signed [32-1:0] a_in," << endl; ref << " output reg signed [32-1:0] a_out," << endl; ref << " input clk);" << endl; ref << endl; ref << " always @(posedge clk) begin: diver_of_a_out" << endl; ref << " a_out <= a_in;" << endl; ref << " end" << endl; ref << endl; ref << "endmodule"; ser.serialize(ctx); //cerr << str.str() << endl; BOOST_CHECK_EQUAL(str.str(), ref.str()); } } BOOST_AUTO_TEST_CASE( simple_ff_intern_sig_module ) { FF_intern_sig ctx(hw_int32); TransformToHdlFriendly t; t.apply(ctx); { stringstream str; Verilog2001 ser(str); stringstream ref; ref << "module ff_intern_sig_module(" << endl; ref << " input signed [32-1:0] a_in," << endl; ref << " output signed [32-1:0] a_out," << endl; ref << " input clk);" << endl; ref << endl; ref << " reg signed [32-1:0] reg_0;" << endl; ref << endl; ref << " assign a_out = reg_0;" << endl; ref << " always @(posedge clk) begin: diver_of_reg" << endl; ref << " reg_0 <= a_in;" << endl; ref << " end" << endl; ref << endl; ref << "endmodule"; ser.serialize(ctx); //cerr << str.str() << endl; BOOST_CHECK_EQUAL(str.str(), ref.str()); } } BOOST_AUTO_TEST_CASE( mux_module ) { Mux4x32 ctx; TransformToHdlFriendly t; t.apply(ctx); { stringstream str; Verilog2001 ser(str); stringstream ref; ref << "module mux4x32_module(" << endl; ref << " input signed [32-1:0] a_in0," << endl; ref << " input signed [32-1:0] a_in1," << endl; ref << " input signed [32-1:0] a_in2," << endl; ref << " input signed [32-1:0] a_in3," << endl; ref << " output reg signed [32-1:0] a_out," << endl; ref << " input [8-1:0] sel);" << endl; ref << endl; ref << " always @(sel or a_in0 or a_in1 or a_in2 or a_in3) begin: diver_of_a_out" << endl; ref << " if (sel == 8'h00)" << endl; ref << " a_out = a_in0;" << endl; ref << " else if (sel == 8'h01)" << endl; ref << " a_out = a_in1;" << endl; ref << " else if (sel == 8'h02)" << endl; ref << " a_out = a_in2;" << endl; ref << " else if (sel == 8'h03)" << endl; ref << " a_out = a_in3;" << endl; ref << " else" << endl; ref << " a_out = 32'h00000000;" << endl; ref << endl; ref << " end" << endl; ref << endl; ref << "endmodule"; ser.serialize(ctx); //cerr << str.str() << endl; BOOST_CHECK_EQUAL(str.str(), ref.str()); } } BOOST_AUTO_TEST_CASE( simple_bram_sp_module ) { Bram_sp ctx; TransformToHdlFriendly t; t.apply(ctx); { stringstream str; Verilog2001 ser(str); stringstream ref; ref << "module bram_sp_module(" << endl; ref << " input [4-1:0] addr," << endl; ref << " input clk," << endl; ref << " input signed [32-1:0] d_in," << endl; ref << " output reg signed [32-1:0] d_out," << endl; ref << " input en);" << endl; ref << endl; ref << " reg signed [32-1:0] mem [0:15];"<< endl; ref << endl; ref << " always @(posedge clk) begin: diver_of_d_out" << endl; ref << " d_out <= mem[addr];" << endl; ref << " if (en)" << endl; ref << " mem[addr] <= d_in;" << endl; ref << endl; ref << " end" << endl; ref << endl; ref << "endmodule"; ser.serialize(ctx); //cerr << str.str() << endl; BOOST_CHECK_EQUAL(str.str(), ref.str()); } } //____________________________________________________________________________// BOOST_AUTO_TEST_SUITE_END()
0a84ac14d0552bd99c5dd1be3484e0c11831ee23
877fff5bb313ccd23d1d01bf23b1e1f2b13bb85a
/app/src/main/cpp/dir7941/dir7942/dir8062/dir8063/dir12766/dir12767/dir13029/dir13714/file15015.cpp
e4c2bd08fa3a71c91d7875b250bf743183eb09e7
[]
no_license
tgeng/HugeProject
829c3bdfb7cbaf57727c41263212d4a67e3eb93d
4488d3b765e8827636ce5e878baacdf388710ef2
refs/heads/master
2022-08-21T16:58:54.161627
2020-05-28T01:54:03
2020-05-28T01:54:03
267,468,475
0
0
null
null
null
null
UTF-8
C++
false
false
115
cpp
file15015.cpp
#ifndef file15015 #error "macro file15015 must be defined" #endif static const char* file15015String = "file15015";
8560feffaf02d460fe6e318e5a1e66cf6a5b767d
3c3a77937d43706dfa4cc14ee82c83378968a57c
/Visual Studio 2013/Projects/Practice/Practice/C++11.cpp
d0483fee3333100232325da576d55eae6832fa1d
[]
no_license
KimBoWoon/HomeWork
221225411e08e184805af2f1742334639bb0db89
c5d9fc2e9b14812b85afbf8319395518f7ca0b0a
refs/heads/master
2021-07-21T10:24:30.769743
2016-10-04T06:58:05
2016-10-04T06:58:05
41,595,238
0
0
null
null
null
null
UTF-8
C++
false
false
99
cpp
C++11.cpp
#include <iostream> using namespace std; int main() { auto n = 3545846464l; cout << n << endl; }
31c1d6907faf7800a04eb078723312e38bad608a
2814ba8b4454c1d73d8caa1c1bd52abec8cb5326
/GUI/xppMenuLabels.cpp
51dd42314579f0708861fb077a500cddffe3dc74
[]
no_license
miscco/xppGUI
4ccdc3241358365fe280a22c102fe5a36053693f
825131c994c4b56e0ec2043504c93a576b853288
refs/heads/master
2021-03-16T05:32:09.539062
2016-08-19T08:22:08
2016-08-19T08:22:08
66,022,558
1
0
null
null
null
null
UTF-8
C++
false
false
10,774
cpp
xppMenuLabels.cpp
#include "xppMenuLabels.h" /******************************************************************************/ /* Main window */ /******************************************************************************/ xppMenu BoundaryValues = { .Title = "&Boundary values", .Labels = {"&Range", "&No show", "&Show", "&Periodic"}, .Dialogs = {} }; xppMenu Continue = { .Title = "&Continue", .Labels = {}, .Dialogs = {} }; xppMenu DirectionField = { .Title = "&DirectionField", .Labels = {"&Direction field", "&Flow", "&No direction field", "&Colorize", "Scaled direction field"}, .Dialogs = {} }; xppMenu Erase = { .Title = "&Erase", .Labels = {}, .Dialogs = {} }; xppMenu File = { .Title = "&File", .Labels = {"&Printsource", "&Write read", "&Read set", "&Auto", "&Calculator", "&Edit", "&Save info", "&Bell off", "&Help", "&Quit", "&Transpose", "T&ips", "&Get parameter set", "C&lone", "Edit &Xprrc", "T&utorial"}, .Dialogs = {} }; xppMenu Graphics = { .Title = "&Graphics", .Labels = {"&Add Curve", "&Delete last", "&Remove all", "&Edit curve", "&Postscript", "S&VG", "&Freeze", "A&xes options", "Exp&ort data", "&Colormap"}, .Dialogs = {{.Title = "New Curve", .EditLabels = {"X-Axis:", "Y-Axis:", "Z-Axis:", "Color:", "Line type:"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 0}, {.Title = "Edit Curve", .EditLabels = {"Curve Id:", "X-Axis:", "Y-Axis:", "Z-Axis:", "Color:", "Line type:"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 3}, {.Title = "Postscript options", .EditLabels = {"Axes Fontsize:", "Font:", "Linewidth:"}, .CheckLabels ={"Colored (*) or Black/White", "Landscape (*) or Portrai"}, .SwitchLabels = {}, .actionIndex = 4}, {.Title = "Axes options", .EditLabels = {"X-Origin:", "Y-Origin:", "Z-Origin:"}, .CheckLabels ={"Use X-origin:", "Use Y-origin:", "Use Z-origin:"}, .SwitchLabels = {}, .actionIndex = 7}, {.Title = "Colormap", .EditLabels = {}, .CheckLabels ={}, .SwitchLabels = {"&Normal", "&Periodic", "&Hot", "&Cool", "&Blue-red", "&Gray", "C&ubehelix"}, .actionIndex = 9} } }; xppMenu Integrate = { .Title = "&Integrate", .Labels = {"&Range", "Range &2D", "&Last", "&Old", "&Go", "&Mouse", "&Shift", "&New", "S&hoot", "&File", "Form&ula", "M&ice", "&DEA Guess", "&Backward"}, .Dialogs = {{.Title = "Range Integrate", .EditLabels = {"Range Over:", "Steps:", "Start:", "End:"}, .CheckLabels ={"Reset Storage", "Use old ICs", "Cycle Colors", "Movie"}, .SwitchLabels = {}, .actionIndex = 0}, {.Title = "Double Range Integrate", .EditLabels = {"Range Over 1:", "Steps 1:", "Start 1:", "End 1:", "Range Over 2:", "Steps 2:", "Start 2:", "End 2:"}, .CheckLabels ={"Reset Storage", "Use old ICs", "Cycle Colors", "Movie", "Curve"}, .SwitchLabels = {}, .actionIndex = 1}, {.Title = "New Initial Conditions", .EditLabels = {"TODO Parse ode file"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 7} } }; xppMenu Kinescope = { .Title = "&Kinescope", .Labels = {"&Capture", "&Reset", "&Playback", "&Autoplay", "&Save", "&Make Animation"}, .Dialogs = {} }; xppMenu Nullclines = { .Title = "&Nullclines", .Labels = {"&New", "&Restore", "&Auto", "&Manual", "&Freeze", "&Save"}, .Dialogs = {} }; xppMenu Numerics = { .Title = "N&umerics", .Labels = {"&Total", "&Start time", "T&ransient", "&Dt", "&Nullcline control", "&Singular point Controll", "N&Output", "&Method", "D&elay", "&Color code", "&Stoc&hast", "&Poincaré map", "R&uelle plot", "Loo&kup", "Boundary &Values", "&Averaging"}, .Dialogs = {{.Title = "Method", .EditLabels = {}, .CheckLabels ={}, .SwitchLabels = {"&Discrete", "&Euler", "&Modified Euler", "&Runge Kutta", "&Adams", "&Gear", "&Volterra", "&Backwards Euler", "&Qualst Runge Kuta", "&Stiff", "&CVode", "Dormance Prince &5", "Dormance Prince &83", "Rosen &23", "S&ymplectic"}, .actionIndex = 7} } }; xppMenu Parameter3D = { .Title = "&3D Parameter", .Labels = {}, .Dialogs = {} }; xppMenu Parameters = { .Title = "&Parameters", .Labels = {}, .Dialogs = {} }; xppMenu Phasespace = { .Title = "Ph&asespace", .Labels = {"&All", "&None", "&Choose"}, .Dialogs = {{.Title = "Choose torus", .EditLabels = {"Period"}, .CheckLabels ={"TODO Read ode file"}, .SwitchLabels = {}, .actionIndex = 2} } }; xppMenu Plot = { .Title = "Plot &X vs t", .Labels = {}, .Dialogs = {} }; xppMenu Restore = { .Title = "&Restore", .Labels = {}, .Dialogs = {} }; xppMenu Singular = { .Title = "&Singular Points", .Labels = {"&Go", "&Mouse", "&Range", "Monte &Carlo"}, .Dialogs = {} }; xppMenu Text = { .Title = "&Text", .Labels = {"&Text", "&Arrow", "&Pointer", "&Marker", "&Edit", "&Delete all", "Marker&s"}, .Dialogs = {} }; xppMenu View = { .Title = "&View", .Labels = {"&2D", "&3D", "&Array", "&Toon"}, .Dialogs = {{.Title = "2D View", .EditLabels = {"X-Axis:", "Y-Axis:", "XLabel:", "YLabel:", "X-min:", "X-max:", "Y-min:", "Y-max:"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 0}, {.Title = "3D View", .EditLabels = {"X-Axis:", "Y-Axis:", "Z-Axis:", "XLabel:", "YLabel:", "ZLabel:", "X-min:", "X-max:", "Y-min:", "Y-max:", "Z-min:", "Z-max:"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 1} } }; xppMenu Window = { .Title = "&Window", .Labels = {"&Create", "&Kill all", "&Destroy", "&Bottom", "&Auto", "&Manual", "&Simultaneous plot"}, .Dialogs = {{.Title = "Set Window range", .EditLabels = {"X min", "X max", "Y min", "Y max"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 0} } }; QList<xppMenu> xppMenus { Integrate, Continue, Nullclines, DirectionField, Phasespace, Kinescope, Graphics, Numerics, File, Parameters, Erase, Window, Text, Singular, View, Plot, Restore, Parameter3D, BoundaryValues }; /****************************************************************************************/ /* Auto window */ /****************************************************************************************/ xppMenu autoAxes= { .Title = "&Axes", .Labels = {"&Parameter", "&Limits", "P&lot type", "&Zoom in", "Zoom &out", "Last &1 parameter", "Last &2 parameter", "&Fit", "&Default", "&Scroll"}, .Dialogs = {{.Title = "Auto Plot Parameter", .EditLabels = {"Y-Axis", "Main Parameter", "Second Parameter"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 0}, {.Title = "Auto Plot Limits", .EditLabels = {"X max", "X min", "Y max", "Y min"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 1}, {.Title = "Auto Plot Type", .EditLabels = {}, .CheckLabels ={}, .SwitchLabels = {"&High", "&Norm", "H&igh-Low", "&Period", "&Two Parameter", "F&requency", "&Average"}, .actionIndex = 2} } }; xppMenu autoClear= { .Title = "&Clear", .Labels = {}, .Dialogs = {} }; xppMenu autoFile= { .Title = "&File", .Labels = {"&Import orbit", "&Save diagram", "&Load diagram", "&Reset diagram", "&Postscript", "&SVG", "&Clear grab", "&Write points", "&All info", "Init &data", "&Toggle redraw", "Auto ra&nge", "S&elect 2 parameter point", "Draw la&bled", "L&oad branch", "&Quit"}, .Dialogs = {} }; xppMenu autoGrab= { .Title = "&Grab", .Labels = {}, .Dialogs = {} }; xppMenu autoNumerics= { .Title = "&Numerics", .Labels = {}, .Dialogs = {{.Title = "Auto Parameter", .EditLabels = {"Ntst:", "Nmax:", "NPr:", "Ds:", "Dsmin:", "Dsmax:", "Ncol:", "Parameter Min:", "Parameter Max:", "Norm Min:", "Norm Max:", "EPSL:", "EPSU:", "EPSS:", "IAD:", "MXBF:", "IID:", "ITMX:" "ITNM:", "NWTN:", "IADS:"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 0} } }; xppMenu autoParameter= { .Title = "&Parameter", .Labels = {}, .Dialogs = {{.Title = "Auto Parameter", .EditLabels = {"Parameter 1:", "Parameter 2:", "TODO read ode file"}, .CheckLabels ={}, .SwitchLabels = {}, .actionIndex = 0} } }; xppMenu autoRedraw= { .Title = "Re&draw", .Labels = {}, .Dialogs = {} }; xppMenu autoRun= { .Title = "&Run", .Labels = {}, .Dialogs = {} }; xppMenu autoUserPeriod= { .Title = "&User Period", .Labels = {}, .Dialogs = {{.Title = "Number", .EditLabels = {}, .CheckLabels ={}, .SwitchLabels = {"&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9"}, .actionIndex = 0} } }; QList<xppMenu> autoMenus { autoParameter, autoAxes, autoNumerics, autoRun, autoGrab, autoUserPeriod, autoClear, autoRedraw, autoFile };
af97f06595f026e09770e603520fe5eca0098f4d
756e08cef15ea31fefb0f358fce47d08f592afca
/Huffman/Huffman.cpp
ca2b915e9974d411bdb4e0ba9d1c7f7c0e63a638
[]
no_license
parz1/Algorithm
4de1a903bffcf2f59944fdc68f544b592a737d0d
db420782ed2ea8237e25eb3a2d28a7fcf813f284
refs/heads/master
2020-05-17T17:47:42.859835
2020-01-30T04:57:40
2020-01-30T04:57:40
183,865,157
1
0
null
null
null
null
UTF-8
C++
false
false
4,510
cpp
Huffman.cpp
#include "Huffman.h" #include <iostream> #include <fstream> #include <cstdio> #include <cstring> #define MIN 100000 using namespace std; void Huffman::Initialize() { ifstream in("hfmTree.txt"); int cnt[M]; char str[M]; if (in.is_open()) { int i = 0; int n; in >> n; for (int i = 1; i <= n; i++) { in >> str[i] >> cnt[i]; } length = n; createHuffmanTree(cnt, str); in.close(); } else { ofstream out("hfmTree.txt", ofstream::out); int n; cin >> n; out << n << ' '; for (int i = 1; i <= n; i++) { cin >> str[i] >> cnt[i]; out << str[i] << ' ' << cnt[i] << ' '; } length = n; createHuffmanTree(cnt, str); out.close(); } } void Huffman::huffmanSelect(int k, int &s1, int &s2) { int i, j, minl = MIN; for (i = 1; i <= k; i++) { if (HuffmanTree[i].w < minl && HuffmanTree[i].parent == 0) { j = i; minl = HuffmanTree[i].w; } } s1 = j; minl = MIN; for (i = 1; i <= k; i++) { if (HuffmanTree[i].w < minl && HuffmanTree[i].parent == 0 && i != s1) { j = i; minl = HuffmanTree[i].w; } } s2 = j; } void Huffman::createHuffmanTree(int cnt[], char str[]) { int i, s1, s2; //clear for (i = 1; i < length * 2; i++) { HuffmanTree[i].lchild = 0; HuffmanTree[i].rchild = 0; HuffmanTree[i].parent = 0; HuffmanTree[i].w = 0; } for (i = 1; i <= length; i++) { HuffmanTree[i].w = cnt[i]; } for (i = length + 1; i < 2 * length; i++) { huffmanSelect(i - 1, s1, s2); //cout << s1 << ' ' << s2 << endl; HuffmanTree[s1].parent = i; HuffmanTree[s2].parent = i; HuffmanTree[i].lchild = s1; HuffmanTree[i].rchild = s2; HuffmanTree[i].w = HuffmanTree[s1].w + HuffmanTree[s2].w; } for (i = 1; i <= length; i++) { HuffmanCode[i].ch = str[i]; } } void Huffman::Encoding() { cout << "ENCODING" << endl; int c, p, i; char cd[M]; int start; cd[length] = '\0'; for (i = 1; i <= length; i++) { start = length; c = i; while (HuffmanTree[c].parent> 0) { start--; cd[start] = (HuffmanTree[p].lchild == c) ? '0' : '1'; cout << cd[start] << endl; c=p; } strcpy(HuffmanCode[i].bits, &cd[start]); HuffmanCode[i].len = length - start; } cout << "CD: " << cd << endl; } void Huffman::Decoding(char s[]) { FILE *fp; fopen_s(&fp, "CodeFile.txt", "r"); if (fp == NULL) { return; } char ch; int num = 0; while (ch = getc(fp) != EOF) { num++; } fclose(fp); ifstream in("CodeFile.txt"); string line; char result[200]; int z = 0; if (in) { while (!in.eof()) { in >> ch; result[z] = ch; z++; } } else { cout << "READ FILE ERR" << endl; } result[num] = '\0'; cout << result << endl; in.close(); char str[300]; char cd[10]; int i, j, k = 0, p = 0, flag; while (result[p] != '\0') { flag = 0; for (i = 0; i < num && flag == 0 && result[p != '\0']; i++) { cd[i] = ' '; cd[i + 1] = '\0'; cd[i] = result[p]++; for (j = 1; j <= num; j++) { if (strcmp(HuffmanCode[j].bits, cd) == 0) { str[k] = HuffmanCode[j].ch; k++; flag = 1; break; } } } } str[k] = '\0'; strcpy(s, str); } void Huffman::Coding(char str[], char get[]) { cout << "Coding" << endl; int i, j = 0; while (str[j] != '\0') { for (i = 1; i <= length; i++) { if (HuffmanCode[i].ch == str[j]) { cout << HuffmanCode[i].bits << endl; strcat(get, HuffmanCode[i].bits); break; } } j++; } //strcat(get, '\0'); int len = sizeof(get) / sizeof(get[0]); cout << len << endl; FILE *fp; fopen_s(&fp, "CodeFile.txt", "w"); fputs(get, fp); fclose(fp); };
4e8cca94eb378650ee4eefd08d0605f7d2ba71e4
949ab1beaae33b35f6401cbc5bc870c3e80d4fcd
/EmitterBase.h
90fc1a6a21ffac3aa802977d704274c88a7baa43
[]
no_license
SH0756/PresentationFolder
edc0f4b973f085c985247d58933723412a70ec6f
45a944f43ce488b8eab47931d6161752258076b6
refs/heads/master
2021-01-01T18:07:24.274956
2015-04-10T10:44:30
2015-04-10T10:44:30
33,710,651
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
319
h
EmitterBase.h
namespace nel { //エミッタのベースクラス class CEmitterBase : public CEmitterFile { public: //コンストラクタ CEmitterBase(wstring filename) : CEmitterFile(filename) { FindAmountChange(); } //エミッタのパラメータ値の変化量を求めます void FindAmountChange(); }; }
164f79a74ef7774c6da4c9d36f265743ef57c089
3c16fa08b2fc072c506f476691a235490cb0b78a
/src/tickets_service/Logger.cpp
c8e16480b0d5caa39649625e3b6d361bad29b5f8
[]
no_license
samiavasil/verify_tickets
14481a9b5f2366707010b95cf1c68da45e80b275
dc8a5c8efeeddcbdeb0925ff9f047bdffa148593
refs/heads/master
2020-12-26T19:47:54.630306
2020-08-04T16:46:09
2020-08-04T23:50:31
237,620,491
0
0
null
null
null
null
UTF-8
C++
false
false
1,732
cpp
Logger.cpp
#include <QString> #include <QMqttClient> #include "Logger.h" #include "MqttManager.h" #include "Configurator.h" class PrivMsg{ public: static void myMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & msg) { QString out_dbg; bool log = false; switch (type) { case QtDebugMsg: { if (Configurator::Instance().LogsLevel() == Configurator::DEBUG) { out_dbg = QString("Debug: %1").arg(msg); log = true; } break; } case QtInfoMsg: out_dbg = QString("Info: %1").arg(msg); log = true; break; case QtWarningMsg: out_dbg = QString("Warning: %1").arg(msg); log = true; break; case QtCriticalMsg: out_dbg = QString("Critical: %1").arg(msg); log = true; break; case QtFatalMsg: out_dbg = QString("Fatal: %1").arg(msg); log = true; break; default: break; } if (log) { if (Configurator::Instance().Mqtt().enbl_logs) { QString topic = Configurator::Instance().Mqtt().log_topic; if (MqttManager::Instance().m_client->state() == QMqttClient::Connected) { MqttManager::Instance().publish(MqttManager::Instance().m_client, QMqttTopicName(topic), out_dbg.toUtf8(), 1, false); } } fprintf(stderr, "%s\n", out_dbg.toStdString().c_str()); } } }; Logger::Logger() { m_Msg = new PrivMsg; qInstallMessageHandler(m_Msg->myMessageOutput); } Logger::~Logger() { delete m_Msg; }
1e63c809c8f8b6b0ceaaf363087d7de328f12843
db7cc99567345f2f7fc7af06ca4362afca63816c
/book.cpp
f9897fc9b0dbb9a3c9edc286d9732a442db258bb
[]
no_license
anishdhakal/novel_and_textbook
0b97b8ca2dc77c2375307264709e3cbb21c63a21
e0fe2a0d393a78be5b1fac659905c98ff0cee48c
refs/heads/master
2021-01-18T13:10:07.246089
2015-04-03T09:57:13
2015-04-03T09:57:13
33,357,547
0
0
null
2015-04-03T09:54:16
2015-04-03T09:54:16
null
UTF-8
C++
false
false
768
cpp
book.cpp
#include<iostream> #include "book.h" using namespace std; Book::Book(string bookName, Author authorName, int bookPrice) { name=bookName; author=authorName; price=bookPrice; } Book::Book(string bookName, Author authorName, int bookPrice, int bookQuantity) { name=bookName; author = authorName; price=bookPrice; quantity=bookQuantity; } string Book::getName() { return name; } Author Book::getAuthor() { return author; } void Book::setPrice(int bookPrice) { price=bookPrice; } int Book::getPrice() { return price; } void Book::setQuantity(int bookQuantity) { quantity=bookQuantity; } int Book::getQuantity() { return quantity; } string Book::toString() { return getName() + " by " + author.toString(); }
724580e095e3d222d7f08bb6080b8971cf01a82b
4a9900b0161e79315bb45acbf5c807544ad35150
/Affectation.h
072bc986a25be4252f3c2a951752ac6d08b00f55
[]
no_license
youssefOud/PLD_COMP_Hexa_4112
477f1b9744b6b9973c0246611d7d9a0cc1984710
695999de242488d5b8601dc53fb30b81e22ceec1
refs/heads/master
2020-04-28T03:39:45.002172
2019-04-12T21:56:12
2019-04-12T21:56:12
174,946,061
0
0
null
2019-04-12T21:56:13
2019-03-11T07:18:46
C++
UTF-8
C++
false
false
989
h
Affectation.h
#pragma once #ifndef PLD_COMP_AFFECTATION_H #define PLD_COMP_AFFECTATION_H #include <iostream> #include <string> #include "Instruction.h" #include <utility> #include <map> #include "Enum.h" using namespace std; class Affectation : public Instruction { public: Affectation(Instruction *e, LeftValue *l, string t); Affectation(); virtual ~Affectation(); virtual string toString(){ return "Affectation"; }; virtual int getClassName()=0; Type getType(); void setType(Type t); Instruction *getExpr(); LeftValue *getLeft(); Type convertTypeToInt(string); virtual string buildIR(CFG *cfg) = 0; virtual void analyse(map<string,vector<int>> & staticAnalysis,list<string> & errors,list<string> & warnings, multimap<string,pair<Type,DefAppel*>> & prototypes,bool returnType) {}; virtual bool estCst(list<string> & opti); protected: Instruction *expr; Type type; LeftValue *left; private: }; #endif //PLD_COMP_AFFECTATION_H
2e2eca837514ed29a1e8b915271c5be5c38003cb
3f8b288711bb5adc2394171507f54c62dc60c601
/atcoder/abc/166f.cpp
7df84a6955178e9edcfc965a3641e167d48bb417
[]
no_license
pontsuyo/procon
65df6356f0ea1cfb619898d9e8cc6e326c0586e7
804aaeb526946172a8f41e0619712f5989b6b613
refs/heads/master
2021-06-15T15:13:04.441761
2021-03-20T05:26:54
2021-03-20T05:26:54
175,234,672
1
0
null
null
null
null
UTF-8
C++
false
false
1,959
cpp
166f.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, l, r) for (int i = l; i <= (int)(r); i++) #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define all(v) v.begin(), v.end() #define MOD (int) (1e9+7) #define INF (int) 1e9 #define LLINF (ll) 1e18 int main(){ int n, a, b, c; map<char, int>m; cin >> n >> a >> b >> c; m['A'] = a; m['B'] = b; m['C'] = c; map<char, vector<int>> q; vector<int> va, vb,vc; q['A'] = va; q['B'] = vb; q['C'] = vc; // rep(i, 3) q[(char)('A'+i)][n] = 0; string ss[n]; char ans[n]; // printf("%d\n", n); for (int i = n; i >=1; i--) { // printf("%d\n", i); // rep(j, 3) q[(char)('A'+j)][i-1] = q[(char)('A'+j)][i]; string s; cin >> s; ss[n-i] = s; q[s[0]].emplace_back(i); q[s[1]].emplace_back(i); // // printf("%d\n", i); } // printf("ok\n"); rep(i, n){ // printf("%d\n", i); string si = ss[i]; if(m[si[0]]==0 && m[si[1]]==0){ cout << "No" << endl; return 0; }else if(m[si[0]] < m[si[1]]){ ans[i] = si[0]; m[si[0]]++; m[si[1]]--; }else if(m[si[0]] > m[si[1]]){ ans[i] = si[1]; m[si[0]]--; m[si[1]]++; }else{ int q1 = *lower_bound(all(q[si[0]]), i); int q2 = *lower_bound(all(q[si[1]]), i); if(q1 < q2){ ans[i] = si[1]; m[si[0]]--; m[si[1]]++; }else{ ans[i] = si[0]; m[si[0]]++; m[si[1]]--; } } } cout << "Yes" << endl; rep(i, n) cout << ans[i] << endl; // printf("%d\n", N); return 0; }
03106bec3509e34f9388ccce054f0004c7ec9628
c2b3b7bbf89ccd152fc92909b61624bdba3504a2
/src/gemini/epics/jms/JmsIntEpicsBuilder.cpp
b5fad637244cdb1e4d2d271ec4d7a5e78fc5f6c0
[ "BSD-2-Clause" ]
permissive
gemini-hlsw/giapi-glue-cc
9893ffaed0bfb7189c29d3e906f1dfc12ad02f41
17a76e216762af22826c31ef23cd418fbc49b604
refs/heads/develop
2023-05-26T02:20:26.785385
2023-05-18T21:45:18
2023-05-18T21:45:18
94,218,682
0
3
NOASSERTION
2023-05-18T21:45:20
2017-06-13T13:55:53
C++
UTF-8
C++
false
false
659
cpp
JmsIntEpicsBuilder.cpp
#include "JmsIntEpicsBuilder.h" #include <gemini/epics/EpicsStatusItemImpl.h> namespace giapi { JmsIntEpicsBuilder::JmsIntEpicsBuilder(BytesMessage *bm) : JmsEpicsBuilder(bm) { } JmsIntEpicsBuilder::~JmsIntEpicsBuilder() { } pEpicsStatusItem JmsIntEpicsBuilder::getEpicsStatusItem() { int size = _nElements * sizeof(int); char * data = new char[_nElements]; for (int i = 0; i < _nElements; i++) { int val = _message->readInt(); memcpy(data + i * sizeof(int), &val, sizeof(int)); } pEpicsStatusItem item = EpicsStatusItemImpl::create(_name, type::INT, _nElements, data, size); //destroy the local memory delete[] data; return item; } }
daa61d5a6c9ff87ca0b16e0487320205ba4ce748
d350d6d6a959d2a134a66e31c1a841e0e04dbe21
/LibsCXX/Graph/include/private/Data.hpp
54fcb2796ace6b89d716a667ca3a21dcf11160ad
[]
no_license
luisfisherjr/cmake-project-template
5d04062bda3cb754f497841f5f267465ccbe4dc7
3f50d02f1207822ac5b3fb43f31c2b5cffa21424
refs/heads/master
2020-03-26T10:47:11.507856
2018-09-22T18:54:36
2018-09-22T18:54:36
144,815,414
0
0
null
null
null
null
UTF-8
C++
false
false
272
hpp
Data.hpp
#ifndef NODE_DATA_HPP #define NODE_DATA_HPP #include <string> class Data { public: virtual ~Data() {} virtual std::string toString() const = 0; virtual bool equals(const Data *obj) const = 0; virtual int hashCode() const = 0; }; #endif //NODE_DATA_HPP
e5b770af3712ac6a14d525e0f0a2617fc27a76fc
3686ee91b33cf71d6dfbc38cfe797a2a9b6653b0
/archive2/74.cpp
6c95aa75ac72cc3380ad4570e108162f2af0733c
[]
no_license
danleechina/Leetcode
e27e6c4ccb947bf87e200a47c4b3defb4643107a
95a25af7767e30bacc2ebfb7faffbba6d7bdc157
refs/heads/master
2020-03-26T21:56:15.199890
2019-05-22T02:42:30
2019-05-22T02:42:30
145,419,407
0
0
null
null
null
null
UTF-8
C++
false
false
705
cpp
74.cpp
#include <iostream> #include <vector> #include <map> #include <set> #include <stack> #include <string> #include <map> #include <algorithm> using namespace std; bool myfunction (int i,int j) { return (i<j); } class Solution { public: bool searchMatrix(vector<vector<int>>& matrix, int target) { int m = matrix.size(); if (m == 0) return false; int n = matrix[0].size(); int start = 0, end = m * n - 1; while (start <= end) { int mid = (start + end) / 2; int row = mid / n; int col = mid - row * n; if (matrix[row][col] == target) return true; else if (matrix[row][col] < target) start = mid + 1; else end = mid - 1; } return false; } };
83539e9be5d00f55561421efc0732fa213db9015
9b8ed2eb05e40016395a069013402610361ee499
/Test/ServerGrp.h
271445c7c65e99dad936c0e5be5a7370f8bdba77
[]
no_license
singmelody/Test
6b74674cc0219189caaf365df120a4420b77cd6f
9f2d3d72627586bd07a66b2599a7106d7d6b1f1c
refs/heads/master
2020-04-07T02:50:03.334288
2017-12-31T22:26:46
2017-12-31T22:34:09
45,405,601
0
0
null
null
null
null
UTF-8
C++
false
false
1,154
h
ServerGrp.h
#pragma once #include "MySockAddr.h" #include <map> #include <string> class ServerInfo; class ServerManager; class PacketSender; typedef std::map< int32, ServerInfo*> SrvInfoMap; class ServerGrp { public: ServerGrp(void); virtual ~ServerGrp(void); void Init(ServerManager* pMgr, int32 nSrvType); ServerInfo* CreateSrvInfo( int32 nSrvType, int32 nSrvID, int32 nSocketID, SockAddr& laddr); ServerInfo* AddServer( int32 nID, int32 nSocketID, SockAddr& laddr); ServerInfo* GetServer(int32 nID); void BroadcastPacket(class PacketBase* pPkt, int32 nExceptID = -1); void PeerSend( int32 nSocketID, class PacketBase* pPkt); int32 ServerCnt() { return (int32)m_SrvMap.size();} virtual void SortList(){} bool RemoveServer(int32 nID); void InitDogDetailsPools( PacketSender* pSender, int32 nDogSrvID); void BroadcastDogDetailsPools(class ModuleBase* pModule); void UpdateDogDetailsPools(); void SyncGroupInfo(int32 nSocketID); SrvInfoMap m_SrvMap; ServerManager* m_pMgr; int32 m_nSrvType; std::string m_strSrvName; protected: virtual void OnAddServer(ServerInfo* pInfo){} virtual void OnRemoveServer(ServerInfo* pInfo){} };
820ad0051cd4969ddde64dbc5a8165da345d9025
35bf45df1af062cf0b37d032feb2940ee78fe722
/ClassForHelp/Add2Dlg.cpp
f9e6802d2c0ed804ea08fea52bde4b465131a21d
[]
no_license
zhang1320668499/ClassForHelp
adb1e0c8ed1f5125ed2d61bae1b835cb3f633c01
c851a60014682c6fe781d2ae009949732a8b46c9
refs/heads/master
2016-08-03T13:42:25.970231
2015-06-21T02:26:39
2015-06-21T02:26:39
37,793,917
1
0
null
null
null
null
GB18030
C++
false
false
1,593
cpp
Add2Dlg.cpp
// Add2Dlg.cpp : implementation file // #include "stdafx.h" #include "software.h" #include "Add2Dlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CAdd2Dlg dialog CAdd2Dlg::CAdd2Dlg(CWnd* pParent /*=NULL*/) : CDialog(CAdd2Dlg::IDD, pParent) { //{{AFX_DATA_INIT(CAdd2Dlg) m_Xingbie = _T(""); m_Beizhu = _T(""); m_Chuangweihao = _T(""); m_Louhao = _T(""); m_Zhuanye = _T(""); m_Xingming = _T(""); m_Xuehao = _T(""); m_Qinshihao = _T(""); //}}AFX_DATA_INIT } void CAdd2Dlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAdd2Dlg) DDX_CBString(pDX, IDC_COMBO_SEX, m_Xingbie); DDX_Text(pDX, IDC_EDIT_BEIZHU, m_Beizhu); DDX_Text(pDX, IDC_EDIT_CHUANGWEIHAO, m_Chuangweihao); DDX_Text(pDX, IDC_EDIT_LOUHAO, m_Louhao); DDX_Text(pDX, IDC_EDIT_MAJOR3, m_Zhuanye); DDX_Text(pDX, IDC_EDIT_NAME2, m_Xingming); DDX_Text(pDX, IDC_EDIT_NUMBER, m_Xuehao); DDX_Text(pDX, IDC_EDIT_QINSHIHAO, m_Qinshihao); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAdd2Dlg, CDialog) //{{AFX_MSG_MAP(CAdd2Dlg) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CAdd2Dlg message handlers void CAdd2Dlg::OnButton1() { // TODO: Add your control notification handler code here //更新数据 UpdateData(TRUE); if (m_Xingming.IsEmpty()) { AfxMessageBox((_T("姓名不能为空。"))); return; } CDialog::OnOK(); }
5ab6f177da8c8391506122459d2a1092dbc57dfe
35774866a6f846e2d54ea5e0755088f97db93fed
/task 13.cpp
61c451ed3baf1a434ad4b221511a2622c154cb52
[]
no_license
vaishnavi2699/CPP-Logical-programs
5d4f0c6e3684d74f5269a24774cb41d334faaf98
c0d63b86745bc1a15e41cac96149e278e1ebd583
refs/heads/main
2023-02-23T22:01:15.999441
2021-01-29T13:37:23
2021-01-29T13:37:23
334,154,397
0
0
null
null
null
null
UTF-8
C++
false
false
263
cpp
task 13.cpp
// WAP to find sum of all natural numbers between 1-n #include<iostream> using namespace std; int main() { int i=1,n,sum=0; cout<<"enter n number"; cin>>n; while(i<=n) { sum=sum+i; i=i+1; } cout<<"sum is: "<<sum<<"\t"; return 0; }
d2e9f5a839755034622b75fbaa01699b07e989e8
9ada6ca9bd5e669eb3e903f900bae306bf7fd75e
/case3/ddtFoam_Tutorial/0.002050000/HO2
fc4f8750031230e53a5d71116966065637bfc841
[]
no_license
ptroyen/DDT
a6c8747f3a924a7039b71c96ee7d4a1618ad4197
6e6ddc7937324b04b22fbfcf974f9c9ea24e48bf
refs/heads/master
2020-05-24T15:04:39.786689
2018-01-28T21:36:40
2018-01-28T21:36:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
74,408
HO2
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.002050000"; object HO2; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField nonuniform List<scalar> 12384 ( 4.65393e-06 4.33238e-06 4.27757e-06 3.89713e-06 3.80727e-06 3.19057e-06 2.91366e-07 9.4778e-09 2.42558e-09 5.70546e-10 2.09095e-11 4.56778e-13 9.22114e-15 2.38583e-16 4.62926e-12 1.69912e-10 8.56729e-10 2.54931e-09 1.97759e-08 7.19752e-08 1.92867e-07 2.31576e-07 2.26691e-07 2.20456e-07 2.21305e-07 1.84241e-07 1.64816e-07 1.00141e-07 7.75888e-08 5.07823e-08 2.79443e-08 1.11048e-08 2.59042e-09 1.90809e-10 8.75092e-12 1.48132e-12 1.24037e-12 4.60422e-13 2.9242e-14 5.21163e-17 6.63e-20 1.63111e-22 4.41235e-25 1.38123e-26 5.16589e-29 3.68284e-27 2.32808e-25 1.61264e-23 3.48136e-22 3.89974e-21 1.07669e-19 2.92925e-17 2.0721e-14 1.04685e-11 1.66818e-10 4.42474e-10 6.97479e-10 5.55477e-10 2.84089e-10 7.32683e-11 5.41417e-12 3.73314e-13 5.10961e-15 6.31923e-17 1.82853e-18 2.0265e-21 6.25666e-24 1.11085e-26 2.06154e-29 3.26522e-32 3.53768e-35 5.70312e-38 1.01689e-40 2.02972e-43 9.76208e-54 1.7226e-54 3.49594e-56 2.29418e-58 2.34634e-61 1.43812e-64 5.26778e-68 2.43972e-71 9.01895e-75 5.06839e-78 3.73245e-81 6.05266e-84 4.01399e-87 1.24521e-90 5.39237e-94 2.94559e-97 1.80428e-100 1.09806e-103 6.5872e-107 3.7296e-110 2.00905e-113 1.13542e-116 6.97353e-120 3.38706e-123 2.34217e-126 1.31688e-129 6.67692e-133 3.73961e-136 2.0686e-139 1.18267e-142 2.24571e-154 2.60739e-155 5.70745e-158 9.28308e-161 1.19603e-163 1.20666e-166 9.71947e-170 4.08325e-173 8.4836e-179 6.473e-184 2.58235e-188 8.84924e-193 3.51903e-197 1.15207e-201 1.83654e-206 1.68404e-211 1.29348e-216 9.16755e-222 6.40368e-227 4.19525e-232 2.75689e-237 1.77763e-242 1.20889e-247 9.21587e-253 5.96649e-258 2.79063e-263 9.90494e-269 2.81001e-274 7.36787e-280 2.12956e-285 4.8246e-309 1.13938e-311 9.70694e-317 5.78057e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.89429e-06 4.93296e-06 4.89025e-06 4.57973e-06 3.74249e-06 3.7071e-06 2.30242e-07 4.93259e-08 2.10111e-08 5.80496e-09 5.82241e-10 1.91618e-11 1.25504e-12 1.55645e-14 1.19014e-10 3.89675e-09 2.61846e-08 9.37661e-08 2.77747e-07 7.20209e-07 2.33124e-06 2.48387e-06 2.48741e-06 2.46613e-06 2.33617e-06 2.30523e-06 2.20877e-06 1.12883e-06 7.102e-07 4.47866e-07 2.86319e-07 1.86425e-07 1.09833e-07 3.20192e-08 1.89306e-09 3.20984e-10 2.82004e-10 9.85413e-12 2.10764e-12 3.03621e-15 9.16007e-18 1.25451e-20 1.05756e-23 2.20185e-24 3.88039e-27 1.4243e-25 1.15403e-23 8.55863e-22 2.21227e-20 2.49544e-19 1.64838e-17 1.71096e-14 2.70215e-11 1.18956e-08 8.8211e-08 1.37728e-07 1.57617e-07 9.12294e-08 2.34723e-08 2.78246e-09 8.02679e-11 3.97092e-12 6.17954e-13 1.37229e-13 8.21147e-16 4.68861e-20 1.8312e-22 1.81432e-25 2.11594e-27 4.08572e-30 1.10321e-32 1.40186e-35 1.59706e-38 5.98374e-41 3.81247e-50 2.84781e-51 3.17072e-53 2.00458e-55 2.45698e-58 2.40215e-61 1.01953e-64 9.41821e-68 3.26966e-71 1.36395e-74 5.49239e-78 6.90091e-81 2.10086e-84 1.25996e-88 1.43641e-92 5.46312e-97 8.53473e-101 1.62909e-103 8.5204e-107 4.42258e-110 1.96107e-113 1.39206e-116 1.10524e-119 7.91752e-123 2.08726e-125 1.75037e-128 8.21424e-131 7.59846e-134 5.63057e-137 3.79964e-140 9.48915e-152 7.46209e-153 1.69792e-155 3.02137e-158 4.22844e-161 5.00489e-164 4.72369e-167 4.11204e-170 2.44152e-173 2.94028e-178 1.42596e-182 5.73107e-187 4.824e-191 1.72462e-195 2.79055e-200 2.54211e-205 1.8396e-210 1.17615e-215 7.17803e-221 4.33961e-226 2.50104e-231 1.51691e-236 9.03985e-242 6.26087e-247 3.99826e-252 1.8704e-257 6.37975e-263 1.54582e-268 3.35035e-274 6.11063e-280 4.02853e-303 1.04853e-305 8.41532e-311 4.9285e-316 2.49009e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.85744e-06 3.02133e-06 1.88842e-06 1.22728e-06 7.71987e-07 3.17829e-07 7.11581e-08 3.76972e-08 2.0792e-08 1.08736e-08 3.60874e-09 1.68376e-10 3.60174e-11 1.01548e-12 9.82873e-10 6.85566e-08 4.12877e-07 6.63589e-07 7.98217e-07 2.66296e-06 3.14702e-06 3.24235e-06 3.28149e-06 3.27176e-06 2.76242e-06 2.56212e-06 2.3548e-06 2.238e-06 2.18048e-06 1.61286e-06 1.77213e-06 1.59305e-06 9.5153e-07 2.88709e-07 1.08472e-07 8.50495e-08 4.86129e-08 1.00937e-08 4.04077e-10 1.12271e-14 1.29853e-17 3.85287e-20 4.03145e-23 3.55617e-22 2.5673e-25 7.4165e-24 1.9031e-21 5.78601e-20 7.07148e-19 3.9259e-17 2.85106e-14 2.03507e-11 2.39795e-08 1.87176e-07 4.72823e-07 5.91664e-07 7.51834e-07 8.78262e-07 8.06152e-07 6.6656e-07 2.32879e-07 1.99854e-09 2.51581e-12 3.71132e-14 2.79374e-14 3.30342e-14 2.18788e-17 7.3426e-22 1.52903e-25 3.32738e-29 4.15771e-31 3.82972e-33 9.04753e-36 4.81475e-38 1.34981e-47 1.70396e-48 1.44941e-49 7.41911e-51 3.42414e-53 2.61366e-56 3.12037e-60 3.05164e-64 3.67325e-68 1.42169e-71 1.81961e-74 2.74143e-76 8.11466e-79 1.83444e-82 1.39675e-86 1.74393e-91 3.2755e-96 3.13915e-100 4.05606e-104 4.30959e-108 1.20288e-112 3.71825e-116 1.91685e-119 1.63757e-122 5.51313e-124 1.61781e-126 3.48164e-128 5.75071e-131 3.93299e-134 2.05623e-137 6.52989e-150 1.43213e-150 3.42445e-153 5.28824e-156 6.58329e-159 5.55633e-162 3.72816e-165 1.94496e-168 1.15454e-171 6.31378e-175 3.06006e-179 9.86783e-184 1.69794e-187 4.8335e-192 6.91427e-197 6.21094e-202 3.89274e-207 2.42617e-212 1.11865e-217 6.71046e-223 3.24916e-228 1.9415e-233 1.14804e-238 7.18562e-244 5.65065e-249 3.3581e-254 1.60363e-259 4.20715e-265 1.01034e-270 1.06606e-276 4.14794e-300 1.92346e-302 1.62316e-307 8.89489e-313 4.82646e-318 1.97626e-323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.92684e-06 8.00377e-07 2.57365e-07 1.49514e-07 7.41778e-08 4.38022e-08 8.07388e-09 8.5949e-09 1.20504e-08 1.30311e-08 6.7875e-09 2.02873e-09 5.20913e-10 1.34782e-11 3.93947e-09 3.54242e-07 3.4845e-06 4.19447e-06 4.71218e-06 4.16861e-06 3.80327e-06 3.68588e-06 4.18142e-06 4.54305e-06 4.66547e-06 4.498e-06 3.99738e-06 2.94972e-06 3.06508e-06 3.316e-06 3.67082e-06 4.24998e-06 2.14638e-06 1.6073e-06 2.20445e-06 2.35553e-06 1.79454e-06 3.73306e-07 3.48169e-08 1.21571e-10 1.01523e-15 5.40975e-19 3.37111e-21 7.48503e-20 2.41602e-23 1.74206e-21 3.32602e-19 2.2036e-18 4.20685e-17 2.31471e-14 2.29956e-11 2.57124e-08 3.43332e-07 1.13031e-06 3.23553e-06 3.50129e-06 3.84064e-06 3.98406e-06 3.81496e-06 3.12227e-06 1.0303e-06 7.71942e-07 9.54245e-08 3.14546e-11 1.19768e-13 4.55757e-15 2.12186e-14 1.11322e-15 1.74086e-20 1.93256e-24 5.86053e-29 4.26664e-31 4.99035e-33 6.5152e-35 8.4064e-44 1.33207e-43 5.01475e-44 4.25605e-46 3.38786e-50 3.54915e-54 7.36085e-58 1.55392e-61 2.85275e-65 4.17799e-69 1.44649e-72 3.75508e-75 4.28929e-78 9.06058e-81 2.24403e-82 3.63789e-85 4.2803e-89 3.51489e-93 2.95012e-97 1.9099e-101 2.63909e-106 4.19623e-110 1.45885e-113 5.6281e-117 1.79515e-120 6.90113e-124 1.72984e-126 3.36611e-129 1.72404e-132 5.02225e-136 1.73127e-144 7.10668e-145 1.69461e-147 2.57666e-150 2.43106e-153 1.56025e-156 7.51428e-160 3.23565e-163 1.34039e-166 6.63784e-170 3.57397e-173 9.83323e-178 2.50271e-181 5.06426e-186 5.69607e-191 4.27456e-196 2.39782e-201 1.19525e-206 5.06111e-212 2.30191e-217 1.00687e-222 4.53699e-228 2.15371e-233 1.05672e-238 6.23575e-244 3.79856e-249 1.90199e-254 4.51278e-260 7.44718e-266 9.56796e-272 7.2576e-294 1.65726e-296 9.96128e-302 5.51083e-307 2.6687e-312 1.21831e-317 4.44659e-323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8.34445e-07 5.04281e-07 3.11444e-07 2.02811e-07 2.18296e-07 3.22538e-07 9.43225e-07 6.22133e-07 6.04667e-07 1.73587e-07 1.53478e-08 9.43345e-09 3.21706e-09 1.17266e-10 1.76793e-08 8.28666e-07 2.40741e-06 2.5462e-06 1.42798e-06 4.43063e-07 3.53586e-07 3.03442e-07 3.85244e-07 4.33565e-07 3.58746e-07 1.78738e-07 6.81927e-08 3.47685e-08 4.30539e-08 5.56317e-08 7.81564e-08 6.51114e-07 3.88257e-06 4.50835e-06 4.48549e-06 4.48572e-06 3.71834e-06 2.81711e-06 3.9931e-07 1.73706e-08 2.73351e-13 1.18135e-17 3.10152e-19 1.61721e-17 3.36894e-21 6.28787e-19 3.17739e-17 1.01289e-16 9.52992e-15 3.40372e-12 9.10789e-10 2.17484e-07 2.5909e-06 3.21096e-06 3.56794e-06 3.99934e-06 4.2768e-06 4.41245e-06 4.33342e-06 3.98045e-06 4.27995e-06 4.38326e-06 4.80005e-06 2.63149e-07 1.40462e-10 1.90269e-13 1.35653e-14 8.74245e-15 7.16347e-15 5.00953e-19 4.52786e-24 1.03604e-28 8.82043e-31 6.00639e-32 5.67767e-39 2.2362e-38 5.26327e-40 1.86917e-43 1.31929e-46 1.90098e-49 9.84581e-53 1.70541e-56 3.13682e-60 5.41943e-64 8.59563e-68 3.33892e-71 4.00332e-75 1.22691e-78 1.49313e-81 8.75936e-84 1.34673e-85 1.59665e-88 2.62212e-92 3.31371e-96 5.06954e-100 1.17973e-103 3.70041e-107 1.19759e-110 3.19194e-114 7.07373e-118 1.34835e-121 2.5624e-125 4.22196e-129 4.38766e-133 9.6757e-140 1.73555e-140 3.4149e-143 6.20676e-146 1.0988e-148 1.13813e-151 6.9917e-155 3.28302e-158 1.61459e-161 8.70153e-165 5.5237e-168 3.21459e-171 1.65766e-174 2.3699e-179 2.4688e-184 1.59612e-189 8.66027e-195 3.63544e-200 1.4363e-205 5.52237e-211 1.857e-216 7.34747e-222 2.78996e-227 1.18434e-232 5.28333e-238 2.77141e-243 1.33898e-248 3.50704e-254 5.34888e-260 7.24199e-266 4.41538e-287 8.90114e-290 4.64045e-295 2.12899e-300 1.0323e-305 4.32839e-311 1.68031e-316 5.58294e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9.48489e-07 2.52719e-06 3.08668e-06 3.49015e-06 4.55041e-06 6.14436e-06 5.86033e-06 4.09656e-06 3.10492e-06 2.33754e-06 9.31778e-07 1.18921e-07 2.20065e-08 7.15183e-10 8.64053e-08 2.14289e-06 3.22702e-06 3.74912e-07 2.6086e-07 2.4232e-07 2.38955e-07 1.66716e-07 9.63823e-08 6.67825e-08 3.13605e-08 1.10684e-08 4.13982e-09 2.63459e-09 2.45765e-09 2.84547e-09 3.83417e-09 1.75857e-08 1.73758e-07 5.90518e-07 1.33691e-06 2.62571e-06 3.87859e-06 4.06198e-06 3.20805e-06 3.67155e-07 8.5669e-09 1.79646e-13 7.00427e-17 2.1948e-15 1.19646e-18 2.37939e-16 1.60518e-15 6.81502e-15 1.5405e-12 3.16626e-10 2.73952e-08 4.4556e-07 1.81046e-06 3.14698e-06 4.19604e-06 4.5334e-06 4.46292e-06 4.24823e-06 3.93003e-06 3.03067e-06 2.12772e-06 1.47401e-06 2.50288e-06 2.91364e-06 1.12999e-08 1.47936e-10 1.1084e-12 2.6778e-14 2.09691e-14 1.43387e-14 7.44672e-19 3.76864e-24 1.1286e-28 2.82163e-29 3.52343e-34 2.58423e-34 3.2269e-37 1.11607e-39 5.78253e-42 1.48762e-45 1.29561e-49 1.53454e-53 2.83146e-57 2.70756e-60 1.05493e-62 3.16031e-66 6.70813e-71 2.95545e-75 4.60878e-79 3.27834e-82 1.3249e-84 8.44543e-87 5.91758e-89 4.82038e-92 1.24239e-95 3.1298e-99 1.07014e-102 4.50128e-106 1.59856e-109 4.02259e-113 8.14492e-117 1.02926e-120 9.25459e-125 6.09845e-129 8.27775e-136 7.10022e-138 3.95096e-141 2.58978e-144 3.63264e-147 2.0132e-149 1.74743e-151 3.55855e-154 3.05208e-157 2.32705e-160 1.81861e-163 1.29604e-166 9.59258e-170 5.77882e-173 5.66923e-178 3.58935e-183 1.86874e-188 7.31138e-194 2.61071e-199 8.4565e-205 2.7877e-210 8.59723e-216 2.82947e-221 8.94529e-227 3.33605e-232 1.28417e-237 6.17382e-243 1.81146e-248 3.003e-254 3.37947e-260 1.84844e-280 3.00518e-283 1.2939e-288 5.54243e-294 2.21806e-299 9.46425e-305 3.55419e-310 1.20153e-315 3.45352e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.47837e-06 1.02051e-05 1.05057e-05 9.7448e-06 7.12879e-06 5.10814e-06 4.1659e-06 4.05167e-06 4.23241e-06 4.04926e-06 3.09871e-06 1.39043e-06 1.58818e-07 4.6355e-09 2.41352e-07 3.16662e-06 3.36775e-06 3.33198e-07 1.8739e-07 3.21571e-07 7.89538e-07 4.14406e-07 1.56044e-07 3.81591e-08 1.34259e-08 4.64841e-09 1.6688e-09 5.92974e-10 4.56418e-10 4.37777e-10 4.08697e-10 1.54012e-09 8.43778e-09 4.61894e-08 1.74941e-07 5.0577e-07 1.59521e-06 3.42743e-06 4.12512e-06 3.65128e-06 3.26736e-07 3.93697e-09 2.41981e-13 1.72114e-13 7.31418e-16 6.60753e-14 7.16118e-14 3.58498e-13 8.82014e-11 3.25344e-08 2.66115e-07 4.69355e-07 1.01028e-06 3.93308e-06 2.92951e-06 4.9163e-07 1.78858e-07 2.21539e-07 6.06059e-07 1.61292e-06 1.32319e-06 3.93614e-07 5.54467e-07 3.96831e-07 1.54678e-07 1.56847e-08 5.87004e-11 3.09201e-12 1.2814e-13 2.80061e-14 1.49575e-14 1.66952e-19 1.39474e-24 1.33836e-26 1.15513e-29 8.04211e-31 1.34201e-33 1.37077e-35 4.0086e-38 1.22987e-41 1.9302e-45 6.02317e-49 1.29395e-52 3.42437e-56 5.10747e-59 6.58064e-62 8.91122e-67 2.20146e-71 9.65939e-76 1.78826e-79 1.02125e-82 2.58268e-85 1.09825e-87 3.56538e-90 1.02385e-92 1.07251e-95 6.33658e-99 3.93045e-102 2.36687e-105 1.11634e-108 3.40321e-112 5.38103e-116 4.87438e-120 1.35339e-124 1.06685e-132 1.42163e-134 9.36488e-138 1.82712e-141 5.14575e-145 4.39013e-148 1.83091e-150 1.75031e-152 1.97343e-154 6.24118e-157 9.30276e-160 1.01767e-162 9.93507e-166 7.98285e-169 6.44056e-172 4.1823e-177 2.28961e-182 8.88168e-188 3.11497e-193 9.23827e-199 2.81625e-204 7.72077e-210 2.27633e-215 6.32556e-221 1.98038e-226 6.26118e-232 2.35108e-237 7.24629e-243 1.37308e-248 1.62287e-254 6.39936e-274 7.88166e-277 2.38667e-282 7.84166e-288 2.87106e-293 1.06602e-298 4.15477e-304 1.47349e-309 4.71703e-315 1.32904e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.04344e-05 7.65588e-06 6.10103e-06 4.63717e-06 3.77674e-06 2.65e-06 2.05578e-06 2.79719e-06 3.48297e-06 4.21812e-06 3.62707e-06 2.33744e-06 6.17153e-07 1.11109e-08 1.24325e-06 2.45418e-06 4.2155e-06 1.33823e-06 3.55893e-07 1.34455e-06 3.74899e-06 3.87683e-06 1.48162e-06 2.42141e-07 3.71493e-08 1.10308e-08 2.97272e-09 7.75391e-10 2.96863e-10 1.76741e-10 1.23023e-10 2.43402e-10 8.3483e-10 3.89463e-09 1.91698e-08 7.64188e-08 2.92317e-07 9.66957e-07 3.0339e-06 4.21916e-06 3.51845e-06 1.83235e-07 1.40792e-09 2.52692e-11 4.21668e-13 1.11444e-11 2.28283e-12 1.10334e-11 1.73695e-09 2.45845e-07 2.67752e-07 4.49459e-07 1.35435e-06 4.34328e-06 3.96085e-07 2.59539e-08 7.80303e-09 7.0835e-09 1.51225e-08 1.05635e-07 2.30686e-07 2.281e-07 7.7529e-08 7.68953e-08 6.05133e-08 1.5326e-08 3.28941e-10 1.72999e-11 3.93633e-12 1.64878e-13 2.5506e-14 8.38118e-15 2.94252e-20 1.50407e-23 1.93147e-25 2.2431e-27 1.63816e-29 8.59488e-32 2.35721e-34 1.57144e-37 5.50325e-41 2.41274e-44 7.92137e-48 2.45631e-51 9.23401e-55 1.00355e-58 2.12557e-63 7.73044e-68 3.49985e-72 2.49697e-76 5.84327e-80 3.70754e-83 5.35143e-86 1.30087e-88 2.78285e-91 4.5214e-94 7.11245e-97 1.62168e-99 3.26612e-102 3.86089e-105 2.57453e-108 8.51989e-112 8.28246e-116 1.79911e-120 2.05007e-129 3.99072e-131 3.30102e-134 6.13602e-138 4.46562e-142 9.94025e-146 1.15765e-148 6.7729e-151 5.86691e-153 3.1973e-155 1.0501e-157 2.1723e-160 4.80866e-163 7.2462e-166 8.25789e-169 9.04905e-172 5.39011e-177 2.40934e-182 7.87809e-188 2.50328e-193 6.8244e-199 1.89025e-204 4.85578e-210 1.26565e-215 3.37715e-221 9.3919e-227 2.92679e-232 8.90332e-238 2.0248e-243 2.57829e-249 3.81332e-268 1.94212e-271 5.55821e-277 1.73734e-282 5.83122e-288 2.06652e-293 7.55706e-299 2.93061e-304 1.07426e-309 3.44802e-315 9.7825e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.0201e-06 2.66508e-06 2.11464e-06 1.69703e-06 1.38184e-06 6.9543e-07 2.8754e-07 2.57359e-07 5.83206e-07 3.5968e-06 3.20559e-06 1.5049e-06 4.92723e-07 3.22497e-08 6.89589e-08 3.98719e-07 1.45271e-06 3.02039e-06 3.99231e-06 3.54808e-06 1.81882e-06 3.75635e-06 4.23383e-06 4.12127e-06 4.54162e-06 3.21843e-06 9.15002e-07 9.98832e-08 1.98141e-08 3.15493e-09 6.11604e-10 1.48388e-10 5.43521e-11 6.57149e-11 1.3308e-10 4.3223e-10 2.2749e-09 9.27505e-09 4.71663e-08 1.69462e-07 5.68669e-07 2.82155e-06 4.1847e-06 1.25158e-06 3.22908e-08 2.1854e-09 9.85864e-10 4.17256e-10 2.37534e-10 1.19618e-09 2.78266e-10 4.63773e-10 2.91431e-08 5.25077e-07 2.70301e-07 7.03455e-07 2.44831e-06 3.08384e-06 5.0332e-08 3.36048e-09 1.06994e-09 4.88907e-10 4.86508e-10 1.84231e-09 2.87921e-08 5.37904e-08 4.78151e-08 1.85443e-08 1.38238e-08 8.0182e-09 2.61183e-09 7.09805e-11 3.58822e-12 1.47441e-12 6.74171e-14 9.43362e-15 1.0373e-15 3.50979e-20 1.23918e-22 3.78879e-23 1.64229e-22 8.03844e-24 1.32874e-25 2.35069e-28 4.1246e-31 6.33413e-34 7.84753e-37 7.37898e-40 2.70049e-43 2.21054e-47 7.25698e-52 3.27903e-56 1.76189e-60 9.40041e-65 5.60463e-69 4.61052e-73 7.53114e-77 1.92305e-80 8.89142e-84 9.13613e-87 1.51346e-89 1.92463e-92 2.43606e-95 2.91016e-98 4.7747e-101 1.72048e-103 8.47192e-106 1.97174e-108 8.61267e-112 6.38865e-117 1.32717e-120 7.72424e-124 1.17503e-126 3.91585e-129 1.62418e-131 2.98751e-135 2.29781e-139 3.39236e-143 1.78779e-146 8.06326e-149 4.38028e-151 1.88084e-153 5.23528e-156 1.03982e-158 1.77737e-161 2.52887e-164 3.27483e-167 4.36131e-170 4.12476e-173 1.43599e-178 4.05751e-184 1.75295e-189 4.61914e-195 1.35987e-200 3.17566e-206 8.44e-212 1.92425e-217 5.86554e-223 1.59748e-228 6.11982e-234 1.74892e-239 5.48485e-245 3.76008e-251 2.16394e-257 1.09559e-263 2.22839e-269 7.02065e-275 4.39804e-280 2.35024e-285 1.75097e-290 1.16368e-295 7.77687e-301 4.00684e-306 1.73302e-311 5.89248e-317 1.77864e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8.26522e-07 4.40391e-07 3.75908e-07 4.30245e-07 2.98841e-07 1.73599e-07 2.75749e-08 1.04418e-08 7.03698e-09 5.99647e-08 3.93872e-06 1.92584e-06 4.02257e-07 6.13107e-08 7.31965e-08 5.00816e-07 2.50211e-06 3.4154e-06 4.08183e-06 3.53121e-06 3.90076e-06 3.84951e-06 3.45174e-06 3.71569e-06 4.22595e-06 4.54662e-06 4.0877e-06 1.67182e-06 2.18886e-07 1.15943e-08 1.46404e-09 1.98122e-10 6.67206e-11 3.90775e-11 4.02068e-11 8.84874e-11 2.56073e-10 1.03196e-09 5.92271e-09 2.87056e-08 6.72735e-08 2.68737e-07 7.84958e-07 3.95197e-06 4.88557e-07 7.59405e-08 2.54551e-08 2.00866e-08 2.2462e-08 6.13541e-08 8.54859e-08 9.83754e-08 1.54748e-07 1.65606e-06 6.25229e-07 9.93909e-07 4.09045e-06 1.51846e-07 5.31298e-09 8.65329e-10 1.7681e-10 1.37411e-10 6.69326e-11 9.41896e-11 7.75728e-10 9.18726e-09 1.68428e-08 9.8153e-09 2.59753e-09 2.14386e-09 1.52973e-09 3.93134e-10 2.81971e-11 2.26799e-12 3.53616e-13 3.12315e-15 2.17011e-16 3.00258e-16 3.08042e-17 3.56727e-18 2.92463e-19 1.15158e-20 4.05388e-22 2.39102e-24 6.56879e-27 7.32942e-30 2.00172e-33 1.30198e-37 1.2071e-41 1.04006e-45 7.76875e-50 6.21133e-54 5.39617e-58 4.92097e-62 4.85148e-66 5.4355e-70 8.53291e-74 1.49971e-77 4.37146e-81 1.9814e-84 1.3713e-87 1.29489e-90 1.29546e-93 1.18354e-96 1.04943e-99 1.0425e-102 1.28829e-105 2.71152e-108 1.23496e-110 3.47963e-113 1.01984e-116 5.40235e-120 4.69202e-123 5.56809e-126 1.24327e-129 1.67697e-133 2.93934e-137 6.43499e-141 3.25363e-144 4.01913e-147 8.10409e-150 1.92967e-152 3.31673e-155 5.75478e-158 7.50233e-161 1.14678e-163 1.36149e-166 1.5726e-169 1.55969e-172 7.13457e-176 5.26225e-182 5.49491e-188 7.23502e-194 1.88649e-199 5.40643e-205 2.58554e-210 7.67195e-216 2.93555e-221 8.48834e-227 3.02483e-232 8.17177e-238 4.12385e-243 4.35884e-249 8.69841e-255 8.23162e-261 1.88764e-266 6.13892e-272 2.90774e-277 1.46476e-282 1.07079e-287 7.95537e-293 6.35878e-298 3.367e-303 1.57217e-308 5.50784e-314 1.75853e-319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.42952e-08 3.21626e-08 3.54042e-08 3.6738e-08 4.23291e-08 1.70108e-08 2.84113e-09 4.13285e-10 2.42253e-10 4.31995e-10 1.4713e-08 1.31122e-06 2.69249e-06 1.6436e-06 2.28955e-06 3.73059e-06 3.04656e-06 4.1712e-06 4.08919e-06 4.12933e-06 3.97568e-06 3.77194e-06 4.09949e-06 3.79656e-06 3.48013e-06 3.97638e-06 4.07448e-06 3.14723e-06 6.51448e-07 2.76356e-08 1.21359e-09 1.81307e-10 5.04462e-11 2.81798e-11 1.66279e-11 2.1008e-11 4.28213e-11 1.16002e-10 6.35131e-10 3.49611e-09 1.16513e-08 6.08446e-08 3.2618e-07 2.5852e-06 2.18524e-06 1.41666e-07 1.65241e-07 8.94817e-08 7.89344e-08 1.28715e-07 3.98885e-07 5.89119e-07 3.2407e-07 2.52133e-07 2.76078e-07 1.75876e-06 4.28661e-07 4.50188e-09 4.75278e-10 1.23424e-10 7.55112e-11 5.0183e-11 4.52321e-11 2.03479e-11 4.5429e-11 4.99069e-10 2.60143e-09 3.6884e-09 1.52883e-09 3.19507e-10 2.96174e-10 2.34222e-10 7.13286e-11 4.78355e-12 1.33591e-12 1.66216e-14 1.2243e-16 7.12026e-17 9.32265e-17 2.12715e-16 4.42298e-17 1.22584e-18 2.24372e-20 4.73621e-23 2.44713e-26 1.45633e-29 4.33316e-33 1.40233e-36 3.36538e-40 7.19529e-44 9.61135e-48 8.50868e-52 8.35285e-56 9.39073e-60 1.2658e-63 2.11675e-67 3.56832e-71 6.90157e-75 1.68197e-78 4.71651e-82 1.97597e-85 9.40817e-89 6.06106e-92 3.74601e-95 2.67257e-98 1.95793e-101 1.48182e-104 1.3443e-107 1.15298e-110 1.66429e-113 2.0332e-116 1.28737e-119 5.29935e-123 1.611e-126 4.00732e-130 1.02318e-133 2.71771e-137 9.90756e-141 5.45857e-144 3.97679e-147 5.9547e-150 8.81402e-153 1.22672e-155 1.85602e-158 2.28644e-161 2.63229e-164 3.04545e-167 3.63184e-170 3.6422e-173 2.76775e-176 6.33102e-182 1.10383e-187 1.60631e-193 2.8668e-199 4.44623e-205 9.22333e-211 2.45471e-216 7.89831e-222 2.54156e-227 8.61045e-233 2.63796e-238 1.01358e-243 1.93939e-249 4.17059e-255 7.12699e-261 1.62042e-266 5.07204e-272 2.16415e-277 9.68541e-283 5.56618e-288 3.56561e-293 2.47858e-298 1.38117e-303 6.44639e-309 2.40662e-314 7.88677e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7.68985e-10 1.47205e-09 2.07028e-09 1.92242e-09 1.35732e-09 5.31679e-10 1.10397e-10 4.17392e-11 1.68829e-11 2.83868e-11 9.48791e-11 3.95968e-10 7.3812e-09 1.61507e-08 5.53704e-09 1.24937e-08 1.81963e-06 4.08413e-06 3.96675e-06 3.94094e-06 4.02471e-06 3.13008e-06 1.27915e-07 2.70683e-08 2.99147e-08 2.66853e-07 6.30027e-07 6.35353e-07 7.81887e-08 5.84383e-09 4.38708e-10 7.23941e-11 2.7428e-11 1.55933e-11 1.34249e-11 1.23657e-11 1.32273e-11 1.62946e-11 4.48171e-11 2.23639e-10 1.11488e-09 5.60421e-09 3.26682e-08 1.23814e-07 1.4383e-06 4.03525e-06 1.9035e-06 1.09312e-06 6.75281e-07 4.70144e-07 4.27411e-07 4.30094e-07 6.87817e-07 9.76915e-07 3.73018e-06 2.04386e-07 5.44454e-09 4.71012e-10 7.33565e-11 2.70884e-11 2.42806e-11 2.29167e-11 3.00143e-11 2.04666e-11 1.12202e-11 2.22981e-11 1.93489e-10 5.17118e-10 5.07549e-10 8.51845e-11 3.36084e-11 2.80985e-11 2.33373e-11 1.21155e-11 2.43801e-12 6.52561e-13 2.88521e-14 3.66919e-15 1.06466e-15 4.45183e-16 8.73647e-17 2.02273e-18 6.26157e-20 2.40932e-22 2.78154e-25 2.39008e-28 1.9574e-31 1.03389e-34 4.58282e-38 1.2454e-41 2.1329e-45 2.36301e-49 2.12224e-53 2.15039e-57 2.82558e-61 4.24214e-65 9.02269e-69 2.04996e-72 4.96507e-76 1.27273e-79 3.55856e-83 1.05333e-86 4.66883e-90 2.02174e-93 8.91548e-97 5.16291e-100 2.50963e-103 1.64908e-106 8.8323e-110 5.21637e-113 2.53597e-116 1.23362e-119 3.20362e-123 7.67565e-127 1.34378e-130 2.34952e-134 7.39728e-138 2.77957e-141 1.68452e-144 1.26825e-147 1.22506e-150 1.3999e-153 1.54378e-156 1.69531e-159 1.9296e-162 2.3254e-165 2.37126e-168 2.42728e-171 2.24018e-174 7.88947e-178 7.92022e-184 9.57317e-190 1.27113e-195 3.38934e-201 1.09846e-206 3.86787e-212 1.25876e-217 4.11772e-223 1.25876e-228 3.79685e-234 1.07651e-239 3.09657e-245 7.57066e-251 1.78266e-256 3.84918e-262 9.87789e-268 2.98382e-273 1.1537e-278 4.85058e-284 2.59198e-289 1.53231e-294 9.78444e-300 5.00309e-305 2.15779e-310 7.54331e-316 2.33199e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.05371e-11 3.00822e-11 5.59231e-11 5.45027e-11 2.66427e-11 1.27748e-11 1.17636e-11 9.45301e-12 4.88639e-12 4.74975e-12 8.48016e-12 1.1786e-11 2.90359e-11 4.77016e-11 1.63904e-10 6.70944e-09 3.34256e-06 3.80901e-06 3.81938e-06 4.12256e-06 7.83094e-07 7.33788e-09 8.94034e-10 6.63659e-10 1.41615e-09 7.13946e-09 9.98815e-09 1.02214e-08 2.57063e-09 4.41031e-10 4.9273e-11 2.33858e-11 1.35493e-11 1.05457e-11 9.16025e-12 8.24656e-12 8.81569e-12 7.45783e-12 1.08275e-11 1.5395e-11 4.9072e-11 2.72075e-10 1.49924e-09 6.05689e-09 2.69596e-08 2.13233e-07 3.78019e-06 4.16306e-06 3.24479e-06 2.09141e-06 1.41125e-06 1.26994e-06 2.1968e-06 4.26605e-06 2.42934e-06 5.60811e-08 2.07877e-09 1.94453e-10 2.96215e-11 9.95046e-12 8.62725e-12 8.90487e-12 1.41916e-11 1.82721e-11 1.24983e-11 9.42449e-12 1.42537e-11 4.41374e-11 7.38772e-11 4.02768e-11 5.70693e-12 4.17275e-12 3.9642e-12 3.42287e-12 3.54574e-12 1.4005e-12 7.40551e-13 6.265e-13 3.20615e-13 1.81319e-13 2.87289e-14 5.05196e-16 1.63721e-17 3.20924e-20 6.36638e-23 5.97745e-26 5.02995e-29 3.07955e-32 1.31781e-35 4.24386e-39 8.56481e-43 1.06064e-46 9.83145e-51 8.74215e-55 1.08342e-58 1.75875e-62 3.56231e-66 8.1088e-70 1.961e-73 5.01823e-77 1.33463e-80 3.73576e-84 1.07217e-87 3.14075e-91 1.0018e-94 3.85289e-98 1.56652e-101 5.96479e-105 2.40809e-108 7.16653e-112 3.60854e-115 1.34525e-118 3.84208e-122 1.0242e-125 2.12579e-129 5.22264e-133 1.13985e-136 2.34721e-140 6.58489e-144 1.91493e-147 6.03247e-151 1.97441e-154 7.80556e-158 3.7036e-161 2.43173e-164 1.93154e-167 1.52394e-170 1.3503e-173 1.0575e-176 4.20761e-182 1.74901e-187 5.44379e-193 1.49528e-198 3.77222e-204 8.84012e-210 1.89631e-215 4.13589e-221 8.37373e-227 1.91249e-232 4.65494e-238 1.24729e-243 3.62893e-249 1.03261e-254 2.76538e-260 8.73819e-266 2.6317e-271 9.53671e-277 3.5666e-282 1.53099e-287 7.05838e-293 3.78519e-298 1.90566e-303 8.13274e-309 2.85919e-314 8.89713e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.42163e-12 3.49673e-12 3.72697e-12 4.02692e-12 4.18594e-12 4.20735e-12 4.1874e-12 4.08947e-12 4.00737e-12 4.0338e-12 4.15054e-12 4.59185e-12 5.04636e-12 5.5933e-12 1.49816e-11 3.89631e-10 8.15877e-08 3.80958e-06 3.52066e-06 2.1381e-07 3.05136e-09 1.49053e-10 3.87367e-11 3.98998e-11 6.20963e-11 2.02665e-10 2.96984e-10 3.68306e-10 1.79577e-10 6.50901e-11 3.51182e-11 1.2432e-11 1.00761e-11 7.76623e-12 5.64332e-12 5.41271e-12 5.30797e-12 5.12559e-12 5.09012e-12 5.23969e-12 8.4665e-12 1.30813e-11 4.43658e-11 1.34485e-10 4.22384e-10 1.54877e-09 1.31574e-08 6.54122e-08 2.59559e-07 1.48473e-06 3.60758e-06 4.16652e-06 3.22008e-06 1.10113e-06 5.72061e-08 4.14851e-09 2.75732e-10 3.41442e-11 9.88241e-12 7.03008e-12 5.71166e-12 7.98824e-12 1.01831e-11 1.22023e-11 1.28001e-11 7.23295e-12 7.11163e-12 9.98766e-12 1.25681e-11 1.83604e-11 1.50973e-11 8.21465e-12 2.90383e-12 2.84862e-12 2.98912e-12 2.66595e-12 2.75091e-12 2.80904e-12 2.74201e-12 5.73991e-13 4.31691e-13 3.50636e-13 1.64549e-14 2.82551e-17 3.81983e-20 3.64055e-23 2.5221e-26 1.54038e-29 6.7691e-33 2.19854e-36 4.78151e-40 5.89517e-44 7.11218e-48 6.74385e-52 7.45723e-56 1.15613e-59 2.26218e-63 5.09403e-67 1.24793e-70 3.15471e-74 8.21361e-78 2.15424e-81 5.79291e-85 1.60053e-88 4.38012e-92 1.2177e-95 3.66042e-99 1.00053e-102 3.16888e-106 8.50679e-110 2.72258e-113 7.50847e-117 2.41044e-120 6.31716e-124 1.91107e-127 5.11688e-131 1.47475e-134 4.17558e-138 1.20938e-141 3.49722e-145 1.01634e-148 3.04977e-152 8.9336e-156 2.8244e-159 8.73328e-163 3.05339e-166 1.0166e-169 3.88557e-173 1.39031e-176 3.54592e-182 8.42543e-188 1.7985e-193 3.4108e-199 6.07279e-205 9.89467e-211 1.55306e-216 2.31561e-222 3.39863e-228 5.14185e-234 7.77697e-240 1.30796e-245 2.27127e-251 4.44764e-257 8.9377e-263 3.3858e-268 2.66328e-273 1.54192e-278 5.7779e-284 2.3031e-289 7.98217e-295 2.7335e-300 7.55463e-306 1.88159e-311 4.09783e-317 8.39912e-323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.95962e-12 3.93126e-12 4.04179e-12 4.0774e-12 4.09728e-12 4.12205e-12 4.14715e-12 4.19523e-12 4.27956e-12 4.27262e-12 4.62527e-12 5.00647e-12 5.24223e-12 5.23814e-12 5.02216e-12 7.93929e-12 6.60587e-11 1.43549e-09 4.51915e-09 8.598e-10 9.98189e-11 1.63743e-11 7.78974e-12 5.19053e-12 5.54106e-12 9.63707e-12 1.14709e-11 1.73208e-11 1.72087e-11 1.67313e-11 1.32346e-11 1.1603e-11 3.41046e-12 5.25433e-12 4.93881e-12 4.81681e-12 4.6814e-12 4.73118e-12 4.63758e-12 4.61931e-12 4.61348e-12 4.62965e-12 4.65889e-12 8.5632e-12 1.30037e-11 2.35991e-11 8.12254e-11 2.31243e-10 5.75388e-10 1.24862e-09 2.2593e-09 3.86664e-09 3.0862e-09 1.86067e-09 4.70553e-10 1.14715e-10 3.04456e-11 1.15665e-11 7.58664e-12 6.65719e-12 6.18801e-12 7.32194e-12 8.90237e-12 8.33078e-12 8.40772e-12 7.53514e-12 7.59568e-12 6.64424e-12 1.10471e-11 1.23472e-11 1.31466e-11 1.86041e-11 1.66824e-11 9.68325e-12 3.60542e-12 3.70701e-12 3.80482e-12 3.89343e-12 3.78656e-12 3.70343e-12 2.50782e-12 8.35168e-13 3.94082e-13 1.32089e-15 1.06099e-18 8.95591e-22 6.12678e-25 3.31352e-28 1.43078e-31 4.22177e-35 7.29605e-39 1.0188e-42 1.02198e-46 1.05317e-50 1.10418e-54 1.51381e-58 2.79022e-62 6.0265e-66 1.42706e-69 3.54858e-73 9.193e-77 2.45416e-80 6.66849e-84 1.83473e-87 5.1978e-91 1.51472e-94 4.38579e-98 1.28106e-101 4.15977e-105 1.1118e-108 4.14755e-112 1.23929e-115 4.22782e-119 1.3895e-122 5.37569e-126 1.92324e-129 7.19307e-133 2.75334e-136 1.01852e-139 3.90492e-143 1.43946e-146 5.47941e-150 2.05387e-153 7.72875e-157 2.9598e-160 1.10448e-163 4.21595e-167 1.6449e-170 6.1138e-174 2.38072e-177 5.17613e-183 9.90527e-189 1.69545e-194 2.69782e-200 3.96703e-206 5.52122e-212 7.51338e-218 9.80744e-224 1.37838e-229 1.89153e-235 3.06118e-241 5.02049e-247 9.70762e-253 1.84989e-258 4.04887e-264 8.62809e-270 2.06546e-275 5.03338e-281 1.26694e-286 2.78312e-292 5.62586e-298 1.02352e-303 1.79515e-309 2.98521e-315 4.95054e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.17243e-12 4.20713e-12 4.24933e-12 4.27106e-12 4.29111e-12 4.31676e-12 4.34487e-12 4.38577e-12 4.19047e-12 4.69091e-12 4.73951e-12 5.25749e-12 5.34294e-12 5.51745e-12 5.03581e-12 4.59673e-12 5.41983e-12 9.35011e-12 1.06384e-11 8.26829e-12 5.3728e-12 4.84445e-12 4.74617e-12 4.70449e-12 4.71194e-12 4.42317e-12 4.55043e-12 5.701e-12 5.86011e-12 6.40633e-12 6.60996e-12 6.09333e-12 5.38031e-12 4.30809e-12 4.56421e-12 4.58614e-12 4.58229e-12 4.54407e-12 4.57821e-12 4.50909e-12 4.50324e-12 4.44047e-12 4.18628e-12 4.02837e-12 5.09451e-12 5.92143e-12 7.24766e-12 8.4761e-12 1.01081e-11 1.37593e-11 1.99701e-11 1.7079e-11 2.02219e-11 1.7781e-11 1.41219e-11 1.38148e-11 1.23701e-11 9.70218e-12 7.43147e-12 7.02873e-12 6.55466e-12 6.5018e-12 7.54973e-12 6.90344e-12 8.58522e-12 8.75196e-12 9.74851e-12 1.33083e-11 1.27175e-11 1.37912e-11 1.861e-11 1.97188e-11 7.94162e-12 3.86424e-12 3.92556e-12 3.99521e-12 4.03877e-12 4.14625e-12 3.09232e-12 7.61888e-13 4.51584e-13 1.41247e-13 3.06981e-15 1.25068e-17 7.44838e-21 2.84311e-24 8.96089e-28 2.94189e-31 1.00306e-34 3.39866e-38 9.92958e-42 2.35766e-45 7.31857e-49 1.97587e-52 5.20733e-56 1.49827e-59 4.40161e-63 1.37542e-66 4.37091e-70 1.47083e-73 5.11621e-77 1.85864e-80 6.95518e-84 2.69288e-87 1.07048e-90 4.30766e-94 1.72855e-97 7.26219e-101 2.94144e-104 1.13599e-107 4.81562e-111 1.89988e-114 7.13325e-118 2.80249e-121 1.1462e-124 4.1037e-128 1.60777e-131 5.92324e-135 2.24674e-138 8.52103e-142 3.15177e-145 1.19849e-148 4.37744e-152 1.67128e-155 6.07782e-159 2.27438e-162 8.66832e-166 3.18931e-169 1.20174e-172 4.6672e-176 9.65927e-182 1.89369e-187 3.50714e-193 6.4027e-199 1.08714e-204 1.77863e-210 2.68991e-216 3.91581e-222 5.38656e-228 6.95864e-234 8.91915e-240 1.0662e-245 1.30318e-251 1.50999e-257 1.87312e-263 2.27502e-269 3.00185e-275 4.01052e-281 5.71704e-287 8.1506e-293 1.20599e-298 1.75988e-304 2.62532e-310 3.85941e-316 5.78057e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.50326e-06 4.37449e-06 4.35224e-06 3.94515e-06 3.50757e-06 2.99831e-06 4.27097e-07 2.24008e-08 2.10107e-09 5.90827e-10 3.78019e-11 9.22052e-13 1.4627e-14 2.15513e-16 1.73649e-11 4.03229e-10 1.35578e-09 3.46963e-09 2.62426e-08 9.90937e-08 2.31946e-07 2.87332e-07 2.77122e-07 2.52857e-07 2.35189e-07 2.27277e-07 1.68925e-07 1.46825e-07 6.80073e-08 3.80135e-08 2.17579e-08 1.28156e-08 3.39883e-09 2.09782e-10 1.00065e-11 1.73931e-12 7.00442e-13 2.13008e-13 9.43232e-15 1.32626e-17 3.68028e-20 6.34401e-23 9.81057e-26 1.10629e-26 5.11837e-29 3.93608e-27 2.41558e-25 1.67632e-23 3.12968e-22 3.27674e-21 1.14638e-19 3.37698e-17 2.02365e-14 8.22209e-12 1.54926e-10 4.00214e-10 5.74627e-10 5.19992e-10 3.36271e-10 9.06556e-11 7.95445e-12 6.40078e-13 8.59807e-15 1.05502e-16 1.00921e-18 2.59337e-21 4.51966e-24 2.21458e-26 4.4583e-29 5.41063e-32 6.55624e-35 8.69682e-38 1.4047e-40 2.35827e-43 5.62436e-54 1.23317e-54 2.75717e-56 1.17547e-58 1.40755e-61 6.72747e-65 3.35015e-68 1.3428e-71 8.93155e-75 7.79562e-78 9.21154e-81 9.8283e-84 6.59872e-87 2.96756e-90 1.44722e-93 7.82818e-97 4.48144e-100 2.63381e-103 1.53057e-106 8.57253e-110 4.57315e-113 2.63435e-116 1.22426e-119 8.53414e-123 4.19941e-126 2.64338e-129 1.29662e-132 6.90725e-136 3.69643e-139 1.97352e-142 3.42029e-154 3.37641e-155 7.75369e-158 1.2976e-160 1.69102e-163 1.72516e-166 1.39606e-169 7.29107e-173 1.81359e-178 1.25015e-183 4.21368e-188 1.47999e-192 7.85039e-197 2.96765e-201 4.5011e-206 4.45905e-211 3.34812e-216 2.31623e-221 1.50363e-226 9.88498e-232 6.26758e-237 4.10791e-242 2.8068e-247 2.16239e-252 1.39661e-257 6.55424e-263 2.31159e-268 6.57051e-274 1.71815e-279 5.0932e-285 1.12228e-308 3.95088e-311 3.99411e-316 2.68772e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.88136e-06 4.93636e-06 5.07686e-06 4.45582e-06 4.14042e-06 3.90728e-06 2.9133e-07 4.32864e-08 2.03717e-08 7.63598e-09 8.44517e-10 5.35639e-11 1.4488e-12 1.56755e-14 7.82907e-10 1.34746e-08 4.57049e-08 1.09655e-07 3.86548e-07 9.63039e-07 2.55905e-06 2.26638e-06 2.29661e-06 2.2652e-06 2.20958e-06 2.17352e-06 2.16952e-06 2.09114e-06 8.98532e-07 4.02838e-07 2.60635e-07 2.0136e-07 1.13627e-07 2.57572e-08 2.43511e-09 1.62983e-10 1.29323e-10 1.73993e-11 9.64593e-13 3.28198e-15 5.30884e-18 4.48232e-21 3.10965e-24 1.86243e-24 3.8464e-27 1.5583e-25 1.32758e-23 7.10972e-22 2.31998e-20 2.56947e-19 1.90255e-17 2.22742e-14 2.90011e-11 9.40906e-09 8.03474e-08 1.26897e-07 1.27672e-07 6.61976e-08 3.31734e-08 3.70604e-09 1.01066e-10 1.23549e-11 7.68696e-13 1.689e-13 7.61103e-16 1.52185e-19 1.17315e-22 1.31345e-24 2.38781e-27 9.43455e-30 2.17691e-32 2.41895e-35 2.36281e-38 5.73637e-41 2.06438e-50 2.56557e-51 3.13896e-53 9.49638e-56 1.56698e-58 9.66198e-62 9.02202e-65 3.39637e-68 2.46022e-71 1.11711e-74 7.61214e-78 5.37502e-81 1.44082e-84 1.44997e-88 1.43024e-92 4.74561e-97 1.49781e-100 1.84498e-103 1.50708e-106 5.8792e-110 3.10731e-113 1.93542e-116 1.49638e-119 1.03876e-122 2.75749e-125 2.17274e-128 8.58103e-131 7.98851e-134 6.512e-137 4.68018e-140 1.54925e-151 1.10883e-152 2.49137e-155 4.39934e-158 6.35531e-161 7.30637e-164 7.16168e-167 6.20857e-170 4.37455e-173 5.18448e-178 2.30219e-182 9.64182e-187 1.10815e-190 4.2243e-195 6.55235e-200 6.43784e-205 4.75485e-210 2.9842e-215 1.79698e-220 1.01143e-225 5.97513e-231 3.41131e-236 2.16512e-241 1.47565e-246 9.34052e-252 4.50634e-257 1.48765e-262 3.64722e-268 7.77424e-274 1.4473e-279 9.45397e-303 3.90841e-305 3.72044e-310 2.4542e-315 1.35819e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.85496e-06 3.06298e-06 1.57563e-06 1.27903e-06 1.1613e-06 4.22202e-07 6.72613e-08 3.25447e-08 2.27301e-08 1.3949e-08 4.4337e-09 5.23179e-10 3.52166e-11 3.26641e-13 5.67047e-09 2.23537e-07 5.78744e-07 7.83564e-07 1.45203e-06 2.93782e-06 3.32981e-06 3.9093e-06 4.06774e-06 3.68624e-06 3.39217e-06 3.16687e-06 2.84634e-06 2.70381e-06 2.04435e-06 1.71061e-06 1.74917e-06 1.70834e-06 9.62173e-07 2.87837e-07 1.17733e-07 6.73098e-08 3.25591e-08 6.21815e-09 2.14346e-10 2.88161e-15 2.28863e-18 6.17902e-21 9.51364e-24 3.13464e-22 2.15988e-25 7.30691e-24 1.57551e-21 6.42595e-20 7.94459e-19 3.11134e-17 3.4795e-14 2.8156e-11 2.31504e-08 1.861e-07 4.23093e-07 5.76797e-07 7.46097e-07 7.49199e-07 8.44081e-07 7.33531e-07 2.65312e-07 2.83625e-09 5.92964e-12 7.36896e-14 1.20299e-14 3.62598e-14 1.42176e-17 1.02613e-21 2.11817e-25 8.48356e-29 4.63714e-31 4.29374e-33 9.01975e-36 3.93604e-38 5.6423e-48 1.71132e-48 1.38687e-49 4.26875e-51 2.02448e-53 1.42212e-56 1.4372e-60 1.18239e-64 2.85123e-68 7.51918e-72 9.1508e-75 1.47831e-76 4.46924e-79 1.07051e-82 9.37835e-87 1.31104e-91 2.74241e-96 3.51498e-100 4.57122e-104 4.66066e-108 1.33312e-112 4.3276e-116 2.95775e-119 2.02129e-122 7.00282e-124 1.96028e-126 5.30212e-128 6.54774e-131 4.80808e-134 2.53322e-137 1.06874e-149 1.94593e-150 4.94224e-153 8.26795e-156 9.33985e-159 8.30674e-162 5.4568e-165 3.27149e-168 1.70231e-171 1.16758e-174 4.59766e-179 1.73022e-183 3.56773e-187 1.07949e-191 1.54335e-196 1.3716e-201 1.01406e-206 5.22896e-212 3.09928e-217 1.43133e-222 8.41972e-228 4.3855e-233 2.63193e-238 1.87497e-243 1.21463e-248 8.82592e-254 3.52268e-259 1.11006e-264 2.13243e-270 2.60127e-276 9.13289e-300 7.29208e-302 7.02013e-307 4.95278e-312 2.69056e-317 1.38338e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.96868e-06 8.85028e-07 2.44218e-07 7.97284e-08 1.07472e-07 7.94995e-08 1.19149e-08 1.08326e-08 8.83125e-09 1.50457e-08 9.92506e-09 4.14969e-09 4.37984e-10 2.03983e-12 1.9426e-08 8.71419e-07 4.20478e-06 4.54815e-06 4.75877e-06 4.77667e-06 4.72899e-06 3.85812e-06 3.70112e-06 4.26406e-06 4.55428e-06 4.40298e-06 4.15273e-06 3.5049e-06 2.71395e-06 3.24919e-06 4.0145e-06 4.19554e-06 2.07781e-06 1.68135e-06 2.21966e-06 2.44691e-06 1.65057e-06 2.52448e-07 2.07273e-08 7.48324e-12 3.17498e-17 3.56327e-20 1.63144e-21 6.56183e-20 1.92316e-23 1.31126e-21 2.88079e-19 2.4292e-18 4.82425e-17 2.85761e-14 3.07537e-11 2.81242e-08 3.89597e-07 1.16031e-06 3.2944e-06 3.5206e-06 3.82189e-06 4.00621e-06 3.74187e-06 3.00366e-06 2.98676e-06 9.17253e-07 1.79894e-07 3.3055e-11 9.53825e-14 6.44584e-15 1.18642e-14 1.00442e-15 8.62126e-20 2.23852e-24 7.79569e-29 5.17825e-31 5.04802e-33 5.05678e-35 4.2033e-44 1.83273e-43 4.19913e-44 2.80887e-46 2.25259e-50 2.12638e-54 3.39938e-58 1.07408e-61 1.94185e-65 2.01407e-69 7.66185e-73 1.91886e-75 1.87924e-78 4.66235e-81 1.20948e-82 2.10067e-85 2.89936e-89 2.6775e-93 2.66908e-97 1.58456e-101 2.5323e-106 4.8366e-110 1.8811e-113 6.06495e-117 2.50275e-120 7.59167e-124 6.82462e-126 3.76818e-129 2.29993e-132 6.39611e-136 2.71511e-144 9.46397e-145 2.76471e-147 3.99238e-150 3.75226e-153 2.37452e-156 1.15637e-159 5.11812e-163 2.33313e-166 1.04904e-169 6.07489e-173 1.56323e-177 5.11928e-181 9.88809e-186 1.1533e-190 8.87297e-196 5.49623e-201 2.60676e-206 1.23056e-211 5.35782e-217 2.39414e-222 1.08128e-227 5.00576e-233 2.61117e-238 1.45216e-243 9.69606e-249 4.36496e-254 1.1397e-259 1.70488e-265 2.28302e-271 1.76432e-293 6.665e-296 5.16802e-301 2.99908e-306 1.67728e-311 7.52614e-317 3.0138e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9.9158e-07 5.37792e-07 4.27313e-07 2.83367e-07 2.03083e-07 4.24669e-07 9.5854e-07 1.03737e-06 4.50639e-07 1.8597e-07 6.33842e-08 1.61544e-08 3.89403e-09 1.63891e-10 3.34272e-08 2.06717e-06 2.2683e-06 1.77676e-06 1.30849e-06 6.12793e-07 4.19222e-07 4.07548e-07 4.42083e-07 5.85382e-07 4.21253e-07 2.20105e-07 7.34764e-08 3.3552e-08 3.26523e-08 5.55462e-08 9.39041e-08 7.6536e-07 3.95228e-06 4.31122e-06 4.44396e-06 4.34767e-06 3.96063e-06 2.24133e-06 2.06999e-07 1.13025e-08 2.10323e-13 8.01075e-18 3.476e-19 1.42198e-17 2.48472e-21 5.43426e-19 2.96884e-17 1.0136e-16 9.92673e-15 3.72855e-12 8.7812e-10 2.27765e-07 2.99862e-06 3.12593e-06 3.61619e-06 3.95458e-06 4.3013e-06 4.39241e-06 4.25086e-06 4.28008e-06 4.38624e-06 4.6421e-06 4.48442e-06 1.68057e-07 2.00312e-10 3.14642e-13 5.69319e-15 1.40773e-14 1.02655e-14 7.88093e-19 4.6977e-24 1.17459e-28 8.68204e-31 4.41201e-32 2.34369e-39 3.21782e-38 4.15996e-40 9.32609e-44 8.99962e-47 1.17466e-49 5.76634e-53 9.6513e-57 1.79001e-60 2.42596e-64 4.49132e-68 1.50689e-71 1.84024e-75 5.37878e-79 6.81453e-82 4.05406e-84 7.02315e-86 8.34643e-89 1.48473e-92 2.32976e-96 4.17977e-100 1.23219e-103 4.26407e-107 1.49668e-110 4.03661e-114 8.67398e-118 1.8291e-121 3.16542e-125 5.70113e-129 5.65813e-133 1.47926e-139 2.74761e-140 5.4893e-143 9.82992e-146 1.74391e-148 1.75903e-151 1.07696e-154 5.47649e-158 2.77934e-161 1.58408e-164 8.84119e-168 5.71873e-171 2.65914e-174 4.51203e-179 4.199e-184 3.15757e-189 1.74432e-194 8.16199e-200 3.26324e-205 1.22027e-210 4.76851e-216 1.65781e-221 6.77174e-227 2.7775e-232 1.2944e-237 6.81499e-243 3.28196e-248 8.6346e-254 1.30835e-259 1.73351e-265 1.00326e-286 3.65729e-289 2.36226e-294 1.32246e-299 6.2365e-305 2.89266e-310 1.08434e-315 3.57704e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8.47106e-07 2.14739e-06 4.48311e-06 4.90204e-06 3.42016e-06 6.26193e-06 5.77439e-06 3.98644e-06 2.88758e-06 2.15938e-06 9.97538e-07 1.26792e-07 2.92251e-08 1.66163e-09 8.44787e-08 2.18733e-06 3.37461e-06 4.00115e-07 2.6541e-07 2.38086e-07 2.2029e-07 1.53552e-07 1.0812e-07 7.45222e-08 3.29748e-08 1.21127e-08 4.29933e-09 2.52268e-09 2.33133e-09 2.65731e-09 4.02046e-09 2.3319e-08 1.1512e-07 3.70779e-07 1.2107e-06 2.53574e-06 3.7793e-06 4.09045e-06 3.06736e-06 2.96558e-07 6.28517e-09 1.40214e-13 9.91863e-17 1.98029e-15 1.2136e-18 2.10086e-16 1.71402e-15 7.41044e-15 1.47824e-12 3.33924e-10 2.5644e-08 4.59454e-07 1.81718e-06 3.17532e-06 4.19698e-06 4.57512e-06 4.36716e-06 4.34346e-06 3.77693e-06 3.21512e-06 1.78577e-06 2.41984e-06 2.731e-06 2.9878e-06 1.98737e-08 1.61056e-10 6.85195e-13 4.27433e-14 2.64394e-14 1.81084e-14 6.5597e-19 3.7472e-24 1.30961e-28 2.02989e-29 1.96778e-34 4.71758e-34 2.25941e-37 7.00476e-40 4.24497e-42 1.11315e-45 9.64217e-50 7.09623e-54 2.14349e-57 8.09295e-61 5.58836e-63 1.35308e-66 3.20538e-71 1.33039e-75 2.06919e-79 1.57457e-82 6.26307e-85 4.07194e-87 2.89919e-89 2.52764e-92 7.53458e-96 2.49914e-99 1.11995e-102 5.26981e-106 1.9947e-109 5.15253e-113 9.91061e-117 1.27398e-120 1.23786e-124 7.88461e-129 1.26558e-135 1.31721e-137 6.10508e-141 3.86769e-144 5.7216e-147 3.25004e-149 2.83345e-151 6.1803e-154 5.57771e-157 4.30989e-160 3.10132e-163 2.24755e-166 1.49189e-169 9.94456e-173 9.23302e-178 6.48153e-183 3.41693e-188 1.50597e-193 5.31979e-199 1.88373e-204 6.02254e-210 2.0061e-215 6.16356e-221 2.18368e-226 7.74659e-232 3.32165e-237 1.45341e-242 4.76362e-248 6.88507e-254 8.49166e-260 4.50881e-280 1.4942e-282 7.88643e-288 3.45092e-293 1.54773e-298 6.32628e-304 2.43948e-309 7.45518e-315 2.11114e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.88737e-06 8.68423e-06 1.06207e-05 9.24225e-06 7.6605e-06 5.05071e-06 3.98607e-06 3.86266e-06 4.23809e-06 4.03993e-06 2.77998e-06 1.32706e-06 2.27681e-07 6.19092e-09 2.41327e-07 2.87245e-06 3.39183e-06 3.43232e-07 1.97531e-07 3.17322e-07 5.93471e-07 3.89467e-07 1.15476e-07 4.54775e-08 1.36492e-08 4.60987e-09 1.70335e-09 8.63625e-10 4.7575e-10 3.50306e-10 4.48679e-10 1.14621e-09 7.23199e-09 2.7692e-08 1.26033e-07 6.31592e-07 1.59205e-06 3.20411e-06 4.15666e-06 3.42659e-06 2.92677e-07 3.66861e-09 1.87942e-13 1.43189e-13 7.58148e-16 6.03692e-14 7.29681e-14 3.95191e-13 8.47324e-11 3.63912e-08 2.69938e-07 4.58981e-07 1.00065e-06 4.08217e-06 2.71494e-06 4.13048e-07 1.65966e-07 2.90187e-07 1.17861e-06 1.79131e-06 1.24628e-06 6.33349e-07 3.93727e-07 6.04223e-07 2.50675e-07 6.0874e-09 5.23919e-11 3.07838e-12 1.48477e-13 3.27282e-14 1.85561e-14 2.13305e-19 1.61232e-24 1.01785e-26 5.13502e-30 1.08752e-30 9.07246e-34 8.77875e-36 2.6508e-38 6.26361e-42 1.45036e-45 4.26721e-49 9.39903e-53 1.4748e-56 2.93927e-59 3.6318e-62 4.26018e-67 1.0367e-71 4.09424e-76 8.0643e-80 4.76783e-83 1.22904e-85 5.32262e-88 1.75348e-90 5.44079e-93 6.21942e-96 5.35422e-99 4.21778e-102 2.86268e-105 1.38249e-108 4.21169e-112 7.80594e-116 5.84228e-120 1.85138e-124 1.47253e-132 2.4982e-134 1.53623e-137 2.72594e-141 7.89071e-145 6.74443e-148 3.08561e-150 3.28517e-152 4.01084e-154 1.16791e-156 1.67536e-159 1.78765e-162 1.5668e-165 1.36137e-168 9.772e-172 7.18404e-177 3.85473e-182 1.69107e-187 5.78165e-193 1.93742e-198 5.6689e-204 1.73763e-209 4.8823e-215 1.50736e-220 4.55795e-226 1.56808e-231 5.68293e-237 1.83588e-242 3.41596e-248 4.07185e-254 1.52417e-273 3.82178e-276 1.48151e-281 5.55319e-287 2.04195e-292 7.72727e-298 2.83865e-303 9.65868e-309 2.79155e-314 7.24597e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.06964e-05 8.84139e-06 5.49114e-06 4.32963e-06 3.76577e-06 2.32909e-06 2.11268e-06 2.18609e-06 3.2938e-06 4.23875e-06 3.45851e-06 2.1637e-06 5.21648e-07 1.25354e-08 1.25368e-06 2.21092e-06 4.23532e-06 1.3499e-06 3.48805e-07 1.24367e-06 3.51001e-06 3.53591e-06 1.47158e-06 2.18958e-07 4.04439e-08 1.09852e-08 3.5089e-09 8.86371e-10 3.40503e-10 1.49553e-10 1.30608e-10 2.05115e-10 7.9436e-10 3.22094e-09 1.52633e-08 7.57856e-08 3.54114e-07 1.33801e-06 3.26851e-06 4.25192e-06 3.31284e-06 1.85832e-07 1.17484e-09 1.80362e-11 4.75733e-13 1.02965e-11 2.29498e-12 1.12536e-11 1.98519e-09 2.5403e-07 2.581e-07 4.23516e-07 1.3502e-06 4.63045e-06 3.78392e-07 2.37978e-08 8.58304e-09 6.73135e-09 1.87215e-08 1.14364e-07 3.73341e-07 1.9429e-07 1.07297e-07 7.3371e-08 6.10177e-08 2.57906e-08 3.6855e-10 2.01023e-11 4.00338e-12 2.54026e-13 2.38378e-14 1.01516e-14 3.00584e-20 8.27026e-24 9.92405e-26 3.5572e-27 8.61726e-30 7.3832e-32 1.43188e-34 7.88287e-38 4.33226e-41 1.3531e-44 5.15303e-48 1.18721e-51 4.68428e-55 7.98747e-59 1.17315e-63 3.70634e-68 1.61003e-72 1.19205e-76 2.76341e-80 1.74437e-83 2.60075e-86 6.32239e-89 1.39657e-91 2.33537e-94 4.62053e-97 1.39699e-99 3.58412e-102 4.66121e-105 3.13648e-108 1.02915e-111 1.27807e-115 1.87161e-120 2.72958e-129 6.86279e-131 5.68551e-134 8.97733e-138 6.73345e-142 1.51899e-145 2.05769e-148 1.39874e-150 1.28237e-152 6.18259e-155 2.0599e-157 3.64279e-160 8.86591e-163 1.10954e-165 1.43293e-168 1.35752e-171 9.43522e-177 3.87285e-182 1.47097e-187 4.4835e-193 1.37471e-198 3.74618e-204 1.03928e-209 2.79335e-215 7.77943e-221 2.28177e-226 7.00442e-232 2.2732e-237 4.96792e-243 6.69523e-249 9.15197e-268 1.66376e-270 4.54826e-276 1.43545e-281 4.58591e-287 1.54656e-292 5.22634e-298 1.80779e-303 5.86936e-309 1.66161e-314 4.19264e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.95192e-06 3.1329e-06 1.693e-06 1.86802e-06 1.36644e-06 7.52771e-07 3.03641e-07 2.44524e-07 1.02504e-06 4.18804e-06 2.73802e-06 1.13152e-06 3.59695e-07 3.33929e-08 7.55554e-08 4.24212e-07 1.45896e-06 2.92358e-06 3.92791e-06 3.72423e-06 1.63965e-06 3.60312e-06 4.18527e-06 4.17218e-06 4.52426e-06 3.4593e-06 6.47792e-07 9.48197e-08 2.01245e-08 2.95638e-09 4.9868e-10 1.71389e-10 3.3408e-11 5.25576e-11 1.19162e-10 3.72152e-10 1.6318e-09 7.23498e-09 3.86682e-08 2.23634e-07 3.15097e-07 2.31227e-06 4.19238e-06 1.15231e-06 3.22655e-08 1.94742e-09 9.43057e-10 4.56116e-10 2.52276e-10 1.17985e-09 2.49384e-10 5.12526e-10 2.89461e-08 5.28101e-07 2.55864e-07 6.95484e-07 2.41996e-06 3.03814e-06 4.8992e-08 3.98871e-09 9.15609e-10 5.36013e-10 4.98474e-10 3.81354e-09 2.32172e-08 9.19216e-08 4.59679e-08 1.70038e-08 1.29938e-08 1.21235e-08 4.75898e-09 4.94376e-11 3.6827e-12 1.47105e-12 4.71516e-14 6.55989e-15 8.32077e-16 3.93155e-20 1.07835e-22 4.46474e-23 7.59636e-23 7.39367e-24 6.20457e-26 1.82507e-28 2.70126e-31 4.36405e-34 5.12918e-37 4.00227e-40 1.61376e-43 1.65639e-47 5.38704e-52 2.1293e-56 9.91993e-61 4.64688e-65 2.58158e-69 2.21259e-73 3.5825e-77 9.32937e-81 4.32563e-84 4.52e-87 7.42401e-90 9.60438e-93 1.33632e-95 1.83813e-98 4.55891e-101 1.89381e-103 1.05903e-105 2.38639e-108 1.14896e-111 1.12041e-116 1.47827e-120 9.25851e-124 1.21463e-126 5.47029e-129 2.33187e-131 3.61182e-135 3.2209e-139 4.7712e-143 4.25301e-146 1.78502e-148 9.69492e-151 3.65743e-153 1.0149e-155 1.72276e-158 3.20766e-161 3.96523e-164 5.87376e-167 6.42252e-170 6.87712e-173 2.41585e-178 9.0919e-184 2.66609e-189 8.9886e-195 2.32302e-200 6.79673e-206 1.63514e-211 4.56686e-217 1.1074e-222 4.64202e-228 1.36831e-233 4.45624e-239 1.42108e-244 1.05733e-250 5.4897e-257 3.58796e-263 5.24105e-269 1.82339e-274 9.20292e-280 6.06482e-285 3.78028e-290 2.8129e-295 1.70674e-300 9.43176e-306 3.88224e-311 1.37546e-316 4.00193e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6.82123e-07 5.85299e-07 2.88186e-07 3.62816e-07 4.66059e-07 1.12237e-07 4.18932e-08 7.50134e-09 1.36441e-08 8.04329e-08 4.19282e-06 1.59726e-06 3.5957e-07 7.73545e-08 1.12458e-07 7.1847e-07 2.78966e-06 3.56282e-06 4.06213e-06 3.7424e-06 3.94169e-06 3.96237e-06 3.43432e-06 3.7015e-06 4.0472e-06 4.56109e-06 4.0391e-06 1.54848e-06 1.71085e-07 1.05852e-08 1.28811e-09 1.49149e-10 5.3443e-11 3.64012e-11 3.91235e-11 8.2126e-11 2.31431e-10 9.02111e-10 4.87755e-09 2.2904e-08 5.79518e-08 2.5678e-07 1.04201e-06 3.95139e-06 5.10233e-07 7.74828e-08 2.60432e-08 2.04385e-08 2.31117e-08 6.13999e-08 8.50212e-08 9.90509e-08 1.50284e-07 1.72008e-06 6.12595e-07 1.01128e-06 4.10482e-06 1.27321e-07 5.96679e-09 6.8403e-10 2.4451e-10 1.39498e-10 6.5291e-11 9.16452e-11 1.3331e-09 9.20785e-09 1.67336e-08 8.40112e-09 2.59122e-09 2.42887e-09 1.5313e-09 5.84186e-10 2.85324e-11 2.18818e-12 3.87139e-13 3.43432e-15 2.45417e-16 3.56388e-16 3.30431e-17 3.06543e-18 1.84752e-19 1.24488e-20 1.55412e-22 9.77151e-25 3.65515e-27 4.26914e-30 9.24763e-34 7.9475e-38 7.90845e-42 6.59143e-46 5.09504e-50 3.96566e-54 3.17183e-58 2.58013e-62 2.41718e-66 2.67847e-70 4.16853e-74 7.39362e-78 2.14015e-81 9.71734e-85 6.71762e-88 6.45803e-91 6.42682e-94 6.08744e-97 5.75599e-100 6.26125e-103 1.02203e-105 2.64571e-108 1.42477e-110 4.07851e-113 1.88556e-116 5.48916e-120 6.07537e-123 9.05707e-126 1.99752e-129 2.10283e-133 4.13281e-137 9.67993e-141 4.9464e-144 6.07261e-147 1.31498e-149 3.02426e-152 5.38881e-155 8.94241e-158 1.1883e-160 1.71062e-163 2.21171e-166 2.31003e-169 2.70313e-172 1.47361e-175 2.79149e-181 3.15357e-187 3.93878e-193 5.24529e-199 1.53436e-204 4.05555e-210 1.60878e-215 4.84927e-221 1.85985e-226 5.44748e-232 2.28759e-237 7.60955e-243 1.18422e-248 1.75845e-254 2.22197e-260 4.16833e-266 1.58982e-271 6.5154e-277 3.55317e-282 2.17958e-287 1.92382e-292 1.30651e-297 7.79277e-303 3.30062e-308 1.25892e-313 3.80144e-319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.11871e-08 6.30992e-08 2.79139e-08 4.31577e-08 4.21144e-08 1.73273e-08 3.24171e-09 4.28263e-10 3.29381e-10 8.30811e-10 1.34865e-08 1.12828e-06 3.01079e-06 2.54829e-06 3.30758e-06 1.80411e-06 2.34055e-06 4.19002e-06 4.06264e-06 4.17055e-06 3.94758e-06 3.678e-06 4.07134e-06 3.9586e-06 3.82255e-06 3.98115e-06 4.05329e-06 3.1505e-06 5.69103e-07 2.35503e-08 1.15941e-09 1.66664e-10 4.79458e-11 2.41953e-11 1.73129e-11 2.69068e-11 3.91164e-11 1.10186e-10 3.99393e-10 2.86539e-09 9.49555e-09 6.00572e-08 3.56858e-07 2.65488e-06 2.4026e-06 1.52458e-07 1.68742e-07 9.03529e-08 7.97648e-08 1.29917e-07 4.04014e-07 5.90643e-07 3.28189e-07 2.39059e-07 2.79847e-07 1.81172e-06 3.05164e-07 4.20734e-09 5.62494e-10 1.37716e-10 6.88207e-11 5.10029e-11 4.21834e-11 2.14984e-11 4.60379e-11 6.22223e-10 3.29605e-09 3.82875e-09 1.4341e-09 3.3076e-10 2.80594e-10 1.45753e-10 7.84411e-11 4.94343e-12 1.36113e-12 2.50194e-14 1.87669e-16 9.33158e-17 1.37951e-16 7.4874e-17 1.8683e-17 1.16723e-18 1.01863e-20 1.40174e-23 1.04957e-26 5.51245e-30 2.66625e-33 8.78807e-37 2.01487e-40 4.24924e-44 5.56946e-48 5.14322e-52 4.70384e-56 5.12448e-60 6.43566e-64 1.06165e-67 1.77203e-71 3.38819e-75 8.23331e-79 2.2995e-82 9.47861e-86 4.54769e-89 2.9867e-92 1.8939e-95 1.32107e-98 1.01785e-101 7.83816e-105 7.11943e-108 6.38644e-111 9.7478e-114 1.59072e-116 1.28674e-119 7.76851e-123 2.11373e-126 4.9999e-130 1.27766e-133 3.84686e-137 1.43578e-140 7.75958e-144 5.94298e-147 8.81768e-150 1.34589e-152 1.85035e-155 2.80444e-158 3.53154e-161 3.91399e-164 4.85195e-167 5.29769e-170 5.73224e-173 4.58963e-176 1.29281e-181 2.66689e-187 4.76488e-193 9.44353e-199 1.55292e-204 2.64963e-210 5.78839e-216 1.54051e-221 4.9824e-227 1.58618e-232 5.33552e-238 1.71644e-243 3.96313e-249 8.926e-255 1.63409e-260 3.62605e-266 1.25225e-271 4.8881e-277 2.39257e-282 1.26261e-287 8.49945e-293 5.54739e-298 3.21286e-303 1.44199e-308 5.57593e-314 1.79287e-319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6.71646e-10 1.69359e-09 1.83252e-09 2.47555e-09 1.88706e-09 5.15236e-10 1.62408e-10 4.15276e-11 3.00779e-11 3.14526e-11 9.79413e-11 3.61849e-10 3.0832e-09 3.42576e-09 2.51723e-09 9.74204e-09 2.56273e-06 4.04724e-06 3.86303e-06 3.8192e-06 4.02202e-06 2.98502e-06 1.51106e-07 3.06444e-08 6.74339e-08 2.29165e-07 1.17339e-06 5.71908e-07 7.69142e-08 5.35579e-09 3.5285e-10 6.43614e-11 2.48717e-11 1.53464e-11 1.26474e-11 1.19229e-11 1.29459e-11 1.6065e-11 4.45968e-11 1.74871e-10 1.04851e-09 4.27098e-09 2.91278e-08 1.18331e-07 1.31946e-06 4.13821e-06 1.87012e-06 1.04798e-06 6.78498e-07 4.74693e-07 4.29312e-07 4.29341e-07 6.9955e-07 9.56485e-07 3.80181e-06 1.85724e-07 4.88588e-09 5.3462e-10 8.46297e-11 2.68137e-11 1.89833e-11 2.55829e-11 2.57819e-11 1.90279e-11 1.06941e-11 3.68312e-11 2.24327e-10 6.49767e-10 4.26434e-10 8.34329e-11 3.55001e-11 2.77383e-11 2.27937e-11 1.22623e-11 2.35054e-12 7.49792e-13 5.22902e-14 3.74059e-15 1.25006e-15 3.94142e-16 2.63407e-17 1.6838e-18 2.85147e-20 6.13749e-23 1.31398e-25 1.13615e-28 9.38033e-32 5.70414e-35 2.40435e-38 6.74293e-42 1.19037e-45 1.28355e-49 1.13865e-53 1.12108e-57 1.38686e-61 2.08075e-65 4.30021e-69 9.69691e-73 2.31093e-76 5.97916e-80 1.64725e-83 5.00116e-87 2.15331e-90 9.42748e-94 4.23761e-97 2.45119e-100 1.19117e-103 7.89955e-107 3.70637e-110 2.85913e-113 1.44557e-116 6.93006e-120 1.65377e-123 4.11415e-127 7.83751e-131 1.88767e-134 7.63011e-138 3.49532e-141 2.27282e-144 1.77534e-147 1.81846e-150 2.04446e-153 2.34854e-156 2.48834e-159 3.02807e-162 3.36711e-165 3.68945e-168 3.57048e-171 3.46767e-174 1.86278e-177 2.99896e-183 3.84628e-189 6.47908e-195 9.47442e-201 2.25008e-206 6.71699e-212 2.29096e-217 7.42309e-223 2.41953e-228 7.39688e-234 2.23002e-239 6.55834e-245 1.61406e-250 4.04776e-256 9.00662e-262 2.20769e-267 7.29962e-273 2.59644e-278 1.15657e-283 5.66272e-289 3.52015e-294 2.11353e-299 1.13088e-304 4.72173e-310 1.70809e-315 5.21239e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.11522e-11 3.16247e-11 6.24995e-11 6.92015e-11 2.64309e-11 1.36449e-11 1.2374e-11 9.66717e-12 5.09306e-12 4.85242e-12 6.61744e-12 1.05236e-11 1.66874e-11 3.10442e-11 1.64423e-10 8.61508e-09 3.85322e-06 3.75357e-06 3.85312e-06 3.93217e-06 2.32795e-07 6.79523e-09 9.50586e-10 8.37723e-10 2.44066e-09 6.17318e-09 1.78951e-08 9.26223e-09 2.92949e-09 4.27143e-10 7.15298e-11 2.20477e-11 1.29613e-11 1.04199e-11 8.99323e-12 7.89236e-12 7.29062e-12 8.81082e-12 9.72843e-12 1.57775e-11 5.12578e-11 3.08983e-10 1.37706e-09 6.831e-09 2.62599e-08 1.80289e-07 3.67336e-06 4.16156e-06 3.26853e-06 2.09631e-06 1.40801e-06 1.27814e-06 2.13242e-06 4.4226e-06 2.36727e-06 4.79844e-08 2.24625e-09 1.85044e-10 2.85286e-11 1.33127e-11 7.28375e-12 1.07757e-11 1.4618e-11 1.60395e-11 1.24762e-11 9.09265e-12 1.67909e-11 5.56001e-11 7.04668e-11 4.37594e-11 4.81681e-12 4.0806e-12 3.69839e-12 3.63223e-12 3.65468e-12 1.4915e-12 7.23865e-13 6.47572e-13 3.68218e-13 1.32671e-13 1.5492e-14 4.07109e-16 4.92061e-18 1.79772e-20 2.27566e-23 2.97896e-26 2.33579e-29 1.46285e-32 6.92673e-36 2.11763e-39 4.38613e-43 5.54302e-47 4.91211e-51 4.5715e-55 5.16866e-59 8.32931e-63 1.65505e-66 3.69582e-70 8.88237e-74 2.24699e-77 6.03077e-81 1.64695e-84 4.73846e-88 1.44602e-91 4.39184e-95 1.83141e-98 6.87602e-102 2.77069e-105 1.01356e-108 4.09231e-112 1.84715e-115 5.15996e-119 1.85059e-122 3.65457e-126 1.03742e-129 2.36342e-133 5.47103e-137 1.1386e-140 3.26213e-144 1.01344e-147 3.34861e-151 1.32745e-154 6.24984e-158 3.87005e-161 3.04352e-164 2.47511e-167 2.24428e-170 1.82829e-173 1.56642e-176 7.50791e-182 2.21104e-187 8.51132e-193 2.48661e-198 6.6113e-204 1.61145e-209 3.80773e-215 8.18135e-221 1.84758e-226 4.08758e-232 9.98488e-238 2.57178e-243 7.62194e-249 1.86232e-254 5.5649e-260 1.52282e-265 5.03089e-271 1.72889e-276 6.85138e-282 2.86197e-287 1.38392e-292 7.28806e-298 3.81376e-303 1.61045e-308 5.80632e-314 1.80285e-319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.36551e-12 3.46211e-12 3.44077e-12 4.03525e-12 4.22351e-12 4.28081e-12 4.21032e-12 4.10973e-12 4.02047e-12 4.0093e-12 4.0065e-12 4.6179e-12 5.06481e-12 5.28697e-12 1.51303e-11 3.92141e-10 1.11713e-07 3.90033e-06 3.49531e-06 8.67992e-08 1.43156e-09 1.14332e-10 4.04633e-11 4.32617e-11 1.10671e-10 1.47058e-10 4.11783e-10 3.10452e-10 1.8448e-10 6.92178e-11 3.25623e-11 1.27607e-11 9.9488e-12 7.50081e-12 5.64345e-12 5.42392e-12 5.2089e-12 5.12294e-12 5.07898e-12 5.17199e-12 7.67456e-12 1.35723e-11 4.29872e-11 1.4142e-10 4.37136e-10 1.47306e-09 1.3194e-08 6.41084e-08 2.59641e-07 1.49319e-06 3.64808e-06 4.01055e-06 3.47964e-06 8.22324e-07 7.75502e-08 4.11764e-09 2.7509e-10 3.17893e-11 9.72072e-12 6.53837e-12 6.90311e-12 6.65492e-12 9.91188e-12 1.3553e-11 1.05151e-11 8.9061e-12 6.02799e-12 1.03703e-11 1.54596e-11 1.69533e-11 1.62767e-11 8.24962e-12 2.85443e-12 2.92434e-12 2.9626e-12 2.67023e-12 2.69452e-12 2.6695e-12 2.65218e-12 1.16443e-12 6.27625e-13 2.4566e-13 6.09986e-15 1.41476e-17 1.79669e-20 1.51553e-23 1.18983e-26 6.91294e-30 3.21427e-33 1.037e-36 2.31583e-40 3.32249e-44 3.44611e-48 3.08715e-52 3.47966e-56 5.16193e-60 9.93106e-64 2.22971e-67 5.38115e-71 1.37601e-74 3.59383e-78 9.59349e-82 2.59399e-85 7.032e-89 1.96744e-92 5.61451e-96 1.53663e-99 4.83141e-103 1.31525e-106 4.18054e-110 1.13341e-113 3.46457e-117 9.5576e-121 3.03065e-124 7.88683e-128 2.33072e-131 6.5277e-135 1.89465e-138 5.43468e-142 1.60478e-145 4.81696e-149 1.43258e-152 4.55109e-156 1.42052e-159 4.9362e-163 1.65196e-166 6.35401e-170 2.29006e-173 9.26038e-177 2.3687e-182 5.20798e-188 1.09594e-193 2.04477e-199 3.42069e-205 5.45769e-211 8.13794e-217 1.20231e-222 1.76872e-228 2.61979e-234 4.27132e-240 7.19088e-246 1.38239e-251 2.70492e-257 5.82149e-263 2.58612e-268 2.23099e-273 9.29307e-279 4.09039e-284 1.43886e-289 5.49325e-295 1.80905e-300 5.32796e-306 1.31284e-311 2.99278e-317 5.92879e-323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.85902e-12 3.93771e-12 3.9739e-12 4.04982e-12 4.07228e-12 4.09701e-12 4.13842e-12 4.20026e-12 4.25517e-12 4.20549e-12 4.68819e-12 4.97575e-12 5.24801e-12 5.34064e-12 5.28246e-12 1.10243e-11 1.05941e-10 1.27042e-09 3.16901e-09 8.81347e-10 7.72721e-11 1.43169e-11 5.65924e-12 5.29773e-12 5.60042e-12 9.69061e-12 1.29459e-11 1.59482e-11 1.85303e-11 1.77527e-11 1.40066e-11 1.1208e-11 3.57918e-12 5.24209e-12 4.96073e-12 4.76705e-12 4.7613e-12 4.66305e-12 4.6885e-12 4.61764e-12 4.55255e-12 4.42761e-12 4.72966e-12 8.8894e-12 1.33725e-11 2.36567e-11 8.18339e-11 2.31243e-10 5.65479e-10 1.27242e-09 2.6927e-09 3.5068e-09 3.72152e-09 1.34577e-09 6.15225e-10 1.06171e-10 2.90906e-11 1.1322e-11 7.75181e-12 6.81097e-12 6.59723e-12 6.57592e-12 7.98738e-12 8.80936e-12 8.72881e-12 8.82747e-12 6.89095e-12 8.7345e-12 1.03963e-11 1.09799e-11 1.48382e-11 1.95147e-11 1.64071e-11 7.08083e-12 3.5619e-12 3.68356e-12 3.83886e-12 3.89546e-12 3.79732e-12 3.69054e-12 2.46457e-12 6.98394e-13 2.78691e-13 4.59698e-16 5.24771e-19 4.29396e-22 2.87996e-25 1.60726e-28 6.43854e-32 1.93882e-35 3.96697e-39 4.67409e-43 5.52172e-47 4.89173e-51 4.8346e-55 6.76989e-59 1.2085e-62 2.58712e-66 6.08702e-70 1.52186e-73 3.93175e-77 1.04452e-80 2.8348e-84 7.96395e-88 2.24718e-91 6.41758e-95 1.90972e-98 5.75486e-102 1.63001e-105 5.67724e-109 1.71207e-112 5.97615e-116 1.85187e-119 7.5071e-123 2.51406e-126 9.83063e-130 3.81462e-133 1.46551e-136 5.78417e-140 2.16699e-143 8.40132e-147 3.15355e-150 1.20983e-153 4.63537e-157 1.74983e-160 6.84224e-164 2.63467e-167 1.0063e-170 4.0688e-174 1.60337e-177 3.01247e-183 5.74589e-189 9.33477e-195 1.36032e-200 1.86382e-206 2.43362e-212 3.12948e-218 4.23412e-224 5.75012e-230 9.27285e-236 1.52187e-241 2.96654e-247 5.61517e-253 1.21858e-258 2.50941e-264 5.77839e-270 1.32055e-275 3.3749e-281 8.24174e-287 1.88039e-292 3.7455e-298 7.05075e-304 1.22946e-309 2.10654e-315 3.47822e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.16455e-12 4.21158e-12 4.23314e-12 4.26361e-12 4.28257e-12 4.30617e-12 4.33678e-12 4.38236e-12 4.23471e-12 4.4827e-12 5.09659e-12 5.12651e-12 5.43562e-12 5.39091e-12 5.25376e-12 5.0237e-12 5.35891e-12 8.3707e-12 9.82391e-12 8.15039e-12 5.39901e-12 4.92538e-12 4.71411e-12 4.72475e-12 4.68265e-12 4.47126e-12 4.98328e-12 5.22319e-12 6.00907e-12 6.41121e-12 6.66443e-12 6.23334e-12 5.60364e-12 3.85613e-12 4.56842e-12 4.57465e-12 4.58292e-12 4.59997e-12 4.53738e-12 4.5617e-12 4.49275e-12 4.41943e-12 4.38284e-12 4.59176e-12 5.4703e-12 5.98335e-12 7.33586e-12 8.9265e-12 9.67629e-12 1.581e-11 1.61334e-11 1.9332e-11 1.79526e-11 1.94341e-11 1.57023e-11 1.30917e-11 1.29989e-11 9.03809e-12 7.86926e-12 6.63976e-12 6.26329e-12 6.82157e-12 5.91079e-12 8.4145e-12 7.9838e-12 9.57526e-12 1.08146e-11 1.02482e-11 1.27591e-11 1.56967e-11 1.89259e-11 1.91372e-11 9.04548e-12 3.8403e-12 3.93726e-12 3.96478e-12 3.99808e-12 4.13291e-12 3.05067e-12 7.22871e-13 4.7209e-13 2.15688e-14 6.57996e-15 1.36799e-16 1.69084e-20 3.30454e-24 4.57527e-28 1.3041e-31 4.70078e-35 1.46441e-38 4.3661e-42 1.18454e-45 2.65703e-49 7.91732e-53 2.15442e-56 5.85593e-60 1.73389e-63 5.26162e-67 1.69927e-70 5.58905e-74 1.93784e-77 6.99981e-81 2.64605e-84 1.02856e-87 4.11014e-91 1.69357e-94 7.19332e-98 2.94016e-101 1.25718e-104 5.42937e-108 2.03737e-111 9.17636e-115 3.67549e-118 1.60671e-121 5.80161e-125 2.39182e-128 8.84732e-132 3.47956e-135 1.31596e-138 4.94647e-142 1.8931e-145 6.98154e-149 2.67399e-152 9.73311e-156 3.73725e-159 1.39795e-162 5.18669e-166 2.01664e-169 7.7138e-173 3.15061e-176 5.84104e-182 1.20609e-187 2.30344e-193 4.0701e-199 6.9517e-205 1.094e-210 1.65626e-216 2.31781e-222 3.09966e-228 4.02486e-234 4.87491e-240 6.00153e-246 7.00667e-252 8.64175e-258 1.04433e-263 1.38243e-269 1.85201e-275 2.67074e-281 3.84667e-287 5.77304e-293 8.50882e-299 1.28219e-304 1.89358e-310 2.84996e-316 4.24896e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) ; boundaryField { wand { type zeroGradient; } frontAndBack { type empty; } } // ************************************************************************* //
af129fbc4769ee28265c7e04400beabaf941da05
60a15a584b00895e47628c5a485bd1f14cfeebbe
/comps/general/Data/XmlDoc.cpp
a2801a505000e6ee9dbfbe92a4dc9e1dee187bf2
[]
no_license
fcccode/vt5
ce4c1d8fe819715f2580586c8113cfedf2ab44ac
c88049949ebb999304f0fc7648f3d03f6501c65b
refs/heads/master
2020-09-27T22:56:55.348501
2019-06-17T20:39:46
2019-06-17T20:39:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,001
cpp
XmlDoc.cpp
#include "stdafx.h" #import <msxml3.dll> #include "data.h" #include "ContentDlg.h" namespace{ MSXML2::IXMLDOMDocumentPtr dom; } void CContentDlg::OnExport2Xml() { CStringW strDataSourceName; if( m_nDataSource == 0 ) { m_ptrData = GetAppUnknown(); strDataSourceName = L"Shell.xml"; } else { IApplicationPtr ptrApp = GetAppUnknown(); IUnknownPtr punkDoc; ptrApp->GetActiveDocument(&punkDoc); if( punkDoc ) { m_ptrData = punkDoc; IDocumentSitePtr ptrDocSite( punkDoc ); BSTR bstrFileName; ptrDocSite->GetPathName( &bstrFileName ); strDataSourceName = bstrFileName; ::SysFreeString(bstrFileName); int pos=strDataSourceName.ReverseFind(L'.'); strDataSourceName=strDataSourceName.Left(pos)+L".xml"; } } if( m_ptrData==0 ) { _ASSERTE(!"no active documents..."); } else { dom.CreateInstance(__uuidof(MSXML2::DOMDocument30)); MSXML2::IXMLDOMElementPtr el=dom->createElement("ggg"); dom->documentElement=el; m_ptrData->SetupSection( 0 ); m_pNode=el; MSXML2::IXMLDOMNodePtr elel=FillNode(el, m_ptrData, 0, 0 ); //if(elel) // el->appendChild(elel); dom->save((LPCWSTR)strDataSourceName); el=NULL; dom=NULL; } } void Decorate(_bstr_t& bstr){ CStringW str = (LPCWSTR)bstr; str.Replace(' ','_'); str.Replace(')','_'); str.Replace('(','_'); str.Replace('{','_'); str.Replace('}','_'); if(str[0]>='0' && str[0]<='9' || str[0]=='-') str.Insert(0,'_'); bstr=str; } MSXML2::IXMLDOMNode* CContentDlg::FillNode(MSXML2::IXMLDOMNode* pParentNode , INamedData *pIData, const char *szPath, const char *szEntryName ) { MSXML2::IXMLDOMNodePtr node=pParentNode; _bstr_t bstrCurrentSection = szPath; pIData->SetupSection( bstrCurrentSection ); _variant_t var; _bstr_t bstrEntry = szEntryName; pIData->GetValue( bstrCurrentSection, &var ); int nImage = -1; _bstr_t bsDecoratedEntry=bstrEntry; Decorate(bsDecoratedEntry); long nCount = 0; pIData->GetEntriesCount( &nCount ); CString strValue = szEntryName; if( strValue.IsEmpty() ) strValue = "no name"; else { switch(var.vt){ default: { //if(MSXML2::IXMLDOMElementPtr elParent=node) // elParent->setAttribute(bsDecoratedEntry,_bstr_t(var)); //else // MSXML2::IXMLDOMElementPtr el=dom->createElement(bsDecoratedEntry); MSXML2::IXMLDOMElementPtr el=dom->createElement("Section"); el->setAttribute("name",bstrEntry); el->text=_bstr_t(var); node=el; pParentNode->appendChild(node); }break; case VT_EMPTY: { //strValue += ":Empty"; MSXML2::IXMLDOMElementPtr el=dom->createElement("Section"); el->setAttribute("name",bstrEntry); node=el; pParentNode->appendChild(node); }break; case VT_NULL: { //strValue += ":Null"; MSXML2::IXMLDOMElementPtr el=dom->createElement("Entry"); el->setAttribute("name",bstrEntry); el->setAttribute("Default","0"); node=el; pParentNode->appendChild(node); }break; case VT_UNKNOWN: case VT_DISPATCH: { //strValue += ":Data object="; //strValue += GetObjectName( var.punkVal ); MSXML2::IXMLDOMElementPtr el=dom->createElement("Object"); el->setAttribute("name",bstrEntry); el->setAttribute("Unknown",_bstr_t(GetObjectName( var.punkVal ))); if(INamedDataPtr ptrNDPrivate=var.punkVal) { FillNode(el, ptrNDPrivate, 0, 0 ); } node=el; pParentNode->appendChild(node); }break; case VT_BITS: { MSXML2::IXMLDOMElementPtr el=dom->createElement("Object"); el->setAttribute("name",bstrEntry); el->setAttribute("Pointer",_bstr_t(var.lVal)); node=el; pParentNode->appendChild(node); }break; } } CStringArray strs; for( int nEntry = 0; nEntry < nCount; nEntry++ ) { _bstr_t bstr; pIData->GetEntryName( nEntry, bstr.GetAddress() ); strs.Add( bstr ); } for( nEntry = 0; nEntry < nCount; nEntry++ ) { CString strPath = szPath; strPath += "\\"; strPath += strs[nEntry]; FillNode(node, pIData, strPath, strs[nEntry] ); } return 0; }
aeedde80e78b93c4469c4e27a52dc07f5323d1ce
4f65dfa1edc9af705bf72b780a23b2b948e71623
/05_interact_mem/code/02_screen_grab_img_balls_solution/src/ImgManipulation.h
1bc00b1a66c6341efd8c2da6c8b9923494dc9ba6
[ "MIT" ]
permissive
abrennec/sose20_cc2
a484d199f8f724aff780de2466acbf988a41f1bc
e609bbc2b2834dcd1998c7d044d80f8d325c9e52
refs/heads/master
2022-10-20T22:48:00.620259
2020-06-15T12:25:41
2020-06-15T12:25:41
241,618,301
0
0
null
null
null
null
UTF-8
C++
false
false
550
h
ImgManipulation.h
#pragma once #include "ofMain.h" // Any image manipulation should be executed inside of this class. // This includes also any data transfer from the ofApp object to // the image manipulation object and vice versa. class ImageManipulation { public: ImageManipulation(); ofImage processImage(const ofPixels& screenPix, const ofPixels& videoPix); private: void alignPixelResolutions(ofPixels& screenGrab, const ofPixels& videoGrab); void adjustVideoGrab(const ofPixels& screenGrab, ofPixels& videoGrab); };
a979e991016d18c81b939fae82914d9a9c279ddd
1bfcf8aa08418ee93a145afea7d86895fa1e78e0
/codegen/syntax_tree.cpp
35023a69e6c0dd9201dcf4329aea66ce5bee4aff
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-protobuf" ]
permissive
git-littlezhou/emoskit
064f6179c40c8619ebc3da8c3b5a21315af044ff
c2f1179186c969340d2a1d585e2d59cb355e482e
refs/heads/master
2021-01-23T16:22:27.975463
2017-09-15T07:36:19
2017-09-15T07:36:19
102,738,475
4
0
null
null
null
null
UTF-8
C++
false
false
2,938
cpp
syntax_tree.cpp
/* * * Copyright 2017 emsokit authors. * All rights reserved. * * Licensed under the BSD 3-Clause License (the "License"); you may * not use this file except in compliance with the License. You may * obtain a copy of the License at * * https://opensource.org/licenses/BSD-3-Clause * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. * */ #include <string.h> #include "syntax_tree.h" namespace emoskit { /* start of implement of SyntaxParam */ SyntaxParam::SyntaxParam(){ memset(param_name_, 0, sizeof(param_name_)); memset(param_type_, 0, sizeof(param_type_)); } SyntaxParam::~SyntaxParam() { } void SyntaxParam::set_param_name(const char * param_name){ strncpy(param_name_, param_name, sizeof(param_name_) - 1); } const char * SyntaxParam::param_name() const { return param_name_; } void SyntaxParam::set_param_type(const char * param_type){ strncpy(param_type_, param_type, sizeof(param_type_) - 1); } const char * SyntaxParam::param_type() const { return param_type_; } /* end of implement of SyntaxParam */ /* start of implement of SyntaxFunc */ SyntaxFunc::SyntaxFunc(){ memset(func_name_, 0, sizeof(func_name_)); } SyntaxFunc::~SyntaxFunc() { } SyntaxParam * SyntaxFunc::req(){ return &req_; } SyntaxParam * SyntaxFunc::rsp(){ return &rsp_; } void SyntaxFunc::set_func_name(const char * func_name){ strncpy(func_name_, func_name, sizeof(func_name_) - 1); } const char * SyntaxFunc::func_name() const{ return func_name_; } /* end of implement of SyntaxFunc */ /* start of implement of SyntaxTree */ SyntaxTree::SyntaxTree(){ memset(proto_file_name_, 0 , sizeof(proto_file_name_)); memset(package_name_, 0, sizeof(package_name_)); memset(service_name_, 0, sizeof(service_name_)); } SyntaxTree::~SyntaxTree() { } void SyntaxTree::set_proto_file_name(const char * proto_file_name){ strncpy(proto_file_name_, proto_file_name, sizeof(proto_file_name_) - 1); } const char * SyntaxTree::proto_file_name() const{ return proto_file_name_; } void SyntaxTree::set_package_name(const char * package_name){ strncpy(package_name_, package_name, sizeof(package_name_) - 1); } const char * SyntaxTree::package_name() const{ return package_name_; } void SyntaxTree::set_service_name(const char * service_name){ strncpy(service_name_, service_name, sizeof(service_name_) - 1); } const char * SyntaxTree::service_name() const{ return service_name_; } const FuncVector * SyntaxTree::func_list() const { return &func_list_; } FuncVector * SyntaxTree::func_list() { return &func_list_; } /* end of implement of SyntaxTree */ }
04f3276ab69ebd6bc166c64bf57dddd73964f488
0d5a29efe0c04c22e6b6db74109a576ab9c8c5e2
/student_tests.cpp
79a85fec4de555a9759804a24cd62d3e5bb1438b
[]
no_license
bmsiegel/Polynomial
32ac4a93ecc7d077497e3bc47033feed71ac2bda
3a7cd4c4fbd05ae5eb59019762cbd33b015e98c6
refs/heads/master
2020-04-25T05:20:44.014023
2019-02-25T16:15:47
2019-02-25T16:15:47
172,539,522
0
0
null
null
null
null
UTF-8
C++
false
false
2,188
cpp
student_tests.cpp
#define CATCH_CONFIG_MAIN #include "catch.hpp" #include "Polynomial.hpp" TEST_CASE("Tests add") { std::stringstream ss1; Polynomial p; Polynomial q; p.insert_term(Term(2,3)); p.insert_term(Term(2,2)); p.insert_term(Term(2,1)); q.insert_term(Term(1,3)); q.insert_term(Term(3,2)); q.insert_term(Term(5,1)); q.insert_term(Term(6,0)); ss1 << p + q; REQUIRE(ss1.str() == "3x^3+5x^2+7x+6"); } TEST_CASE("Tests subtract") { std::stringstream ss1; Polynomial p; Polynomial q; p.insert_term(Term(2,3)); p.insert_term(Term(2,2)); p.insert_term(Term(2,1)); q.insert_term(Term(1,3)); q.insert_term(Term(3,2)); q.insert_term(Term(5,1)); q.insert_term(Term(6,0)); ss1 << p - q; REQUIRE(ss1.str() == "x^3-x^2-3x-6"); } TEST_CASE("Tests multiply") { std::stringstream ss1; Polynomial p; Polynomial q; p.insert_term(Term(2,1)); p.insert_term(Term(4,0)); ss1 << p*p; REQUIRE(ss1.str() == "4x^2+16x+16"); } TEST_CASE("Tests divide") { std::stringstream ss1; Polynomial p; Polynomial q; p.insert_term(Term(1,4)); p.insert_term(Term(8,3)); p.insert_term(Term(4,2)); q.insert_term(Term(1,2)); q.insert_term(Term(2,1)); q.insert_term(Term(1,0)); ss1 << p / q; REQUIRE(ss1.str() == "x^2+6x-9"); } TEST_CASE("Tests modulus") { std::stringstream ss1; Polynomial p; Polynomial q; p.insert_term(Term(1,4)); p.insert_term(Term(8,3)); p.insert_term(Term(4,2)); q.insert_term(Term(1,2)); q.insert_term(Term(2,1)); q.insert_term(Term(1,0)); ss1 << p % q; REQUIRE(ss1.str() == "12x+9"); } TEST_CASE("Tests weird stuff") { std::stringstream ss1; std::stringstream ss2; Polynomial p; Polynomial q; p.insert_term(Term(1,4)); p.insert_term(Term(8,3)); p.insert_term(Term(4,2)); q.insert_term(Term(1,-2)); q.insert_term(Term(2,1)); q.insert_term(Term(1,0)); REQUIRE_THROWS(p/q); REQUIRE_THROWS(p%q); Polynomial h; Polynomial y; h.insert_term(Term(1,2)); h.insert_term(Term(8,1)); h.insert_term(Term(4,0)); y.insert_term(Term(1,1)); y.insert_term(Term(2,0)); y.insert_term(Term(1,0)); ss1 << y / h; ss2 << y % h; REQUIRE(ss1.str() == "0"); REQUIRE(ss2.str() == "x+3"); }
a6a3bd55f10cded90865595209b0b1ad9cd8f49f
fe96270037113fd5a44ec3adf0aebdeccd04430b
/quarre/interaction/quarre-interaction.cpp
53607d4fcd1fbbb35033f1f1fddba8361ffb7adc
[]
no_license
pchdev/score-addon-quarre
314452061381f192360cc36e6dd502f8eff2ae75
aba5fc38d3345aa5988fa09f9ae6fe9ff66d1614
refs/heads/master
2021-06-13T05:34:32.779319
2019-08-13T18:52:32
2019-08-13T18:52:32
113,207,264
0
1
null
null
null
null
UTF-8
C++
false
false
5,946
cpp
quarre-interaction.cpp
#include "quarre-interaction.hpp" #include <score/serialization/DataStreamVisitor.hpp> #include <score/serialization/JSONVisitor.hpp> #include <QFormLayout> #include <score/tools/IdentifierGeneration.hpp> using namespace score::addons; quarre::interaction::interaction( const Id<quarre::interaction> &id, QObject *parent) : IdentifiedObject ( id, "quarrè-interaction", parent ), m_module ( "No selected module"), m_title ( "Untitled"), m_description ( "No description"), m_length ( 0 ), m_countdown ( 0 ), m_dispatch_all ( false ) { on_end_expression_changed("return true;"); } ossia::time_sync& quarre::interaction::get_ossia_tsync() const { auto model = qobject_cast<quarre::ProcessModel*>(parent()); return model->get_ossia_tsync(); } void quarre::interaction::on_mapping_added() { auto mp = new quarre::mapping(getStrongId(m_mappings), this); m_mappings.push_back(mp); emit mapping_added(*mp); } void quarre::interaction::on_mapping_removed(quarre::mapping *target) { m_mappings.erase (std::remove(m_mappings.begin(), m_mappings.end(), target), m_mappings.end()); delete target; qDebug() << m_mappings.size(); } const std::vector<quarre::mapping*>& quarre::interaction::mappings() { return m_mappings; } std::vector<ossia::value> quarre::interaction::to_list() const { std::vector<ossia::value> list; list.push_back ( m_title.toStdString() ); list.push_back ( m_description.toStdString() ); list.push_back ( m_module.toStdString() ); list.push_back ( m_length ); list.push_back ( m_countdown ); return list; } QStringList quarre::interaction::inputs() const { QStringList res; for ( const auto& mapping : m_mappings ) { QString source = mapping->source(); QString res_src = source.remove("quarre-server:"); res << res_src; } return res; } void quarre::interaction::on_dispatch_all_changed(bool dispatch_all) { m_dispatch_all = dispatch_all; } void quarre::interaction::on_module_changed(QString module) { m_module = module; } void quarre::interaction::on_title_changed(QString title) { m_title = title; } void quarre::interaction::on_description_changed(QString description) { m_description = description; } void quarre::interaction::on_length_changed(int length) { m_length = length; } void quarre::interaction::on_countdown_changed(int countdown) { m_countdown = countdown; } void quarre::interaction::on_end_expression_changed(QString expression) { m_end_expression = expression; m_end_expression_js = expression.prepend("(function(v){").append("})"); } void quarre::interaction::on_end_expression_source_changed(QString source) { m_end_expression_source = source; } QString quarre::interaction::end_expression_source() const { return m_end_expression_source; } const QString &quarre::interaction::end_expression_js() const { return m_end_expression_js; } QString quarre::interaction::end_expression() const { return m_end_expression; } QString quarre::interaction::module() const { return m_module; } QString quarre::interaction::title() const { return m_title; } QString quarre::interaction::description() const { return m_description; } bool quarre::interaction::dispatch_all() const { return m_dispatch_all; } int quarre::interaction::length() const { return m_length; } int quarre::interaction::countdown() const { return m_countdown; } template <> void DataStreamReader::read( const quarre::interaction& e ) { m_stream << e.module(); m_stream << e.dispatch_all(); m_stream << e.title(); m_stream << e.description(); m_stream << e.length(); m_stream << e.countdown(); m_stream << e.end_expression_source(); m_stream << e.end_expression(); m_stream << (qint64) e.m_mappings.size(); for ( const auto& mapping : e.m_mappings ) readFrom( *mapping ); insertDelimiter(); } template <> void DataStreamWriter::write( quarre::interaction& e ) { int msz; QString eex; m_stream >> e.m_module >> e.m_dispatch_all >> e.m_title >> e.m_description >> e.m_length >> e.m_countdown >> e.m_end_expression_source >> eex; e.on_end_expression_changed(eex); m_stream >> msz; for (; msz-- >0;) { auto mp = new quarre::mapping(*this, &e); writeTo(*mp); e.m_mappings.push_back(mp); } checkDelimiter(); } template <> void JSONObjectReader::read( const quarre::interaction& e ) { obj [ "Module" ] = e.module(); obj [ "DispatchAll" ] = e.dispatch_all(); obj [ "Title" ] = e.title(); obj [ "Description" ] = e.description(); obj [ "Length" ] = e.length(); obj [ "Countdown" ] = e.countdown(); obj [ "Expr" ] = e.end_expression(); obj [ "ExprSrc" ] = e.end_expression_source(); obj [ "Mappings" ] = toJsonArray(e.m_mappings); } template <> void JSONObjectWriter::write( quarre::interaction& e ) { e.m_module = obj [ "Module" ].toString(); e.m_dispatch_all = obj [ "DispatchAll" ].toBool(); e.m_title = obj [ "Title" ].toString(); e.m_description = obj [ "Description"].toString(); e.m_length = obj [ "Length"].toInt(); e.m_countdown = obj [ "Countdown" ].toInt(); e.m_end_expression_source = obj [ "ExprSrc" ].toString(); e.on_end_expression_changed ( obj [ "Expr" ].toString()); for ( const auto& json_vref : obj ["Mappings"].toArray()) { JSONObject::Deserializer dsrz (json_vref.toObject()); auto mp = new quarre::mapping(dsrz, &e); e.m_mappings.push_back(mp); } }
70555e16eb82457285b69382668d435ccfbdf07c
c31792ecc2f4558530aea33c2692773932e6cf50
/bulletgba/generator/data/code/daiouzyou/round_6_boss_2.hpp
66a65dc1d1565dfc5e1e3d4fb313b4adece732aa
[ "Unlicense" ]
permissive
pqrs-org/BulletGBA
f65e4e7b964b5bb021a8b95dd7727852e62a866c
a294007902970242b496f2528b4762cfef22bc86
refs/heads/main
2021-08-29T02:12:55.680153
2020-03-22T05:50:28
2020-03-22T05:50:28
249,121,625
12
0
null
null
null
null
UTF-8
C++
false
false
1,843
hpp
round_6_boss_2.hpp
#ifndef GENERATED_392821aa3e2b08ef77581d5e5c66d605_HPP #define GENERATED_392821aa3e2b08ef77581d5e5c66d605_HPP #include "bullet.hpp" void stepfunc_6a44bb20f393a4c1d9283abe159a2ec3_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_d91fbeb3c9cbc08c4af678982ad3c426_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_2e91540b81904a107b66c3e5f979813c_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_c7925c00af925695c9273556d2bf7ed4_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_16152aa766944a2b259efd2ab76637ce_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_9a262eab9bee9a27b0f4b6d72eb6d017_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_5344d4d35d51e560c6ab9392650572e5_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_769bdefb02579aa79348dd03cdd26c8a_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_f46c86bb8f4d5378ece14bfe91d083be_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_62b3d319a1eeb69b2f0d96412f8eb3e9_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); void stepfunc_72f044d58ccfb4d5b2b84dbe3f00df2f_b26ebadaebd607f43b5d7cb9bf8a96f5(BulletInfo *p); extern const BulletStepFunc bullet_cd8961e7d83a0b990306a27515358693_b26ebadaebd607f43b5d7cb9bf8a96f5[]; const unsigned int bullet_cd8961e7d83a0b990306a27515358693_b26ebadaebd607f43b5d7cb9bf8a96f5_size = 3; extern const BulletStepFunc bullet_3e83a87883d96f6e6f46f5864b4bc926_b26ebadaebd607f43b5d7cb9bf8a96f5[]; const unsigned int bullet_3e83a87883d96f6e6f46f5864b4bc926_b26ebadaebd607f43b5d7cb9bf8a96f5_size = 12; extern const BulletStepFunc bullet_dd28c9fbaa455bbd2ae4aa033a80f196_b26ebadaebd607f43b5d7cb9bf8a96f5[]; const unsigned int bullet_dd28c9fbaa455bbd2ae4aa033a80f196_b26ebadaebd607f43b5d7cb9bf8a96f5_size = 10; #endif
19305cb7cf7e4e853125728230e053e93437936b
0dc2640b666b02fc92dfde1660f5625157d4c2ca
/devel/cpp/src/numeric/Histogram.hpp
e903f2dc0669ff55b205149ff129f06a65d82a97
[]
no_license
staticimport/promotelib
878fb63b6697e3c5944c3f7b1c5ac8dc6d140e9f
742b4777919964ee62b52246f3df6c36af4d5e86
refs/heads/master
2021-01-01T18:42:09.152398
2011-09-20T03:55:01
2011-09-20T03:55:01
2,027,477
1
0
null
null
null
null
UTF-8
C++
false
false
3,398
hpp
Histogram.hpp
#ifndef PROMOTE_HISTOGRAM_HPP_ #define PROMOTE_HISTOGRAM_HPP_ #include <cmath> #include <cstdio> #include <cstdlib> #include "PoolQueueAllocator.hpp" #include "TreapMap.hpp" namespace promote { template <typename K> class Histogram { public: Histogram(); ~Histogram() { } // Const bool isEmpty() const { return _sampleCount == 0; } typename Passable<K const>::Type max() const { return _max; } typename Passable<K const>::Type min() const { return _min; } std::size_t sampleCount() const { return _sampleCount; } template <typename T> T mean() const { T value(static_cast<T>(_max)); typename TreapMap<K,uint64_t>::ConstIterator iter; _map.iterator(iter); while( iter.hasNext() ) { TreapMapEntry<K,uint64_t> const& entry(iter.next()); K const& key(entry.key()); uint64_t const count(entry.value()); value = value + (static_cast<T>(key) * (iter.hasNext() ? count : (count-1))); } return value / _sampleCount; } template <typename T> T median() const { typename TreapMap<K,uint64_t>::ConstIterator iter; _map.iterator(iter); for(std::size_t ii = (_map.size()-1) >> 1; ii; --ii) { iter.next(); } if( (_map.size() & 1) ) { return static_cast<T>(iter.next().key()); } else { return static_cast<T>(iter.next().key() + iter.next().key()) / 2; } } template <typename T> T standardDeviation() const { double const mean(Histogram<K>::mean<double>()); double value(0); typename TreapMap<K,uint64_t>::ConstIterator iter; _map.iterator(iter); while( iter.hasNext() ) { TreapMapEntry<K,uint64_t> const& entry(iter.next()); double const diffFromMean(static_cast<double>(entry.key()) - mean); value += entry.value() * (diffFromMean * diffFromMean); } return static_cast<T>(sqrt(value / _sampleCount)); } // Non-Const void add(typename Passable<K const>::Type key) { uint64_t* valuePtr(0); if( _map.find(key, valuePtr) ) { ++(*valuePtr); } else { _map[key] = 1; if( _sampleCount ) { if( key < _min ) { _min = key; } else if( _max < key ) { _max = key; } } else { _min = _max = key; } } ++_sampleCount; } void clear() { _map.clear(); _sampleCount = 0; } private: PoolQueueAllocator<false,false> _pool; TreapMap<K,uint64_t> _map; std::size_t _sampleCount; K _min; K _max; }; } /**** * Implementation ****/ template <typename K> promote::Histogram<K>::Histogram() : _pool(sizeof(TreapMapEntry<K,uint64_t>), 32), _map(_pool), _sampleCount(0) { } #endif /* PROMOTE_HISTOGRAM_HPP_ */
baf2d6b4eb85448070e7aedbf52bbe8b79d60861
909ceff3349b6469c1c5be524bafb3fe8f7f54eb
/src/SerialCommunicator.cpp
c64bbc998bf17864bf6d4ddd13f29f7fe4f8e9b6
[]
no_license
swankun/pendulum
714893d6de99011523e0e0b1cc8556a802432275
35a50268ff07a7d093a3648d04a1b1d5b1f62c86
refs/heads/master
2021-06-20T05:13:35.583104
2017-05-25T01:12:49
2017-05-25T01:12:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,626
cpp
SerialCommunicator.cpp
#include "../include/SerialCommunicator.h" #include <iostream> //#include <cstdio> //#include <windows.h> //#define _USE_MATH_DEFINES // for C++ //#include <cmath> #include <thread> #define M_PI 3.14159265358979323846f #define LOOPRATE_MS 2 #define POWER_OFF 32767 #define BACKWARD_MAX 0 #define FORWARD_MAX USHRT_MAX #define MESSAGE_MAX 65535.0f #define RAD_S_TO_RPM 9.549296596f #define RPM_TO_RAD_S 0.104719755f #define RADS_MAX RPM_MAX*RPM_TO_RAD_S //using std::string; //using std::exception; using std::cout; using std::cerr; using std::endl; using std::vector; /* Constructor */ SerialCommunicator::SerialCommunicator(): port("/dev/ttyACM0"), baud(115200), my_serial(port, baud, serial::Timeout::simpleTimeout(1)) { //my_serial.setTimeout(serial::Timeout::max(), 1, 0, 1, 0); my_serial.flush(); //flush the serial line // Sleep(100); cout << "Is the serial port open?"; if (my_serial.isOpen()) cout << " Yes." << endl; else cout << " No." << endl; // setup the message by setting last byte to be endmessage bytesToBeSent[MESSAGESIZE_WRITE - 1] = endMessage; sentNumber.unsignedShort = 0; //sentNumberLast = sentNumber; writeCount = 0; //int writeCountOld = writeCount; bytes_read = 0; readCount = 0; //durationReadThreadSleepUS = 500; } /* Destructor */ SerialCommunicator::~SerialCommunicator() { } void SerialCommunicator::sendMotorTorque(float torque) { uint16_t message = this->convertTorqueToMessage(torque); this->sendMessage(message); } void SerialCommunicator::sendMessage(uint16_t message) { sentNumber.unsignedShort = message; std::memcpy(bytesToBeSent, sentNumber.binary, SHORTSIZE); bytes_wrote = my_serial.write(bytesToBeSent, MESSAGESIZE_WRITE); //printf("bytes_wrote = %f\n", bytes_wrote*1.0f); printf("Sent Number = %d\n", sentNumber.unsignedShort); writeCount += 1; /* if (writeCount % LOOPCOUNTS_INT == 0) { // cout << "Writ Iter: " << writeCount << ", Len: " << bytes_wrote << ", Val: " << sentNumber.floatingPoint << " BIN: " << (int)sentNumber.binary[0] << " " << (int)sentNumber.binary[1] << " " << (int)sentNumber.binary[2] << " " << (int)sentNumber.binary[3] << endl; printf("Delta: %d, lastSent: %d, received: %d \n", sentNumberLast.unsignedShort - receivedNumber.unsignedShort, sentNumberLast.unsignedShort, receivedNumber.unsignedShort); // writeCountOld = writeCount; } if (writeCount % LOOPCOUNTS_INT == 1) { // cout << "Read Iter: " << readCount << ", Len: " << bytes_read << ", Val: " << receivedNumber.floatingPoint << " BIN: " << (int)receivedNumber.binary[0] << " " << (int)receivedNumber.binary[1] << " " << (int)receivedNumber.binary[2] << " " << (int)receivedNumber.binary[3] << endl; // cout << "-----------------------------------------------------------------------------" << endl; // writeCountOld = writeCount; } */ sentNumberLast = sentNumber; } float SerialCommunicator::readEncoderRad() { this->getNewMessage(); return this->convertMessageToRad(receivedNumber.unsignedShort); } void SerialCommunicator::getNewMessage() { whatIsAvailable = my_serial.available(); //cout << "Bytes Available: " << whatIsAvailable << endl; if (whatIsAvailable < MESSAGESIZE) printf("too short message - bytes Available: %d\n", whatIsAvailable); if (whatIsAvailable > MESSAGESIZE - 1) { bytes_read = my_serial.read(incomingData, whatIsAvailable); //cout << "Bytes read: " << length << endl; //if (bytes_read == MESSAGESIZE && incomingData[MESSAGESIZE - 1] == endMessage) if (incomingData[bytes_read - 1] == endMessage) { std::memcpy(receivedNumber.binary, &(incomingData[bytes_read - 1 - SHORTSIZE]), SHORTSIZE); //std::memcpy(receivedNumber.binary, incomingData), SHORTSIZE); //std::memcpy(otherNumber.binary, &(incomingData[FLOATSIZE]), FLOATSIZE); readCount++; //if (readCount % LOOPCOUNTS_INT == 0) // cout << "Read Iter: " << readCount << ", Len: " << bytes_read << ", Val: " << receivedNumber.unsignedShort << endl; if (whatIsAvailable > MESSAGESIZE) printf("long message (multiple) - bytes Available: %d\n", whatIsAvailable); } else { printf("long message (wrong length) - bytes Available: %d\n", whatIsAvailable); } } } uint16_t SerialCommunicator::convertTorqueToMessage(float torque) { double desiredCurrent = torque/KTAU; if (desiredCurrent < -CURRENT_LIMIT) desiredCurrent = -CURRENT_LIMIT; if (desiredCurrent > CURRENT_LIMIT) desiredCurrent = CURRENT_LIMIT; printf("Tau = %4.3f\n", torque); return (USHRT_MAX/2.0/CURRENT_LIMIT * desiredCurrent + USHRT_MAX/2); } float SerialCommunicator::convertMessageToRad(uint16_t message) { return MAX_REVOLUTIONS * 2 * M_PI / USHRT_MAX * message - MAX_REVOLUTIONS / 2 * 2 * M_PI; } void SerialCommunicator::enumerate_ports() { vector<serial::PortInfo> devices_found = serial::list_ports(); vector<serial::PortInfo>::iterator iter = devices_found.begin(); while (iter != devices_found.end()) { serial::PortInfo device = *iter++; printf("(%s, %s, %s)\n", device.port.c_str(), device.description.c_str(), device.hardware_id.c_str()); } } void SerialCommunicator::print_usage() { cerr << "Usage: test_serial {-e|<serial port address>} "; cerr << "<baudrate> [test string]" << endl; }
fca55b1a8b2fa3f5e85722b251eed906bc104ca9
3d06f6d33f3f1cb17169dc603dcaed4ba0930307
/SFML_Game/enemy.cpp
d363a056303a36a2a979152684c759e76f23227c
[]
no_license
LukaszSielski/Programy
76f3196e325488b86e55471080316c2b8251d43d
89b2c34104363a4e118751698d12d3d534363435
refs/heads/master
2021-01-23T04:39:35.275216
2017-05-31T11:09:47
2017-05-31T11:09:47
92,937,214
0
0
null
null
null
null
UTF-8
C++
false
false
1,022
cpp
enemy.cpp
#include "enemy.h" Enemy::Enemy() { rect.setSize(sf::Vector2f(32,32)); rect.setPosition(0,0); rect.setFillColor(sf::Color::Red); sprite.setTextureRect(sf::IntRect(49*4,0,49,49)); } void Enemy::update() { sprite.setPosition(rect.getPosition()); } void Enemy::updateMovement() { if(direction == 1) { rect.move(0,-movementSpeed); } else if(direction == 2) { rect.move(0,movementSpeed); } else if(direction == 3) { rect.move(-movementSpeed,0); sprite.setTextureRect(sf::IntRect((49*4)+49*counterWalking,0,49,49)); } else if(direction == 4) { rect.move(movementSpeed,0); sprite.setTextureRect(sf::IntRect((49*6)+49*counterWalking,0,49,49)); } else { //No movement } counterWalking++; if(counterWalking == 1) { counterWalking = 0; } counter++; if(counter >= movementLength) { counter = 0; direction = generateRandom(10); } }
9b506bbbefc13d660e6be77ff2b9627f44d2eb21
24b8aef808a1722b29ee22dc26b2dec0447db427
/模拟考试/1152-1155(得分92)/1154 Vertex Coloring (25 分)/1154.cpp
da22c38038df7bbc5837cdf0a43449773aff4f39
[]
no_license
drincs/100-day-plan
63f080a5328a58cb6f1fe1e97677a13f05d50c45
ff06270f5d8d53fea3d34d990bb3ff336bb77557
refs/heads/main
2023-07-25T10:10:52.797163
2021-09-09T10:25:31
2021-09-09T10:25:31
359,845,885
0
0
null
null
null
null
UTF-8
C++
false
false
1,010
cpp
1154.cpp
#include <iostream> #include <vector> #include <map> #include <set> using namespace std; struct edge { int x; int y; }; vector<edge> edges; int main() { int n, m, k; scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) { edge t; scanf("%d %d", &t.x, &t.y); if (t.x != t.y) edges.push_back(t); } scanf("%d", &k); for (int i = 0; i < k; i++) { vector<int> color; set<int> maxk; for (int j = 0; j < n; j++) { int t; scanf("%d", &t); color.push_back(t); maxk.insert(t); } bool isColor = true; for (int j = 0; j < m; j++) { if (color[edges[j].x] == color[edges[j].y]) { isColor = false; break; } } if (isColor) printf("%d-coloring\n", maxk.size()); else printf("No\n"); } system("pause"); return 0; }
ec8955fb7f320f7d8a6d398c5028e97e1db8a718
4ff94a09467dcca356fa903508773d4707ecca2e
/akillimarketarabasi.ino
8c02cf35908b990a5e843366e6db148d7d24bc05
[]
no_license
ahmetanilsari/arduinoakillimarketarabasi
514f0adea26cadf32d63356c9c35cd303a0ebd22
b1f4f4768ac89152a1ec22ef40631955e1875953
refs/heads/main
2023-01-20T22:20:54.523108
2020-12-05T20:31:30
2020-12-05T20:31:30
318,880,891
1
0
null
null
null
null
UTF-8
C++
false
false
91,428
ino
akillimarketarabasi.ino
#include <hid.h> #include <hiduniversal.h> #include <usbhub.h> #include <avr/pgmspace.h> #include <Usb.h> #include <usbhub.h> #include <avr/pgmspace.h> #include <hidboot.h> #include "U8glib.h" U8GLIB_ST7920_128X64 u8g( 13,11,10,U8G_PIN_NONE); //U8G_PIN_NONE int dizi[100]; int i=0; int t=0; int s=0; //int x=0; int toplam1=1; float toplam2=0; float agirlik=0; /////////// URUNLER //////////////////////////////// char bumbo[]="ETI BUMBO BISKUVI 2 TL"; //579 char mendil[]="SELPAK MENDIL 1.5 TL"; //425 char caramio[]="ULKER CARAMIO 1 TL"; //595 char dido[]="ULKER DIDO 1.5 TL"; //537 char popkek[]="ETI POPKEK 0.75 TL"; //585 char su[]="KAYIN SU 0.5 LT 1 TL"; //539 USB Usb; USBHub Hub(&Usb); // //I enable this line HIDUniversal Hid(&Usb); //Add this line so that the barcode scanner will be recognized, I use "Hid" below HIDBoot<HID_PROTOCOL_KEYBOARD> Keyboard(&Usb); // class KbdRptParser : public KeyboardReportParser { void PrintKey(uint8_t mod, uint8_t key); // Add this line to print character in ASCII protected: virtual void OnKeyDown (uint8_t mod, uint8_t key); virtual void OnKeyPressed(uint8_t key); }; void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key) { uint8_t c = OemToAscii(mod, key); if (c) { OnKeyPressed(c); if(c!=19) { if(c!=48) { toplam1=toplam1+c; } if(c==48) { toplam1=toplam1+0; } } else { dizi[i]=toplam1; toplam1=1; Serial.println(dizi[i]); i++; } } } void KbdRptParser::OnKeyPressed(uint8_t key) { }; KbdRptParser Prs; void setup(void) { Serial.begin( 115200 ); Serial.println("Start"); if (Usb.Init() == -1) { Serial.println("OSC did not start."); } Hid.SetReportParser(0, (HIDReportParser*)&Prs); //Here I change "Keyboard" for "Hid" } void loop() { u8g.firstPage(); do { draw(); } while( u8g.nextPage() ); Usb.Task(); } void draw(void) { ///////////////****************************************** 1.SAYFA ******************///////////////////////////////////////////////////////////////////////////// if(s==0) { if(dizi[0]==425) { if(t==0) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[0]==595) { if(t==0) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[0]==585) { if(t==0) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[0]==537) { if(t==0) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[0]==539) { if(t==0) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[0]==579) { if(t==0) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[1]==425) { if(t==1) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 16); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[1]==595) { if(t==1) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 16); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[1]==537) { if(t==1) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 16); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[1]==539) { if(t==1) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 16); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[1]==585) { if(t==1) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 16); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[1]==579) { if(t==1) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[2]==579) { if(t==2) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[2]==595) { if(t==2) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[2]==537) { if(t==2) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[2]==539) { if(t==2) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[2]==585) { if(t==2) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[2]==425) { if(t==2) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[3]==579) { if(t==3) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[3]==425) { if(t==3) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[3]==595) { if(t==3) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[3]==585) { if(t==3) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[3]==537) { if(t==3) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[3]==539) { if(t==3) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[4]==579) { if(t==4) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[4]==425) { if(t==4) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[4]==595) { if(t==4) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[4]==585) { if(t==4) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[4]==537) { if(t==4) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[4]==539) { if(t==4) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } ///// //// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[5]==579) { if(t==5) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[5]==425) { if(t==5) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[5]==595) { if(t==5) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[5]==585) { if(t==5) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[5]==537) { if(t==5) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } if(dizi[5]==539) { if(t==5) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[6]==579 || dizi[6]==595 || dizi[6]==537 || dizi[6]==425 || dizi[6]==585 || dizi[6]==539) { if(t==6) { t=t+1; s=s+1; } /* u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 54); u8g.print("BUMBO 2 TL 35GR"); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); */ } } ////////////***************************** 2.sayfa *********************************////////////////////////////////////////////////////////////////////////// if(s==1) { if(dizi[6]==425) { if(t==7) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[6]==579) { if(t==7) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[6]==595) { if(t==7) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[6]==585) { if(t==7) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[6]==537) { if(t==7) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[6]==539) { if(t==7) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[7]==425) { if(t==8) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 16); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[7]==579) { if(t==8) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[7]==595) { if(t==8) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[7]==585) { if(t==8) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[7]==537) { if(t==8) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[7]==539) { if(t==8) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[8]==579) { if(t==9) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[8]==595) { if(t==9) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[8]==585) { if(t==9) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[8]==537) { if(t==9) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[8]==539) { if(t==9) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[8]==425) { if(t==9) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[9]==579) { if(t==10) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[9]==595) { if(t==10) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[9]==585) { if(t==10) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[9]==537) { if(t==10) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[9]==539) { if(t==10) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[9]==425) { if(t==10) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[10]==579) { if(t==11) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[10]==595) { if(t==11) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[10]==585) { if(t==11) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[10]==537) { if(t==11) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[10]==539) { if(t==11) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[10]==425) { if(t==11) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[11]==579) { if(t==12) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[11]==595) { if(t==12) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[11]==585) { if(t==12) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[11]==537) { if(t==12) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[11]==539) { if(t==12) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } if(dizi[11]==425) { if(t==12) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[12]==579 || dizi[12]==595 || dizi[12]==537 || dizi[12]==425 || dizi[12]==585 || dizi[12]==539) { if(t==13) { t=t+1; s=s+1; } /* u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 54); u8g.print("BUMBO 2 TL 35GR"); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-1); u8g.print("ADET"); */ } } ///////////////////////////////////////////////********************** 3. SAYFA ************************////////////////////////////////////////////////////////////////// if(s==2) { if(dizi[12]==425) { if(t==14) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[12]==579) { if(t==14) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[12]==595) { if(t==14) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[12]==585) { if(t==14) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[12]==537) { if(t==14) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[12]==539) { if(t==14) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[13]==425) { if(t==15) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 16); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[13]==579) { if(t==15) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[13]==595) { if(t==15) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[13]==585) { if(t==15) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[13]==537) { if(t==15) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[13]==539) { if(t==15) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[14]==579) { if(t==16) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[14]==595) { if(t==16) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[14]==585) { if(t==16) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[14]==537) { if(t==16) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[14]==539) { if(t==16) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[14]==425) { if(t==16) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[15]==579) { if(t==17) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[15]==595) { if(t==17) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[15]==585) { if(t==17) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[15]==537) { if(t==17) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[15]==539) { if(t==17) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[15]==425) { if(t==17) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[16]==579) { if(t==18) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[16]==595) { if(t==18) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[16]==585) { if(t==18) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[16]==537) { if(t==18) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[16]==539) { if(t==18) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[16]==425) { if(t==18) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[17]==579) { if(t==19) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[17]==595) { if(t==19) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[17]==585) { if(t==19) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[17]==537) { if(t==19) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[17]==539) { if(t==19) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } if(dizi[17]==425) { if(t==19) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-2); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[18]==579 || dizi[18]==595 || dizi[18]==537 || dizi[18]==425 || dizi[18]==585 || dizi[18]==539) { if(t==20) { t=t+1; s=s+1; } /* u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 54); u8g.print("BUMBO 2 TL 35GR"); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t); u8g.print("ADET"); */ } } ////////////*************************** 4. SAYFA ***************/////////////////////////////////////////////////////////////////////////////////////////////////// if(s==3) { if(dizi[18]==425) { if(t==21) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[18]==579) { if(t==21) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[18]==595) { if(t==21) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[18]==585) { if(t==21) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[18]==537) { if(t==21) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[18]==539) { if(t==21) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[19]==425) { if(t==22) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 16); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[19]==579) { if(t==22) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[19]==595) { if(t==22) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[19]==585) { if(t==22) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[19]==537) { if(t==22) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[19]==539) { if(t==22) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[20]==579) { if(t==23) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[20]==595) { if(t==23) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[20]==585) { if(t==23) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[20]==537) { if(t==23) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[20]==539) { if(t==23) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[20]==425) { if(t==23) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[21]==579) { if(t==24) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[21]==595) { if(t==24) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[21]==585) { if(t==24) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[21]==537) { if(t==24) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[21]==539) { if(t==24) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[21]==425) { if(t==24) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[22]==579) { if(t==25) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[22]==595) { if(t==25) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[22]==585) { if(t==25) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[22]==537) { if(t==25) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[22]==539) { if(t==25) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[22]==425) { if(t==25) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[23]==579) { if(t==26) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[23]==595) { if(t==26) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[23]==585) { if(t==26) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[23]==537) { if(t==26) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[23]==539) { if(t==26) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } if(dizi[23]==425) { if(t==26) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[24]==579 || dizi[24]==595 || dizi[24]==537 || dizi[24]==425 || dizi[24]==585 || dizi[24]==539) { if(t==27) { t=t+1; s=s+1; } /* u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 54); u8g.print("BUMBO 2 TL 35GR"); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); */ } } //////////////////////**************************************** 5.SAYFA *******************////////////////////////////////////////////////////////////////////////////////////// if(s==4) { if(dizi[24]==425) { if(t==28) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[24]==579) { if(t==28) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[24]==595) { if(t==28) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[24]==585) { if(t==28) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[24]==537) { if(t==28) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[24]==539) { if(t==28) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 7); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[25]==425) { if(t==29) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 16); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[25]==579) { if(t==29) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[25]==595) { if(t==29) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[25]==585) { if(t==29) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[25]==537) { if(t==29) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[25]==539) { if(t==29) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0,16); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[26]==579) { if(t==30) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[26]==595) { if(t==30) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[26]==585) { if(t==30) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[26]==537) { if(t==30) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[26]==539) { if(t==30) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[26]==425) { if(t==30) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 25); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[27]==579) { if(t==31) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[27]==595) { if(t==31) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[27]==585) { if(t==31) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[27]==537) { if(t==31) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[27]==539) { if(t==31) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[27]==425) { if(t==31) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 34); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[28]==579) { if(t==32) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[28]==595) { if(t==32) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[28]==585) { if(t==32) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[28]==537) { if(t==32) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[28]==539) { if(t==32) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[28]==425) { if(t==32) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 43); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[29]==579) { if(t==33) { toplam2+=2; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(bumbo); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[29]==595) { if(t==33) { toplam2+=1; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(caramio); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[29]==585) { if(t==33) { toplam2+=0.75; agirlik+=60.50; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(popkek); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[29]==537) { if(t==33) { toplam2+=1.5; agirlik+=35; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(dido); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[29]==539) { if(t==33) { toplam2+=1; agirlik+=100; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(su); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } if(dizi[29]==425) { if(t==33) { toplam2+=1.5; agirlik+=20; t=t+1; } u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 52); u8g.print(mendil); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-4); u8g.print("ADET"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(dizi[30]==579) { if(t==34) { t=t+1; s=s+1; } /* u8g.setFont(u8g_font_6x10); u8g.setPrintPos(0, 54); u8g.print("BUMBO 2 TL 35GR"); u8g.setFont(u8g_font_6x13); u8g.setPrintPos(0, 64); u8g.print(toplam2); u8g.print("TL,"); u8g.print(agirlik);u8g.print("GR,"); u8g.print(t-3); u8g.print("ADET"); */ } } }
d6b3afe3d9f64428cca87eece8a25abca3986dc3
b6d2cb74a76194fd25fdc3607ef828e94d98039e
/Contests/Pacific Northwest Regional/2016-2017-Div.1/G.cpp
a4ab28cbbc0d84b244c7b9af1ff41d6eb7d48d27
[]
no_license
giovaneaf/CompetitiveProgramming
22d63481015ab45a03d527c866cae339cffeb5fb
863f6bc61497591cb98e50973aa23bfcb9879ab8
refs/heads/master
2021-06-07T20:28:45.116299
2021-05-25T00:38:16
2021-05-25T00:38:16
131,643,425
6
1
null
null
null
null
UTF-8
C++
false
false
2,743
cpp
G.cpp
#include <bits/stdc++.h> using namespace std; #define MAXN 200010 #define LOGMAXN 20 #define INF 1000000010 typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<int> vi; typedef long long ll; int n, m, nOfCs; string M[45]; bool visited[45][45]; int dr[] = {1, 0, -1, 0}; int dc[] = {0, 1, 0, -1}; bool bpm(vi* adj, int cur, vector<bool>& seen, vi& match) { for(int j = 0; j < adj[cur].size(); ++j) { int u = adj[cur][j]; if(!seen[u]) { seen[u] = true; if(match[u] == -1 || bpm(adj, match[u], seen, match)) { match[u] = cur; return true; } } } return false; } int maxMatching(vi& first, vi& second, vi* adj) { vi match; match.assign(nOfCs, -1); int mx = 0; for(int i = 0; i < first.size(); ++i) { vector<bool> seen; seen.assign(nOfCs, false); if(bpm(adj, first[i], seen, match)) mx++; } return mx; } void ff(int r, int c) { visited[r][c] = true; for(int i = 0; i < 4; ++i) { int nr = r + dr[i]; int nc = c + dc[i]; if(nr < 0 || nc < 0 || nr >= n || nc >= m || M[nr][nc] != 'L' || visited[nr][nc]) continue; // out of bounds or not land! ff(nr, nc); } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); while(cin >> n >> m) { for(int i = 0; i < n; ++i) cin >> M[i]; nOfCs = 0; map<ii, int> mp; for(int i = 0; i < n; ++i) { for(int j = 0; j < m; ++j) { visited[i][j] = false; if(M[i][j] == 'L') { for(int k = 0; k < 4; ++k) { int nr = i + dr[k]; int nc = j + dc[k]; if(nr < 0 || nc < 0 || nr >= n || nc >= m || M[nr][nc] != 'C') continue; // out of bounds or filled cell! M[nr][nc] = 'W'; } } } } for(int i = 0; i < n; ++i) { for(int j = 0; j < m; ++j) { if(M[i][j] == 'C') { mp[{i, j}] = nOfCs++; } } } vi adj[nOfCs]; vi first; // first bipartite set vi second; // second bipartite set for(int i = 0; i < n; ++i) { for(int j = 0; j < m; ++j) { if(M[i][j] == 'C') { if((i+j) & 1) { int idx1 = mp[{i, j}]; first.push_back(idx1); for(int k = 0; k < 4; ++k) { int nr = i + dr[k]; int nc = j + dc[k]; if(nr < 0 || nc < 0 || nr >= n || nc >= m || M[nr][nc] != 'C') continue; // out of bounds or filled cell! int idx2 = mp[{nr, nc}]; adj[idx1].push_back(idx2); adj[idx2].push_back(idx1); } } else { second.push_back(mp[{i, j}]); } } } } int ansff = 0; for(int i = 0; i < n; ++i) { for(int j = 0; j < m; ++j) { if(visited[i][j] || M[i][j] != 'L') continue; ansff++; ff(i, j); } } cout << ansff + nOfCs - maxMatching(first, second, adj) << '\n'; } return 0; }
5799142f1e6714566150e04ad9aac4d7101d2ca0
c6c2672f74d8b32d2f7164b6296a33a2a16a28e7
/src/ActionRecognition/Dense.cc
fcc7365f64e8fa28c7c9b1edbc0100599b91fd68
[]
no_license
RaduAlexandru/Dense-Trajectories
31b3e3b1a7e67b7b36a932d0f27d23d979fe3372
b2a06f59e2b9fa46e572c0a39e50a98a407daf23
refs/heads/master
2021-01-21T07:13:53.795531
2017-05-24T19:13:37
2017-05-24T19:13:37
91,604,690
1
0
null
null
null
null
UTF-8
C++
false
false
34,088
cc
Dense.cc
#include "Dense.hh" #include <algorithm> using namespace ActionRecognition; const Core::ParameterString Dense::paramVideoList_("video-list", "", "dense"); // constructor Dense::Dense(): videoList_(Core::Configuration::config(paramVideoList_)) {} // empty destructor Dense::~Dense() {} void Dense::showVideo(const Video& vid) { Video video = vid; for (u32 t = 0; t < video.size(); t++) { cv::namedWindow( "Display window", cv::WINDOW_AUTOSIZE ); cv::imshow("Display window", video.at(t)); cv::waitKey(0); } } cv::Mat Dense::mat2gray(const cv::Mat& src){ cv::Mat dst; cv::normalize(src, dst, 0.0, 255.0, cv::NORM_MINMAX, CV_8U); return dst; } void Dense::readVideo(const std::string& filename, Video& result) { // open video file cv::VideoCapture capture(filename); if(!capture.isOpened()) Core::Error::msg() << "Unable to open Video: " << filename << Core::Error::abort; cv::Mat frame, tmp; result.clear(); // read all frames u32 nFrames = capture.get(CV_CAP_PROP_FRAME_COUNT); while ((nFrames > 0) && (capture.read(frame))) { if (frame.channels() == 3) cv::cvtColor(frame, tmp, CV_BGR2GRAY); else tmp = frame; result.push_back(cv::Mat()); tmp.convertTo(result.back(), CV_32FC1, 1.0/255.0); nFrames--; } capture.release(); } void Dense::opticalFlow(const Video& video, Video& flow, Video& flowAngle, Video& flowMag) { flow.clear(); flowAngle.clear(); flowMag.clear(); for (u32 t = 0; t < video.size() - 1; t++) { cv::Mat tmpFlow; cv::Mat tmpXY[2]; //we need to denormalize the images before calculatng the optical flow otherwise the output of it is wrong and scaled cv::normalize(video[t], video[t], 0.0f, 255.0f, cv::NORM_MINMAX, CV_32FC1); cv::normalize(video[t+1], video[t+1], 0.0f, 255.0f, cv::NORM_MINMAX, CV_32FC1); // cv::calcOpticalFlowFarneback(video.at(t), video.at(t+1), tmpFlow, 0.702, 5, 10, 2, 7, 1.5, cv::OPTFLOW_FARNEBACK_GAUSSIAN ); cv::calcOpticalFlowFarneback(video.at(t), video.at(t+1), tmpFlow, 0.5, 3, 15, 3, 5, 1.2, 0); cv::normalize(video[t], video[t], 0.0f, 1.0f, cv::NORM_MINMAX, CV_32FC1); cv::normalize(video[t+1], video[t+1], 0.0f, 1.0f, cv::NORM_MINMAX, CV_32FC1); cv::split(tmpFlow, tmpXY); cv::Mat magnitude, angle; cv::cartToPolar(tmpXY[0], tmpXY[1], magnitude, angle, true); flowAngle.push_back(angle); flowMag.push_back(magnitude); //median filter it cv::Mat flowChannels[2]; cv::split(tmpFlow, flowChannels); cv::medianBlur(flowChannels[0], flowChannels[0], 5); cv::medianBlur(flowChannels[1], flowChannels[1], 5); cv::merge(flowChannels, 2, tmpFlow); flow.push_back(tmpFlow); } } //create Track objects from a vector of points corresponding to detections in the image void Dense::makeTracks(std::vector<Track>& tracks, std::vector<cv::Point>& points, int start_time){ for (size_t i = 0; i < points.size(); i++) { tracks.push_back( Track( points[i], start_time ) ); } } void Dense::track(std::vector<Track>& tracks, Video& flow){ for (size_t i = 0; i < tracks.size(); i++) { if (tracks[i].getLength()<15){ cv::Point new_point; int x=tracks[i].getLastPoint().x; int y=tracks[i].getLastPoint().y; int t=tracks[i].getLastTime(); new_point.x = tracks[i].getLastPoint().x + flow[t].at<cv::Point2f>(y,x).x; new_point.y = tracks[i].getLastPoint().y + flow[t].at<cv::Point2f>(y,x).y; //The tracks sometimes get out of the video for some reason if (new_point.x<0 || new_point.x>flow[0].cols){ continue; } if (new_point.y<0 || new_point.x>flow[0].rows){ continue; } tracks[i].addPoint(new_point); } } } void Dense::extractTrajectories(Video& video, Video& flow, std::vector<Track> & tracks){ tracks.clear(); for (u_int i = 0 ; i < video.size()-1;i++){ if (i==0){ std::vector<cv::Point> points; denseSample(video[i],points,5); makeTracks(tracks,points,i); } //with some criteria sample again if (i%12==0){ std::vector<cv::Point> points; denseSample(video[i],points,5); makeTracks(tracks,points,i); } track (tracks, flow); } } void Dense::denseSample(cv::Mat frame, std::vector<cv::Point>& points, int stepSize){ cv::Mat minEigenvalMat; cv::cornerMinEigenVal( frame, minEigenvalMat, 3, 3, cv::BORDER_DEFAULT ); //get the threhold double maxEigenval = 0; cv::minMaxLoc(minEigenvalMat, 0, &maxEigenval); float threshold = maxEigenval*0.001; MemoryAccessor minEigenvalMat_acc (minEigenvalMat.rows, minEigenvalMat.cols, (Float*) minEigenvalMat.data); for (u32 x = 0; x < minEigenvalMat.cols-stepSize; x=x+stepSize) { for (u32 y = 0; y < minEigenvalMat.rows-stepSize; y=y+stepSize) { if (minEigenvalMat_acc(y,x)>threshold){ points.push_back(cv::Point(x,y)); } } } // //draw the points on the frame // for (size_t i = 0; i < points.size(); i++) { // cv::circle(frame, points[i], 3, cv::Scalar(0,0,255)); // } // // // // cv::namedWindow( "Display window", cv::WINDOW_AUTOSIZE ); // // cv::imshow("Display window", mat2gray(minEigenvalMat)); // cv::imshow("Display window", frame); // cv::waitKey(0); } void Dense::filterTracks(std::vector<Track>& tracks){ //remove the ones that don't have a length of 15 std::vector<Track>::iterator it; for(it = tracks.begin(); it != tracks.end();){ if(it->getLength()<15){ it = tracks.erase(it); } else{ ++it; } } //remove the ones that are almost constant for(it = tracks.begin(); it != tracks.end();){ int displacement=0; for (size_t p_id = 0; p_id < it->getLength()-1; p_id++) { int dis_x= std::fabs(it->getPoint(p_id).x - it->getPoint(p_id+1).x); int dis_y= std::fabs(it->getPoint(p_id).y - it->getPoint(p_id+1).y); displacement+=std::sqrt( dis_x*dis_x + dis_y*dis_y ); } if (displacement<=12){ it = tracks.erase(it); } else{ ++it; } } } //write tracks to file in a format representable by gnuploy void Dense::writeTracksToFile(std::string trackFile, std::vector<Track> tracks){ std::ofstream myfile; myfile.open (trackFile); myfile << "# X Y Z\n"; for (size_t i = 0; i < tracks.size(); i++) { for (size_t p_id = 0; p_id < tracks[i].getLength(); p_id++) { myfile << tracks[i].getPoint(p_id).x << " " << tracks[i].getPoint(p_id).y << " " << tracks[i].getStartTime()+p_id << "\n"; } myfile << "\n"; } myfile.close(); } void Dense::derivatives(const Video& in, Video& Lx, Video& Ly, Video& Lt) { Lx.resize(in.size() - 1); Ly.resize(in.size() - 1); Lt.resize(in.size() - 1); /* loop over the original frames */ for (u32 t = 0; t < in.size() - 1; t++) { cv::Sobel(in.at(t), Lx.at(t), CV_32FC1, 1, 0, 3, 1, 0, cv::BORDER_DEFAULT); cv::Sobel(in.at(t), Ly.at(t), CV_32FC1, 0, 1, 3, 1, 0, cv::BORDER_DEFAULT); Lt.at(t) = in.at(t) - in.at(t+1); } } void Dense::compute_grad_orientations_magnitudes(Video Lx, Video Ly, Video& grad_mags, Video& grad_orientations ){ std::cout << "compute_grad_orientations_magnitudes" << '\n'; grad_mags.clear(); grad_orientations.clear(); bool useDegree = true; // use degree or rad grad_mags.resize(Lx.size()); grad_orientations.resize(Lx.size()); for (size_t i = 0; i < Lx.size(); i++) { // the range of the direction is [0,2pi) or [0, 360) cv::cartToPolar(Lx[i], Ly[i], grad_mags[i], grad_orientations[i], useDegree); } } void Dense::compute_mbh(Video flow, Video& mbh_x_mag, Video& mbh_x_orientation, Video& mbh_y_mag, Video& mbh_y_orientation){ mbh_x_mag.resize(flow.size()); mbh_x_orientation.resize(flow.size()); mbh_y_mag.resize(flow.size()); mbh_y_orientation.resize(flow.size()); for (size_t i = 0; i < flow.size(); i++) { cv::Mat tmpXY[2]; cv::split(flow[i], tmpXY); //mbh_x cv::Mat dx, dy; cv::Sobel(tmpXY[0], dx, CV_32FC1, 1, 0, 3, 1, 0, cv::BORDER_DEFAULT); cv::Sobel(tmpXY[0], dy, CV_32FC1, 0, 1, 3, 1, 0, cv::BORDER_DEFAULT); cv::cartToPolar(dx, dy, mbh_x_mag[i], mbh_x_orientation[i], true); //mbh_y cv::Sobel(tmpXY[1], dx, CV_32FC1, 1, 0, 3, 1, 0, cv::BORDER_DEFAULT); cv::Sobel(tmpXY[1], dy, CV_32FC1, 0, 1, 3, 1, 0, cv::BORDER_DEFAULT); cv::cartToPolar(dx, dy, mbh_y_mag[i], mbh_y_orientation[i], true); } } void Dense::computeDescriptors(Video& video,std::vector<Track>& tracks, Video Lx, Video Ly, Video flow, Video flowAngle, Video flowMag ){ int vol_x_size=32; int vol_y_size=32; int vol_t_size=15; int cell_per_vol_x=2; int cell_per_vol_y=2; int cell_per_vol_t=3; int nbins_hog=8; float hist_range=360.0f; float mag_thresh_low=1e-8; int cell_size_x=std::ceil(vol_x_size/(float)cell_per_vol_x); int cell_size_y=std::ceil(vol_y_size/(float)cell_per_vol_y); int cell_size_t=std::ceil(vol_t_size/(float)cell_per_vol_t); //compute gradient orientation and magnitude Video grad_mags, grad_orientations; Video mbh_x_mags, mbh_x_orientations, mbh_y_mags, mbh_y_orientations; compute_grad_orientations_magnitudes(Lx,Ly,grad_mags,grad_orientations); compute_mbh(flow,mbh_x_mags,mbh_x_orientations, mbh_y_mags, mbh_y_orientations); //get descriptor for (size_t i = 0; i < tracks.size(); i++) { Histogram descriptor; std::vector<float> traj_desc= tracks[i].getDescriptor(); descriptor.concatenate(traj_desc); //hog utils::Array<Histogram, 3> hist_hog_vol; size_t size_hog_vol [3]= { cell_per_vol_t, cell_per_vol_y, cell_per_vol_x }; // Array dimensions hist_hog_vol.resize(size_hog_vol,Histogram(nbins_hog, hist_range)); //hof for normal flow utils::Array<Histogram, 3> hist_hof_vol; size_t size_hof_vol [3]= { cell_per_vol_t, cell_per_vol_y, cell_per_vol_x }; // Array dimensions hist_hof_vol.resize(size_hof_vol,Histogram(nbins_hog, hist_range)); //hof with 1 bin for the bin that has low magnitude utils::Array<Histogram, 3> hist_hof_low_mag_vol; hist_hof_low_mag_vol.resize(size_hof_vol,Histogram(1, 360.0f)); //mbh_x utils::Array<Histogram, 3> hist_mbhx_vol; hist_mbhx_vol.resize(size_hog_vol,Histogram(nbins_hog, hist_range)); //mbh_y utils::Array<Histogram, 3> hist_mbhy_vol; hist_mbhy_vol.resize(size_hog_vol,Histogram(nbins_hog, hist_range)); for (size_t t = 0; t < tracks[i].getLength()-1; t++) { for (size_t y = std::max(0,tracks[i].getPoint(t).y-16); y < std::min(video[0].rows,tracks[i].getPoint(t).y+15); y++) { for (size_t x = std::max(0,tracks[i].getPoint(t).x-16); x < std::min(video[0].cols,tracks[i].getPoint(t).x+15); x++) { //get which cell of the 16x16x5 volume does this pixel belong to int cell_idx_x= (x- (tracks[i].getPoint(t).x - vol_x_size/2 ) )/cell_size_x; int cell_idx_y= (y- (tracks[i].getPoint(t).y - vol_y_size/2 ) )/cell_size_y; int cell_idx_t= t/cell_size_t; // std::cout << "cell indexing i" << cell_idx_x << " " << cell_idx_y << " " << cell_idx_t << '\n'; //we need it because the idx in time needs to be the time of the point + the time when the track started int t_idx=t+tracks[i].getStartTime(); float grad_mag=grad_mags[t_idx].at<float>(y,x); float grad_orientation=grad_orientations[t_idx].at<float>(y,x); float flow_mag=flowMag[t_idx].at<float>(y,x); float flow_orientation=flowAngle[t_idx].at<float>(y,x); float mbh_x_mag=mbh_x_mags[t_idx].at<float>(y,x); float mbh_x_orientation=mbh_x_orientations[t_idx].at<float>(y,x); float mbh_y_mag=mbh_y_mags[t_idx].at<float>(y,x); float mbh_y_orientation=mbh_y_orientations[t_idx].at<float>(y,x); //hog hist_hog_vol[cell_idx_t][cell_idx_y][cell_idx_x].add_val(grad_orientation,grad_mag); //hof if (flow_mag<mag_thresh_low) { hist_hof_low_mag_vol[cell_idx_t][cell_idx_y][cell_idx_x].add_val(flow_orientation,flow_mag); }else{ hist_hof_vol[cell_idx_t][cell_idx_y][cell_idx_x].add_val(flow_orientation,flow_mag); } //mbh_x hist_mbhx_vol[cell_idx_t][cell_idx_y][cell_idx_x].add_val(mbh_x_orientation,mbh_x_mag); //mbh_y hist_mbhy_vol[cell_idx_t][cell_idx_y][cell_idx_x].add_val(mbh_y_orientation,mbh_y_mag); } } } //concatenate the the low threshold with the high threshold HOF for (size_t t = 0; t < cell_per_vol_t; t++) { for (size_t y = 0; y < cell_per_vol_y; y++) { for (size_t x = 0; x < cell_per_vol_x; x++) { hist_hof_vol[t][y][x].concatenate(hist_hof_low_mag_vol[t][y][x]); } } } Histogram hof_full; for(auto hist: hist_hof_vol){ hof_full.concatenate(hist); } hof_full.normalize(); Histogram hog_full; for(auto hist: hist_hog_vol){ hog_full.concatenate(hist); } hog_full.normalize(); Histogram mbhx_full; for(auto hist: hist_mbhx_vol){ mbhx_full.concatenate(hist); } mbhx_full.normalize(); Histogram mbhy_full; for(auto hist: hist_mbhy_vol){ mbhy_full.concatenate(hist); } mbhy_full.normalize(); //full descriptor descriptor.concatenate(hog_full); descriptor.concatenate(hof_full); descriptor.concatenate(mbhx_full); descriptor.concatenate(mbhy_full); tracks[i].descriptor=descriptor; } } int Dense::write_descriptors_to_file(std::vector<Track> tracks, std::ofstream& file){ int descriptor_written=0; for (size_t i = 0; i < tracks.size(); i++) { //if the descriptor is not yet initialized it means it's empty if (!tracks[i].descriptor.to_string().empty() ){ file << tracks[i].descriptor.to_string() << std::endl; descriptor_written++; } } return descriptor_written; } void Dense::read_features_from_file_Mat(std::string descriptor_file_path, cv::Mat& features, std::vector<int>& nr_features_per_video){ std::ifstream desc_file( descriptor_file_path ); int nr_vectors=0; int vector_dimensions=0; int nr_videos=0; std::string line; getline( desc_file, line ); std::istringstream buf(line); std::istream_iterator<std::string> beg(buf), end; std::vector<std::string> tokens(beg, end); // done! nr_vectors=atoi(tokens[0].data()); vector_dimensions=atoi(tokens[1].data()); nr_videos=atoi(tokens[2].data()); // std::cout << "nr_vectors" << nr_vectors << '\n'; // std::cout << "vector_dimensions" << vector_dimensions << '\n'; // std::cout << "nr_videos" << nr_videos << '\n'; features=cv::Mat(vector_dimensions,nr_vectors,CV_32FC1); MemoryAccessor features_acc (features.rows, features.cols, (Float*) features.data); // features.resize(vector_dimensions,nr_vectors); int sample=0; int features_current_video=0; while( getline( desc_file, line ) ){ if (line=="#"){ std::cout << "read a video with nr of features" << features_current_video<< '\n'; nr_features_per_video.push_back(features_current_video); features_current_video=0; continue; } std::istringstream buf(line); std::istream_iterator<std::string> beg(buf), end; std::vector<std::string> tokens(beg, end); // done! for (size_t i = 0; i < tokens.size(); i++) { // features.at(i,sample)=atof(tokens[i].data()); // features_acc(i,sample)=atof(tokens[i].data()); features.at<float>(i,sample)=atof(tokens[i].data()); } sample++; features_current_video++; } desc_file.close(); } void Dense::read_features_per_video_from_file_Mat(std::string descriptor_file_path, std::vector<cv::Mat >& features_per_video, int max_nr_videos){ std::ifstream desc_file( descriptor_file_path ); int nr_vectors=0; int vector_dimensions=0; int nr_videos=0; std::string line; getline( desc_file, line ); std::istringstream buf(line); std::istream_iterator<std::string> beg(buf), end; std::vector<std::string> tokens(beg, end); // done! nr_vectors=atoi(tokens[0].data()); vector_dimensions=atoi(tokens[1].data()); nr_videos=atoi(tokens[2].data()); std::cout << "nr_vectors" << nr_vectors << '\n'; std::cout << "vector_dimensions" << vector_dimensions << '\n'; std::cout << "nr_videos" << nr_videos << '\n'; features_per_video.resize(nr_videos); for (size_t i = 0; i < nr_videos; i++) { features_per_video[i]=cv::Mat(1,1,CV_32FC1); } std::vector<std::vector<float>>features_video; // int nr_features_in_video=0; int video_nr=0; while( getline( desc_file, line ) ){ if (line=="#"){ if (!features_video.empty()){ // features_per_video[video_nr].resize(vector_dimensions,features_video.size()); cv::resize(features_per_video[video_nr],features_per_video[video_nr], cv::Size(features_video.size(), vector_dimensions )); // cv::resize(features_per_video[video_nr],features_per_video[video_nr], size); //get the features_video and put them into the features__video_vector of math::matrices for (size_t i = 0; i < vector_dimensions; i++) { for (size_t j = 0; j < features_video.size(); j++) { // features_per_video[video_nr].at(i,j) = features_video[j][i]; features_per_video[video_nr].at<float>(i,j) = features_video[j][i]; } } features_video.clear(); video_nr++; } } if (video_nr>max_nr_videos){ break; } std::istringstream buf(line); std::istream_iterator<std::string> beg(buf), end; std::vector<std::string> tokens(beg, end); // done! std::vector<float> tmp; for (size_t i = 0; i < tokens.size(); i++) { tmp.push_back(atof(tokens[i].data())); } features_video.push_back(tmp); } desc_file.close(); } void Dense::read_features_per_video_from_file_math(std::string descriptor_file_path, std::vector<Math::Matrix<Float> >& features_per_video, int max_nr_videos){ std::ifstream desc_file( descriptor_file_path ); int nr_vectors=0; int vector_dimensions=0; int nr_videos=0; std::string line; getline( desc_file, line ); std::istringstream buf(line); std::istream_iterator<std::string> beg(buf), end; std::vector<std::string> tokens(beg, end); // done! nr_vectors=atoi(tokens[0].data()); vector_dimensions=atoi(tokens[1].data()); nr_videos=atoi(tokens[2].data()); std::cout << "nr_vectors" << nr_vectors << '\n'; std::cout << "vector_dimensions" << vector_dimensions << '\n'; std::cout << "nr_videos" << nr_videos << '\n'; features_per_video.resize(nr_videos); std::vector<std::vector<float>>features_video; // int nr_features_in_video=0; int video_nr=0; while( getline( desc_file, line ) ){ if (line=="#"){ if (!features_video.empty()){ features_per_video[video_nr].resize(vector_dimensions,features_video.size()); //get the features_video and put them into the features__video_vector of math::matrices for (size_t i = 0; i < vector_dimensions; i++) { for (size_t j = 0; j < features_video.size(); j++) { features_per_video[video_nr].at(i,j) = features_video[j][i]; } } features_video.clear(); video_nr++; } } if (video_nr>max_nr_videos){ break; } std::istringstream buf(line); std::istream_iterator<std::string> beg(buf), end; std::vector<std::string> tokens(beg, end); // done! std::vector<float> tmp; for (size_t i = 0; i < tokens.size(); i++) { tmp.push_back(atof(tokens[i].data())); } features_video.push_back(tmp); } desc_file.close(); } void Dense::read_features_from_file_math(std::string descriptor_file_path, Math::Matrix<Float>& features){ std::ifstream desc_file( descriptor_file_path ); int nr_vectors=0; int vector_dimensions=0; int nr_videos=0; std::string line; getline( desc_file, line ); std::istringstream buf(line); std::istream_iterator<std::string> beg(buf), end; std::vector<std::string> tokens(beg, end); // done! nr_vectors=atoi(tokens[0].data()); vector_dimensions=atoi(tokens[1].data()); nr_videos=atoi(tokens[2].data()); // std::cout << "nr_vectors" << nr_vectors << '\n'; // std::cout << "vector_dimensions" << vector_dimensions << '\n'; // std::cout << "nr_videos" << nr_videos << '\n'; features.resize(vector_dimensions,nr_vectors); int sample=0; int features_current_video=0; while( getline( desc_file, line ) ){ if (line=="#"){ std::cout << "read a video with nr of features" << features_current_video<< '\n'; features_current_video=0; continue; } std::istringstream buf(line); std::istream_iterator<std::string> beg(buf), end; std::vector<std::string> tokens(beg, end); // done! for (size_t i = 0; i < tokens.size(); i++) { features.at(i,sample)=atof(tokens[i].data()); } sample++; features_current_video++; } desc_file.close(); } cv::PCA Dense::compressPCA(const cv::Mat& pcaset, int maxComponents, const cv::Mat& testset, cv::Mat& compressed) { cv::PCA pca(pcaset, // pass the data cv::Mat(), // we do not have a pre-computed mean vector, // so let the PCA engine to compute it CV_PCA_DATA_AS_COL, // indicate that the vectors // are stored as matrix rows // (use CV_PCA_DATA_AS_COL if the vectors are // the matrix columns) maxComponents // specify, how many principal components to retain ); // if there is no test data, just return the computed basis, ready-to-use // if( !testset.data ) // return pca; // CV_Assert( testset.cols == pcaset.cols ); compressed.create(maxComponents, pcaset.cols, pcaset.type()); // cv::Mat reconstructed; for( int i = 0; i < pcaset.cols; i++ ) { cv::Mat vec = pcaset.col(i), coeffs = compressed.col(i), reconstructed; // compress the vector, the result will be stored // in the i-th row of the output matrix pca.project(vec, coeffs); // and then reconstruct it pca.backProject(coeffs, reconstructed); // and measure the error printf("%d. diff = %g\n", i, norm(vec, reconstructed, cv::NORM_L2)); } return pca; } void Dense::write_nr_features_per_video_to_file(std::string nr_features_per_video_file_path, std::vector<int> nr_features_per_video){ std::ofstream file; file.open (nr_features_per_video_file_path); for (size_t i = 0; i < nr_features_per_video.size(); i++) { file << nr_features_per_video[i] << std::endl; } } void Dense::write_compressed_features_to_file(std::string desc_compressed_file_path, cv::Mat feat_compressed, std::vector<int> nr_features_per_video){ std::ofstream file; file.open (desc_compressed_file_path); int current_video=0; int features_written=0; for (size_t i = 0; i < feat_compressed.cols; i++) { //write the column for (size_t j = 0; j < feat_compressed.rows; j++) { file << feat_compressed.at<float>(j,i) << " "; } file << std::endl; // file << feat_compressed.col(i) << std::endl; features_written++; if (features_written==nr_features_per_video[current_video]){ current_video++; features_written=0; file << "#"<< std::endl; } } file.seekp(0); //Move at start of file file << feat_compressed.cols << " " << 64 << " " << nr_features_per_video.size() << std::endl; file.close(); } void Dense::computeFisherVectors(Math::Matrix<Float>& fisher_vectors, std::vector <Math::Matrix<Float> >& features_per_video, const Math::Matrix<Float>& means, const Math::Vector<Float>& weights, const Math::Matrix<Float>& sigmas){ //fisher vectors will contain the vectors for all the videos as column vectors fisher_vectors.resize((2*64+1)*64, features_per_video.size() ); //make a matrix computing the u response of each features in the ideo under each gaussian, u_k(x_t) //rows will be the features, columns will be the gaussians for (size_t vid_idx = 0; vid_idx < features_per_video.size(); vid_idx++) { std::cout << "calculated fisher vector for video = " << vid_idx << '\n'; Math::Matrix<Float> u_s (features_per_video[vid_idx].nColumns(), 64); //loop through all of the features and through all of the gaussians and fill the matrix up for (size_t x_idx = 0; x_idx < features_per_video[vid_idx].nColumns(); x_idx++) { for (size_t k = 0; k < 64; k++) { Math::Vector<Float> feature(64); features_per_video[vid_idx].getColumn(x_idx, feature); u_s.at(x_idx,k)=u(feature, means,sigmas, k); } } //make a vector of the sum of the rows of the u_s matrix, we will need it for the normalization factor in the gammas Math::Vector<Float> u_s_sum(features_per_video[vid_idx].nColumns()); for (size_t x_idx = 0; x_idx < features_per_video[vid_idx].nColumns(); x_idx++) { Math::Vector<Float> u_row(64); u_s.getRow(x_idx, u_row); float res=0; for (size_t k = 0; k < 64; k++) { res+= weights.at(k)*u_row.at(k); } u_s_sum.at(x_idx)=res; } //Make a matrix of gammas containint all the gammas of the featurs in this video Math::Matrix<Float> gammas (features_per_video[vid_idx].nColumns(), 64); for (size_t x_idx = 0; x_idx < features_per_video[vid_idx].nColumns(); x_idx++) { for (size_t k = 0; k < 64; k++) { gammas.at(x_idx,k) = (weights.at(k) * u_s.at(x_idx,k)) / u_s_sum.at(x_idx); } } //loop through all of the k in gaussan and get the G_a, G_u and G_sigma Math::Vector<Float> fisher_vector((2*64+1)*64); for (size_t k = 0; k < 64; k++) { //normalization factor float normalization=(1/std::sqrt(weights.at(k))) ; //sum on the right hand side of G_a float sum_g_a=0; for (size_t x_idx = 0; x_idx < features_per_video[vid_idx].nColumns(); x_idx++) { sum_g_a+= gammas.at(x_idx,k)- weights.at(k); } float G_a=normalization * sum_g_a; //G_u Math::Vector<Float> G_u(64); G_u.setToZero(); for (size_t x_idx = 0; x_idx < features_per_video[vid_idx].nColumns(); x_idx++) { Math::Vector<Float> x(64); features_per_video[vid_idx].getColumn(x_idx, x); Math::Vector<Float> mean(means.nRows()); means.getColumn(k, mean); Math::Vector<Float> sigma(sigmas.nRows()); sigmas.getColumn(k, sigma); Math::Vector<Float> sigmaInv(64); calculateInverse(sigma, sigmaInv); x.add(mean, -1.0f); x.elementwiseMultiplication(sigmaInv); //TODO I am not sure what this sigma exactly means for (size_t idx = 0; idx < x.nRows(); idx++) { x.at(idx)=x.at(idx)*gammas.at(x_idx,k); } // x.elementwiseMultiplication(gammas.at(x_idx,k)); G_u.add(x); } for (size_t idx = 0; idx < G_u.nRows(); idx++) { G_u.at(idx)=G_u.at(idx)*normalization; } // G_u.elementwiseMultiplication(normalization); //G_sigma Math::Vector<Float> G_s(64); G_s.setToZero(); for (size_t x_idx = 0; x_idx < features_per_video[vid_idx].nColumns(); x_idx++) { Math::Vector<Float> x(64); features_per_video[vid_idx].getColumn(x_idx, x); Math::Vector<Float> mean(means.nRows()); means.getColumn(k, mean); Math::Vector<Float> sigma(sigmas.nRows()); sigmas.getColumn(k, sigma); sigma.elementwiseMultiplication(sigma); x.add(mean, -1.0f); x.elementwiseMultiplication(x); x.elementwiseDivision(sigma); //TODO I am not sure what this sigma exactly means x.addConstantElementwise(-1); for (size_t idx = 0; idx < x.nRows(); idx++) { x.at(idx)=x.at(idx)*gammas.at(x_idx,k)* (1/std::sqrt(2)); } // x.elementwiseMultiplication(gammas.at(x_idx,k)* (1/std::sqrt(2)) ); G_s.add(x); } for (size_t idx = 0; idx < G_s.nRows(); idx++) { G_s.at(idx)=G_s.at(idx)*normalization; } // G_s.elementwiseMultiplication(normalization); //copy them into the respective place in the fisher vector fisher_vector.at(k*(2*64+1))=G_a; for (size_t i = 0; i < 64; i++) { fisher_vector.at(k*(2*64+1) + i + 1)=G_u.at(i); fisher_vector.at(k*(2*64+1) + i + k +1 )=G_s.at(i); } } //copy the fisher vector for this video into the big fisher vectors matrix, where each column is the fisher vector for a certain video fisher_vectors.setColumn(vid_idx,fisher_vector); } } Float Dense::calculateDeterminenet(const Math::Vector<Float>& sigma) { Float result = 1.0f; for (u32 i=0; i<sigma.nRows(); i++) { result *= sigma.at(i); } return result; } void Dense::calculateInverse(const Math::Vector<Float>& diagonalMat, Math::Vector<Float>& result) { for (u32 i=0; i<diagonalMat.nRows(); i++) { result.at(i) = 1.0f / diagonalMat.at(i); } } float Dense::u(Math::Vector<Float>& x, const Math::Matrix<Float>& means, const Math::Matrix<Float>& sigmas, int k ){ Math::Vector<Float> sigma(sigmas.nRows()); sigmas.getColumn(k, sigma); Math::Vector<Float> mean(means.nRows()); means.getColumn(k, mean); Math::Vector<Float> sigmaInv(sigmas.nRows()); calculateInverse(sigma, sigmaInv); x.add(mean, -1.0f); Math::Vector<Float> temp(x.nRows()); temp.copy(x); x.elementwiseMultiplication(sigmaInv); float result = (1.0f/(pow((2 * M_PI), 64 / 2.0f) * pow(abs(calculateDeterminenet(sigma)), 0.5))) * exp(x.dot(temp) * (-1.0f/2.0f)); return result; } void Dense::task_1_2_extract_trajectories(std::string descriptor_file_path){ Core::AsciiStream in(videoList_, std::ios::in); std::string filename; std::ofstream desc_file; desc_file.open (descriptor_file_path); int nr_vectors=0; int vector_dimensions=0; int nr_videos=0; while (in.getline(filename)) { std::cout << "video " << filename<< '\n'; Video video; Video flow, flowAngle, flowMag; Video Lx,Ly,Lt; std::vector<Track> tracks; readVideo(filename, video); // showVideo(video); //compute_optical_flow opticalFlow(video, flow, flowAngle, flowMag); extractTrajectories(video, flow, tracks); filterTracks(tracks); // std::string trackFile="./tracks.txt"; // writeTracksToFile(trackFile,tracks); //derivatives derivatives(video,Lx,Ly,Lt); computeDescriptors(video,tracks, Lx, Ly, flow, flowAngle, flowMag); //write to file int descriptor_written=write_descriptors_to_file(tracks, desc_file); desc_file << "#"<< std::endl; nr_vectors+=descriptor_written; vector_dimensions=426; //TODO remove hardcode nr_videos++; video.clear(); flow.clear(); flowAngle.clear(); flowMag.clear(); Lx.clear(); Ly.clear(); Lt.clear(); tracks.clear(); std::cout << "finished" << '\n'; } //Add header to file desc_file.seekp(0); //Move at start of file desc_file << nr_vectors << " " << vector_dimensions << " " << nr_videos << std::endl; desc_file.close(); } void Dense::task_3_pca(std::string descriptor_file_path, std::string desc_compressed_file_path){ //pca-------------------------------------------------- //Read the features back again and do pca on them std::string nr_features_per_video_file_path = "./new_features_per_video.txt"; cv::Mat features, feat_compressed; std::vector<int> nr_features_per_video; read_features_from_file_Mat(descriptor_file_path,features,nr_features_per_video); // write_nr_features_per_video_to_file(nr_features_per_video_file_path, nr_features_per_video); compressPCA(features, 64, cv::Mat(), feat_compressed); std::cout << "finished compressing" << '\n'; std::cout << "feat compressed has size " << feat_compressed.rows << " " << feat_compressed.cols << '\n'; write_compressed_features_to_file(desc_compressed_file_path, feat_compressed, nr_features_per_video); } void Dense::task_3_gmm(std::string desc_compressed_file_path){ //Gmm----------------------------------------- Math::Matrix<Float> features; features.read(desc_compressed_file_path,true); // read_features_from_file_math(desc_compressed_file_path,features); for (size_t i = 0; i < features.nRows(); i++) { for (size_t j = 0; j < features.nColumns(); j++) { if (std::isnan( features.at(i,j)) || std::isinf( features.at(i,j)) ){ std::cout << "error, found a nan in the features" << '\n'; exit(1); } } } std::cout << "compressed features has size" << features.nRows() << " " << features.nColumns() << '\n'; Gmm gmm; gmm.train(features); gmm.save(); } void Dense::task_3_fisher(std::string desc_compressed_file_path){ Gmm gmm; gmm.load(); std::cout << "finished loading gmm" << '\n'; std::vector <Math::Matrix<Float> > features_per_video; Math::Matrix<Float> fisher_vectors; read_features_per_video_from_file_math(desc_compressed_file_path, features_per_video, 227); computeFisherVectors(fisher_vectors, features_per_video, gmm.mean(), gmm.weights(), gmm.sigma()); } void Dense::run() { if (videoList_.empty()) Core::Error::msg("dense.video-list must not be empty.") << Core::Error::abort; // std::string descriptor_file_path = "./desc.txt"; // std::string desc_compressed_file_path = "./desc_comp.txt"; std::string descriptor_file_path = "./desc_test.txt"; std::string desc_compressed_file_path = "./desc_comp_test.txt"; task_1_2_extract_trajectories(descriptor_file_path); task_3_pca(descriptor_file_path, desc_compressed_file_path); task_3_gmm(desc_compressed_file_path); task_3_fisher(desc_compressed_file_path); // task_4_svm(); // TODO }
aff2be6c28c692175e40b8458af24e5ef5a3fd26
ad485ea0ef7e719f8ad8c8f698629cce88c2fec6
/main.cpp
79c42a665ec484c4223e88ffcce1971db60d769d
[]
no_license
konstantinoscs/Atiki_odos-Simulation
78ed69515a3a2476deadcde51ba2dc98ab8cc45c
a9651f56d225dd21546258ea65a2497ff0dec94b
refs/heads/master
2021-01-21T10:34:09.063857
2018-04-06T21:51:10
2018-04-06T21:51:10
83,453,062
1
2
null
null
null
null
UTF-8
C++
false
false
1,176
cpp
main.cpp
/* * File: main.cpp * Author: konstantinos(Lead) / Giannis(Support) * * Created on January 4, 2016, 2:37 AM */ #include <cstdlib> #include <iostream> #include <ctime> #include "Highway.h" using namespace std; inline int args_to_var(int &N, int &NSegs, int &K, int &Percent, int argc, char **argv); int main(int argc, char** argv) { int N = 5, NSegs = 10, K = 30, Percent = 40, capacity = 20; highway *attiki_odos = NULL; srand(time(NULL)); if(!args_to_var(N, NSegs, K, Percent, argc, argv)) { cerr << "Not the correct number of arguments!"<< endl; return -1; } cout << "Give segments capacity: "; cin >> capacity; attiki_odos = new highway(NSegs, capacity, K); for (int i = 0; i< N; i++) { attiki_odos->operate(Percent); } delete attiki_odos; return 0; } inline int args_to_var(int &N, int &NSegs, int &K, int &Percent, int argc, char ** argv) { if(argc != 5) { return 0; } else { N = atoi(argv[1]); NSegs = atoi(argv[2]); K = atoi(argv[3]); Percent = atoi(argv[4]); return 1; } }
b4a614aec32e46a862ef7f7598b3a523a8ee983d
a10fecaa7a8639123331caaae42e5b8ea27c8959
/Lab1-3/MatrixOperations.cpp
aa4a99397dc4925062970a7a6d1603e8f127d273
[]
no_license
7kia/OOP
140cb7efa8dc59dfd8c3638cddcacdd7d5417998
4cf00a5432aa727a56c9540167b35fceb0ae9fdb
refs/heads/master
2021-01-21T21:47:32.142695
2016-05-25T12:46:33
2016-05-25T12:46:45
51,295,296
0
0
null
null
null
null
UTF-8
C++
false
false
2,995
cpp
MatrixOperations.cpp
#include "stdafx.h" #include "MatrixOperations.h" double MatrixOperations::GetDeterminate(const Matrix &matrix) { double determinate = 0; size_t sizeMatrix = matrix.size(); if (sizeMatrix > 2) { int countForDegree = 2; for (size_t i = 0; i < sizeMatrix; i++) { determinate += matrix[0][i] * pow(-1 , countForDegree) * GetMinor(matrix , i , 0); countForDegree++; } } else if(sizeMatrix == 2) { determinate = (matrix[0][0] * matrix[1][1]) - (matrix[0][1] * matrix[1][0]); } else if(sizeMatrix == 1) { determinate = matrix[0][0]; } return determinate; } // work for 3X3 matrixs double MatrixOperations::GetMinor(const Matrix &matrix , size_t x , size_t y) { Matrix subMatrix; subMatrix.resize(2); subMatrix[0].resize(2); subMatrix[1].resize(2); std::vector<Vector2UL> skipPositions; for (size_t i = 0; i < 3; i++) { skipPositions.push_back(Vector2UL(x , i)); skipPositions.push_back(Vector2UL(i , y)); } size_t sx = 0; size_t sy = 0; for (size_t mx = 0; mx < 3; mx++) { for (size_t my = 0; my < 3; my++) { if (std::count(skipPositions.begin(), skipPositions.end(), Vector2UL(my, mx)) == 0) { subMatrix[sy][sx] = matrix[mx][my]; sx++; if (sx > 1) { sx = 0; sy++; if (sy > 1) { sy = 0; } } } } } return MatrixOperations::GetDeterminate(subMatrix); } Matrix MatrixOperations::GetMinorMatrix(const Matrix & matrix) { Matrix minorMatrix; const size_t sizeMinorMatrix = matrix.size(); minorMatrix.resize(sizeMinorMatrix); for (size_t index = 0; index < sizeMinorMatrix; index++) { minorMatrix[index].resize(sizeMinorMatrix); } int countForDegree = 2; for (size_t y = 0; y < sizeMinorMatrix; y++) { for (size_t x = 0; x < sizeMinorMatrix; x++) { minorMatrix[y][x] = pow(-1 , countForDegree) * GetMinor(matrix , x , y); countForDegree++; } } return minorMatrix; } Matrix MatrixOperations::GetTransposeMatrix(const Matrix & matrix) { Matrix transposeMatrix = matrix; const size_t sizeTransposeMatrix = matrix.size(); for (size_t y = 0; y < sizeTransposeMatrix; y++) { for (size_t x = y; x < sizeTransposeMatrix; x++) { std::swap(transposeMatrix[y][x] , transposeMatrix[x][y]); } }; return transposeMatrix; } Matrix MatrixOperations::GetInvertMatrix(const Matrix & matrix) { const double determinate = MatrixOperations::GetDeterminate(matrix); if (determinate != 0) { Matrix transposeMatrix = MatrixOperations::GetTransposeMatrix(matrix); Matrix minorMatrix = MatrixOperations::GetMinorMatrix(transposeMatrix); for (auto &row : minorMatrix) { for (auto &element : row) { element /= determinate; } } return minorMatrix; } throw std::invalid_argument(MESSAGE_ZERO_DETERMINATE); } void MatrixOperations::PrintMatrix(const Matrix &matrix) { std::cout << std::setprecision(3); for (auto &row : matrix) { for (auto &element : row) { std::cout << element << " "; } std::cout << std::endl; } }
e147e2acedeeb16c9e66c814bdfd61cb35608b73
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/httpd/gumtree/httpd_repos_function_2482_httpd-2.4.17.cpp
c93ea40e42768f8bb9721ce89d8147fe198a0ee5
[]
no_license
niuxu18/logTracker-old
97543445ea7e414ed40bdc681239365d33418975
f2b060f13a0295387fe02187543db124916eb446
refs/heads/master
2021-09-13T21:39:37.686481
2017-12-11T03:36:34
2017-12-11T03:36:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
573
cpp
httpd_repos_function_2482_httpd-2.4.17.cpp
static const char *h2_add_alt_svc(cmd_parms *parms, void *arg, const char *value) { if (value && strlen(value)) { h2_config *cfg = h2_config_sget(parms->server); h2_alt_svc *as = h2_alt_svc_parse(value, parms->pool); if (!as) { return "unable to parse alt-svc specifier"; } if (!cfg->alt_svcs) { cfg->alt_svcs = apr_array_make(parms->pool, 5, sizeof(h2_alt_svc*)); } APR_ARRAY_PUSH(cfg->alt_svcs, h2_alt_svc*) = as; } (void)arg; return NULL; }
efd134d3ff51896539351ba3e429771d5e38cff4
c79dc016ca85e461e89393ab59a4ebce80160161
/Ice Climber Clone/DebugPhysicsScene.cpp
8dfcccc5b05deb66635f32e7aadbbc41eaa408c0
[]
no_license
janplaehn/Ice-Climber
e37d6e112aeb6e8164e1d8cab60036e5d896c3e2
1d0dcfc7aaa234aa0f9152d90c43ab285dd4398b
refs/heads/main
2023-06-28T08:01:55.388763
2021-07-27T18:06:53
2021-07-27T18:06:53
331,251,484
0
0
null
null
null
null
UTF-8
C++
false
false
1,294
cpp
DebugPhysicsScene.cpp
#include "DebugPhysicsScene.h" #include "Random.h" void DebugPhysicsScene::Load() { const int OBJECTCOUNT = 15; for (int i = 0; i < OBJECTCOUNT; i++) { GameObject* go = new GameObject(); go->_transform->_position = Vector2D(Random::Range(0, Screen::_width),Random::Range(0,Screen::_height)); SpriteRenderer* sr = go->AddComponent<SpriteRenderer>(); sr->_sprite = Sprite::Create("Assets/Sprites/UI/gameOver.png"); AABBCollider* col = go->AddComponent<AABBCollider>(); col->ApplySpriteSize(sr->_sprite); Rigidbody* rb = go->AddComponent<Rigidbody>(); rb->_velocity = Vector2D(Random::Range(-100, 100), Random::Range(-100, 100)); } GameObject* go = new GameObject(); go->_transform->_position = Vector2D::Zero(); go->_transform->_pivot = Vector2D(0, 1); AABBCollider* col = go->AddComponent<AABBCollider>(); col->SetScale(Vector2D(Screen::_width, 16)); go = new GameObject(); go->_transform->_position = Vector2D::Zero(); go->_transform->_pivot = Vector2D(1, 1); col = go->AddComponent<AABBCollider>(); col->SetScale(Vector2D(16, Screen::_height)); go = new GameObject(); go->_transform->_position = Vector2D(Screen::_width, 0); go->_transform->_pivot = Vector2D(0, 1); col = go->AddComponent<AABBCollider>(); col->SetScale(Vector2D(16, Screen::_height)); }
9ddebf116453b953ba736bc76902211a55441467
d7a1f879a11ae73088207d0b219fc460b057c0ed
/SuperTagEditor/DlgUnifyChar.cpp
7ed332ddd49781e0dd1123768f87af7897e7c6f1
[]
no_license
leiqunni/STEP_Unicode
d34dfdc773ce6576475a1be0beab6c9b284e163f
da43176a6dc9719d4da2c1fb086bcd56eb6a33f5
refs/heads/master
2021-01-22T12:12:04.291267
2014-05-20T04:20:04
2014-05-20T04:20:04
19,245,061
1
0
null
null
null
null
SHIFT_JIS
C++
false
false
1,528
cpp
DlgUnifyChar.cpp
// DlgUnifyChar.cpp : インプリメンテーション ファイル // #include "stdafx.h" #include "supertageditor.h" #include "DlgUnifyChar.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDlgUnifyChar ダイアログ CDlgUnifyChar::CDlgUnifyChar(CWnd* pParent /*=NULL*/) : CDialog(CDlgUnifyChar::IDD, pParent) { //{{AFX_DATA_INIT(CDlgUnifyChar) m_nConvAlpha = -1; m_nConvHiraKata = -1; m_nConvKata = -1; m_nConvKigou = -1; m_nConvSuji = -1; m_nConvUpLow = -1; m_nConvFixedUpLow = -1; //}}AFX_DATA_INIT } void CDlgUnifyChar::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDlgUnifyChar) DDX_Radio(pDX, IDC_CONV_ALPHA_NONE, m_nConvAlpha); DDX_Radio(pDX, IDC_CONV_HIRAKATA_NONE, m_nConvHiraKata); DDX_Radio(pDX, IDC_CONV_KATA_NONE, m_nConvKata); DDX_Radio(pDX, IDC_CONV_KIGOU_NONE, m_nConvKigou); DDX_Radio(pDX, IDC_CONV_SUJI_NONE, m_nConvSuji); DDX_Radio(pDX, IDC_CONV_UPLOW_NONE, m_nConvUpLow); DDX_Radio(pDX, IDC_CONV_FIXED_UPPER_LOWER_NONE, m_nConvFixedUpLow); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDlgUnifyChar, CDialog) //{{AFX_MSG_MAP(CDlgUnifyChar) // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します。 //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDlgUnifyChar メッセージ ハンドラ
1986202570f6f2d79560d893b5ee0317a62d40b8
d844890a5fc447d405aa710b6912a00cb58fe104
/EudoraEngine/application.h
19f6e40409e0e995e114abd27e395930fd55e059
[]
no_license
hasinaxp/opengl_render_engine
30bd1dfe4096f70c03ca1d6de2d84230bfee142e
e5c0c6112396bc1760e28d27797b3920313f83f7
refs/heads/master
2022-04-24T11:35:34.814502
2020-04-26T04:18:00
2020-04-26T04:18:00
192,807,059
0
0
null
null
null
null
UTF-8
C++
false
false
2,137
h
application.h
#pragma once #include "api.h" #include "display.h" #include "deps/glad.h" #include "eventSystem.h" #include <string> namespace sp { //base class for application layer // must be implemented(inherited) with two methods: // init(), update(float dt); class SP_API ApplicationLayer { private: float _dt; //time in second std::string _name; public: ApplicationLayer(std::string name) { _name = name; }; virtual ~ApplicationLayer() {}; virtual void onInit() = 0; virtual void onLoad() {}; virtual void onExit() {}; virtual void onUpdate(float dt) = 0; // time in second virtual void fastUpdate(float dt) {}; // runs on different thread. // used variables must be deadlock protected virtual void clean() {}; void appUpdate(float dt) { onUpdate(dt); _dt = dt; } virtual void onRender() {}; float getDeltaTime_s() const { return _dt; } float getDeltaTime_ms() const { return _dt * 1000; } std::string getName() const { return _name; } }; class SP_API Application { private: static Display* _display; static float _accumulatedTime; static float _currentTime; static float _lastTime; static int _frameRate; static ApplicationLayer* _currentLayer; static ApplicationLayer* _overlayLayer; static std::vector<ApplicationLayer*> _application_layers; public: static void create(int width = 640, int height = 480, const char* title = "application"); static void run(); static void close(); static void destroy(); static void resizeWindow(int width, int height); static void lockMouse(bool lock); static void pushLayer(ApplicationLayer* layer); static void pushOverlayLayer(std::string name); static void popOverlayLayer(); static void switchLayer(std::string name); static int getWidth() { return _display->getWidth(); } static int getHeight() { return _display->getHeight(); } static int getFrameRate() { return _frameRate; } static Display* getMainDisplay() { return _display; } static void setFrameRate(int frameRate) { _frameRate = frameRate; } static void fastLoop(); private: static void renderLoop(); static void loop(); }; };
ad9a97e20a6683267c8166b14adc1d8cc891da6a
fc8b9a876ecb1c62ca85f2f4de57a51299164fc0
/src/matris.h
ecfa30286be8bcc73e401fa26c3f5485fce21a2c
[]
no_license
meertuysaal/162106102004_MertUysal_Genel
84297d998dc471ae6eee46b7fdfbb5cc580556d4
d29dda6ba6d00668167d2cc9a515539c62221f95
refs/heads/master
2023-02-17T11:48:55.860610
2021-01-18T18:57:36
2021-01-18T18:57:36
330,753,512
0
0
null
null
null
null
UTF-8
C++
false
false
3,382
h
matris.h
#ifndef MATRIS_HPP #define MATRIS_HPP #include <iostream> // std::cout #include <iomanip> // std::setprecision() #include <math.h> // std::pow(), std::sqrt() #include <cstddef> // NULL #include "matris.h" #include <string> class Matris { public: Matris(); Matris(const int satir_sayisi, const int sutun_sayisi, long double **dizi_2b); Matris(const Matris &orijinal); ~Matris(); // gorsellestirme std::string to_string( const std::string indentasyon = "") const; std::string to_csv() const; // getter int get_satir_sayisi() const; int get_sutun_sayisi() const; long double get_eleman(const int satir, const int sutun) const; Matris* get_dikdortgen(const int satir_id, const int sutun_id, const int yukseklik, const int genislik) const; Matris* get_satir(const int satir_id) const; Matris* get_sutun(const int sutun) const; Matris* get_minor(const int satir_id, const int sutun_id) const; long double get_kofaktor(const int satir_id, const int sutun_id) const; Matris* get_komatris() const; Matris* get_transpoze() const; long double get_determinant() const; long double get_satir_normu(const int satir) const; long double get_sutun_normu(const int sutun) const; long double get_oklid_normu() const; long double get_iz() const; Matris* get_kosegen_form(bool yapmak_indirgenmis = false) const; // get_gauss_jordan_tersi fonksiyonunun basit hali Matris* get_gauss_tersi() const; Matris* get_gauss_jordan_tersi() const; Matris* get_kramer_tersi() const; // setter void set_satir(const int satir_id, const Matris &satir); void set_sutun(const int sutun_id, const Matris &sutun); void set_eleman(const int satir, const int sutun, const long double deger); void set_dikdortgen(const int satir_id, const int sutun_id, const Matris &dikdortgen); //modifiye eden void toplam(const long double deger); void katla(const long double deger); //asagidaki gauss yontemlerini gauss-jordan yapmak icin yapmak_indirgenmis parametresini "true" olarak verin void gauss_elimine_alt_ucgen(bool yapmak_indirgenmis = false); void gauss_elimine_alt_ucgen(Matris &tekrarci, bool yapmak_indirgenmis = false); void gauss_elimine_ust_ucgen(bool yapmak_indirgenmis = false); void gauss_elimine_ust_ucgen(Matris &tekrarci, bool yapmak_indirgenmis = false); // gauss-jordan yerine gauss yontemi secilmisse, kosegen formu indirgemek icin kullanilir, ayni sonuca ulasilmaktadir void gauss_kosegenden_birime(Matris &tekrarci); // statik static Matris* birim(const int boyut); static Matris* sifirlar(const int satir_sayisi, const int sutun_sayisi); static Matris* birler(const int satir_sayisi, const int sutun_sayisi); static Matris* toplam(const Matris &sol, const Matris &sag); static Matris* carpim(const Matris &sol, const Matris &sag); static Matris* soldan_bolum(const Matris &sol, const Matris &sag); private: int satir_sayisi = 0; int sutun_sayisi = 0; long double **dizi_2b = NULL; // matris satirlarini iceren iki boyutlu dizi (pointer pointer long double) bool olmak_kare() const; bool olmak_bos() const; bool olmak_null_dizi_2b() const; bool olmak_aralik_icinde_satir(const int satir_id) const; bool olmak_aralik_icinde_sutun(const int sutun_id) const; }; #endif
7080df8deb6ec90834ac051d22d9a12e8a568fdb
80ebce13244410af3a3818304de9b3b2a9dfc93c
/hardware/qcom/media/mm-video/qdsp6/vdec/src/omx_vdec_inpbuf.cpp
d9c0dbfcf3bc407d4f16c425b6ac46509328359d
[]
no_license
hongyunnchen/qiss-me-bsp
4d53d6f0bf242521a104024c2a72b8f290873fdb
342f7464d58479abe9e64917deb0281582bc25dc
refs/heads/master
2021-01-10T10:03:52.319213
2012-12-12T02:26:39
2012-12-12T02:28:43
49,120,250
2
0
null
null
null
null
UTF-8
C++
false
false
7,357
cpp
omx_vdec_inpbuf.cpp
/*-------------------------------------------------------------------------- Copyright (c) 2009, Code Aurora Forum. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Code Aurora nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------*/ /*============================================================================ O p e n M A X Component Video Decoder Input buffer class *//** @file omx_vdec_inpbuf.cpp This module contains the class definition for openMAX input buffer related logic. *//*========================================================================*/ ////////////////////////////////////////////////////////////////////////////// // Include Files ////////////////////////////////////////////////////////////////////////////// #include <string.h> #include <omx_vdec.h> /* ====================================================================== FUNCTION omx_vdec_inpbuf constructor DESCRIPTION Constructor. PARAMETERS None RETURN VALUE None ========================================================================== */ omx_vdec_inpbuf::omx_vdec_inpbuf():m_read(0), m_write(0), m_last(-1), m_size(0) { memset(m_pend_q, 0, sizeof(m_pend_q)); memset(m_flags, 0, sizeof(m_flags)); } /* ====================================================================== FUNCTION omx_vdec_inpbuf destructor DESCRIPTION Destructor. PARAMETERS None RETURN VALUE None ========================================================================== */ omx_vdec_inpbuf::~omx_vdec_inpbuf() { // empty due to the lack of dynamic members } /* ====================================================================== FUNCTION omx_vdec::add_entry DESCRIPTION Add new entry to the pending queue. PARAMETERS 1. index -- Input buffer index to be added. RETURN VALUE true/false depending on whether the entry is successfully added or not? ========================================================================== */ bool omx_vdec_inpbuf::add_entry(unsigned int index) { bool ret = false; if (m_size < MAX_NUM_INPUT_BUFFERS) { m_size++; ret = true; m_pend_q[m_write] = index; m_write = (m_write + 1) % MAX_NUM_INPUT_BUFFERS; BITMASK_SET(m_flags, index); } return ret; } /* ====================================================================== FUNCTION omx_vdec::push_back_entry DESCRIPTION Push back the last entry deleted back to the pending queue. PARAMETERS 1.index - Index of the entry which needs to be re-inserted at the top RETURN VALUE true/false depending on the situation. ========================================================================== */ bool omx_vdec_inpbuf::push_back_entry(unsigned int index) { bool ret = false; if (m_size == 0) { // If the queue is empty execute the add_entry ret = add_entry(index); } // Make sure that last entry deleted is same else if ((m_size > 0) && (m_size < MAX_NUM_INPUT_BUFFERS) && (m_last >= 0) && (m_last == index)) { m_size++; ret = true; // Read index need to go back here if (m_read > 0) { m_read--; } else { m_read = MAX_NUM_INPUT_BUFFERS - 1; } m_pend_q[m_read] = index; BITMASK_SET(m_flags, index); } else { QTV_MSG_PRIO3(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR, "Error - push_back_entry didn't push anything m_size %d, m_last %d, index %d\n", m_size, m_last, index); } return ret; } /* ====================================================================== FUNCTION omx_vdec::remove_top_entry DESCRIPTION Knock off the top entry from the pending queue. PARAMETERS 1. ctxt(I) -- Context information to the self. 2. cookie(I) -- Context information related to the specific input buffer RETURN VALUE true/false ========================================================================== */ int omx_vdec_inpbuf::remove_top_entry(void) { int ret = -1; if (m_size > 0) { m_size--; ret = m_pend_q[m_read]; m_read = (m_read + 1) % MAX_NUM_INPUT_BUFFERS; BITMASK_CLEAR(m_flags, ret); m_last = ret; } return ret; } /* ====================================================================== FUNCTION omx_vdec::OMXCntrlBufferDoneCb DESCRIPTION Buffer done callback from the decoder. PARAMETERS 1. ctxt(I) -- Context information to the self. 2. cookie(I) -- Context information related to the specific input buffer RETURN VALUE true/false ========================================================================== */ bool omx_vdec_inpbuf::is_pending(void) { return (m_size > 0); } /* ====================================================================== FUNCTION omx_vdec::OMXCntrlBufferDoneCb DESCRIPTION Buffer done callback from the decoder. PARAMETERS 1. ctxt(I) -- Context information to the self. 2. cookie(I) -- Context information related to the specific input buffer RETURN VALUE true/false ========================================================================== */ bool omx_vdec_inpbuf::is_pending(unsigned int index) { return (BITMASK_PRESENT(m_flags, index) > 0); } /* ====================================================================== FUNCTION omx_vdec::get_first_pending_index DESCRIPTION Get first pending index from the queue. Peek the first entry in the queue if there is any. PARAMETERS None RETURN VALUE Returns the top input buffer index ========================================================================== */ int omx_vdec_inpbuf::get_first_pending_index(void) { int ret = -1; if (m_size > 0) { ret = m_pend_q[m_read]; } return ret; }
14fe29dc60d9fcd087df0653c17de051ac403309
90d253b075c47054ab1d6bf6206f37e810330068
/USACOcontests/bronze/2016.12/cowsignal.cpp
95c2908f2e79a1dc4b1628b65e36b1ef78269cb5
[ "MIT" ]
permissive
eyangch/competitive-programming
45684aa804cbcde1999010332627228ac1ac4ef8
de9bb192c604a3dfbdd4c2757e478e7265516c9c
refs/heads/master
2023-07-10T08:59:25.674500
2023-06-25T09:30:43
2023-06-25T09:30:43
178,763,969
22
8
null
null
null
null
UTF-8
C++
false
false
1,174
cpp
cowsignal.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; template <typename T1, typename T2> ostream &operator <<(ostream &os, pair<T1, T2> p){os << p.first << " " << p.second; return os;} template <typename T> ostream &operator <<(ostream &os, vector<T> &v){for(T i : v)os << i << ", "; return os;} template <typename T> ostream &operator <<(ostream &os, set<T> s){for(T i : s) os << i << ", "; return os;} template <typename T1, typename T2> ostream &operator <<(ostream &os, map<T1, T2> m){for(pair<T1, T2> i : m) os << i << endl; return os;} int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); freopen("cowsignal.in", "r", stdin); freopen("cowsignal.out", "w", stdout); int M, N, K; cin >> M >> N >> K; string b[M]; for(int i = 0; i < M; i++){ cin >> b[i]; } for(int i = 0; i < M; i++){ string linetk; for(int j = 0; j < N; j++){ for(int k = 0; k < K; k++){ linetk += b[i][j]; } } for(int j = 0; j < K; j++){ cout << linetk << endl; } } return 0; }
28aa12138e297249e47594e2cfd311822f3815b4
2672b41f905c0561c816cbb969d1c57752863420
/UVA/UVA 11995.cpp
f2a572ed4430fede1067f0fb27c44772540c4129
[]
no_license
MohamedFathi45/Competitive-programming
a9a6b8b3e8be5924ef4774b90b81a5149cfc0332
3ed5bdd0c698c5c4273455828f6d74ff13374902
refs/heads/master
2021-01-25T14:46:57.008806
2020-12-22T03:35:54
2020-12-22T03:35:54
123,729,376
0
0
null
null
null
null
UTF-8
C++
false
false
2,397
cpp
UVA 11995.cpp
#include<iostream> #include<algorithm> #include<string.h> #include<string> #include<vector> #include<math.h> #include<set> #include<map> #include<iomanip> #include<queue> #include<deque> #include<bitset> #include<stack> #include<list> #define Mohamed_Fathi ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); typedef long long ll; using namespace std; int main( ) { queue<int> q; priority_queue<int>pq; stack<int> st; int n; int q_counter=0 , pq_counter=0 , st_counter=0; short key,k; while(cin>>n ) { q_counter=0 , pq_counter=0 , st_counter=0; queue<int> q; priority_queue<int>pq; stack<int> st; bool notvalid = false; for( int i = 0 ; i < n ; i ++ ) { cin>>key>>k; if( key == 1) { q.push(k); pq.push(k); st.push(k); } else { bool ok = false; if( !q.empty() && q.front() == k ) { q_counter++ , q.pop(); ok = true; } if(!pq.empty() && pq.top()==k ) { pq_counter++ , pq.pop(); ok = true; } if(!st.empty() && st.top() == k ) { st_counter++ , st.pop(); ok = true; } if( !ok ) notvalid = true; } } if(notvalid) { cout<<"impossible"<<endl; continue; } set<int>s; s.insert(q_counter) ,s.insert(pq_counter) , s.insert(st_counter); set<int>::iterator it = s.end(); it--; if((*it == st_counter && *it == q_counter) || (*it == st_counter && *it == pq_counter) ||(*it==st_counter &&*it == pq_counter) ) { cout<<"not sure"<<endl; continue; } if( st_counter > q_counter && st_counter > pq_counter ) cout<<"stack"<<endl; else if(q_counter > st_counter && q_counter >pq_counter ) cout<<"queue"<<endl; else if( pq_counter > q_counter && pq_counter > st_counter) cout<<"priority queue"<<endl; else cout<<"not sure"<<endl; s.clear(); } return 0; }
f8aa4c3a70f2fb6f29c4a34cf3293810ecfebd81
29aea75942aa113f9e2d96d0dff3da1b3e8ab319
/src/navigation/navigation.h
fb3dc1fdaf12b3853f89934b4672954f0fcd6781
[]
no_license
saikm200022/cs393r_particle_filter
6d39fbdcad45361723c27d2561f8be655e7b1c3d
94ffd57b0d45113aa98f62711056fe8806f77abf
refs/heads/master
2023-08-14T11:02:09.107830
2021-10-11T21:52:50
2021-10-11T21:52:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,388
h
navigation.h
//======================================================================== // This software is free: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License Version 3, // as published by the Free Software Foundation. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // Version 3 in the file COPYING that came with this distribution. // If not, see <http://www.gnu.org/licenses/>. //======================================================================== /*! \file navigation.h \brief Interface for reference Navigation class. \author Joydeep Biswas, (C) 2019 */ //======================================================================== #include <vector> #include "eigen3/Eigen/Dense" #include <math.h> #ifndef NAVIGATION_H #define NAVIGATION_H namespace ros { class NodeHandle; } // namespace ros namespace navigation { struct PathOption { float curvature; float theta; float clearance; float radius; Eigen::Vector2f CoT; float angle_travelled; float free_path_length; float distance_to_goal; Eigen::Vector2f obstruction; Eigen::Vector2f closest_point; float score; EIGEN_MAKE_ALIGNED_OPERATOR_NEW; }; class Navigation { public: // Constructor explicit Navigation(const std::string& map_file, ros::NodeHandle* n); // Used in callback from localization to update position. void UpdateLocation(const Eigen::Vector2f& loc, float angle); // Used in callback for odometry messages to update based on odometry. void UpdateOdometry(const Eigen::Vector2f& loc, float angle, const Eigen::Vector2f& vel, float ang_vel); // Updates based on an observed laser scan void ObservePointCloud(const std::vector<Eigen::Vector2f>& cloud, float time); // Main function called continously from main void Run(); // Used to set the next target pose. void SetNavGoal(const Eigen::Vector2f& loc, float angle); void TrimDistanceToGoal (struct PathOption& option); private: float* Simple1DTOC(); float* getBestCurvature(); float getTravellableDistance(struct PathOption& option); float GetMaxDistance(struct PathOption& option, Eigen::Vector2f point); float GetMaxDistance2(struct PathOption& option, Eigen::Vector2f point); float GetMaxDistanceStraight(Eigen::Vector2f point); float Simple1DTOC(Eigen::Vector2f point); float getDistanceToGoal(struct PathOption& option); float GetAngleBetweenVectors (Eigen::Vector2f a, Eigen::Vector2f b); void scorePath(struct PathOption& option); void GetClearance (struct PathOption& option); void TransformPointCloud(float dx, float dy, float theta); void DrawCar(); void DrawArcs(float theta, float dist); Eigen::Vector2f GlobalToRobot(Eigen::Vector2f point); // REAL CAR CONSTANTS const float LENGTH = 0.5; const float WIDTH = 0.25; const float WHEELBASE = 0.35; const float TRACK = 0.25; const float SAFETY_MARGIN = 0.1; // SIMULATOR CONSTANTS // const float LENGTH = 0.535; // const float WIDTH = 0.281; // const float WHEELBASE = 0.535; // const float TRACK = 0.281; // const float SAFETY_MARGIN = 0.1; float CAR_FRONT = WHEELBASE + (LENGTH+SAFETY_MARGIN*2 - WHEELBASE)/2; float CAR_INSIDE = (WIDTH + SAFETY_MARGIN*2) / 2.0; float CAR_OUTSIDE = -CAR_INSIDE; Eigen::Vector2f INNER_FRONT_CORNER = Eigen::Vector2f(CAR_FRONT, CAR_INSIDE); Eigen::Vector2f OUTER_FRONT_CORNER = Eigen::Vector2f(CAR_FRONT, CAR_INSIDE); const float MAX_VELOCITY = 1.0; const float MAX_ACCEL = 0.4; const float MAX_DECEL = 0.4; const float INF = std::numeric_limits<float>::max(); Eigen::Vector2f GOAL = Eigen::Vector2f(25, 0); Eigen::Vector2f GetTranslation(float velocity, float curvature, float time); float GetRotation(float velocity, float curvature, float time); float LATENCY = 0.1; float CLEARANCE_WEIGHT = 0.1; float GOAL_WEIGHT = 0.1; bool VISUALIZE = 1; int iteration = 0; int scratch = 0; float previous_velocity = 0; float previous_curvature = 0; Eigen::Vector2f obstacle; // Whether odometry has been initialized. bool odom_initialized_; // Whether localization has been initialized. bool localization_initialized_; // Current robot location. Eigen::Vector2f robot_loc_; // Current robot orientation. float robot_angle_; // Current robot velocity. Eigen::Vector2f robot_vel_; // Current robot angular speed. float robot_omega_; // Odometry-reported robot location. Eigen::Vector2f odom_loc_; // Odometry-reported robot angle. float odom_angle_; // Odometry-reported robot starting location. Eigen::Vector2f odom_start_loc_; // Odometry-reported robot starting angle. float odom_start_angle_; // Latest observed point cloud. std::vector<Eigen::Vector2f> point_cloud_; // Whether navigation is complete. bool nav_complete_; // Navigation goal location. Eigen::Vector2f nav_goal_loc_; // Navigation goal angle. float nav_goal_angle_; }; } // namespace navigation #endif // NAVIGATION_H
1fa4eacbc6ba284874fdc80ea857a52649e644c6
717c70331e83947539c4a68dd63d1863bbed32e0
/textga/textga_cmd/tags/ver1.0.0/src/local/Merge.hpp
92d181c2c3dfd3621127a72ab0348c591d3c6554
[]
no_license
hoboaki/oldcode
5907bdd01af84d6d2d779e26d6e4dbd3be1a028c
2c2aa0b20dc3f48656011dd5eb197d79fa3266cf
refs/heads/master
2020-12-03T03:51:03.125931
2017-06-29T13:44:19
2017-06-29T13:44:19
95,781,642
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
492
hpp
Merge.hpp
/** * @file * @brief アルファチャンネルをマージする関数を記述する。 */ #pragma once //------------------------------------------------------------ namespace local { class ArgumentDataIterator; /// アルファチャンネルをマージする関数。 class Merge { public: static bool execute( const ArgumentDataIterator& ); }; } //------------------------------------------------------------ // EOF
ff843458564922e4be25fb6bb504e87f915eaa00
346c17a1b3feba55e3c8a0513ae97a4282399c05
/MMVII/src/SymbDerGen/Formulas_ImagesDeform.h
ad1296f24ca2158bb30690c5ee0ae376b7a20e1f
[ "LicenseRef-scancode-cecill-b-en" ]
permissive
micmacIGN/micmac
af4ab545c3e1d9c04b4c83ac7e926a3ff7707df6
6e5721ddc65cb9b480e53b5914e2e2391d5ae722
refs/heads/master
2023-09-01T15:06:30.805394
2023-07-25T09:18:43
2023-08-30T11:35:30
74,707,998
603
156
NOASSERTION
2023-06-19T12:53:13
2016-11-24T22:09:54
C++
UTF-8
C++
false
false
5,144
h
Formulas_ImagesDeform.h
#ifndef _FORMULA_IMAGES_DEFORM_H_ #define _FORMULA_IMAGES_DEFORM_H_ #include "MMVII_TplSymbImage.h" #include "MMVII_util_tpl.h" /** \brief class to generate code for images transformation by mimnization */ // #include "ComonHeaderSymb.h" using namespace NS_SymbolicDerivative; namespace MMVII { /** Game example, class for computing homothety bewteen two images We have a modele fonction M (which can be an image or not) and the image I of that regisetr this function after certain transformation. The transformation is both geomtric and radiometric, the unknown are : * RadTr & RadSc for the radiometry * Tr (translation) and S (scale) for the geometry. The equation we have is : _I_ ( GTr + GS(x,y)) = RadTr + RadSc * _M_ (x,y) */ class cDeformImHomotethy { public : cDeformImHomotethy() { } static std::vector<std::string> VNamesUnknowns() { return {"RadSc","RadTr","GeomSc","GeomTrX","GeomTrY"}; // 2 radiometry + 3 geometry } static const std::vector<std::string> VNamesObs() { return Append ( FormalBilinIm2D_NameObs("H") , // 6 obs for bilinear interpol of Im std::vector<std::string>{"xMod","yMod","ValueMod"} // x,y of point, value of modele ); } std::string FormulaName() const { return "DeformImHomotethy";} template <typename tUk,typename tObs> static std::vector<tUk> formula ( const std::vector<tUk> & aVUk, const std::vector<tObs> & aVObs ) // const { size_t IndBilin = 0; size_t IndX = FormalBilinIm2D_NbObs+ IndBilin; // extract observation on model const auto & xModele = aVObs[IndX]; const auto & yModele = aVObs[IndX+1]; const auto & vModelInit = aVObs[IndX+2]; // extract unknowns const auto & aRadSc = aVUk[0]; const auto & aRadTr = aVUk[1]; const auto & aGeomScale = aVUk[2]; const auto & aGeomTrx = aVUk[3]; const auto & aGeomTry = aVUk[4]; // compute pixel homologous to model in image auto xIm = aGeomTrx + aGeomScale * xModele; auto yIm = aGeomTry + aGeomScale * yModele; // compute formula of bilinear interpolation auto aValueIm = FormalBilinIm2D_Formula(aVObs,IndBilin,xIm,yIm); // take into account radiometric transform auto aValueModele = aRadTr + aRadSc * vModelInit; // residual is simply the difference between both value return { aValueModele - aValueIm}; } }; // ------------------------------------------------------------------ // Test affinity estimation (now for the coded target detection) // ------------------------------------------------------------------ class cDeformImAffinity { public : cDeformImAffinity() { } static std::vector<std::string> VNamesUnknowns() { return {"RadSc","RadTr","GeomScA11", "GeomScA12", "GeomScA21", "GeomScA22", "GeomTrX","GeomTrY"}; // 2 radiometry + 6 geometry } static const std::vector<std::string> VNamesObs() { return Append ( FormalBilinIm2D_NameObs("H") , // 6 obs for bilinear interpol of Im std::vector<std::string>{"xMod","yMod","ValueMod"} // x,y of point, value of modele ); } std::string FormulaName() const { return "DeformImAffinity";} template <typename tUk,typename tObs> static std::vector<tUk> formula ( const std::vector<tUk> & aVUk, const std::vector<tObs> & aVObs ) // const { size_t IndBilin = 0; size_t IndX = FormalBilinIm2D_NbObs+ IndBilin; // extract observation on model const auto & xModele = aVObs[IndX]; const auto & yModele = aVObs[IndX+1]; const auto & vModelInit = aVObs[IndX+2]; // extract unknowns const auto & aRadSc = aVUk[0]; const auto & aRadTr = aVUk[1]; const auto & GeomScA11 = aVUk[2]; const auto & GeomScA12 = aVUk[3]; const auto & GeomScA21 = aVUk[4]; const auto & GeomScA22 = aVUk[5]; const auto & aGeomTrx = aVUk[6]; const auto & aGeomTry = aVUk[7]; // compute pixel homologous to model in image auto xIm = aGeomTrx + GeomScA11 * xModele + GeomScA12 * yModele; auto yIm = aGeomTry + GeomScA21 * xModele + GeomScA22 * yModele; // compute formula of bilinear interpolation auto aValueIm = FormalBilinIm2D_Formula(aVObs,IndBilin,xIm,yIm); // take into account radiometric transform auto aValueModele = aRadTr + aRadSc * vModelInit; // residual is simply the difference between both value return { aValueModele - aValueIm}; } }; };// namespace MMVII #endif // _FORMULA_IMAGES_DEFORM_H_
2c2aeded6cfbb046e35113514e67dbbe9ba84e1d
8dfaae5a6ce1a913440f3ee7610e753a6b3f7e65
/abc.cpp
23ed532f5e1b835da9ffc963280ed5f2b353befc
[]
no_license
parthchatta/1BM17CS057_ADA
780604704b004c298fd2b0c00875eb68e1c27db9
f6037e0064e2299f0301bc7b6b43921774639d5d
refs/heads/master
2020-06-30T23:50:19.908142
2019-11-20T07:14:53
2019-11-20T07:14:53
200,986,905
0
0
null
null
null
null
UTF-8
C++
false
false
1,044
cpp
abc.cpp
#include<bits/stdc++.h> using namespace std; int bs(int a[],int n) { int l=0,h=n-1; while(l<=h) { int mid=(h+l)/2; //cout<<"<"<<mid<<">\n"; if (mid<h && arr[mid]>arr[mid+1]) { return mid; } if (mid>l && arr[mid]<arr[mid-1]) { return mid-1; } if (arr[l]>=arr[mid]) { return findPivot(arr,l,mid-1); } return findPivot(arr,mid+1,h); } return 0; } int search(int a[],int n,int k) { int index=-1; int l=0,h=n-1; while(l<=h) { int mid=(h+l)/2; cout<<"<"<<mid<<">\n"; if(a[mid]==k) { return mid; } else if(a[mid]<k) { l=mid+1; } else { h=mid-1; } } return index; } int main() { freopen("input.txt","r",stdin); int t; cin >> t; while(t--) { int n,k; cin>>n>>k; int a[n]; for(int i=0;i<n;i++) { cin>>a[i]; } int p=bs(a,n); int index=search(a,p+1,k); int index2=search(a+p+1,n-p-1,k); if(index==-1) { if(index2!=-1) cout<<index2+p+1<<"\n"; else cout<<index2; } else { cout<<index<<"\n"; } } return 0; }