content stringlengths 263 5.24M | pred_label stringclasses 1
value | pred_score_pos float64 0.6 1 |
|---|---|---|
/**
*
*/
package com.apress.demo.entities;
import java.sql.Timestamp;
/**
* @author Siva
*
*/
public class Comment
{
private Integer id;
private Integer postId;
private String name;
private String email;
private String content;
private Timestamp createdOn;
public Comment() {
}
... | __label__POS | 0.811733 |
/**
*
*/
package com.apress.demo.entities;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
/**
* @author Siva
*
*/
public class Post
{
private Integer id;
private String title;
private String content;
private Timestamp createdOn;
private List<Comment> comments =... | __label__POS | 0.824042 |
/**
*
*/
package com.apress.demo.services;
/**
* @author Siva
*
*/
import static com.apress.demo.jooq.domain.tables.Posts.POSTS;
import static com.apress.demo.jooq.domain.tables.Comments.COMMENTS;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import org.jooq.DSLContext;
import... | __label__POS | 0.647656 |
package com.apress.jhblog.security;
import org.junit.Test;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.co... | __label__POS | 0.852798 |
package com.apress.jhblog.security.jwt;
import com.apress.jhblog.security.AuthoritiesConstants;
import io.github.jhipster.config.JHipsterProperties;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.HttpStatus;
import org.springframework.mock.web.MockFilterChain;
import org.springframewor... | __label__POS | 0.768851 |
package com.apress.jhblog.web.rest;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeDiagnosingMatcher;
import org.springframework.http.Media... | __label__POS | 0.725004 |
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';
@Injectable()
export class JhiConfigurationService {
constructor(private http: Http) {
}
get(): Observable<any> {
return this.http.get('management/configprops').map((r... | __label__POS | 0.880343 |
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';
@Injectable()
export class JhiHealthService {
separator: string;
constructor(private http: Http) {
this.separator = '.';
}
checkHealth(): Observable<any> {
... | __label__POS | 0.848703 |
import { HttpInterceptor } from 'ng-jhipster';
import { RequestOptionsArgs, Response } from '@angular/http';
import { Observable } from 'rxjs/Observable';
export class NotificationInterceptor extends HttpInterceptor {
constructor() {
super();
}
requestIntercept(options?: RequestOptionsArgs): Requ... | __label__POS | 0.683736 |
import { Component, ElementRef, Input, Renderer } from '@angular/core';
@Component({
selector: 'jhi-password-strength-bar',
template: `
<div id="strength">
<small>Password strength:</small>
<ul id="strengthBar">
<li class="point"></li>
<li class="... | __label__POS | 0.623352 |
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { AccountService } from './account.service';
@Injectable()
export class Principal {
private userIdentity: any;
private authenticated = false;
private authenticationState ... | __label__POS | 0.639483 |
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
import { Principal } from '../';
import { LoginModalService } from '../login/login-modal.service';
import { StateStorageService } from './state-storage.service';
@Injectable(... | __label__POS | 0.610433 |
<nav class="navbar navbar-inverse navbar-toggleable-md jh-navbar">
<div class="jh-logo-container float-left">
<a class="jh-navbar-toggler hidden-lg-up float-right" href="javascript:void(0);" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-la... | __label__POS | 0.730071 |
package com.apress.jhblog.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.validation.constraints.NotNull;
import javax.v... | __label__POS | 0.662142 |
package com.apress.jhblog.security;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
/**
* Utility class ... | __label__POS | 0.961802 |
package com.apress.jhblog.config.audit;
import com.apress.jhblog.domain.PersistentAuditEvent;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
pub... | __label__POS | 0.977463 |
package com.apress.jhblog.web.rest;
import com.apress.jhblog.config.DefaultProfileUtil;
import io.github.jhipster.config.JHipsterProperties;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
... | __label__POS | 0.917271 |
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <boost/lexical_cast.hpp>
using namespace std;
struct Journal
{
string title;
vector<string> entries;
explicit Journal(const string& title)
: title{title}
{
}
void add(const string& entry);
// persistence is a separ... | __label__POS | 0.858097 |
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
using namespace std;
// A. High-level modules should not depend on low-level modules.
// Both should depend on abstractions.
// B. Abstractions should not depend on details.
// Details should depend on abstractions.
enum class Relationsh... | __label__POS | 0.743703 |
#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <boost/lexical_cast.hpp>
#include <vector>
class Database
{
public:
virtual int get_population(const std::string& name) = 0;
};
class SingletonDatabase : public Database
{
SingletonDatabase()
{
std::cout << "Initia... | __label__POS | 0.984205 |
package com.apress.jhblog.web.rest.vm;
import com.apress.jhblog.service.dto.UserDTO;
import javax.validation.constraints.Size;
import java.time.Instant;
import java.util.Set;
/**
* View Model extending the UserDTO, which is meant to be used in the user management UI.
*/
public class ManagedUserVM extends UserDTO {... | __label__POS | 0.96663 |
package com.apress.jhblog.web.rest.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
/**
* Utility class for HTTP headers creation.
*/
public final class HeaderUtil {
private static final Logger log = LoggerFactory.getLogger(HeaderUtil.class);
priva... | __label__POS | 0.963118 |
// Objects in a program should be replaceable with instances of their subtypes
// w/o altering the correctness of the program
#include <iostream>
class Rectangle
{
protected:
int width, height;
public:
Rectangle(const int width, const int height)
: width{width}, height{height} { }
int get_width() const { r... | __label__POS | 0.730649 |
package com.apress.jhblog.web.rest.util;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpHeaders;
import org.springframework.web.util.UriComponentsBuilder;
/**
* Utility class for handling pagination.
*
* <p>
* Pagination uses the same principles as the <a href="https://developer.... | __label__POS | 0.960356 |
package com.apress.jhblog.web.rest.errors;
import java.util.HashMap;
import java.util.Map;
/**
* Custom, parameterized exception, which can be translated on the client side.
* For example:
*
* <pre>
* throw new CustomParameterizedException("myCustomError", "hello", "world");
* </pr... | __label__POS | 0.861576 |
package com.apress.jhblog.web.rest.errors;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* View Model for transferring error message with a list of field errors.
*/
public class ErrorVM implements Serializable {
private static final long serialVersionUID = 1L;
private... | __label__POS | 0.834441 |
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
using namespace std;
struct ContainsIntegers
{
virtual int sum() = 0;
};
struct SingleValue : ContainsIntegers
{
int value{ 0 };
SingleValue() = default;
explicit SingleValue(const int value)
: value{value}
{
}
int sum() ... | __label__POS | 0.9904 |
#include <cstdio>
#include <memory>
#include <iostream>
#include <vector>
using namespace std;
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics.hpp>
using namespace boost::accumulators;
// 2 + (3+4)
struct Expression
{
virtual double eval() = 0;
virtual void collect(vector<do... | __label__POS | 0.648796 |
#include <cstdio>
#include <stack>
#include <vector>
#include <array>
#include <iostream>
using namespace std;
#include <boost/algorithm/string.hpp>
void stack_and_vector()
{
stack<int, vector<int>> s;
s.push(123);
int x = s.top();
s.pop();
}
class String
{
string s;
public:
String(const string& s) : s{s... | __label__POS | 0.974188 |
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <sstream>
using namespace std;
struct Flower
{
virtual string str() = 0;
};
struct Rose : Flower
{
string str() override {
return "A rose";
}
};
struct RedFlower : Flower
{
Flower& flower;
RedFlower(Flower &flower) : f... | __label__POS | 0.825826 |
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <sstream>
#include <map>
#include <algorithm>
using namespace std;
class Person
{
friend class ResponsiblePerson;
int age;
public:
Person(int age) : age(age) {}
int get_age() const { return age; }
void set_age(int age) { th... | __label__POS | 0.990534 |
#include <iostream>
#include <string>
#include <ostream>
#include <vector>
using namespace std;
class FormattedText
{
string plain_text;
bool *caps;
public:
explicit FormattedText(const string& plainText)
: plain_text{plainText}
{
caps = new bool[plainText.length()];
memset(caps, 0, plain_text.leng... | __label__POS | 0.990677 |
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <sstream>
#include <map>
#include <algorithm>
using namespace std;
struct Sentence
{
struct WordToken
{
bool capitalize;
};
vector<string> words;
map<int, WordToken> tokens;
Sentence(const string& text)
{
ist... | __label__POS | 0.789051 |
#include <iostream>
#include <string>
using namespace std;
struct Creature
{
string name;
int attack, defense;
Creature(const string& name, const int attack, const int defense)
: name(name),
attack(attack),
defense(defense)
{
}
friend ostream& operator<<(ostream& os, const Creature& obj... | __label__POS | 0.920549 |
#include <iostream>
#include <vector>
using namespace std;
struct Creature;
struct Game
{
vector<Creature*> creatures;
};
struct StatQuery
{
enum Statistic { attack, defense } statistic;
int result;
};
struct Creature
{
protected:
Game& game;
int base_attack, base_defense;
public:
Creature(Game &game, i... | __label__POS | 0.953259 |
#include <iostream>
#include <vector>
using namespace std;
template <typename T>
struct Node
{
T value;
Node *left{nullptr}, *right{nullptr}, *parent{nullptr};
Node(T value) : value(value) {}
Node(T value, Node<T> *left, Node<T> *right) : value(value), left(left), right(right) {
left->parent = ... | __label__POS | 0.943287 |
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <boost/iterator/iterator_facade.hpp>
struct Node
{
string value;
Node* next = nullptr;
explicit Node(const string& value)
: value(value)
{
}
Node(const string& value, Node* const parent)
: value(value)
... | __label__POS | 0.982365 |
#include <map>
#include <string>
#include <vector>
#include <regex>
#include <iostream>
using namespace std;
inline vector<string> split(const string& stringToSplit)
{
vector<string> result;
size_t pos = 0, lastPos = 0;
while ((pos = stringToSplit.find_first_of("+-", lastPos)) != string::npos)
{
result.pu... | __label__POS | 0.899808 |
#include <iostream>
#include <string>
#include <vector>
#include <memory>
using namespace std;
class Memento
{
int balance;
public:
Memento(int balance)
: balance(balance)
{
}
friend class BankAccount;
friend class BankAccount2;
};
class BankAccount
{
int balance = 0;
public:
explicit BankAccount... | __label__POS | 0.926274 |
#include <iostream>
#include <vector>
using namespace std;
struct Command
{
enum Action { deposit, withdraw } action;
int amount{0};
bool success{false};
};
struct Account
{
int balance{0};
void process(Command& cmd)
{
switch (cmd.action)
{
case Command::deposit:
balance += cmd.amou... | __label__POS | 0.90031 |
#include <iostream>
#include <string>
using namespace std;
class Game
{
public:
explicit Game(int number_of_players)
: number_of_players(number_of_players)
{
}
void run()
{
start();
while (!have_winner())
take_turn();
cout << "Player " << get_winner() << " wins.\n";
}
protected:
virtual void start... | __label__POS | 0.918506 |
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class CombinationLock
{
vector<int> combination;
int digits_entered{0};
bool failed{false};
void reset()
{
status = "LOCKED";
digits_entered = 0;
failed = false;
}
public:
string status;
Com... | __label__POS | 0.951166 |
using System;
namespace ChainOfResponsibilityPatternModified
{
public enum MessagePriority
{
Normal,
High
}
public class Message
{
public string Text;
public MessagePriority Priority;
public Message(string msg, MessagePriority p)
{
Text ... | __label__POS | 0.871925 |
using System;
using FacadePattern.RobotParts;
namespace FacadePattern
{
public class RobotFacade
{
RobotColor rc;
RobotHands rh ;
RobotBody rb;
public RobotFacade()
{
rc = new RobotColor();
rh = new RobotHands();
rb = new RobotBody(... | __label__POS | 0.755052 |
using System;
namespace CommandPattern
{
public interface ICommand
{
void Do();
}
public class MyUndoCommand: ICommand
{
private Receiver receiver;
public MyUndoCommand(Receiver recv)
{
receiver=recv;
}
public void Do()
{
//Per... | __label__POS | 0.697409 |
using System;
using System.Linq;//For Contains() method below
namespace ProxyPatternQAs
{
/// <summary>
/// Abstract class Subject
/// </summary>
public abstract class Subject
{
public abstract void DoSomeWork();
}
/// <summary>
/// ConcreteSubject class
/// </summary>
... | __label__POS | 0.633736 |
using System;
namespace DecoratorPattern
{
abstract class Component
{
public abstract void MakeHouse();
}
class ConcreteComponent : Component
{
public override void MakeHouse()
{
Console.WriteLine("Original House is complete. It is closed fo... | __label__POS | 0.880095 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PrototypePatternQAs
{
class Student
{
int rollNo;
string name;
//Instance Constructor
public Student(int rollNo, string name)
{
this... | __label__POS | 0.85635 |
using System;
namespace AdapterPattern
{
class Rect
{
public double length;
public double width;
}
class Calculator
{
public double GetArea(Rect rect)
{
return rect.length * rect.width;
}
}
class Triangle
{
public double baseT... | __label__POS | 0.960704 |
using static System.Console;
namespace DotNetDesignPatternDemos.SOLID.LiskovSubstitutionPrinciple
{
// using a classic example
public class Rectangle
{
//public int Width { get; set; }
//public int Height { get; set; }
public virtual int Width { get; set; }
public virtual int Height { get; set;... | __label__POS | 0.605953 |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using static System.Console;
namespace DotNetDesignPatternDemos.SOLID.SRP
{
// just stores a couple of journal entries and ways of
// working with them
public class Journal
{
private readonly List<string> entries = ... | __label__POS | 0.749471 |
using System;
namespace AbstractFactoryPattern
{
public interface IDog
{
void Speak();
void Action();
}
public interface ITiger
{
void Speak();
void Action();
}
#region Wild Animal collections
class WildDog : IDog
{
public ... | __label__POS | 0.610156 |
using System;
namespace ProxyPattern
{
/// <summary>
/// Abstract class Subject
/// </summary>
public abstract class Subject
{
public abstract void DoSomeWork();
}
/// <summary>
/// ConcreteSubject class
/// </summary>
public class ConcreteSubject : Subject
{
... | __label__POS | 0.845615 |
using System;
using static System.Console;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Xml.Serialization;
namespace DotNetDesignPatternDemos.Creational.Prototype
{
public static class ExtensionMethods
{
public static T DeepCopy<T>(this T self)
{
using (var str... | __label__POS | 0.947143 |
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Creational.Prototype
{
namespace Coding.Exercise
{
public class Point
{
public int X, Y;
}
public class Line
{
public Point Start, End;
public Line DeepCopy()
{
var newStart = new Point{X = Start.X, Y =... | __label__POS | 0.940387 |
using System;
using static System.Console;
namespace DotNetDesignPatternDemos.Creational.Prototype
{
public class Address
{
public string StreetAddress, City, Country;
public Address(string streetAddress, string city, string country)
{
StreetAddress = streetAddress ?? throw new ArgumentNullExce... | __label__POS | 0.873575 |
using System;
using DotNetDesignPatternDemos.Creational.Prototype;
using NUnit.Framework.Internal.Commands;
using static System.Console;
namespace DotNetDesignPatternDemos.Creational.PrototypeFactory
{
public class Address
{
public string StreetAddress, City;
public int Suite;
public Address(string s... | __label__POS | 0.926546 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ImpromptuInterface.Dynamic;
using static System.Console;
namespace DotNetDesignPatternDemos.Creational.Builder
{
class HtmlElement
{
public string Name, Text;
public List<HtmlElement> ... | __label__POS | 0.919062 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DotNetDesignPatternDemos.Creational.Builder.BuilderParameter
{
public class MailService
{
public class Email
{
public string From, To, Subject, Body;
}
public class ... | __label__POS | 0.98913 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace DotNetDesignPatternDemos.Creational.BuilderFacets
{
public class Person
{
public Person()
{
WriteLine("Creating an instance of Person");
}
... | __label__POS | 0.900501 |
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Creational.Builder
{
namespace Coding.Exercise
{
class Field
{
public string Type, Name;
public override string ToString()
{
return $"public {Type} {Name}";
}
... | __label__POS | 0.963389 |
using System;
using System.Collections.Generic;
using System.Threading;
namespace DesignPatterns
{
public class Person
{
public string Name;
public string Position;
public DateTime DateOfBirth;
public class Builder : PersonBirthDateBuilder<Builder>
{
internal Builder() {}
}
... | __label__POS | 0.998258 |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Autofac;
using ImpromptuInterface;
using MoreLinq;
using NUnit.Framework;
using static System.Console;
namespace DotNetDesignPatternDemos.Creat... | __label__POS | 0.958699 |
using System;
namespace DotNetDesignPatternDemos.Creational.Factories
{
public class Point
{
private double x, y;
protected Point(double x, double y)
{
this.x = x;
this.y = y;
}
public override string ToString()
{
return $"{nameof(x)}: {x}, {nameof(y)}: {y}";
}
... | __label__POS | 0.885774 |
using System;
using System.Collections.Generic;
namespace DotNetDesignPatternDemos.Creational.AbstractFactory
{
public interface IHotDrink
{
void Consume();
}
internal class Tea : IHotDrink
{
public void Consume()
{
Console.WriteLine("This tea is nice but I'd prefer it with milk.");
}... | __label__POS | 0.623209 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace DotNetDesignPatternDemos.Structural.Composite.GeometricShapes
{
public class GraphicObject
{
public virtual string Name { get; set; } = "Group";
public... | __label__POS | 0.991685 |
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Structural.Composite
{
namespace Coding.Exercise
{
public interface IValueContainer : IEnumerable<int>
{
}
public class SingleValue : IValueContainer
{
public int... | __label__POS | 0.999598 |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace DotNetDesignPatternDemos.Structural.Composite.NeuralNetworks
{
// we cannot use a base class
public static class ExtensionMethods
{
public static void ConnectTo(this IEnumerable<Neuron... | __label__POS | 0.985153 |
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq.Expressions;
using System.Security.AccessControl;
using MoreLinq;
using static System.Console;
namespace DotNetDesignPatternDemos.Structural.Adapter.NoCaching
{
public class Point
{
public int X, Y;
pu... | __label__POS | 0.975721 |
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
namespace DotNetDesignPatternDemos.Structural.Adapter.PropertySurrogate
{
public class CountryStats
{
... | __label__POS | 0.997428 |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using MoreLinq;
using NUnit.Framework;
using static System.Console;
namespace DotNetDesignPatternDemos.Structural.Adapter.Lazy
{
public class Point
{
public int X;
public int ... | __label__POS | 0.978388 |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using MoreLinq;
using NUnit.Framework;
using static System.Console;
namespace DotNetDesignPatternDemos.Structural.Adapter.WithCaching
{
public class Point
{
public int X;
publ... | __label__POS | 0.970947 |
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Structural.Adapter
{
namespace Coding.Exercise
{
public class Square
{
public int Side;
}
public interface IRectangle
{
int Width { get; }
int Height { get; }
}
public static class ExtensionMethods
{
... | __label__POS | 0.999325 |
using NUnit.Framework;
using NUnit.Framework.Internal;
namespace DotNetDesignPatternDemos.Structural.Bridge
{
namespace Coding.Exercise
{
//public abstract class Shape
//{
// public string Name { get; set; }
//}
//public class Triangle : Shape
//{
// public Triangle() => Name = "Tri... | __label__POS | 0.854068 |
using System;
using System.Runtime.Serialization;
using System.Text;
using static System.Console;
namespace DotNetDesignPatternDemos.Structural.AdapterDecorator
{
public class MyStringBuilder
{
StringBuilder sb = new StringBuilder();
//=============================================
public static impl... | __label__POS | 0.650921 |
using NUnit.Framework;
using NUnit.Framework.Internal;
namespace DotNetDesignPatternDemos.Structural.Decorator
{
namespace Coding.Exercise
{
public class Bird
{
public int Age { get; set; }
public string Fly()
{
return (Age < 10) ? "flying" : "too old";
}
}
... | __label__POS | 0.970176 |
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Text;
using ImpromptuInterface;
using static System.Console;
namespace DotNetDesignPatternDemos.Structural.Proxy
{
public interface IBankAccount
{
void Deposit(int amount);
bool Withdraw(int amount);
string ToString();
... | __label__POS | 0.810849 |
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Structural.Proxy
{
namespace Coding.Exercise
{
public class Person
{
public int Age { get; set; }
public string Drink()
{
return "drinking";
}
public string Drive()
{
return "driving";
}
... | __label__POS | 0.983493 |
using System;
using System.Collections.Generic;
namespace DotNetDesignPatternDemos.Structural.Proxy.PropertyProxy
{
public class Property<T> where T : new()
{
private T value;
private readonly string name;
public T Value
{
get => value;
set
{
if (Equals(this.value, value... | __label__POS | 0.919168 |
using System.Activities.Statements;
using System.Collections.Generic;
using System.Text;
using static System.Console;
namespace DotNetDesignPatternDemos.Structural.Flyweight.TextFormatting
{
public class FormattedText
{
private readonly string plainText;
public FormattedText(string plainText)
{
... | __label__POS | 0.965901 |
using System.Collections.Generic;
using System.Linq;
using JetBrains.dotMemoryUnit;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Structural.Flyweight.Users
{
using System;
using static System.Console;
public class User
{
public string FullName { get; }
public User(string fullName)
{... | __label__POS | 0.937247 |
using System.Collections.Generic;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Structural.Flyweight
{
namespace Coding.Exercise
{
public class Sentence
{
private string[] words;
private Dictionary<int, WordToken> tokens = new Dictionary<int, WordToken>();
public Sentence(st... | __label__POS | 0.965556 |
using System;
using System.Collections.Generic;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Behavioral.ChainOfResponsibility
{
namespace Coding.Exercise
{
public abstract class Creature
{
protected Game game;
protected readonly int baseAttack;
protected readonly int baseDef... | __label__POS | 0.926389 |
using System;
using System.Security.Cryptography;
using static System.Console;
namespace DotNetDesignPatternDemos.Behavioral.ChainOfResponsibility.MethodChain
{
public class Creature
{
public string Name;
public int Attack, Defense;
public Creature(string name, int attack, int defense)
{
Na... | __label__POS | 0.981173 |
using System;
using System.Collections.Generic;
using DotNetDesignPatternDemos.Behavioral.ChainOfResponsibility.MethodChain;
using static System.Console;
namespace DotNetDesignPatternDemos.Behavioral.ChainOfResponsibility.ModifierChain.BrokerChain
{
// command query separation is being used here
public class Que... | __label__POS | 0.778488 |
/**
*
*/
package com.apress.demo.repositories;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import o... | __label__POS | 0.942304 |
using System;
using System.Numerics;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Behavioral.Strategy
{
namespace Coding.Exercise
{
public interface IDiscriminantStrategy
{
double CalculateDiscriminant(double a, double b, double c);
}
public class OrdinaryDiscriminantStrategy :... | __label__POS | 0.758578 |
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
using static System.Console;
namespace DesignPatterns.Behavioral.Strategy.Static
{
public enum OutputFormat
{
Markdown,
Html
}
public interface IListStrategy
{
void Start(StringBuilder sb);
void End(Str... | __label__POS | 0.818452 |
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Behavioral.Iterator
{
namespace Coding.Exercise
{
public class Node<T>
{
public T Value;
public Node<T> Left, Right;
public Node<T> Parent;
public Node(T value)
{
... | __label__POS | 0.868852 |
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
namespace DotNetDesignPatternDemos.Structural.Iterator.TreeTraversal
{
public class Node<T>
{
public T Value;
public Node<T> Left, Right;
public Node<T> Parent;
public Node(T value)
{
Value =... | __label__POS | 0.95816 |
using System;
using System.Activities.Statements;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace DotNetDesignPatternDemos.Behavioral.MediatorWithEvents
{
abstract class GameEventArgs : EventArgs
{
public abstract voi... | __label__POS | 0.718467 |
using System.Collections.Generic;
using System.Linq;
using static System.Console;
namespace DotNetDesignPatternDemos.Behavioral.Mediator.ChatRoom
{
public class Person
{
public string Name;
public ChatRoom Room;
private List<string> chatLog = new List<string>();
public Person(string name) => Name... | __label__POS | 0.987292 |
/**
*
*/
package com.apress.demo.controllers;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot... | __label__POS | 0.931755 |
using System;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Behavioral.Mediator
{
namespace Coding.Exercise
{
public class Participant
{
private readonly Mediator mediator;
public int Value { get; set; }
public Participant(Mediator mediator)
{
this.mediator = m... | __label__POS | 0.986773 |
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Behavioral.Interpreter
{
namespace Coding.Exercise
{
public class ExpressionProcessor
{
public Dictionary<char, int> Variables = new Dictionary<char, int>()... | __label__POS | 0.957278 |
using System;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Behavioral.NullObject
{
namespace Coding.Exercise
{
public interface ILog
{
// maximum # of elements in the log
int RecordLimit { get; }
// number of elements already in the log
int RecordCount { get; se... | __label__POS | 0.927442 |
using System.Collections.Generic;
using static System.Console;
namespace DotNetDesignPatternDemos.Behavioral.Memento.UndoRedo
{
public class Memento
{
public int Balance { get; }
public Memento(int balance)
{
Balance = balance;
}
}
public class BankAccount // supports undo/redo
{
... | __label__POS | 0.965705 |
using System;
using System.Text;
using NUnit.Framework;
namespace DotNetDesignPatternDemos.Behavioral.Memento
{
namespace Coding.Exercise
{
public class MyString
{
private StringBuilder sb = new StringBuilder();
public MyString(string s)
{
sb.Append(s);
}
public... | __label__POS | 0.996413 |
package com.apress.demo.services;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import... | __label__POS | 0.687741 |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using DotNetDesignPatternDemos.Annotations;
using MoreLinq;
namespace DotNetDesignPatternDemos.Behavioral.Observer.Properties
{
class PropertyNotifica... | __label__POS | 0.696228 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.