method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e94fe551-dab0-404a-9e95-0f89c9a2e139 | 1 | public void addMatch(Match match){
match.setPlaymode(this.playmode);
match.setGameID(this.gID);
match.setScoreList(this.scoreList);
if(this.runningMatch == null){
this.runningMatch = match;
}else{
this.upcomingMatches.add(match);
}
} |
cd3d0c86-f5dd-4cb4-a315-85b4ebed6c67 | 8 | private void createSR(String in1, String in2, String out)
{
SRFlipFlop sr = new SRFlipFlop();
// Connect the first input
// Check if the in wire is an input
if (stringToInput.containsKey(in1))
{
Wire inWire = new Wire();
stringToInput.get(in1).connectOutput(inWire);
sr.connectInput(inWire);
}
/... |
6c5cb0fb-9b5c-4012-ba87-8ef6b397efe0 | 0 | public void clickChooseCharacterSkills(Scanner scanchoice, ArrayList<MainMenuHeroSlot> heroies) {
state.clickChooseSkills(scanchoice, heroies);
} |
fd2f1615-c8c4-40fe-b108-cd49bc643ae2 | 9 | @Override
public void draw(Graphics g) {
//Draw Score Card
g.setFont("Arial", Graphics.BOLD, 25);
g.setColor(Color.WHITE.getRGB());
g.drawString("Score:",GamePanel.GAMEWIDTH+20,70);
g.setFont("Arial",Graphics.PLAIN,15);
... |
2d2ea966-f328-48b4-a6ff-e957f7ca806b | 8 | public static double[][] benchmarkJLargeArraysDoubleSequentualNative(long[] sizes, int[] nthreads, int iters, String file)
{
LargeArray.setMaxSizeOf32bitArray(1);
double[][] results = new double[nthreads.length][sizes.length];
long k;
System.out.println("Benchmarking JLargeArrays (do... |
3f58b186-1c33-489c-90a3-7415c00290a3 | 3 | private void updateAIPaddle() {
if (ballXSpeed < 0) {
double destination = AI.outputs(new double[] {ballY, ballX, ballYSpeed})[0];
destination = destination*2-1; //retour entre 0 et 1
if (Math.abs(destination-AIPaddlePos) > 0.04) {
if (destination > AIPaddlePos) {
AIPaddlePos += 0.03;
} else {
AIP... |
a69a839c-efda-435b-bcfc-164c2585e9cf | 3 | private static void processSource(final Socket connectionSocket) {
//create a new source task
Runnable sourceTask = new Runnable() {
@Override
public void run() {
//get source socket
Socket sourceSocket = connectionSocket;
while (li... |
16c11165-80e9-4c1a-98dc-e9f4c1cdb683 | 3 | public void removeChild(int index)
{
if (children != null &&
index >=0 &&
index < children.size())
children.remove(index);
} |
7f4ca0c3-39a4-40cc-a8de-4b615561bf12 | 5 | @Test
public void testExecutionSucceededState() throws ProcessExecutionException, ProcessRollbackException {
IProcessComponent<?> comp = TestUtil.executionSuccessComponent(true);
// use reflection to set internal process state
TestUtil.setState(comp, ProcessState.EXECUTION_SUCCEEDED);
assertTrue(comp.getStat... |
f054dac4-f147-41d0-8af0-30df66098f64 | 5 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
7f342011-0fdc-46ff-929f-59eee7ca4544 | 3 | public List<Player> getWinner(){
List<Player> winners = new ArrayList<Player>();
winners.add(allPlayers.get(0));
int max = allPlayers.get(0).getPoints();
for(int i=1;i<allPlayers.size();i++){
Player p = allPlayers.get(i);
if(p.getPoints()>max){
winners.clear();
winners.add(p);
max = p.getPoin... |
db127a62-1d54-45f6-8776-0b1f9f051c8d | 5 | public Map<String, String> getFileLocks(String dir) {
Map<String, String> map = new HashMap<>();
String currentPid = null;
for(String line : getFileLocksLines(dir)) {
if(line == null || line.trim().length() == 0) {
continue;
}
if(line.startsWith("p")) {
currentPid = line.substring(1);
} els... |
01ede96a-7c66-4271-a597-4cd01e70a1ef | 9 | private static int quickSort0(int[] a, int low, int high, String tabs) { //the valid elements of the list are [low, high]
if (high - low <= 1)
return high - low;
if (high - low == 2) { //efficient!
if (a[low] > a[low + 1])
swap(a, low, low + 1);
retu... |
d91c6ac2-8515-46ef-a7b5-d70e7d2a4888 | 7 | public AIBoard16x16 (int width, int height, String diff, User u){
pencilMode_ON_OFF = false;
user = u;
difficulty = diff;
this.setBackground(Color.WHITE);
this.setLayout(new BorderLayout());
JTextPane titleMessage = new JTextPane();
JPanel title = new JPanel();
title.setBackground(Color.WHITE);
title.... |
c56ff3ca-a306-4bc8-9cf7-bd6b48013ba0 | 8 | public static String formatearNombreCalle(String c){
String[] l = c.toLowerCase().split(" ");
String ret = "";
for (String s : l){
if (!s.isEmpty() && !s.equals("de") && !s.equals("del") && !s.equals("la") && !s.equals("las") && !s.equals("el") && !s.equals("los")){
char mayus = Character.toUpperCase(s.c... |
84c646e7-08e7-4ce2-9b66-313deffb0c12 | 7 | public List<Country> randomCountriesFromDifferentContinents(Country startPoint, int size) {
List<Country> neighbours = new ArrayList<Country>(size);
int tries = MAX_RANDOM_TRIES;
do {
Country next = randomCountry();
boolean canBeAdded = true;
if(StringUtils.... |
1142224b-98f5-4857-889c-03031c7fb6e7 | 0 | public Integer save(Journal journal) {
return (Integer) sessionFactory.getCurrentSession().save(journal);
} |
19fdd2a5-3cdf-4792-ad64-489e1d48e9bf | 0 | public void setOutputFormat(String outputFormat) {
this.outputFormat = outputFormat;
} |
9e6297ca-915f-48c9-a2fc-bcabbd8c866f | 5 | @Override
public int[][] findMatching(DeviceGraph graph) {
ObjectGraphBuilder ogb = new ObjectGraphBuilder();
HashSet<Requestor> unsortedRequestors = ogb.buildObjectGraph(graph);
int requestorCount = unsortedRequestors.size();
TreeSet<Requestor> requestors = new TreeSet<Requestor>(new RequestorComparator());
... |
ebed9a9f-95f7-4659-aca2-4a716a808924 | 7 | private void tritomyRoot(JadeNode toberoot) {
JadeNode curroot = this.getRoot();
assert curroot != null;
assert curroot.getChildCount() == 2;
// @todo code duplication could be lessened by using a pair of ints: toBeDeletedIndex, toGetExtraBLIndex set to (0,1) or (1,0)
if (toberoot == null) {
if (curroo... |
272d242d-aa2a-4b80-ab19-cd0857a5d264 | 1 | public List<Tiedote> haeEtusivunTiedotteet()
throws DAOPoikkeus {
// Tämä metodi hakee tiedotteet etusivulle järjestämällä taulun päivämäärän mukaan ja valitsemalla viimeisimmät kolme.
List<Tiedote>etusivuntiedotteet;
try {
// haetaan tiedotteet tietokannasta
TiedoteDAO tDao = new TiedoteDAO();
... |
d249d477-8049-4b60-a75f-49bab57cf81e | 9 | ObstaclePopupMenu(AtomisticView v) {
super("Obstacle");
view = v;
JMenuItem mi = new JMenuItem(view.getActionMap().get(AtomisticView.COPY));
String s = MDView.getInternationalText("Copy");
if (s != null)
mi.setText(s);
add(mi);
mi = new JMenuItem(view.getActionMap().get(AtomisticView.CUT));
s = M... |
8f6f5d87-690b-433c-9728-8203d4ad6cac | 5 | public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
System.out.println(System.getProperty("java.class.path"));
if ("loader".equalsIgnoreCase(args[0])) {
connectToALoaderServer(args[1], Integer.valueOf(args[2]));
return;
} else {
if ... |
b52b6c70-55f3-4cb8-8b81-2dce47b7c672 | 2 | public Matrix4f Mul(Matrix4f r)
{
Matrix4f res = new Matrix4f();
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < 4; j++)
{
res.Set(i, j, m[i][0] * r.Get(0, j) +
m[i][1] * r.Get(1, j) +
m[i][2] * r.Get(2, j) +
m[i][3] * r.Get(3, j));
}
}
return res;
} |
4e88674f-5d20-470a-bd68-910c0a447454 | 5 | static StringBuffer getRequirePath(String string) {
int start = -1;
int end = -1;
int len = string.length();
StringBuffer result = new StringBuffer();
for (int i = 0; i < len; i++) {
if (string.charAt(i) == '>') {
end = i;
break;
}
if (start >= 0 && end < 0) {
... |
3a5fe03e-c3d7-443d-8908-d9eaa643f37d | 4 | @Deprecated
public static String manualRequest(String line)
{
//Region_Service:operation-param1,param2,...
String region = line.substring(0,line.indexOf("_"));
String service = line.substring(line.indexOf("_")+1,line.indexOf(":"));
String operation = line.substring(line.indexOf(":")+1,line.indexOf("-"));
St... |
d36a7903-359a-4e65-9c55-62138b8276a6 | 4 | public void playGame()
{
System.out.println("The game has begun! Good luck!");
Scanner sc = new Scanner(System.in);
boolean win=false; // Game is not won by default
do {
win = player[this.current].makeGuess(g);
char res = player[this.current].opponentGrid.returnCharacter(g.get_Y(), g.get_X()... |
5b14138f-e186-40e2-aa6f-87177901a24f | 4 | private boolean DFSCycle(Vertex a, Hashtable<Vertex,Color> color){
color.put(a,Color.GREY);
LinkedList<Vertex> adjacencyVertices=graph.getAdjacencyVertices(a);
Iterator<Vertex> i = new Iterator<Vertex>(adjacencyVertices);
while(i.hasNext()){
Vertex u = i.getNext();
... |
539deb29-6cef-49b2-a3ef-71d47a762363 | 6 | @Override
public void preUpdate() {
Event ev;
boolean expDamage = false;
while(eventExist())
{
ev = popEvent();
if(ev.getName().equals("explosion"))
{
if(!expDamage)
{
hp-=5;
expDamage = true;
if(hp <= 0 && alive)
{
destroy();
}
}
}
if(ev.getName().equ... |
8839001a-cd2e-4be4-a451-03fa7bb66782 | 0 | public static ResultSet _findAll(String tableName) throws SQLException {
PreparedStatement statement = connect.prepareStatement(" select * from `" + tableName + "`" );
ResultSet result = statement.executeQuery();
return result;
} |
be6ddb60-1b7e-4c74-99fb-e5eed53e9660 | 7 | public Stolik chceStolik(Osoba osobaChcacaStolik) throws InterruptedException {
lock.lock();
try {
log.info("osoba numer {} z pary {} wchodzi", osobaChcacaStolik.podajNumerOsoby(),
osobaChcacaStolik.podajNumer());
++pary[osobaChcacaStolik.podajNumer()];
while (pary[osobaChcacaStolik.podajNumer()] < 2... |
ff061323-da09-489b-9980-33bdb15e189d | 8 | private void processBuffer(byte[] buffer, List<Token> tokens,
TokenGenerator tokenGenerator, ZipEntry zipEntry) {
tokenGenerator.setBuffer(buffer);
final int length = tokenGenerator.length();
int row = 1, column = 0;
int i = 0;
while (i < length) {
char c = tokenGenerator.charAt(i++);
++column;
... |
0d6e351a-4465-45df-ba5c-c846d4007129 | 7 | public LinkedList<ListEmp> getFaults(){
LinkedList<ListEmp> psl = new LinkedList<ListEmp>();
Connection Conn;
ListEmp ps = null;
ResultSet rs = null;
try {
Conn = _ds.getConnection();
} catch (Exception et) {
System.out.println("No connection");
return null;
}
PreparedStatement pmst = null;
... |
18b12cd0-3dd7-4eba-9880-ada90f677b8a | 0 | public void delete(BaseDO baseDO) {
//baseDO = this.makeObjectPersistent(baseDO);
getEntityManager().remove(baseDO);
} |
56c55e89-624c-488b-9c20-af3829cfeea1 | 8 | private boolean r_instrum() {
int among_var;
// (, line 76
// [, line 77
ket = cursor;
// substring, line 77
among_var = find_among_b(a_3, 2);
if (among_var == 0) {
return false;
}
// ], line 77
bra = cursor;
// call R1, line 77
if (!r_R1()) {
return false;
}
switch (among_var) {
cas... |
4014766e-6095-41cf-91bb-67603b4b902f | 8 | public static int arithmeticSequence(int[] nums) {
if (nums == null || nums.length < 3) return 0;
int res = 0;
int gap = nums[1] - nums[0];
int length = 2;
for (int i = 1; i < nums.length - 1; i++) {
if (nums[i+1] - nums[i] == gap) {
length++;
} else {
gap = nums[i+1] - nums[i];
if (length >... |
3d7ff474-ca27-4bc8-8489-c68f07662deb | 1 | public void update(long deltaMs) {
Iterator<RenderObject> it = renderableActors.iterator();
while(it.hasNext()) {
RenderObject ro = it.next();
ro.update(deltaMs);
}
Collections.sort(renderableActors);
} |
d72c165e-6cc5-447e-84ad-1b152a09a79e | 2 | static MemoryBTXObject readObject(DataInput in) throws IOException {
String name = readString(in);
MemoryBTXObject ret = new MemoryBTXObject(name);
int count = read32BitUnsigned(in);
while (count > 0) {
ret.attrs.add(readAttribute(in));
}
count = read32BitUnsigned(in);
while (count > 0) {
ret.childr... |
33251800-a7d2-4af8-9860-74fe6ebfbf10 | 7 | @Override
public
void whatToDo(Character character) {
Game currentGame = Game.getInstance();
int rollResult = currentGame.rollDice(3);
if(rollResult == 4){
Trait physicalTraitChosen = currentGame.chooseAPhysicalTrait();
if(physicalTraitChosen == Trait.SPEED){
character.incrementSpeed();
}else if(ph... |
725abdca-1d55-4118-8bc5-5728f7a00b6a | 0 | @Test
public void eventNotified()
{
eventBus.post( new ApplicationEvent() );
assertTrue( eventNotified );
} |
c17cdcc4-00d1-4262-8d3c-c80e0fe76668 | 3 | public static void drawTransparent(Graphics g, int x, int y, int width, int height)
{
Shape clip = g.getClip();
g.clipRect(x, y, width, height);
int size = 8;
for (int xx = 0; xx <= width / size; xx++)
for (int yy = 0; yy <= height / size; yy++)
{
... |
8a75ca76-f55c-4c60-afd0-a0ca8bf15bce | 2 | public static void odd_square_sum(Integer x, Integer y) {
int sum = 0;
for (int i = x; i <= y; i++) {
if (i % 2 != 0) {
sum += i * i;
}
}
System.out.println(sum);
} |
e8185bd4-3501-48cd-af04-75c6f991f4e0 | 4 | @Override
public void setValueAt(Object o, int r, int c)
{
if (r == 0)
lmodel.info.name = (String)o;
else if (r == 1)
lmodel.info.author = (String)o;
else if (r == 2)
lmodel.info.source = (String)o;
else if (r == 3)
lmodel.info.modelNumber = (String)o;
... |
87a44007-1d5f-47ff-9565-f58c695dc26e | 9 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == nextPlayer) {
if(game.turnDone && !game.isGameDone()) {
if(game.getCurrentPlayerIndex() + 1 == game.getPlayers().size())
game.setCurrentPlayerIndex(0);
else
game.setCurrentPlayerIndex(game.getCurrentPlayerIndex() +... |
a8fcaa2f-4c76-40d1-bd5b-c36aa8cd6984 | 3 | public boolean addToTree(CoreInterface ci){
if(ci.getClass() == Dvd.class){
dvdTree.add(ci);
return true;
}else if(ci.getClass() == Location.class){
locationTree.add(ci);
return true;
}else if(ci.getClass() == Genre.class){
genreTree.add(ci);
return true;
}
return false;
} |
8e1c408f-f9e5-4ce4-9811-4bd3ba58c094 | 0 | public void setCalculateFromScratch(Boolean calculateFromScratch) {
this.calculateFromScratch = calculateFromScratch;
} |
9671aefb-140d-4754-82fe-9ec42b27a601 | 1 | private static String getIndentString(int indent) {
String indentString = "";
for (int i = 0; i < indent; i++)
indentString += "\t";
return indentString;
} |
24b1f63c-6a07-4a51-9c92-e3260f954bf7 | 2 | public NewsDialog() {
super(MainFrame.instance(), "添加新闻", true);
setLayout(null);
setSize(420, 420);
setLocationRelativeTo(null);
newsDialog = this;
JLabel jlbName = new JLabel("新闻内容(100字):");
JButton ensure = new JButton("确定");
JButton cancel = new JButton("取消");
jTextArea = new JTextArea();
jlbNa... |
94206af4-32f7-4c67-b413-8b8d04429489 | 3 | public static String[] delimitedStringArray(String from, char start, char end){
//���ʂ��i�[����z��̐����B�e�ʂ͊܂܂��start�̐���葽���͂Ȃ�Ȃ��B
final int maxOfResultSize = countIncludedChar(from, start);
String[] temporaryResult = new String[maxOfResultSize];
int resultSize = 0;
int index = 0;
String testedStr... |
bf535722-2d3e-419e-96a8-cc289caa2a08 | 4 | public void getMap() {
try {
status.setText("Connect to runescape.com...");
BufferedReader read = new BufferedReader(new InputStreamReader(
new URL("http://www.runescape.com/downloads.ws").openStream()));
String line;
while ((line = read.readLi... |
297c40d2-2396-4738-b0ce-e9eb04f5c922 | 2 | @Override
public List<Description> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException {
int pageSize = 10;
List paramList = new ArrayList<>();
StringBuilder sb = new StringBuilder(WHERE);
String queryStr = new QueryMapper() {
@... |
c74734b6-1911-4f27-8be7-66e076748077 | 5 | public boolean updateProdutos(Produtos produtos) {
this.getConectaBanco();
try {
if (this.getConn() != null || !this.getConn().isClosed()) {
this.getConn().setAutoCommit(false);
this.setStmt(this.getUpdateProdutos());
this.getStmt().execute();
this.setSuc... |
467f843e-78a4-4a44-826a-7de1516de5f1 | 9 | protected Collection<Object> getCellsForChange(mxUndoableChange change)
{
mxIGraphModel model = getGraph().getModel();
Set<Object> result = new HashSet<Object>();
if (change instanceof mxChildChange)
{
mxChildChange cc = (mxChildChange) change;
Object parent = model.getParent(cc.getChild());
if (cc.... |
b082ff6d-e26e-4aa2-a0c6-2f33b5a105b2 | 9 | public MainGUI() {
super("Sudoku");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setSize(new Dimension(500, 550));
board = new JPanel(new GridLayout(3, 3));
boxes = new JPanel[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
boxes[i][j] = new JPanel(new GridLayout(3, 3));
... |
49007cc4-bcdb-4409-af59-70b76945c14a | 3 | @Override
public void execute(Player player, String[] args) {
if(args.length != 0){
if(BanHandler.isBanned(args[0])){
player.sendMessage(args[0]+ " is already banned");
return;
}
if(!args[0].equalsIgnoreCase(player.username)){
BanHandler.ban(args[0]);
player.sendMessage("You successfu... |
eb4eb97d-3816-4c5a-baed-25f9f2f65492 | 7 | public static Rule_HASH parse(ParserContext context)
{
context.push("HASH");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>();
int s1... |
19f4e093-1940-4555-b737-56451a907b3a | 6 | private ArrayList<Integer> generateActions(int[][] state) {
ArrayList<Integer> result = new ArrayList<Integer>();
int middle = x/2;
//TODO choose random when x is even
if (state[middle][0] == 0) {
result.add(middle);
}
for (int i=1; i <= x/2; i++){
if(middle + i < x) {
if ... |
168057fa-a169-41fb-8caf-fd72cbed95c0 | 1 | public Peg(String name, int maxDisks, int initDiskCount)
{
this.name = name;
this.maxDisks = maxDisks;
disks = new Stack<Integer>();
for (int i = 1; i <= initDiskCount; i++) {
disks.push(i);
}
width = maxDisks * DISK_WIDTH_DELTA + SIDES_MARGIN;
h... |
3d929e94-3982-4198-9575-e12e985a6044 | 2 | private void moveMBlocks() {
for (MBlock b : mBlocks) {
b.move();
if (edges.contains(b.location()))
b.respawn();
}
} |
5637cc77-fefc-439a-8948-80700a27ae4a | 0 | public Chlodzenie dawajChlodzenie(){
System.out.println("Dodaje: " + name);
return new ChlodzenieDlaLaptopa();
} |
1f93468b-0981-4708-b102-2c2dcd87e36e | 1 | @Override
public JMenu createMenu() {
JMenu menu = new JMenu("Edit"); //$NON-NLS-1$
menu.add(new DynamicMenuItem(UndoCommand.INSTANCE));
menu.add(new DynamicMenuItem(RedoCommand.INSTANCE));
menu.addSeparator();
menu.add(new DynamicMenuItem(CutCommand.INSTANCE));
menu.add(new DynamicMenuItem(CopyCommand.INS... |
83062489-b21b-42bc-b874-8d276538d9db | 9 | public static boolean run(Automaton a, String s) {
if (a.isSingleton())
return s.equals(a.singleton);
if (a.deterministic) {
State p = a.initial;
for (int i = 0; i < s.length(); i++) {
State q = p.step(s.charAt(i));
if (q == null)
return false;
p = q;
}
return p.accept;
} else {
... |
03082e74-a6ae-45f3-9866-10630b92e883 | 7 | private <T> Elements<T> join (Elements<T> min, Elements<T> inserted) {
if (min == null && inserted == null) { return null;}
else if (min != null && inserted == null) { return min; }
else if (min == null && inserted != null) { return inserted; }
else { Elements<T> minNext = min.rightk... |
2f40f5f9-5b70-402b-b974-f222670e01c2 | 6 | @Override
public synchronized boolean removeUser(String username, UUID uuid) {
FileWriter writer = null;
try {
BufferedReader reader = new BufferedReader(new FileReader(new File(OnlineUsers.directory+OnlineUsers.flatfileData)));
String line = "";
StringBuilder toSave = new StringBuilder();
while ((line... |
3b6029d5-6373-460d-a661-8f348db8971b | 6 | public static MapObject loadMapObjectFromString(String uin, TileMap tm, World w){
switch (uin) {
case LOG:
return new BlockLog(tm, w).setType(Block.WOOD);
case CRAFTINGTABLE:
return new BlockCraftingTable(tm, w).setType(Block.WOOD);
case IRON:
return new BlockIron(tm, w).setType(Block.ROCK);
case ROC... |
e59d0329-e233-4384-9109-9f86b983fd27 | 0 | public static void main(String[] args) throws Exception {
DataOutputStream dos = new DataOutputStream(
new BufferedOutputStream(new FileOutputStream("data.txt")));
byte b = 3;
int i = 12;
char ch = 'b';
float f = 3.3f;
dos.writeByte(b);
dos.writeInt(i);
dos.writeChar(ch);
dos.writeFloat(... |
b4f1147e-963e-4952-a7f2-123db72fc843 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> already <S-... |
05ca1e93-f155-4402-8d4c-9d3dea79d7ac | 9 | public void reduce() {
if (isSingleton())
return;
Set<State> states = getStates();
setStateNumbers(states);
for (State s : states) {
List<Transition> st = s.getSortedTransitions(true);
s.resetTransitions();
State p = null;
int min = -1, max = -1;
for (Transition t : st) {
if (p == t.to) {
... |
a23cfd33-e22a-4111-b0ea-69746c099de5 | 4 | public static void endRound() {
GUI.nextRound.setEnabled(true);
GUI.submit.setEnabled(false);
if(wordExists(latestWord) == false){
GUI.resultText.setText("That Word Doesn't Exist. You Scored 0 Points.");
heresWhatYouCouldHaveWon();
gui.updatePotentialSolutionsBar(answers);
}
else if(lettersInOrder(... |
5c665da2-e1fb-4c8e-b638-1ec9833d6a68 | 8 | public List<RangStatistik> getRangStatistik(String spielerName, String datePattern, String dateStart) {
List<EloStatistik> eigeneEloStatistik = getEloStatistikInternal(spielerName, datePattern, dateStart, true);
Map<String, List<EloStatistik>> andereEloStatistiken = new HashMap<String, List<EloStatistik>>();
List... |
f4ddbbb5-a7b3-47fb-bc6f-b4694e1dc2db | 8 | protected boolean isConverged(int iter) {
// print out debug info
if (verbose) {
Logs.debug("{}{} iter {}: errs = {}, delta_errs = {}, loss = {}, delta_loss = {}, learn_rate = {}",
new Object[] { algoName, foldInfo, iter, (float) errs, (float) (last_errs - errs), (float) loss,
(float) (Math.abs(last... |
4c152221-b54b-4e82-90d5-aeb065c53090 | 1 | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... |
bb9fdbb2-28ee-43c6-8882-4f1794091e10 | 1 | public Coord negSize() {
if (gob().getneg() != null)
return gob().getneg().bs;
return new Coord(0, 0);
} |
a297b541-0b63-48b8-9f05-b5d27d67e3a7 | 4 | @Override
public Result<Boolean> register(String username, String password) {
UsersDAO dao = new UsersDAO(getDBConnection());
try {
if (!checkLoginPassword(username, password)) return new Result<>(false, ExceptionMessages.EMPTY_DATA);
if (dao.getUser(username) != null) return... |
30c6e360-c4b4-4ca8-95d1-c94e1c39af5b | 3 | @Override
public void process(SimEvent event) {
NodeReachedEvent _event = (NodeReachedEvent) event;
this.setPosition(_event.getNode()); // Sets the actual position to the reached node.
System.out.println(getName() + "@" + getEngine().getCurrentTime() + ": reached node " + getPosition());
getLog().addNode(getP... |
791b48f4-0da6-4a01-8832-fcaad333e8ee | 0 | public final String getPassword() {
return _password;
} |
bcfedebe-bf82-4077-9996-7cfa8612a737 | 8 | public void drawLine(double x1, double y1, double x2, double y2) {
if (x1 > maxX) {
maxX = x1;
}
if (x2 > maxX) {
maxX = x2;
}
if (x1 < minX) {
minX = x1;
}
if (x2 < minX) {
minX = x2;
}
if (y1 > maxY... |
ea867e12-47dc-4241-931d-19a9f40efc4d | 0 | public void setStatus(String status) {
this.status = status;
} |
de83be4d-1ff7-4902-b62b-adcf7442f71a | 8 | public void attemptToPerformAction(Player actingPlayer, String actionStringKey){
Action action = playerActionMaps.get(actingPlayer.toString()).get(actionStringKey);
gameHistory += actingPlayer + " attempted " + actionString(action) + ":::";
for(Player nonEliminatedPlayer : players){
nameToOutWriter.get(nonE... |
5a22ab10-a4ed-4461-bcd4-ff5e0b8dc8a3 | 0 | public boolean isVisited() {
return visited;
} |
42c5c351-140b-49a8-b253-14392f5e5b8c | 5 | public void setWeight(Vertex a, Vertex b, int weight){
if(!isConnected(a,b)){
connect(a,b,weight);
}else{
int edgeWeight = this.weight.get(new Edge(a,b));
if(edgeWeight!=1){
this.withWeight--;
}
if(edgeWeight<0){
... |
8e8ce0d8-fe84-4201-a663-f64f6c8070e1 | 6 | public static void main(String []arg)
{
System.out.println("Sudoku Solver is Started ..");
if(arg.length > 0)
{
if(arg[0].equals("-c"))
{
SudokuGrid m_grid=new SudokuGrid();
Scanner sc = new Scanner(System.in);
int val;
for(int i=0;i<9;i++)
{
for(int j=0;j<9;j++)
{
... |
4938153c-4c09-498b-aad7-2f36b952dbd7 | 4 | public static void main( String[] args ) throws MVDException
{
if ( args.length == 1 )
{
File file = new File( args[0] );
File[] files = file.listFiles();
try
{
for ( int i=0;i<files.length;i++ )
{
FileInputSt... |
d6899438-0683-4363-9060-8af430a46d37 | 1 | private int generateContactId() {
// Generates a random 6 digit integer as the ID number.
int newId = (int)(Math.random()*999999);
// Then checks to see if this number is already in use recursively.
if(getContactFromID(newId) != null) {
return generateContactId();
} ... |
43db5355-4d85-4d1a-891a-9fe8c7784141 | 2 | public static void main(String args[]){
ExecutorService executor = Executors.newFixedThreadPool(2);
for (int i=0;i<5;i++){
executor.submit(new processor(i));
}
executor.shutdown();
System.out.println("all tasks submitted");
try {
executor.awaitTermination(1, TimeUnit.DAYS);
} catch (Interru... |
1ace2304-36fc-475c-85d7-3c6d103a7c90 | 4 | public void visitArithExpr(final ArithExpr expr) {
if (expr.left().type().isIntegral()) {
foldArithInteger(expr);
} else if (expr.left().type().equals(Type.LONG)) {
foldArithLong(expr);
} else if (expr.left().type().equals(Type.FLOAT)) {
foldArithFloat(expr);
} else if (expr.left().type().equals(Type.D... |
ca50b846-dd98-4c01-bf81-af268bd2c422 | 6 | public static void main(String[] args) {
RandomList<String> rs = new RandomList<String>();
String[] arrayStrings = ("The quick brown fox jumped over "
+ "the lazy brown dog").split(" ");
for(String s : arrayStrings) {
rs.add(s);
}
for(int i = 0; i < ... |
87d32d13-612a-4c25-aafd-c24873e3aa58 | 2 | public static void main(String arg[])
{
String username = "Alice";
String ip = "192.158.1.1";
boolean available = true;
try
{
User alice = new User(username,ip,available);
DatabaseHandler dbHand = new DatabaseHandler();
dbHand.onCreate();
dbHand.addUser(alice);
dbHand.addUser(new User("Bob","1... |
4d702122-c647-4cd1-a31d-5fe0dd6691af | 4 | private void setUpArmor() {
for (int i = 0; i < 25; i++) {
armor.add("Armor" + File.separator + "leatherarmor.properties");
}
for (int i = 0; i < 15; i++) {
armor.add("Armor" + File.separator + "chainmail.properties");
}
for (int i = 0; i < 10; i++) {
armor.add("Armor" + File.separ... |
5c67fd0f-946b-46aa-b7b1-092d454394b5 | 7 | public static String decrypt(String input, String key){
int inputLength = input.length();
char[] out = new char[inputLength];
int code = key.hashCode();
Character[] mapping = antiRandomizeArray(getMasterMapping(), code);
for(int i = 0; i < inputLength; i++){
char x = input.charAt(i);
if(x < 32 && x != 9... |
48d8b548-b73a-4bf9-a4e3-ec2d75f11913 | 8 | public static void main(String[] args) throws java.io.IOException {
if (args.length != 8) {
System.out.println("Usage: LDAExpt <instances> <num_topics> <num_itns> <print_interval> <save_sample_interval> <symmetric> <optimize> <output_dir>");
System.exit(1);
}
String file = args[0];
int T ... |
1fe83690-0c76-4618-8845-085137604ed7 | 7 | private void setRecommendedIndex(int index, boolean silent) {
if(index == recommendedIndex) return;
if(index < 0) index = 0;
if(index > model.getSize() - 1) index = model.getSize() - 1;
boolean first = false;
if(recommendedIndex > -1 && recommendedIndex < model.getSize()) {
model.setElement(model.get(recom... |
0638ae93-c7a1-4a89-8123-89b39d8c1a69 | 5 | @Override
//handles the player's keystrokes
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_LEFT){
this.player.setSavedDir(0);
}
else if (e.getKeyCode() == KeyEvent.VK_RIGHT){
this.player.setSavedDir(2);
}
else if (e.getKeyCode() == KeyEvent.VK_UP){
this.player.setSavedDir(1... |
8476fe97-5f41-4ba5-9ca4-7d01342ad51a | 1 | public static void main(String[] args) {
int sum = 0;
for(int i = 0; i <= 10; i++){
System.out.println("i=" + i);
sum +=i;
}
} |
b6310f80-dff8-4adb-810a-9924d8242e55 | 4 | public IImage createImage(String path) {
if(getExtension(path).equals("jpg")) {
return new ImageX(path);
}
else if(getExtension(path).equals("gif")) {
return new ImageX(path);
}
else if(getExtension(path).equals("png")) {
return new ImageX(path);
}
else if(getExtension(path).equals("bmp")) {
r... |
93343a41-dadd-4613-9ed0-7d9b1a7f6b78 | 1 | int getSize() {
int size = 0;
AnnotationWriter aw = this;
while (aw != null) {
size += aw.bv.length;
aw = aw.next;
}
return size;
} |
bb6cccb7-938d-4a33-838a-a8b9ff072ab9 | 6 | public String getProfiles( String mKey ) {
StringBuffer sb = new StringBuffer();
sb.append("select id,key,title,description,reverse_cost,");
sb.append("public,enabled,pgr_sp,pgr_dd,rid from app.profiles ");
if( mKey != null ) {
sb.append("where key in (").append(mKey).append(") ");
}
sb.appen... |
a57296ca-5157-40ed-9c19-7709ee3c402f | 0 | public List<Player> getplayers() {
return players;
} |
87c6f589-eaa3-46dd-a36b-d64409c1956d | 9 | int insertKeyRehash(byte val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... |
59ac2312-9514-480d-a539-680969209586 | 3 | private Color calculateColour(PColorSpace colorSpace, float s,
float t0, float t1) {
// find colour at point 1
float t = parametrixValue(s, t0, t1, extend);
// find colour at point
float[] input = new float[1];
input[0] = t;
if (functi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.