method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d1b4d98d-12b2-4c51-a5e6-e411a6f1f945
0
public String toString() { return "[" + grades[0] + " " + grades[1] + " " + grades[2] + "]" ; }
5ecc07c4-a70d-4b53-9a80-9902de5b8ef5
6
private boolean range(int x, int y ,int[] original_color,int range) { int rgb[] = new int[3]; if(rgb[0] >= original_color[0] +range || rgb[0] <= original_color[0] - range || rgb[1] >= original_color[1] +range || rgb[1] <= original_color[1] -range || rgb[2] >= original_color[2] +range || rgb[2] <= original_...
f20fd1dc-7018-4b55-9c9a-f5bfb79fb69c
2
private boolean isNameUnique(FileProtocol protocolToCheck) { for (int i = 0, limit = protocols.size(); i < limit; i++) { FileProtocol protocol = (FileProtocol) protocols.get(i); if (protocol.getName().equals(protocolToCheck.getName())) { return false; } } return true; }
699187a6-dd72-4721-9475-a27560715b77
3
@Override public void run() { initializeLogger(); BufferedReader commandReader = new BufferedReader( new InputStreamReader(System.in)); String commandLine; while (true) { commandLine = readLine(commandReader); String[] commandArgument = commandLine.split(" "); this.log.info("split command line: "...
2aa9982f-7073-4909-8db7-1b4e66b09dc8
2
public boolean setmin(int min) { if(min>0&&min<60) { _min=min; return true; } else return false; }
05fa7310-2a64-4453-a7c3-5d77595cce36
0
public location(String id){ super(id); }
a987270b-de3b-43ba-ac72-e12805eb84b2
0
public IDGrabber(String link) { this.link = link; }
0656ca0c-5850-4e56-a18f-5aad113b5690
6
public void displayMessage(String message, int type) { StyledDocument doc = chatWindow.getStyledDocument(); SimpleAttributeSet keyWord = new SimpleAttributeSet(); StyleConstants.setForeground(keyWord, Color.BLUE); final String finalmessage; String prefix = null; if (type ...
b57caa87-97f8-45eb-b151-842d291727de
3
public ArrayList<TeamObject> readTeamObject() { ArrayList<TeamObject> match = new ArrayList<TeamObject>(); try { CsvReader teams = new CsvReader(path); teams.readHeaders(); while (teams.readRecord()) { TeamObject read = new...
7bfe98e1-9f31-494d-9750-ca0647ec6575
2
private void calcImageSizes() { double labelRatio = (double) getWidth() / (double) getHeight(); double imageRatio = (double) image.imagewidth / (double) image.imageheight; if (labelRatio <= imageRatio) { imagePosX = 0; imageSizeX = getWidth(); } else { imageSizeX = (int) (getWidth() * (imageRat...
fee335b1-7d46-4f32-8b87-50b551f058f7
0
public double mean() { //************************** return this.mean; //************************** /* double sum = 0; for (int i = 0; i < inputbuffersize ; i++) { sum=sum+i; } return (sum / inputbuffersize); */ ...
dc2dac19-a663-47c4-8279-9af0db94b776
1
private static String getStringFromDocument(Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); ...
25aba24e-ca08-4e8d-8ba1-df91de941e79
3
public static int deleteRoom(String name) { int del = 0; Iterator<SavedRoom> rmit = Roomy.savedRooms.iterator(); while(rmit.hasNext()) { SavedRoom sv = rmit.next(); if (sv.getName().equalsIgnoreCase(name)) { int index = Roomy.savedRooms.indexOf(sv); if (index >=0) { rmit.remove(); del...
6000b50c-eb71-4e25-8b75-577a3ef3b0ba
9
static final void updateLocalPlayerMovement() { Class142_Sub27_Sub3.incomingVector.initBitAccess(); int updateFlag = Class142_Sub27_Sub3.incomingVector.readBits(1); if (updateFlag == 0) { return; } int movementFlag = Class142_Sub27_Sub3.incomingVector.readBits(2); ...
4b81446c-bebb-4915-8933-f68e2eaf481f
6
@Override public void quickPlay( boolean priority, boolean toStream, boolean toLoop, String sourcename, FilenameURL filenameURL, float x, float y, float z, int attModel, float distOrRoll, boolean temporary ) { SoundBuffer b...
63ca8c04-5c45-4d95-afc0-cc84abd6e420
9
private String readString() throws JSONException { Kim kim; int from = 0; int thru = 0; int previousFrom = none; int previousThru = 0; if (bit()) { return getAndTick(this.stringkeep, this.bitreader).toString(); } byte[] bytes = new byte[65536];...
f631effb-b02b-4cfa-98b9-84ff87e5ed44
2
@Override public int createRenderTarget(int width, int height, int texId) { int fbo = glGenFramebuffersEXT(); FramebufferData data = new FramebufferData(width, height); framebuffers.put(fbo, data); if (texId != 0 && texId != -1) { bindRenderTarget(fbo); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, ...
89f9fff8-edb2-4c01-a4bd-9ac7f06e28b1
8
public String toDot() { StringBuilder s = new StringBuilder(); s.append("digraph {\n"); s.append("\tnode [shape=point, color=white, fontcolor=white]; start;\n"); s.append("\tnode [shape=circle, color=black, fontcolor=black];\n"); //a roundabout way of collecting transitions... HashMap<Tuple, ArrayList<Ch...
75c61d3c-66d2-420c-b513-57cd7dc77bd7
1
public int hashCode() { return (int)(9 *((hardness == null) ? 0 : hardness.hashCode())); }
a7df8b0d-d7ed-460e-af50-c06afc2ccaaf
1
@Deprecated public static ComplexMatrix multyply2x2(ComplexMatrix a, ComplexMatrix b) { try { return new ComplexMatrix(new Complex[][]{ { a.getElem(0, 0).times(b.getElem(0, 0)) .add(a.getElem(0, 1).times(b.getEle...
356b4e71-d196-4c49-b368-171b65026aaa
5
public Writer write(Writer writer) throws JSONException { try { boolean b = false; Iterator keys = keys(); writer.write('{'); while (keys.hasNext()) { if (b) { writer.write(','); } Object k = ke...
9814fdda-81db-4cc7-8251-01977e3bd435
5
@Override public void eigenschaftUpdate() { //early out, wenn wir gerade laden. if(_leveldaten == null) return; RaumBearbeitenPanel bearbeitenPanel = _ui.getBearbeitenPanel(); if(_ui.getMap().buttonAusgewaehlt() && bearbeitenPanel != null) { Raum raum = bearbeitenPanel.getRaum(); RaumEigenschafte...
d672fc55-6ba5-4346-9824-fa3d5d00904b
8
private void playerDead(int coordX, int coordY) { timerUtils.stopTimer(); System.out.println("You are dead."); cellArray[coordX][coordY].type = Cell.CellType.MINEEXPLODED; this.playerIsDead = true; for (int x = 0; x < sizeX; ++x) { for (int y = 0; y < sizeY; ++y) { if (cellArray[x][y].type == Cell....
acde6a0b-3aee-4148-af80-c7cc9d2e3ddf
4
public void loadCfg(String fileName) throws Exception { // load config synchronized(hostCache) { Properties p = new Properties(); p.load(new FileInputStream(fileName)); for (Object k: p.keySet()) { String key = (String)k; String value = p.getProperty(key); // build host record from value Ho...
68d87b56-47b5-46d6-aba9-7495daa828fd
1
public LocaleBtnPreview(SkinPropertiesVO skin, JPanel parent) { if (skin == null) { IllegalArgumentException iae = new IllegalArgumentException("Wrong parameter!"); throw iae; } this.skin = skin; }
9df666c6-05d6-41a2-9acf-193016bd25c4
2
public static void main(String[] args) { long max = 0; long maxindex = 0; for (int i = 1; i < 1e6; i++) { // System.out.println(i); long temp = trace(i); if (temp > max) { maxindex = i; max = temp; } } System.out.println(maxindex); }
18d082cd-8476-4d64-9d08-eb6ce58c669d
2
public void synchronizeMenus() { // Get SubMenu Items OutlinerSubMenuItem openMenuItem = (OutlinerSubMenuItem) GUITreeLoader.reg.get(GUITreeComponentRegistry.OPEN_MENU_ITEM); OutlinerSubMenuItem importMenuItem = (OutlinerSubMenuItem) GUITreeLoader.reg.get(GUITreeComponentRegistry.IMPORT_MENU_ITEM); OutlinerSubM...
f4cfb303-102b-486e-9642-338b5ec62051
4
private static void testIsSolved() { // In this test, you'll want to create a new 2D Color array and // reassign the ColumnPuzzle's array in order to test isSolved(). // There are two tests here. You should add other test cases. int tests = 0; int failed = 0; printHeade...
35ccafb6-56ab-4041-8d8f-2bb4bebc4c6c
1
private void zzScanError(int errorCode) { String message; try { message = ZZ_ERROR_MSG[errorCode]; } catch (ArrayIndexOutOfBoundsException e) { message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; } throw new Error(message); }
a592d7fd-49be-402b-a71d-7eb068387779
2
public void combat(){ int combatDamage = 0; for(Creature c : p1.getCritters()) if(c.canAtk()) combatDamage += c.getPower(); //System.out.println("Combat Damage " + combatDamage); p1.damage(combatDamage); }
2ca3e659-df14-4906-9db5-7307052b8da9
4
void negateBatteryAtPos(int[] changepos) { ArrayList<String> usedAlready = new ArrayList<>(); int currentSlot = 0; // the current slot: if a repeat is encountered it doesn't count as a slot. for (int i = Competition.getInstance().getNextCodeRedMatch(); i < Competition.getInstance().getNextCodeRe...
efcaa913-ed35-4c6e-abde-cb0ce9a93f2b
5
public boolean subscribe() throws Exception { Message message = connection.receive(); System.out.println(message.getPayloadBuffer().toString()); String[] tmp; tmp = message.getPayloadBuffer().toString().split(" ", 2); message.ack(); if(firstMsg == false) {msgP...
39ce939f-c3fb-4783-951a-7f097775be50
1
public static void main(String[] args) { Distance d1 = new Distance(10, "mm"); Distance d2 = new Distance(2.5, "cm"); Distance d3 = d1.add(d2); Point p1 = new Point(new Distance(10, "mm"), new Distance(15, "mm")); Point p2 = new Point(new Distance(30, "mm"), new Distance(50, "mm")); Point p3 = new Point(ne...
84160549-019c-4749-9a5c-30675c4d4dad
4
public void validate(Object paramValue, Object value) { if (paramValue instanceof String) { isGreaterThanString((String) paramValue, value); } else if (paramValue instanceof Integer) { isGreaterThanInteger((Integer) paramValue, value); } else if (paramValue instanceof Boolean) { throw new IllegalArgument...
f3f86600-49f6-4de7-af38-4ac600f53ed0
1
public PokemonManager getInstance() { if(instance == null) instance = new PokemonManager(); return instance; }
aadd1a7b-2d7b-47c4-9889-b42074de7899
6
public boolean canJump(int[] A) { int n = A.length; if (n==0){ return false; } boolean[] result = new boolean[n]; result[0]=true; for (int k=1;k<0;k++){ result[k]= false; } for(int i = 1;i<n;i++){ for (int j=0;j<i;j++){ ...
8726e1cd-2fef-410d-8d17-e106f0075735
1
public static void main(String argv[]) { Frame frame = new Frame(GlobalOptions.copyright); Window win = new Window(frame); String cp = System.getProperty("java.class.path"); if (cp != null) win.setClassPath(cp.replace(File.pathSeparatorChar, Decompiler.altPathSeparatorChar)); String cls = win.getClas...
254309c6-ff3c-468c-baa9-017eb57caabf
1
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked if (jTable1.getModel().getValueAt(jTable1.getSelectedRow(), jTable1.getSelectedColumn()) == null) { killButton.setEnabled(false); return; } else killButton.setEna...
f60cbead-2045-4fb4-b00b-51393733c389
5
private void compileTypeDeclarations(Program program) throws ParseException, IOException { while (tokenizer.tokenType() == Tokenizer.KEYWORD) { // type or const switch (tokenizer.keyword()) { case Tokenizer.KW_TYPE: compileType(); break; case Tokenizer.KW_CONS...
2681d79d-460b-42bd-811f-b6338025416a
7
public String calculateDepositedAmountAgainstCostOfSoda(BigDecimal costOfSoda, BrandsOfSoda soda, int compared, boolean hasStock) { if (workingBalance.equals(new BigDecimal(ZERO_DOLLARS)) && hasStock) { return MESSAGE_PLEASE_INSERT_PROPER_AMOUNT_PREFIX + costOfSoda.toString() + CENTS; } ...
928ca266-0d15-4a41-9a52-7c76630e127f
2
@Override public void addTextBack() { Element textBack = text.getOwnerDocument().createElement("path"); String d = "M"; for (Coordinate c : geometry.getCoordinates()) { if(d.length()>1){ d=d+" L"; } d = d + " " + c.x + "," + c.y; } textBack.setAttribute("d", d); textBack.setAttribute("style", ...
68b2e203-34f7-4f01-9aeb-d9ff4de78a6d
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
00985532-67d8-4318-9060-d05df8b94696
6
public Sprite findSpriteAtCanvasLocation(int x, int y) { for (Police p : level.getPolices()) { if (p.containsPoint(x + INTERSECTION_RADIUS, y + INTERSECTION_RADIUS)) { return p; } } for (Zombie z : level.getZombies()) { ...
982e42ab-f5c8-445b-9f04-8cfcc881a821
8
public void DoTimeStep() { // Add ships to each non-neutral planet according to its growth rate. for (Planet p : planets) { if (p.Owner() > 0) { p.AddShips(p.GrowthRate()); } } // Advance all fleets by one time step. for (Fleet f : fleets) { f.TimeStep(); } // Determine the result of any batt...
a9474968-0a04-4d3c-9af1-8ca7f3614f96
9
int get(Token id) { switch(id) { case PosY: switch(this) { case TrainStation: case ArkhamAsylum: case BankOfArkham: return 88; case Docks: return 1016; default: return 0; } case PosX: switch(this) { case TrainStation: return 263; case BankOfArkham: return 511...
31eeb02f-00c9-44ae-a2f9-482e85622908
2
private void paintInvasores(Graphics2D g2d){ for (Invasor i : invasores) { if(i.isVivo()) i.paint(g2d); } }
b2a8b880-b051-49e0-844a-17dde8967cac
6
private int splitData(int startIndex, int endIndex) { // find pivot element with median-of-three heuristic int middleIndex = (startIndex + endIndex) >> 1; int lastButOneIndex = endIndex - 2; swap(middleIndex, lastButOneIndex); compareAndSwap(startIndex, lastButOneIndex); compareAndSwap(startIndex, end...
8aeee6c6-4767-4a9d-98db-0ef8c92d9e06
0
private void doInit() throws UnknownHostException, IOException { remoteClientCall = new RemoteClientCall(serverIP, port); remoteClientCall.setIdleTimeout(idleTimeout); remoteClientCall.init(); remoteClientCall.addExceptionListener(new IExceptionListener() { @Override public boolean OnExce...
29dbace5-6c1f-4ec3-accd-ba249cc3863e
6
public boolean during(Temporal temporal) { if (null == temporal) return false; if (this == temporal) return true; if (isTimeInstance()) { if (temporal.isTimeInstance()) return startTime == temporal.startTime; return !(startTime < temporal.startTime || temporal.endTime <= endTime); } else return !(startTim...
be993c9e-87bc-448e-9542-4d623728485d
7
public Item onItemRightClick(Level level) { Random r = new Random(); int attackx = level.player.x; int attackz = level.player.z; int hitChance = level.player.getSkill(PlayerSkill.MELEE); boolean hit = r.nextInt(100) <= hitChance; if (level.player.rot == 0) attackz++; ...
f59dd438-bef3-45a3-a2e2-756a2bc1e409
4
public static void main(String[] args) { if (args.length != 1) { System.err.println("usage: java Registrar [integer]"); System.exit(1); } int n = Integer.parseInt(args[0]); Registrar server = new Registrar(n); Utils.out(server.pid, String.format("Registrar started n = %d.", n)); ServerSocket server...
8818ceb5-4c18-43e3-9bb1-1a42b3ab1a05
4
private void doDrawing(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.red); Dimension size = getSize(); Insets insets = getInsets(); int w = size.width - insets.left - insets.right; int h = size.height - insets.top - insets.bottom; int middle = w >> 1; g2d.setColor(C...
0a46f1a3-7a0c-43ee-8b01-a161abed6d35
7
private boolean processLine(String line){ for(int i = 0; i < line.length(); ++i){ char c = line.charAt(i); if(c != ' ' && c != '|' && c != '-' && c != 'x') return false; List<GridType> list = grid.get(grid.size()-1); if(c == ' ') list.add(GridType.Empty); else if(c == 'x'){ starting...
f7a182f1-44b4-462b-9c17-407364ff8bbc
9
@Override public byte[] runBinaryMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) throws HTTPServerException { final ByteArrayOutputStream bout=new ByteArrayOutputStream(); try { synchronized(sync) { final boolean imageRequest=httpReq.isUrlParameter("IMAGE"); if(imageRequest) { ...
0ae7e109-63e0-4cf2-86b6-02adc303063f
4
public static void reloadChat( String readUTF ) throws SQLException, IOException { ByteArrayOutputStream b = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream( b ); try { out.writeUTF( "Reload" ); } catch ( IOException e ) { e.printStackTrac...
3cf8f35f-edd1-4411-a6c5-f4b9a38699c2
9
public String stExternalEmailYahooLogin(int dataId,int ExpVal,String flow ) { int actVal=1000; String returnVal=null; hm.clear(); hm=STFunctionLibrary.stMakeData(dataId, "Login"); String emailadrs = hm.get("EmailAddress"); String password = hm.get("Password...
4af8cf33-32a5-4db5-bc95-5f9833b97402
2
public Customer getCustomererById(int id){ for(Person person : customerList){ if(person.getId()==id){ return (Customer)person; } } return null; }
1b76984c-a1bb-4475-a114-6c5fe1fc80f1
1
public void enqueue(Object item) { if(first == null) { last = new Node(item); first = last; } else { last.next = new Node(item); last = last.next; } size++; }
a66b2473-623b-4759-b33c-bed8ca15f6ad
4
public void runOnce() throws InterruptedException { Collections.shuffle(agents); for (AgentAbs agent : agents) { environment = agent.run(environment); } vue.grille(); Thread.sleep(environment.wait_time); agents = new ArrayList<AgentAbs>(); for (int y = 0; y < environment.taille_envi; y++) { for (...
534d49d0-8914-48bd-affd-082f4425e2e8
4
private static final void handleEntry( String entry, final String path, final Collection<ClassPathHandler> handlers, final ClassLoader classLoader, final ErrorHandler errorHandler ) { if ( !entry.endsWith( CLASS_EXTENSION ...
831b5faf-7d8b-49d0-b774-e4a0271a7809
2
public static String trimString(String str, int length) { if (str == null) { return ""; } else if (str.length() > length) { return str.substring(0, length - 3) + "..."; } else { return str; } }
b3224b37-e52e-485f-87dd-d3187ed68601
3
private Main() { System.setOut(new Logger(System.out)); System.setErr(new Logger(System.err)); System.out.println("Home Directory: " + System.getProperty("user.home")); System.out.println("Current Directory: " + System.getProperty("user.dir")); Runtime.getRuntime().addShutdownHook(new ShutdownHook()); Sy...
b25cb104-493d-485c-a080-67c5848ad368
0
public static void main(String[] s) { //wap to find square root of 64 without using inbuilt function and arithmetics int x=64; //in binary 1000000 int y=x>>3; // in binary 1000 System.out.println("the square root of 64 is "+y); }
b3d98cf7-6a5b-4c37-b881-24ec753381a3
7
private void topPossibleMoves(Piece piece, Position position) { int x1 = position.getPositionX(); int y1 = position.getPositionY(); if(y1 >= 0 && y1 < 7) { boolean pieceNotFound = true; for (int i = y1 + 1; pieceNotFound && (i < maxHeight) && (board.getChessBoardSquare(x1, i).getPiece().getPieceC...
7286881c-1fcc-4a7f-bdd8-28b3692d67dc
0
@Override public void actionPerformed(ActionEvent e) { saveAsOutlinerDocument((OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(), getProtocol()); }
523a1468-c1da-4df1-b0ae-b26447eefeeb
0
public static Configuration getConfiguration() { return configuration; }
53961d47-60f8-4d49-862f-0f864b89b753
7
private void writeNameValuePair(String uri, String localName, String qualifiedName, String value) throws SAXException { try { writeName(uri, localName, qualifiedName); output.write("=".getBytes("UTF-8")); output.write("\"".getBytes("UTF-8")); if (value != null) { ...
fc9f5658-bc1d-48d1-b077-3eb79fa58783
2
private IUIAction getObjectForCmd(String cmd) { for(Iterator<String> it = commands.keySet().iterator(); it.hasNext();) { String actVal = it.next(); if(actVal.equalsIgnoreCase(cmd)) { return commands.get(actVal); } } return null; }
6817b50e-4daf-4e92-95a0-be212e991229
2
public static void main(String[] args) { GasVehicle gasolineVehicle = new GasVehicle(); gasolineVehicle.makeTrip(); System.out.printf("Efficiency of Gas Vehicle (miles/gallon): %.02f%n", gasolineVehicle.getMilesPerGallon()); ElectricVehicle electricVehicle = new ElectricVehicle(); electricVehicle.makeTrip...
07995b5a-9835-4dc8-9b54-c1217fafa274
0
public void setFilePath(String name){ fileName = name; }
26cd6664-948f-49b3-b0df-bdbe93dd729f
4
public void setInitRes() { switch (type) { case 1: // TYPE_VEG_FAIBLE resInterne = ConstantesAgents.RES_INT_VEG_FAIBLE; resExterne = ConstantesAgents.RES_EXT_VEG_FAIBLE; break; case 3: // TYPE_VEG_MOY resInterne = ConstantesAgents.RES_INT_VEG_MOY; resExterne = ConstantesAgents.RES_EXT_VEG_MOY; ...
55def4f9-d834-47c0-88b3-b05f1f63e2d0
8
public Animation checkAnimationState(Animation animation){ if(dead){ return death; } if (type == Type.CAT){ if (animation == dogAnimLeftWalking){ return catAnimLeftWalking; } else if (animation == dogAnimRightWalking){ return catAnimRightWalking; } else if (animation == dogAnimLeftSta...
d5cce9e2-4bf2-4a3a-8ccb-373e979b5ab8
7
private void CHASE(Vector3f direction, float distance) { double time = (double)Time.getTime()/(double)(Time.SECOND); double timeDecimals = time - (double)((int)time); if(timeDecimals < 0.25) material.setTexture(textures.get(0)); else if(timeDecimals < 0.5) ma...
b188ef6b-db6e-4ac6-a2bb-adb8cc0c5342
6
public Currency search(String string) throws CurrencyNotFoundException, MultipleCurrencyException { for (Currency currency : set) { if (currency.getCode().equalsIgnoreCase(string)) return currency; if (currency.getSymbol().equalsIgnoreCase(string)) return currency; if (curren...
ce4ff5c9-192e-434d-b6e0-094185523338
8
private void printArray(ArrayList<Integer> theGuess2, boolean useInt) { int i = 0; while (i != theGuess2.size()) { int colour = theGuess2.get(i); if (useInt) { System.out.print(colour + " "); } else { if (colour == RED) { System.out.print("red "); } else if (colour == BLUE) { S...
55881bd3-b88b-495a-baec-dcd0b4c0916d
4
public boolean add(Object element) { if (element == null) throw new NullPointerException(); for (int i = 0; i < count; i++) { if (element.equals(elementObjects[i])) return false; } if (count == elementObjects.length) { Object[] newArray = new Object[(count + 1) * 3 / 2]; System.arraycopy(eleme...
f4cd5e23-31a7-452b-96e2-eea6f1fc3a25
6
static public String numberToString(Number n) throws JSONException { if (n == null) { throw new JSONException("Null pointer"); } testValidity(n); // Shave off trailing zeros and decimal point, if possible. String s = n.toString(); if (s.indexOf('.') > 0 ...
b9ef47d1-8fd8-4870-ad6b-68d2eb7d5d3d
8
public static String getMessage(int skill) { switch (skill) { case Skills.AGILITY: return "deftness and precision"; case Skills.CONSTRUCTION: return "buildings and security"; case Skills.COOKING: return "fire and preparation"; case Skills.FISHING: return "life and cultivation"; case Skills.FLETC...
76807fbb-1a3f-4557-9016-9f2d82766ea9
0
public TiltForDistance(double power,Distance distance) { super(power, _targetFromDistance(distance)); _distance = distance; }
3241e760-0d44-4835-abad-828f469ef305
4
public void sincronizaVentas(){ PhpposAppConfigEntity idPos = getAppConfig("id_pos"); for (PhpposSalesEntity movimientoPos : getMovimientosPos()) { String tipoMovimiento = getTipoMovimientoPos(movimientoPos.getTipoMovimiento()); logger.info("tipoMovimiento = " + tipoMovimiento ...
2cae11ae-99ee-42cf-a440-bb39289d6773
3
public ConsoleVisualizer(GameBoard gameBoard) { this.gameBoard = gameBoard; printBoard(); GameResult result = GameResult.UNDETERMINED; while (result == GameResult.UNDETERMINED) { MoveDirection direction = getPlayerMove(); if (gameBoard.canMove(direction)) { result = gameBoard.move(direction); } ...
5aae312b-e025-4910-b64e-e6df3a3fb9e2
9
public static UserBean login(UserBean bean) { Statement stmt = null; String username = bean.getUsername(); String password = bean.getPassword(); String searchQuery = "select * from users where username='" + username + "' AND password='" + password + "'"; try { currentCon = ConnectionManager.get...
9fa11628-1810-48fe-871b-8e306171a51c
1
private static boolean deleteDrug(Drug bean, PreparedStatement stmt) throws SQLException{ stmt.setInt(1, bean.getDrugId()); int affected=stmt.executeUpdate(); if(affected==1){ System.out.println("Drug with ID "+bean.getDrugId()+" has been Removed from database."); } else { System.out.println("unabl...
aafe7548-1b04-4132-8750-ff1e02c5eeb9
3
public void updateArchNodes(int k) throws IOException{ for(int j=1; j<=archN; j++){ hiddenLayers[k]=j; if(k==0) //for(int l=0; l < hiddenLayersNo; l++) System.out.print(hiddenLayers[l]); testArchitecture(); //in if if(k-1>=0) updateArchNodes(k-1); } }
0fa35082-723e-45ee-b3aa-8cf6198e430b
5
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Person)) return false; Person person = (Person) o; if (!email.equals(person.email)) return false; if (!first_name.equals(person.first_name)) return false; if (!last_name.equal...
590592bc-ac9d-41cc-a673-69cf7d9d5ce8
3
@Override @SideOnly(Side.CLIENT) public void updateProgressBar(int id, int value) { switch (id) { case 0: te.progress = value; break; case 1: te.burnRemaining = value; break; case 2: te.currentFuelBurn = va...
808d2fc6-f279-4d15-bacc-7669ff58bfce
8
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[18]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 18; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
15cbfbe5-ffc0-4869-baeb-35137716d380
2
public void print(String name) { for (int i = 0; i < 20; i++) { System.out.printf("%s %s\n", name, i); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }
e8437fe6-e647-4c33-b65c-ff7cbbb63baf
7
protected void onEvent(Entity e) { if (method == null) { Class<?> cls = e.getClass(); while (true) { if (cls == Entity.class) return; try { Method m = cls.getDeclaredMethod(methodName); m.setAccessible(true); m.invoke(e); return; } catch (NoSuchMethodException e1) { cls = cl...
0f188238-5245-45b8-90d9-aab5a6cdd96b
4
private static EventDetailShopInfo getEventShopInfo(int eventId) throws HibernateException { EventDetailShopInfo eventDetailShopInfo = null; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); // get the event String hql ...
3063d8f2-96e5-4b78-92a8-83cd35672b31
5
private BranchGroup createRootBranch(){ BranchGroup rootGroup = new BranchGroup(); BranchGroup cubeGroup = new BranchGroup(); TransformGroup transGroup = new TransformGroup(); transGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); transGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_...
78f5d60c-8641-4e54-941c-bda1c90235dd
9
private void chargerFichier() throws Exception { // On ouvre le fichier InputStream flux = new FileInputStream(nomFichier); InputStreamReader fluxEntree = new InputStreamReader(flux); BufferedReader buffer = new BufferedReader(fluxEntree); String ligne; // Variable perme...
e89fdab7-c6d2-447e-920b-4f8b70bb82fb
1
private static ArrayList<Long> getTimesServed(String hostname) { ArrayList<Long> times = records.get(hostname); return (times == null) ? new ArrayList<Long>() : times; }
715a103c-19e7-4c62-8c49-29b6e6044356
1
public void decreaseCounter(){ movementkeycounter--; if (movementkeycounter==0){ isMoving = false; } }
c44d6772-9012-414d-b22f-cd97ee468ed4
5
private final void method4005(r_Sub1 var_r_Sub1, int i, int i_21_, int i_22_) { anInt8310++; if (i_22_ != 21722) fa(16, 8, null); int[] is = ((s_Sub3) this).anIntArrayArrayArray8321[i_21_][i]; int[] is_23_ = ((s_Sub3) this).anIntArrayArrayArray8313[i_21_][i]; int i_24_ = is.length; if (Class30.anIntArr...
2a93fc67-f210-4d1a-9769-17713743b4aa
8
public static String binarySearch(RandomAccessFile raf, String keyword, long startseek, long endseek) { //RandomAccessFile raf = new RandomAccessFile(file, "r"); //System.out.println("Binary Search "+keyword); if(startseek>=endseek) { //System.out.println("Start is more now"); return ""; } long m...
8be08b77-c463-414f-889b-a2a439449859
8
private static long doWork(Sort12 sorter, String document, int numwords, boolean doPrint ) { long start, end; // now read in words int nwords = 0; ArrayList<String> unsorted = new ArrayList<String>(numwords); // get the start time long totalTime = 0; try { // open up the document FileI...
a8575ea6-1264-40df-8fee-16eaf72fe4a2
7
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.drawImage(walls, 0...
efc006ed-5dd9-476f-af03-7b53986b0118
4
private static void sink(Comparable[] a, int k, int N){ //bounds error check: are there still children in array //k is parent idx while(2*k <= N){ int j = 2*k; //idx j is child of parent k //pick the smaller of the 2 children if( j < N && less(a, ...
880d909f-7fb2-4b97-beb2-95b7971f044f
5
public int isHit(int pdmg) { System.out.println("DMG:"+pdmg); System.out.println("DEF:"+def); int toDo = (pdmg-def); if (toDo <= 0) { //stays the same toDo=0; } else if(toDo > 0) { curHP = curHP-toDo; if(curHP < (-2*maxHP)) { System.out.println("OVERKILL"); curHP =...