method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
97f45795-e6a0-45c9-b065-d208fe08ecfc | 3 | TreeItem findItem(String value, TreeItem[] items) {
for (int i = 0; i < items.length; i++) {
TreeItem item = items[i];
if (item.getText().equals(value)) return item;
item = findItem(value, item.getItems());
if (item != null) return item;
}
return null;
} |
3699f85d-00ce-4072-901d-75f622e979a4 | 3 | public static boolean swapOpt(int tour[],int[][] dist){
boolean improved=false;
// System.out.println("improving!");
for(int i=0; i<tour.length;i++){
for(int j=i+1; j<tour.length;j++){
// swapIfBetter(tour,dist,i,j);
improved = swapIfBetter(tour,dist,i,j) || improved;
}
}
return improved;
... |
1b730036-5566-4907-8609-47e480d6637f | 4 | private Dimension layoutSize(Container parent,boolean minimum){
Dimension dim=new Dimension(0,0);
Dimension d;
synchronized(parent.getTreeLock()){
int n=parent.getComponentCount();
for(int i=0;i<n;i++){
Component c=parent.getComponent(i);
if(c.isVisible()){
d=minimum ? c.getMinimumSize... |
d99f3d41-d18f-4773-a560-edc3e1baa83c | 9 | private void register(HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
// Liste aller Fehlermeldungen
ArrayList<String> errors = new ArrayList<String>();
// Teste, ob die Mail gültig ist:
String email = request.get... |
939adab5-8577-4232-9583-7142fc285b02 | 4 | @Override
public Collection<String> getItems() {
items.clear();
try {
for (String item : fTPConnector.getNames()) {
if (item.endsWith(".jpg") || item.endsWith(".jpeg")) {
items.add(item);
}
}
} catch (IOException ex)... |
14eb715d-e7c1-4bdf-b30e-c28e87d5284d | 9 | protected void processDefaultCollationAttribute(String ns) throws XPathException {
String v = getAttributeValue(ns, StandardNames.DEFAULT_COLLATION);
if (v != null) {
StringTokenizer st = new StringTokenizer(v, " \t\n\r", false);
while (st.hasMoreTokens()) {
Strin... |
ef3b7d7a-55a7-4bbe-b943-57dc8304381b | 4 | @Override
public Operation simplify() {
Expression L = Simplify.mod(this.L);
Expression R = Simplify.mod(this.R);
if( "0.0".equals(R.operation.getString() ) ){
return new Number(1);
} else if ( "0.0".equals(L.getString()) ){
return new Number(0);
} else if ( "1.0".equals(L.getString()) ){
return new... |
5a87b1ca-e6e7-40c7-89ac-21cab6b665c7 | 6 | private static void filterReducer(String realJvmCostDir, String reducerJvmCost, String filteredReducer, String dataflowName) {
File input = new File(realJvmCostDir + reducerJvmCost);
File output = new File(realJvmCostDir + filteredReducer);
if(!output.exists())
output.getParentFile().mkdirs();
try {
... |
b1f3bd32-1b89-4a8b-8d2b-1bcec9587796 | 1 | public static void forceRepaint() {
for (AppWindow window : AppWindow.getAllWindows()) {
window.repaint();
}
} |
e18a8d07-85ab-4c92-827d-9c88527508d2 | 9 | boolean tryPlan(Plan p, int depth) //try Plan within given depth
{
if(depth < 0)
return false;
if(usableFormulaStatic(p.action)) //if all reqs are known, apply DynamicFormula
{
evaluateStaticFormula(p.action);
return true;
}
else
{
if(p.subgoals.size() == 0) //no subgoal... |
a8632034-1720-4402-aa25-544811462666 | 8 | @Override
public boolean newPositionValide(Position nextPosition, int rotation) {
TetrisShape shape = (TetrisShape) getCurrentPiece().getShape(rotation);
for (int i = 0; i < TetrisShape.NB_ROW; i++) {
for (int j = 0; j < TetrisShape.NB_COL; j++) {
if (shape.getShape(i, j... |
b3a5ca96-600e-4c6d-9bb2-dd562debdbc6 | 6 | private void fillHillDown(int xx, int yy,int side){
for (int ny = yy+1; ny < height; ny++){
if (getBlock(xx,ny) == 0 || getBlock(xx,ny) == HILL_TOP_LEFT){
if (side == 0){
setBlock(xx,ny,Level.HILL_FILL);
}
else if (side == 1){
setBlock(xx,ny,Level.HILL_LEFT);
... |
b27375d2-dfd4-4f87-ba62-4ab4462dd417 | 1 | public static void enable(boolean enabled) {
if(!enabled)
play(null, false);
Music.enabled = enabled;
Utils.setpref("bgmen", Boolean.toString(enabled));
} |
ef92f701-3a27-4e7a-8a9f-15f850fa0c21 | 7 | public static PlagiarismDetector getInstance(String name, String args) {
if (PlagiarismDetector.nameToClassMap.containsKey(name)) {
try {
return (PlagiarismDetector) PlagiarismDetector.nameToClassMap.get(name).getConstructor(String.class)
.newInstance(args);
} catch (InstantiationException e) {
//... |
a4a34779-92d6-4e76-adbc-0a133f882d21 | 3 | public int[] getIntersection_usingBinarySearch(int[] a, int[] b) {
BinarySearch bs = new BinarySearch();
int smallL;
int[] smallR, largeR;
if (a.length > b.length) {
smallL = b.length;
smallR = b;
largeR = a;
} else {
smallL = a.length;
smallR = a;
largeR = b;
}
int[] c = new int[smal... |
76ee1a55-4612-460c-91c6-6174cb7b1608 | 4 | private static String createTestMVD( File folder )
throws Exception
{
if ( !folder.isDirectory() || !folder.exists() )
throw new MVDTestException("Missing folder "
+folder.getName() );
String mvdName = TEST_FOLDER+File.separator
+folder.getName()+".mvd";
if ( new File(mvdName).exists() )
return m... |
b0c1d5d3-ecb2-439a-afc4-a7cf167c107d | 8 | public static String randomPoker(){
StringBuilder sb=new StringBuilder("");
sb.append(ChatColor.WHITE);
Random r=new Random();
int num=r.nextInt(13)+1;
int pok=r.nextInt(4);
switch(pok){
case 0:
sb.append("Spade"... |
7e61775f-d81d-4b95-aee0-541a450f001e | 6 | public void testFin(int cptEssais) {
if(mot.equals(getTest()) || cptEssais==7){
if(mot.equals(getTest()))
a.sound();
if(mots==10 && mot.equals(getTest())){ // Jeu fini et gagné
Plateau.boucleMots=true;
Plateau.boucleJeu=true;
Fenetre.finJeu=true;
repaint();
}
else{
Plateau.boucleMo... |
4697a03d-eb69-4899-b13e-1665df16ba91 | 4 | public void save(final Paypassage plugin) throws InvalidSignCreation {
if(super.getSignLocation() == null){
throw new InvalidSignCreation("You must choose a sign");
}
if(super.getDestination() == null){
throw new InvalidSignCreation("You have to choose a destination first... |
6f715bc3-05a3-4b9e-a0b0-dc79639dd595 | 9 | public void handleMouseDragged(MouseEvent evt) {
int x = evt.getX();
int y = evt.getY();
if (drawing.layers[controlPanel.getCurrentLayer()].visible && !menuBar.colorPicker.isSelected()) {
//drawing.currentCurve.addPoint(x, y);
drawing.addToCurve(x, y, drawingPanel.currentCurve);
//menuBar.save.setE... |
85e60e28-3da7-4ed3-b8b9-165cce20ffed | 1 | private boolean kasitteleDesimaalipiste() {
if (!desimaalipisteLoydetty) {
desimaalipisteLoydetty = true;
return true;
}
return false;
} |
4aa0e144-77ef-4d92-84a5-9fed5453ecca | 1 | public TransformConstructors(ClassAnalyzer clazzAnalyzer, boolean isStatic,
MethodAnalyzer[] cons) {
this.clazzAnalyzer = clazzAnalyzer;
this.isStatic = isStatic;
this.cons = cons;
if (!isStatic)
this.outerValues = clazzAnalyzer.getOuterValues();
lookForConstructorCall();
} |
2ea0dacd-4c56-4175-a938-976a1d2cd0a8 | 6 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
7cd17536-5399-45c3-a100-cc2ee3c690ed | 9 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
MovieData data = (MovieData) obj;
return ots.equals(data.ots) && ecu.equals(data.ecu) && cu.equals(data.cu) && mcu.equals(data.mcu)
&& ms.equals(data.ms) && mls.equals(data.mls) && ls.equals(data.ls) && els.equals(da... |
cafab9d5-6d09-41c4-93f4-0fbb457ad70b | 0 | private Rank(int value, char shortName) {
this.value = value;
this.shortName = shortName;
} |
8391a084-790b-440f-b780-c2a2edb34dfa | 9 | protected void respondToInput() {
if (isPressed[KeyEvent.VK_UP]) {
if (s.getY() - SIDE_SCREEN_BUFFER > SIDE_SCREEN_BUFFER) {
s.moveBy(0, -MOVEMENT_SPEED);
}
}
if (isPressed[KeyEvent.VK_DOWN]) {
if (s.getY() + s.getHeight() < HEIGHT) {
s.moveBy(0, MOVEMENT_SPEED);
}
}
if (isPressed[KeyEve... |
25f7f824-a5e8-45c5-a08a-822060939ee0 | 5 | public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, ((Integer)value).intValue() + 1);
} else if (value instanceof Long) {
... |
57e89d39-37ff-4814-8006-d8344cf3f402 | 6 | public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... |
e9d3ce22-c378-413d-9bf7-69a3c0c3a82e | 7 | private boolean isDragOk(final java.io.PrintStream out,
final java.awt.dnd.DropTargetDragEvent evt) {
boolean ok = false;
// Get data flavors being dragged
java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
// See if any of the flavors are a file list... |
8eb5802b-749e-49a0-b0ae-18f9d6f60ed9 | 7 | private void move(char bORr, int bottom, int right, int[][] obstacleGrid) {
if (bORr == 'b') {
bottom++;
} else if (bORr == 'r') {
right++;
}
if (obstacleGrid[bottom][right] == 1) {
return;
}
if (bottom == obstacleGrid.length - 1
&& right == obstacleGrid[0].length - 1) {
count++;
return;... |
a8ee7173-301b-43b2-993b-1d97c1ef78a4 | 7 | private boolean r_postlude() {
int v_1;
int v_2;
// (, line 203
// Boolean test Y_found, line 203
if (!(B_Y_found))
{
return false;
}
// repeat, line 20... |
9d09a561-886d-462e-8549-8c285fe59614 | 4 | @Override
public void mouseDragged(MouseEvent e)
{
Point dragged = e.getLocationOnScreen();
int dragX = getDragDistance(dragged.x, pressed.x, snapSize.width);
int dragY = getDragDistance(dragged.y, pressed.y, snapSize.height);
int locationX = location.x + dragX;
int locationY = location.y + dragY;
// M... |
c7aacb4c-1168-49c1-b22b-5379eb888b6b | 3 | private static void processObject(MapObject mo, String map, PrintWriter warpOut, PrintWriter mobOut, TreeSet<Integer> mobs) {
if (mo == null) return;
String name = mo.getName();
String type = mo.getType();
Rectangle bounds = new Rectangle(mo.getBounds());
Properties props = mo.ge... |
62cade80-4907-4569-a8ee-2e2c992ef6f5 | 1 | public void init(int nplayers, int[] pref) {
this.nplayer=nplayers;
this.pref=pref;
this.position=this.getIndex();// position start from 0
this.record = new int[2*nplayer];
if(nplayers-position<=9)
magic=magic_table[nplayers-position];
else
magic=(int) Math.round(0.369... |
ad57d614-f337-4b28-a4aa-cc6d94d260b2 | 7 | public boolean isWeekLetter(String letter)
{
boolean validLetter = false;
if(letter.equals("SA"))
{
validLetter = true;
}
else if(letter.equals("SU"))
{
validLetter = true;
}
else if(letter.equals("TU"))
{
... |
3fb58986-13cf-4b80-958f-6ad380b53f45 | 1 | public static Boolean saveResults(int QuizId, Map<Integer, Integer> selectedAnswers, int UserId) {
String Statement = "INSERT INTO QUIZRESULT (QUIZID, QUESTIONID, USERID, ANSWERID) VALUES";
for (Map.Entry<Integer, Integer> answerpair : selectedAnswers.entrySet())
{
String valstring = Str... |
87e38465-f176-4b05-9b3e-4b3d423dc86d | 2 | public Tile getFrame(int f) {
if (f > 0 && f < frames.length) {
return frames[f];
}
return null;
} |
1bc830ed-4c2b-42dc-a0e6-6e7fbdedc329 | 2 | @Override
public boolean sessionExists(int session, int subsession) {
//build the url
final String commonURL = "http://www.assnat.qc.ca/fr/travaux-parlementaires/journaux-debats/index-jd/";
String url = commonURL + session + "-" + subsession + ".html";
//attempt to connect
t... |
6fa5b8e8-c758-4c8d-b789-4589288bb297 | 6 | public LanguageController createLanguageController(String languageName) {
LanguageController languageController = new EnglishLanguageController();
if (languageName != null) {
if (languageName.equals("italian")) {
languageController = new ItalianLanguageController();
} else if (languageName.equals("norwegi... |
f9171f60-d95f-4937-be0b-9f23db5cb1f0 | 3 | public ArrayList<MCQ> getList(String whereString) {
StringBuffer sql = new StringBuffer("");
sql.append("SELECT Question_ID,QType_ID,Question_Text");
sql.append(" FROM `MCQ`");
if (whereString.trim() != "") {
sql.append(" where " + whereString);
}
SQLHelper s... |
ae6221d6-b6b4-4495-a93b-f9519411a65b | 4 | @Override
public long lastAccessibleCycleBefore(long cycle, AccessibilityGbState gbState) {
if (cycle < getCbgpInaccessibleFrom()) // before first frame
return cycle;
int lineCycle = (int) (cycle % GbConstants.LINE_CYCLES);
int frameLine = (int) ((cycle % GbConstants.FRAME_CYCLES) / GbConstants.LIN... |
fce9bc11-5acf-4380-8df5-4bc4e3322287 | 4 | private static boolean visible(WidgetChild... children) {
if (children == null)
return false;
for (WidgetChild wc : children) {
if (wc == null || !wc.visible())
return false;
}
return true;
} |
53ef0578-6809-412d-a00f-2a34c984b558 | 8 | public void performMoveOnBoard(int x, int y, Board board) {
Point pacManLoc = board.getPacManLocation();
Point[] possibleMoves = {Board.UP,
Board.DOWN,
Board.LEFT,
Board.RIGHT};
int bestMove = -1;
double bestMoveDistance = 99999;
for (... |
0189cdb3-e103-4f01-a51d-fc4a412faa6f | 3 | public void activate(Robot paramRobot, int paramInt)
{
if (this.clearAnimations != null)
{
if ((!this.clear) && (!this.active))
{
this.active = true;
return;
}
}
else
{
this.clear = true;
}
} |
8719e2ac-a6e7-460c-a0b6-5af13b3f5abd | 1 | public String getQuizStringWithURL(boolean isNewpage) {
StringBuilder sb = new StringBuilder();
sb.append("<a class=\"link-style-dominant\" href=\"/QuizWebsite/quiz_summary.jsp?id=");
sb.append(quizID + "\"");
if (isNewpage) {
sb.append("target=\"_blank\"");
}
sb.append(">" + name + "</a>");
return sb.... |
ce03c6fb-0cc1-43ae-b71b-9b993bb38c72 | 2 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In list games handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("get")) {
String unvalidatedCookie = exchange.getRequestHeaders().get("Cookie").get(0);
System.out.pri... |
fb880802-46c2-4ced-9313-d6941ca90c33 | 2 | private final void renameUser(String oldNick, String newNick) {
synchronized (_channels) {
Enumeration enumeration = _channels.keys();
while (enumeration.hasMoreElements()) {
String channel = (String) enumeration.nextElement();
User user = this.removeUser(... |
b8f3bc89-c716-4bbb-bf92-f67502f146e1 | 8 | public boolean checkTree(Set<Node> featureList){
boolean check = true;
if (feature!= null && !featureList.contains(feature))
return false;
if (trueChild != null && trueChild.parent != this)
return false;
else if (trueChild != null)
check &= trueChild.c... |
3113f87a-3834-4362-8eef-372a5bbb098e | 9 | public static void xpWorthyChange(MOB mob, Area area, Climate oldC, Climate newC)
{
Ability A=area.fetchEffect("Chant_ControlWeather");
if((A==null)&&(mob!=null))
{
if((oldC.nextWeatherType(null)!=Climate.WEATHER_CLEAR)
&&(oldC.nextWeatherType(null)!=Climate.WEATHER_CLOUDY)
&&((newC.nextWeatherType(null... |
d7b0fc76-7c83-45bb-9704-ee93b76b19af | 8 | private void decodePayload(OMMMsg msg)
{
OMMMap map;
if (msg.getDataType() == OMMTypes.MAP)
{
try
{
map = (OMMMap)msg.getPayload();
}
catch (Exception e) // Just in case
{
System.out.println(e.getClas... |
7ff455af-c606-40a6-919c-013f7fd1afc2 | 2 | public void print(int indent) {
//The string to represent child nodes of the AST
String indentString = "";
for (int i = 0; i < indent; i++)
indentString += " ";
//Recursively print this node's children
for (int i = 0; i < children.size(); i++) {
//Print the child node's details
System.out.prin... |
878967a8-2ecb-459d-b2c6-aceeac6782fc | 1 | void stats(double[] v) {
if (v == null) {
numLabel.setText(" ");
} else {
double min = Statistics.min(v);
double max = Statistics.max(v);
double mean = Statistics.mean(v);
double range = Statistics.range(v);
double median = Statist... |
d8f14408-7df8-4171-a577-610fe5be86cd | 9 | public void spawn(){
for(int x=0;x<enemies;x++) {
if (Math.random() < .0005) {
int spawnxvariation = (int) (Math.random() * Alpha.mapsize / 8);
int spawnx = Alpha.mapsize + Alpha.mapsize / 4 + spawnxvariation;
int spawny = (int) (Math.random() * Alpha.... |
5ce5e93b-79b9-4b05-9ab7-3b6d7e85a63a | 2 | private int[] getModelToView()
{
if (modelToView == null)
{
int n = getViewToModel().length;
modelToView = new int[n];
for (int i = 0; i < n; i++)
{
modelToView[modelIndex(i)] = i;
}
}
return modelToView;
} |
a563bbfa-f271-42e3-82d4-e88e46b82190 | 0 | @Test
public void testGetMovimientos() {
System.out.println("getMovimientos");
Cuenta instance = new Cuenta();
ArrayList expResult = null;
ArrayList result = instance.getMovimientos();
assertEquals(expResult, result);
// TODO review the generated test code and remove ... |
8083c1b3-9a1e-487d-835d-c7835a3f2097 | 7 | public HashMap getTags(RandomAccessFile s) throws IOException {
int xoff = 4; // skip file magic
int retry = 64;
boolean need_infos = true;
boolean need_tags = true;
HashMap infos = new HashMap();
HashMap tags = new HashMap();
for(; retry > 0; retry--) {
PageInfo pi = parse_stream_page(s, xoff);
... |
7a08ce9f-3320-4c76-9897-725635f1c543 | 4 | public void run () {
//Guarda el tiempo actual del sistema
tiempoActual = System.currentTimeMillis();
//Ciclo principal del Applet. Actualiza y despliega en pantalla la
//animación hasta que el Applet sea cerrado.
while(true){
if(!bPausa ... |
056cf6d8-78cc-47e1-9f8a-b27fc4ef0769 | 9 | public void start(){
System.out.println("LABYRINTHE");
System.out.println("================");
System.out.println("1/ Générer Labyrinthe Simple");
System.out.println("2/ Générer Labyrinthes Multiples");
System.out.println("3/ Solutions");
Scanner scanner = new Scanner(Sys... |
c51f1d02-1259-4828-bfbb-076127fde7c8 | 0 | public static Hand Flush(List<Card> cards, Suit suit) {
return new Hand(HandRank.Flush, suit, cards.get(0).rank, cards.get(1).rank, cards.get(2).rank, cards.get(3).rank, cards.get(4).rank);
} |
8b588c96-b01d-43b4-9078-1277b6121284 | 7 | public void writeEvents(File file)
{
FileOutputStream fos=null;
OutputStreamWriter osw=null;
PrintWriter writer=null;
try
{
fos=new FileOutputStream(file);
osw=new OutputStreamWriter(fos,"UTF8");
writer=new PrintWriter(osw);
writer.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
writer... |
12bb42ac-dfb8-4053-8bc9-115484376dfd | 7 | private void sendLoanRequest(double salary, double loanAmt) {
// Create and send the loan request message request
SendMessageRequest loanRequestMessageRequest = new SendMessageRequest();
MessageAttributeValue value = new MessageAttributeValue()
.withDataType("String");
value.setStringValue(uuid.toString())... |
cd291fb6-ae99-45c6-ad69-a90d515937bb | 1 | public ArrayList<ItemType> getItem() {
if (item == null) {
item = new ArrayList<ItemType>();
}
return this.item;
} |
fef005ed-7a0c-4b64-b9c6-56227dfc797d | 6 | private void printMeleeScores(BattleScore lastScore, BattleScore avgScore,
String challenger, ScoringStyle scoringStyle) {
RobotScore challengerScore = lastScore.getRobotScore(challenger);
RobotScore avgChallengerScore = avgScore.getRobotScore(challenger);
Map<RobotScore, RobotScore> avgScoreMap = Ma... |
935b375e-963e-4918-94db-0ec5ea0d36bf | 9 | public static ArrayList<Employee> readFromXML(String file)
{
try {
File xmlFile = new File(file);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(xmlFile);
doc.getDocumentElement().normali... |
6d089b5f-3ddd-4363-ac53-c67e86c306aa | 0 | public String getCheminIcone() {
return icone;
} |
c1be8eaf-f84a-4f86-a4e2-18a6325f7f4e | 9 | private void lossyFilterNear(int q) {
for (int i = 0; i < biWidth; i ++) {
for (int i2 = 0; i2 < biHeight; i2 ++) {
for (int i3 = 0; i3 < 3; i3++) {
image.setPoint(i, i2, i3);
int val = image.getCurVal();
int nv = filter(i, i2, i3);
if (nv < 0) { nv += 256; }
... |
598c707e-2157-41d4-ae09-c8d2596a2df8 | 2 | @Override
public ArrayList<Object> show(int id) {
conn = new SQLconnect().getConnection();
ArrayList<Object> tns = new ArrayList<Object>();
try {
String sql = "select * from Timenodes where display = 'true' and time_owner = " + id + " order by time_weight desc;";
Statement st = (Statement) conn.createState... |
d530b804-6d2c-4f43-aaf7-480f2a45ddda | 9 | @Override
protected Move makeMove(boolean[] foodpresent, int[] neighbors,
int foodleft, int energyleft) {
Move m = null;
if (energyleft <= ENERGY_TO_MOVE * 5 && foodleft != 0) {
return null;
}
int direction = 4;
for (int move : getValidMoves(neighbors)) {
if (foodpresent[move]) {
directio... |
b29a4a2f-0b8b-49aa-80b6-8a78c2bf97ba | 4 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder sb = new StringBuilder();
count(coins, coins.length, 7490);
d: do {
line = br.readLine();
if (line == null || line.length() == 0)
brea... |
3ee49f85-c9c0-4b9b-8ae8-183ce5deefb1 | 3 | protected void processBlock(byte[] data)
{
t0 += 512;
if ((t0 & ~0x1FF) == 0)
t1 ++;
int v0 = h0;
int v1 = h1;
int v2 = h2;
int v3 = h3;
int v4 = h4;
int v5 = h5;
int v6 = h6;
int v7 = h7;
int v8 = s0 ^ (int)0x243F6A88;
int v9 = s1 ^ (int)0x85A308D3;
int vA = s2 ^ (int)0x13198A2E;
int vB... |
19012216-3ed8-4451-b0c1-cc578b90d4ea | 1 | @Test
public void estLogIdGenerator() {
LogIDGenerator logIDGenerator = new UUIDHashLogIDGenerator();
int size = 10000;
Set<Long> largeSet = new HashSet<Long>(size);
for (int i = 0; i < size; i++) {
long id = logIDGenerator.generate(null, null, new Objec... |
7e3d55d6-dbda-4f3d-97be-734b12bab8c3 | 7 | @Override
public void mouseReleased(MouseEvent e) {
System.out.println("Mouse released");
Point mouse = e.getPoint();
isImPress = false;
isExPress = false;
isImHover = importHover(mouse.getX(),mouse.getY());
isExHover = exportHover(mouse.getX(),mouse.getY());
isImChose = !isExportError();
... |
d968580a-ec50-4c49-a540-421775a80fef | 6 | public static void addToSubs(String str){
if(str.startsWith("@")){
str = str.substring(1);
}
subFile = new File(str + "Subs.UMW");
boolean exists = false;
if(subFile.exists()){
try {
Scanner input = new Scanner(subFile);
while(input.hasNextLine()){
if(input.nextLine().contentEquals(userObj.... |
71b32bad-ef6c-4455-a2d1-ba682bbf3e46 | 1 | @Before
public void putDataQuickSort(){
a_quickSort = new Integer[MAX];
for(int i = 0; i < MAX; ++i){
a_quickSort[i] = i + 1;
}
shuffleIntArray(a_quickSort);
} |
78829647-410d-40f2-89c5-b7b58a9b0b56 | 0 | public Map<String, String> getHeaders() {
return headers;
} |
2a3aecb7-72bf-410d-8b15-1a5f63f129e7 | 2 | private boolean isCadenaEnLista(String cadena, List<String> lista) {
for (String s : lista) {
if (cadena.equals(s)) {
return true;
}
}
return false;
} |
a6390c72-6515-4245-a7b8-847645e8cf7a | 4 | public static Resource createResource(JSONObject data) throws JSONException {
switch (convertType(data.getString("type"))) {
case Pool:
return new net.elbandi.pve2api.data.resource.Pool(data);
case VmQemu:
return new net.elbandi.pve2api.data.resource.Vm(data);
case Node:
return new net.elbandi.pve2api.... |
7e62633e-a76f-4d93-9dac-bcd2acf554e1 | 3 | public Set<Integer> generate(int m, ArrayList<Integer> n) throws Exception {
// Create a new arrayList to store all the integers not in n.
ArrayList<Integer> rest = new ArrayList<Integer>();
// Create a new set
Set<Integer> set = new HashSet<Integer>();
for (int v : n) {
rest.add(v);
}
for (int i = 0; ... |
479490de-bb47-4597-9439-08fd1aa2861a | 8 | private boolean isBacklog(long now, OneMerge merge) {
double mergeMB = bytesToMB(merge.estimatedMergeBytes);
for (MergeThread mergeThread : mergeThreads) {
long mergeStartNS = mergeThread.merge.mergeStartNS;
if (mergeThread.isAlive() && mergeThread.merge != merge &&
mergeStartNS != -1 &&
... |
2b723a43-4eb5-483d-a346-3770c67c2a85 | 9 | public Matrix solve (Matrix B) {
if (B.getRowDimension() != m) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!this.isNonsingular()) {
throw new RuntimeException("Matrix is singular.");
}
// Copy right hand side with pivoting
int n... |
2479de5a-4d74-4d00-a4ba-2907b33bba73 | 6 | private String findBackupWeStarted(String prevBackupName, Date timeoutDate) {
String backupWeStartedName = null;
com.unispezi.cpanelremotebackup.tools.Console.print("Polling for backup we just started");
while ((backupWeStartedName == null) && (new Date().before(timeoutDate))) {
com.... |
a41004e1-72c7-487b-abeb-c85eb87a448c | 6 | public static Stella_Object accessXmlDoctypeSlotValue(XmlDoctype self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Stella.SYM_STELLA_NAME) {
if (setvalueP) {
self.name = ((StringWrapper)(value)).wrapperValue;
}
else {
value = StringWrapper.wrapString(... |
df2800bd-24d9-4b9c-826a-7eff2842e805 | 1 | protected ImageIcon createImageIcon(String path,
String description) {
java.net.URL imgURL = getClass().getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Couldn't find file: " + pa... |
39c19ece-1ba2-45f4-a319-a9f6ff3d550b | 1 | public void dumpDeclaration(TabbedPrintWriter writer)
throws java.io.IOException {
LocalInfo li = getLocalInfo();
if (li.isFinal)
writer.print("final ");
writer.printType(li.getType().getHint());
writer.print(" " + li.getName().toString());
} |
1fb62466-78e8-45c4-b8a9-c12c5166ad5c | 9 | public Matrix4x4 getInverseMatrix() {
/*
* inverse matrix is given by A^(-1) = 1/det(A) * CT where CT is the
* transpond matrix of cofactors c(i,j) = (-1)^(i+j)*det(A(i,j))
* [source: "Principles of Interactive Computer Graphics",
* W.M.Newman/R.F.Sproull]
*/
double det = this.computeDeterminante();... |
42a15dce-5aee-47c2-846a-8aa041c27ef2 | 8 | public byte whoWin() {
// The player with the most pieces on the board at the end of the game
// wins
// State.DARK dark wins, State.LIGHT light wins, State.TIE tie,
// state.NONE nobody wins yet(game hasnt finished yet)
if (getNumberOfMoves(state.board, State.DARK) != 0
|| getNumberOfMoves(state.board, ... |
b3a02513-ab8a-4d65-89b2-3147654fb5d8 | 2 | public Vector3D getAverageLocationOfOpponents(Opponent[] opponents) {
float totalX = 0;
float totalY = 0;
if (opponents.length == 0)
return null;
for (Opponent opponent: opponents) {
Vector3D opponentLocation = opponent.getLocation();
totalX += opponentLocation.getX();
totalY += opponentLocation.get... |
68fe6c3b-17b9-4d96-93b5-a3ad2570ff3a | 0 | @Before
public void setUp() throws Exception
{
_player1 = new Player("Player A");
_player2 = new Player("Player B");
_underTest = new GameManager();
} |
3fb8394b-6708-4e51-8240-c20530a3005e | 2 | @Override
public int compareTo(Delayed o) {
Student student = (Student) o;
return submitTime > student.submitTime ? 1 : (submitTime < student.submitTime ? -1 : 0);
} |
c52fddaa-73fd-4b1b-a341-628ff3e2bf85 | 6 | static Bag createBag(BagType type) {
switch (type) {
case SANDBAG: return new Sandbag();
case GRAVEL_BAG: return new GravelBag();
case CEMENT_BAG: return new CementBag();
case WOODEN_DIVIDER: return new WoodenDivider();
case IRON_DIVIDER: return new Ir... |
269d967b-d234-4908-bc35-9911038e35f0 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
PayloadTermQuery other = (PayloadTermQuery) obj;
if (function == null) {
if (other.function != null)
ret... |
0007048f-b35a-437d-98df-30473d5e76f8 | 6 | public static int evaluate(String in) {
StkInt stack = new StkInt();
String opers = "+-*/";
for (int a, b, i = 0; i < in.length(); i++) {
if (opers.indexOf(in.charAt(i)) == -1) {
stack.push(in.charAt(i) - 48);
} else {
b = stack.pop();
... |
95063400-9cdd-474d-adbc-5fdccff625d3 | 2 | private void startComputer() {
final Thread computer = new Thread() {
public void run() {
try {
// Perform user-defined calculations
while (computerRunning) {
long startTime = System.currentTimeMillis();
compute();
lastCalculationDuration = System.currentT... |
e91f3f66-7d90-4859-9160-b360b4034ed5 | 0 | public void addBall()
{
Ball b = new Ball();
comp.add(b);
Runnable r = new BallRunnable(b, comp);
Thread t = new Thread(r);
t.start();
} |
2e07ec3d-e95b-4800-a963-b9ebbcff3175 | 4 | private File getConfigFile(String file) {
if(file.isEmpty() || file == null) {
return null;
}
File configFile;
if(file.contains("/")) {
if(file.startsWith("/")) {
configFile = new File(plugin.getDataFolder() + file.replace("/", File.separat... |
60a6cffe-fedd-4207-a753-771330655984 | 9 | private Constructor filterConstructors(Constructor[] constructors, Class[] parameterTypes) throws TooManyMatchesException
{
ArrayList<Constructor> list = new ArrayList<Constructor>();
outside1:
for(Constructor c : constructors)
{
if(parameterTypes != null)
{
... |
58264b01-184a-4692-be32-902ca9d1fb2b | 7 | public void actionPerformed(ActionEvent event){
String tempName = "a";
dnisenba_lab06_Course tempCourse = new dnisenba_lab06_Course();
boolean courseNotFound = true;
while (courseNotFound == true){
tempName = JOptionPane.showInputDialog(null,"Enter Course to drop Student from: ",
"Input", JOptionPane.Q... |
e80f39b2-beb3-4a88-a495-e786f9a546c0 | 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(new FileInpu... |
062bb95a-7dce-4705-8233-99b8bee5c46e | 5 | @Override
public void displayMenu() {
String command;
do {
this.display();
// get command entered
command = this.getCommand();
switch (command) {
case "B":
control.displayBoardHelp();
break... |
168fa31e-138b-440a-b72f-1764f777096a | 3 | public void cancelPlaceable(Player p) {
if (p == registry.getPlayerManager().getCurrentPlayer()) {
if (currentlyPlacing()) {
if (placeables.containsKey(currentlyPlacing.getId())) {
placeables.remove(currentlyPlacing.getId());
}
curr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.