method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1e3c20d7-bea1-4d8c-acb3-b8f8535d31b5 | 6 | public void tick(int par1)
{
this.tickCounter = par1;
this.removeDeadAndOutOfRangeDoors();
this.removeDeadAndOldAgressors();
if (par1 % 20 == 0)
{
this.updateNumVillagers();
}
if (par1 % 30 == 0)
{
this.updateNumIronGolems();
... |
9c31338e-4fb1-4611-9472-aebf1c48f84d | 4 | public String getAmount(){
String result = "";
if(amount < 1000) result = Integer.toString(amount);
if(amount >= 1000) result = Integer.toString(amount / 1000) + "k";
if(amount >= 1000000) result = Integer.toString(amount / 1000000) + "m";
if(amount >= 1000000000) result = Integer.toString(amount / 1000000... |
29d25c40-0752-4d43-aa45-da9cdb3efd1b | 2 | public static String calculate(String expression,boolean useDegree,int decimalPlaces){
useDegrees = useDegree;
try {
//Parse
Vector<Token> tokens = Parser.tokenize(expression);
tokens = Parser.convertToPostfixTokens(tokens);
double result = Parser.calculatePostfixTokens(tokens);
//Round to the s... |
70affb29-389a-4e73-9fff-e84451b31c7a | 2 | private void clearProjectiles() {
for (int i = 0; i < projectiles.size(); i++) {
Projectile p = projectiles.get(i);
if (p.isRemoved()) {
projectiles.remove(i);
}
}
} |
e6e0e9ee-8573-4c5c-aa6a-0825abee6092 | 1 | public void updateCollisionShape(Polygon col){
theEnemies = new CopyOnWriteArrayList<Enemy>(enemylist);
for(Enemy e : theEnemies){
e.collisionshape=col;
}
} |
8e438d84-8668-4fbc-81e5-767c0c523c7d | 4 | public Image getTile(int x, int y) {
if (x < 0 || x >= getWidth() ||
y < 0 || y >= getHeight())
{
return null;
}
else {
return tiles[x][y];
}
} |
9dc81bdb-60b4-4137-bbb7-9456a20d3d93 | 4 | public static int sqrt(int x) {
long start=0;
long end=x;
long middle=0;
long temp=0;
while(start < end){
middle = (start+end)/2;
temp=middle*middle;
if(temp < x)
start=middle+1;
else if(temp == x)
return (int)middle;
else {
end=middle... |
b19eada5-6f27-4928-b4cb-4c5e074955f7 | 0 | public JDialog getDialog() {
return dialog;
} |
88d7ff70-94c6-4949-99a1-55f4055cf31e | 8 | public void removeWalls(double accuracy) {
for (int x = 0; x < vWalls.length; x++)
for (int y = 0; y < vWalls[0].length; y++) {
if (vWalls[x][y] && Math.random() < accuracy) vWalls[x][y] = false;
}
for (int x = 0; x < hWalls.length; x++)
for (int y = 0; y < hWalls[0].length; y++) {
if (hWalls[x][y]... |
151e4ef6-0296-42c4-b5c6-590766ded0ad | 4 | public static Adress getAdressByID(int adressID){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
PreparedStatement stmnt = conn.prepa... |
3a88cd4d-c8b5-4755-87c4-b0717d8c461e | 5 | @Override
public int hashCode() {
int hash = 0;
hash += (a == null ? 0 : a.hashCode());
hash += (b == null ? 0 : b.hashCode());
hash += (c == null ? 0 : c.hashCode());
hash += (d == null ? 0 : d.hashCode());
hash += (e == null ? 0 : e.hashCode());
return hash;
} |
58c67100-1f30-489f-b1d7-2f4c0d105a15 | 3 | @Override
public TexInfo getTexInfo(int data){
switch(data){
default:
case 0:
return normal;
case 1:
return mud;
case 2:
return whiteFlowers;
}
} |
e0ce2d98-2f0c-4090-9219-47eb69477e33 | 5 | public void checkDown(Node node) {
this.down = -1; // reset value to -1
// Prevent out of bounds
if((node.getX()+1) < this.size.getX()) {
if(checkWall(new Node( (node.getX()+1), (node.getY()) ))) {
if(this.closedNodes.size()==0)
this.down = 1;
else {
for(int i = 0; i < this.closedNodes.size()... |
c3fb631e-36bc-413b-a416-552427f3c077 | 4 | public static void registerTileImage(Class<?extends Game> gameClass, char symbol, URL imageURL) {
tileImageURLs.put(new T2<Class<?extends Game>, Character>(gameClass,symbol), imageURL);
BufferedImage img = null;
try {
img = ImageIO.read(imageURL);
} catch (IOException e) {}
tileImages.put(new T2<Class<?ext... |
69a67b04-8b2f-4534-984a-f82e02a187d3 | 1 | public void link(Fibonaccinode y, Fibonaccinode x) {
y.left.right = y.right;
y.right.left = y.left;
y.parent = x;
if (x.child == null) {
x.child = y;
y.right = y;
y.left = y;
} else {
y.left = x.child;
y.right = x.child.rig... |
06ac9bdf-aae3-4b4f-b437-6b63c0ecc8e9 | 0 | public String getEmptyString(){
return emptyString;
} |
1198516f-8488-4bb2-871d-a3536cf3129c | 9 | private void jComboBox3actionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3actionPerformed
// TODO add your handling code here:
if (this.jComboBox3.getSelectedIndex() == 0) {
return;
}
int ptr = this.jComboBox3.getSelectedIndex() - 1;
String str = "The select event --- ... |
3a5da1e2-bc09-45bb-9498-0826da7e7781 | 2 | public static void generateRandomFile(String path, int size) throws IOException{
size *= 1024;
Process p = Runtime.getRuntime().exec("dd if=/dev/urandom of="+path+" count=1 bs="+size);
boolean finish = false;
while (!finish) {
try {
p.exitValue();
finish = true;
} catch (IllegalThreadStateExcep... |
ea10d869-4e08-4d22-b875-8726db435687 | 8 | public void actionPerformed(ActionEvent e) {
String c = e.getActionCommand();
String commandPlus = "";
String commandMinus = "";
for (int i = 0; i < numberOfGroups; ++i) {
commandPlus = String.format("%d+", i);
commandMinus = String.format("%d-", i);
if (c.equals(commandPlus)) {
UpdateTicketVa... |
c5382ba4-f485-4c57-913c-5cc0c094298d | 4 | private boolean zIntersects(Vec3D var1) {
return var1 == null?false:var1.x >= this.x1 && var1.x <= this.x2 && var1.y >= this.y1 && var1.y <= this.y2;
} |
a5266010-5bd5-4878-94d1-b01bb66f37a5 | 5 | public double getCorrectPercentage(long incorrect, long correct) {
if (correct < 0) {
System.out.println("Invalid number of correct answers");
return -1;
}
if (correct > 81) {
System.out.println("Invalid number of correct answers");
return -1;
}
if (incorrect < 0) {
System.out.... |
bf80fcd7-1104-4791-bf2f-f034a4d52aa9 | 0 | public ValidableEntitiesList getEntityList() {
return entityList;
} |
346535fe-5e77-4971-8255-7750f66b2daf | 6 | private void processSelectFile(APDU apdu) {
byte[] buffer = apdu.getBuffer();
byte p1 = buffer[OFFSET_P1];
byte p2 = buffer[OFFSET_P2];
if(p1 != (byte)0x02 || p2 != (byte)0x0C) {
ISOException.throwIt(SW_INCORRECT_P1P2);
}
short lc = (short) (buffer[OFFSET_LC] ... |
68e9d7d6-d4cd-4013-ba2d-b02986da8b35 | 6 | public ICodec getInstance()
{
if( iCodecClass == null )
return null;
Object o = null;
try
{
o = iCodecClass.newInstance();
}
catch( InstantiationException ie )
{
instantiationErro... |
e1066a9c-3eab-44e6-aa37-ad9c10e09b0f | 0 | @Override
public void execute(VirtualMachine vm) {
vm.newFrameAtRunTimeStack(numberOfArguments);
} |
72ec17d4-6390-43c3-b18c-d152894b6076 | 2 | void callAnnotated(Class<? extends Annotation> ann, boolean lazy) {
for (ComponentAccess p : oMap.values()) {
p.callAnnotatedMethod(ann, lazy);
}
} |
c1ad0d16-7e1e-41ec-9869-e2717cc20a76 | 1 | private void doAfterProcessing(ServletRequest request, ServletResponse response)
throws IOException, ServletException {
if (debug) {
log("FiltradoSesion:DoAfterProcessing");
}
// Write code here to process the request and/or response after
// the rest of the filter chai... |
04c03ceb-45ae-4844-8637-e01bbdb25b87 | 8 | public void putObjectOnBorder(Point inpNeighbourPoint, FieldObject inpObject) throws NoSuchPositionException {
if (inpNeighbourPoint.x < 0 || inpNeighbourPoint.y < 0 || inpNeighbourPoint.x > rowSizeForUser - 1 || inpNeighbourPoint.y > colSizeForUser - 1) {
throw new NoSuchPositionException("There is... |
0270500c-319f-429f-8f03-1cd275cca006 | 0 | @Override
public void paintComponent(Graphics g){
game.setSize(getSize());
game.draw(g);
} |
ff531860-efbc-4706-a7a6-f9ff33a75aa7 | 1 | public synchronized void adicionar()
{
try
{
new InstituicaoSubmissaoView(this);
}
catch (Exception e)
{
}
} |
fc71654a-52bd-4cf7-9fc0-0399947cd137 | 4 | public synchronized void removePlayer(String player, byte id) {
Player temp = new Player(player, id);
for (Player p : players) {
if (p.equals(temp)) {
temp = p;
}
}
if (temp != null) {
//With this, at least it shouldn't break.
players.remove(temp);
players.add(new Player("Disconnected",id));... |
7a097c10-76cc-4e7d-86d9-4c356dbd0388 | 8 | public final void update(ResultData results[]) {
if(results == null) {
return;
}
if(!_onlineModus) {
for(int i = 0; i < results.length; ++i) {
if(results[i] != null) {
DataDescription dataDescription = results[i].getDataDescription();
if(dataDescription != null) {
if(!_simAttrib... |
4f61946b-b1ae-48d7-b26d-3c0d70eb4375 | 5 | public static int LongestCommonSubsequence(char[] a, char[] b){
int m=a.length;
int n=b.length;
int[][] c=new int[m+1][n+1];
for (int i=0;i<=m;i++){
c[i][0]=0;
}
for (int j=0;j<=n;j++){
c[0][j]=0;
}
for (int i=1;i<=m;i++){
for (int j=1;j<=n;j++){
if (a[i-1]==b[j-1]){
c[i][j]=1+c[i-1][j... |
a8a97aa9-56b2-4059-9d8e-2c52b90a9392 | 5 | private static byte[] deCompress(byte[] comprMsg){
PDU compressedPDU = new PDU(comprMsg, comprMsg.length);
int algorithm = compressedPDU.getByte(0);
int checksum = compressedPDU.getByte(1);
int compLength = compressedPDU.getShort(2);
int unCompLength = compressedPDU.getShort(4);
... |
d021d3cd-4b0d-46d8-b650-e15a4b47c084 | 1 | private Session getSession() {
if (_currentSession == null)
{
_currentSession = getSessionFactory().openSession();
}
return _currentSession;
} |
ab5bf423-90d1-4ecb-bc65-40900cc8f2ac | 6 | public double[] getIntersection(Line l){
double [] retArr = new double[2];
if ((_x == l.getSlope() && _y == l.getYCoefficient()) || (_y == 0 && l.getYCoefficient() == 0)){
return null;
}
else{
convertToSlopeIntersect();
l.convertToSlopeIntersect();
if (l.getYCoefficient() == 0){
retArr[0] = -1 ... |
842b59ca-65ee-407e-bf13-86325b8fc0a7 | 2 | @Override
public boolean delete(Object item) {
conn = new SQLconnect().getConnection();
String sqlcommand = "UPDATE `Timeline_Database`.`Eventnodes` SET `display`='false' WHERE `id`='%s';";
if(item instanceof Eventnode)
{
Eventnode newitem = new Eventnode();
newitem = (Eventnode)item;
try {
Str... |
8f4db7b4-364e-4e3e-b9f6-fbb5f388a24f | 8 | @Override
public Component getListCellRendererComponent(JList<? extends T> list, T value, int index, boolean isSelected, boolean cellHasFocus)
{
int i = getIndexFromData(list.getModel(), value);
JLabel cell = new JLabel(entries.get(i), icons.get(i), SwingConstants.LE... |
d8b9ec29-737f-415c-b909-fbbe93cf193c | 0 | public Parser (String gridString){
this.gridString = gridString;
} |
72b36c14-4c4e-4b5f-bb1d-0fdd851dc809 | 2 | public static void executeInstance(NanoHTTPD server) {
try {
server.start();
} catch (IOException ioe) {
System.err.println("Couldn't start server:\n" + ioe);
System.exit(-1);
}
System.out.println("Server started, Hit Enter to stop.\n");
try ... |
3f9ea74f-aaee-4ed7-a8a7-a092bf272804 | 2 | public static void scan(InputStream source, InputStream format) throws IOException{
Scanner scanner = new Scanner(source);
SimpleFormat sf = JAXB.unmarshal(format, SimpleFormat.class);
ColumnIndexParser parser = new ColumnIndexParser(sf);
Integer r = 0;
while (... |
841271d5-fca6-4ae6-a5fb-1a0cd499f720 | 8 | public void setPosicionJugador1(int x,int y){
if(x>=0&&x<8&&y<8&&y>0){
switch (pd.mapa_jugador1[x][y]) {
case "DT":
case "PA":
case "AZ":
System.out.print("POSICION OCUPADA");
System.out.println("OTRA CORDENADA");
... |
ccf9775d-b126-479f-95c3-9b73c3b29be0 | 9 | public JFreeChart MakeChart() {
DefaultCategoryDataset areaDataset = new DefaultCategoryDataset();
Object[] column1Data = super.getDataset().GetColumnData(
super.getAttribute1());
Object[] column2Data = super.getDataset().GetColumnData(
super.getAttribute2());
String column2Header = super.getData... |
2adba832-76b9-4198-b9a1-aa4fe4ebc597 | 9 | public static void printCorInfEventsToLLInterCount(){
int startTime = 0;
int incTime = 5*(60*60*24);
int endTime = 100*60*60*24;
int estNumLocs = 100000;
HashMap<Integer,Integer> aggPop = new HashMap<Integer,Integer>(estNumLocs);
HashMap<Integer,Integer> numInfected = new HashMap<Integer,Integer>(estNumLocs... |
59cd17f8-5500-47e4-95a8-226f34743ba4 | 5 | public float priorityFor(Actor actor) {
/*
final Venue work = (Venue) actor.mind.work() ;
if (work.personnel.shiftFor(actor) != Venue.SECONDARY_SHIFT) {
if (! actor.isDoing("actionEquipYard", null)) return 0 ;
}
//*/
//
// TODO: You can't drill if you lack an appropriate device ... |
4033e4eb-69f2-4813-bcf2-e445b015a06e | 5 | private String read()
{
StringBuffer buffer = new StringBuffer();
int codePoint;
boolean zeroByteRead = false;
try {
do {
codePoint = this.socketIn.read();
if (codePoint == 0) {
zeroByteRead = true;
}
else if (Character.isValidCodePoint(codePoint)) {
buffer.appendCodePoint(codePo... |
20d3e88b-ecda-414b-b9fa-1c9a69d6cc6e | 6 | private byte fromOpcode(Opcode opcode) {
if (opcode == Opcode.CONTINIOUS)
return 0;
else if (opcode == Opcode.TEXT)
return 1;
else if (opcode == Opcode.BINARY)
return 2;
else if (opcode == Opcode.CLOSING)
return 8;
else if (opcode == Opcode.PING)
return 9;
else if (opcode == Opcode.PONG)
r... |
ba3c3f1b-2f36-4fa6-b92b-de59db983be8 | 8 | public void drawItem(Graphics2D g2, XYItemRendererState state,
Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot,
ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset,
int series, int item, CrosshairState crosshairState, int pass) {
if (pass == 0 && datase... |
7239ab53-d82f-4900-aa8d-b088f1bf2de6 | 6 | public void loadPlaymodes(){
try {
Playmode[] playmodes = dbCon.getPlaymodes();
alstPlaymodePanels.clear();
playmodePanel.removeAll();
if(playmodes != null){
for (Playmode playmode : playmodes) {
PlaymodePanel playmodepanel = new PlaymodePanel(playmode);
alstPlaymodePanels.add(playmodepanel)... |
484efded-3916-4e70-9c67-aab1574377ac | 1 | public boolean saveWindowSize()
{
Preferences prefs = Preferences.userNodeForPackage(Joculus.class);
// window preferences
prefs.putInt(WINDOW_SIZE_DEFAULT_W_PROPERTY_NAME, window_size_last.width);
prefs.putInt(WINDOW_SIZE_DEFAULT_H_PROPERTY_NAME, window_size_last.height);
try
{... |
90b03bce-f614-46f4-846f-8d4d6e942aa0 | 7 | public void startEngine(){
try {
// Default localhost host and default port 1099 is used by RMI
Registry engineRegistry = LocateRegistry.createRegistry(1100);
Registry generatorRegistry = LocateRegistry.getRegistry(1099);
// Getting the RMI object to interact with map on generator server
IEngineRMIObj... |
49199e84-e061-452b-a085-50300d2bf0f9 | 3 | public boolean registrarSeriales(entidadPrestamo datosPrestmo) {
conectarse();
boolean retornarObj = false;
String regser = "insert into tbl_dtlls_prestamo (Id_prestamo,Seriales) values(?,?)";
ArrayList seriales_recorrer = datosPrestmo.getSeriales();
String estado = datosPrestmo.... |
8bf6ced0-04ef-4662-b38a-2070c4d06521 | 5 | protected void update() {
double val = Math.sqrt(movX * movX + movY * movY);
if (val > 0) {
posX += movX * speed / val;
posY += movY * speed / val;
}
if (posX < Main.EDGE) {
// posX = Main.FRAME_X - Main.EDGE;
// posX = Main.FRAME_X / 2;
// posX += 1;
life.kill();
... |
3c6d4c16-e213-450f-84a2-6e564e354920 | 8 | private void requestQuotes(TACConnection conn, boolean flightQuotes,
boolean hotelQuotes) {
// This should be changed so that it will only request those quotes
// that are old enough...
if (flightQuotes) {
for (int i = MIN_FLIGHT; i <= MAX_FLIGHT ; i++) {
if (!quotes[i].isAuctionClosed()) {
... |
5e066a88-636f-4a60-ba54-225a8eea4d49 | 1 | private static boolean isRotation(String a, String b)
{
// both must be of the same length && one can find second string in concatenation of the first string to itself ( if it is rotated )
return(a.length()==b.length() && (a+a).indexOf(b)!=-1);
} |
dc1901e4-d330-4996-bee4-b6c162335612 | 1 | public CacheableNode getFront() {
CacheableNode cacheableNode = head.nextNode;
if (cacheableNode == head) {
current = null;
return null;
} else {
current = cacheableNode.nextNode;
return cacheableNode;
}
} |
84dcd1cf-0747-4fd6-b56e-992324190a97 | 0 | public String getBuildingId() {
return buildingId;
} |
5f879d07-4a4f-4d22-af17-94610fc5dab2 | 7 | private synchronized void sendUpdates()
{
_dataGenerator.generateUpdatedEntries();
Set<Token> deletedTokens = new HashSet<Token>();
Iterator<Token> iter = _pendingStreamItems.keySet().iterator();
while (iter.hasNext())
{
Token rq = (Token)(iter.next());
... |
08092799-36aa-43a5-ba56-daa62837a94c | 0 | public DataStructures getArrData(){
return arrData;
} |
8761ed21-e750-4bd3-bd0c-9501526098ce | 5 | public static void insertionSort (int[] array) {
if (array == null || array.length <= 1) {
return ;
}
int insertNum;
int i, j;
for (i = 1; i < array.length; i++) {
insertNum = array[i];
for (j = i - 1; j >= 0 && array[j] > insertNum; j--) {
array[j + 1] = array[j];
}
array[j + 1] = inser... |
dcda9bfb-e688-4d07-858b-9f33fb5d2e64 | 1 | public void prependVarPhi(final PhiJoinStmt stmt) {
final List v = varphis[cfg.preOrderIndex(stmt.block())];
if (!v.contains(stmt)) {
v.add(0, stmt);
}
} |
dc4240d6-1252-4dda-8a25-019f48275699 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LogEntry logEntry = (LogEntry) o;
if (text != null ? !text.equals(logEntry.text) : logEntry.text != null) return false;
return true;
} |
4591a329-e21e-4c19-aa1f-a57c779e909f | 2 | public synchronized void removeListener(final CycLeaseManagerListener cycLeaseManagerListener) {
//// Preconditions
if (cycLeaseManagerListener == null) {
throw new InvalidParameterException("cycLeaseManagerListener must not be null");
}
assert listeners != null : "listeners must not be null";
... |
e85f277e-278b-47de-9d74-ce2f9885fc16 | 6 | private String getPageHtml(WikiContext context, String name, String action) throws IOException {
StringBuilder buffer = new StringBuilder();
String escapedName = escapeHTML(titlePrefix(action) + unescapedTitleFromName(name));
addHeader(context, escapedName, getTalkPage(context, name), buffer);
... |
736ee003-52f8-416b-9326-87590b1fcb57 | 0 | public void desconectar(){
connection = null;
} |
b2fa8915-aa28-45d2-b8e4-757f0a933878 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
58f23a54-c6b6-4f37-8489-d56a294b1555 | 2 | private void updateComboBox() {
if (arrayDirty == true) {
insertionSort();
}
jEmployeeComboBox.removeAllItems();
int count = employees.size();
for(int x = 0;x<count;x++) {
jEmployeeComboBox.addItem(employees.get(x).getFullName());
}
} |
a83dbd6e-02de-4ad4-8adc-2e9d4b5a45d8 | 9 | public boolean deleteFourInRowHorizontal(int i,int j){
if(i < gridRows - 3 && tileGrid[i+1][j] != null && tileGrid[i+2][j] != null && tileGrid[i+3][j] != null
&& tileGrid[i][j].getTileType().equals(tileGrid[i+1][j].getTileType())
&& tileGrid[i][j].getTileType().... |
0b6914a4-53a0-49fe-8eb0-818815070814 | 3 | private boolean isFileValid(File file, String methodName) {
// check if the file is invalid or not
if (file == null) {
System.out.println(name_ + "." + methodName
+ ": Warning - the given file is null.");
return false;
}
String fileName = file... |
19319db3-4b6e-4114-a55e-ccfa78ca6bbf | 6 | public void Parse(String inputPacket, Memory InfoMem) {
// Remove outer parentheses
inputPacket = inputPacket.substring(1, inputPacket.length() - 1);
// Split inputPacket into tokens by "(" and ")" delimiters
String[] splitPacket = (inputPacket.split("[()]"));
// Parse the first element into packet type an... |
a47e40eb-2cfb-4968-90de-107cd21be165 | 3 | @Override
protected void read(InputBuffer b) throws IOException, ParsingException {
VariableLengthIntegerMessage length = getMessageFactory().parseVariableLengthIntegerMessage(b);
b = b.getSubBuffer(length.length());
long l = length.getLong();
if (l > MAX_LENGTH || l < 0) {
throw new ParsingException("List... |
2872d864-f6d3-4efd-87fc-80c34cbfcd54 | 9 | public boolean isPalindrome(String s) {
if(s == null || s.length() == 0)
return true;
else{
int i=0;
int j = s.length()-1;
while(!isAlphanumeric(s.charAt(i))){
i++;
if(i == s.length() )
return true;
... |
fd7f9124-b0db-4fa5-ab81-4d8998982035 | 9 | public boolean checkForEnemyType(int a_xSrc, int a_xDest, int a_ySrc, int a_yDest, int a_type)
{
int min_x = Math.min(a_xSrc, a_xDest);
int min_y = Math.min(a_ySrc, a_yDest);
int max_x = Math.max(a_xSrc, a_xDest);
int max_y = Math.max(a_ySrc, a_yDest);
if(min_x < 0) min_x = ... |
53a8d17d-f876-4a95-a620-a7740bc9a5c9 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Puzzle))
return false;
Puzzle other = (Puzzle) obj;
if (!Arrays.equals(image, other.image))
return false;
if (name == null) {
if (other.name != null)
return fal... |
b78db63e-bad8-41ed-8e7e-4783f63be814 | 4 | public static Event parse(Event rawEvent) throws IOException {
if(rawEvent.getHeader() == null) {
return null;
}
if(rawEvent.getData() == null || !rawEvent.isRawData()) {
return rawEvent;
}
IEventHeader header = rawEvent.getHeader();
BinaryIEventDa... |
0d49c50a-8475-487e-9a9b-16fe364bca9f | 8 | public ArrayList<Vehicle> GetOneVehicle(int VID)
throws UnauthorizedUserException, BadConnectionException, DoubleEntryException
{
/* Variable Section Start */
/* Database and Query Preperation */
PreparedStatement statment = null;
ResultSet results = null;
... |
24348c8d-a8ee-49e5-a03e-f5bb4f47fb6f | 8 | public void Solve() {
List<Integer> primes = Euler.GetPrimes(_max);
for (Iterator<Integer> it = primes.iterator(); it.hasNext();) {
Integer prime = it.next();
String primeString = prime.toString();
for (int numberOfDigits = 1; numberOfDigits < primeString.length(); ... |
1432334b-aa75-42c5-bd1e-760674989e0c | 0 | public Manufacturer getManufacturer() {
return manufacturer;
} |
a3b80199-6787-47c1-8b55-ecc5afcd220b | 5 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(delimiter).length == 2) {
final String remoteVersion = title.split(delimiter)[1].split(" ")[... |
413fb8a5-07ac-441b-a900-aca29dbbc201 | 8 | private StateDist limitDfs(SearchState oldState, int curDist, int maxDist) {
int estimatedCost = curDist + h.estimateCostToGoal(oldState);
if (estimatedCost > maxDist) {
if (estimatedCost >= OO)
return null;
Integer dist = statesWithUnexploredNodes.get(oldState.prevState);
int prevDist... |
76791199-fe50-4fe8-b9c5-b1f2576e1da3 | 0 | @After
public void tearDown() {
} |
f6c50717-cfa8-46a3-ba95-fe8a590986d6 | 8 | @Override
public void deploy(File zipFile, String targetPath) throws IOException,
RemoteException {
// TODO Auto-generated method stub
if(!zipFile.exists())
{
throw new RemoteException(zipFile+" is not exist.");
}
targetPath = pathStrConvert(targetPath);
ArrayList<String> result = new ArrayList<Strin... |
cd1064d4-e078-419b-aa84-13dc1a3ec76c | 0 | private void addPlayerButtonActionPerformed(java.awt.event.ActionEvent evt) {
chooseBrain.showOpenDialog(controlFrame);
} |
bff60157-5cb4-458b-ae16-e2c287d5ab98 | 7 | public int getSocketOption(byte option) throws IllegalArgumentException, IOException {
switch(option){
case SocketConnection.DELAY:
return socket.getTcpNoDelay() ? 0 : 1;
case SocketConnection.KEEPALIVE:
return socket.getKeepAlive() ? 1 : 0;
case SocketConnectio... |
46032059-79ce-426c-b7ff-38f49dc5e4e6 | 3 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
for(ListIterator<PComando> i = this._comando_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChil... |
ac3edc6e-d418-4933-9927-1b48c722afc4 | 5 | public static void generateMaze(int x, int y, long seed)
{
GRID_WIDTH = x;
GRID_HEIGHT = y;
stack = new ArrayList<Cell>();
remainingCells = new ArrayList<Cell>();
// Init array of cells
maze = new Cell[x][y];
// Reset maze and add cells to remainingcell list
for (int i = 0; i < x; i++)
for (int j... |
6297699f-52a7-42bc-9cdf-77240eb1df4a | 4 | private boolean handleSell(String[] parts) {
if (parts.length < 3) {
return false;
}
String id = parts[1];
Stock s = StockControl.queryStock(id);
if (s == null) {
return false;
}
int amount;
try {
amount = Inte... |
92275156-9a0c-4406-a53e-699e85267234 | 0 | public void removeObserver() {
// listObserver = new ArrayList<Observer>();
} |
58536df1-ee2c-4cf5-87f8-50a6d58fb314 | 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 feel.
* For details see http://down... |
8496a3e8-0284-4508-8220-ebf8f0ea3547 | 3 | */
public void updateRowHeightsIfNeeded(Collection<Column> columns) {
if (dynamicRowHeight()) {
for (Column column : columns) {
if (column.getRowCell(null).participatesInDynamicRowLayout()) {
updateRowHeights();
break;
}
}
}
} |
66bd4645-19e3-4fa2-895a-e436e72213b1 | 2 | public RoadList() {
initComponents();
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
RoadList.setAutoCreateRowSorter(true);
Color c = new Color(63,70,73);
... |
c49dad0f-fcae-4fe6-b30e-412d9a47cf08 | 4 | @Override
public void onCoreRoomRequest(GetRoomRequest request) {
String roomName = request.getRoomName();
if (!activeRooms.containsKey(roomName)) {
try {
if (validRoomName(roomName)) {
if (!coreAdmin.destinationExists(roomName)) {
coreAdmin.addDestination(roomName, false);
System.out.print... |
e5b0d720-dd9f-4f5d-835f-8b8941c476b9 | 1 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
File file = new File("C:/1.txt");
BufferedReader in = new BufferedReader(new FileReader(file));
String line;
String subLine;
while ((line = in.readLine()) != null) {
char character = line.charAt(... |
4e936567-b8ad-4db0-9868-03ab39bf6c91 | 5 | @Override
public boolean activate() {
// Fam is !null, Has urns, and inv not full
final boolean valid = workLeft();
if ((valid && (GraniteMiner.curState == GraniteMiner.Status.NONE))) {
GraniteMiner.curState = THIS_STATE;
} else if (!valid && (GraniteMiner.curState == TH... |
0b677914-501c-4cbd-8347-0939ea7971da | 0 | private void jButton0MouseMouseClicked(MouseEvent event) {
this.dispose();
} |
6c75cc9f-c049-4d33-89c7-3c4f5ae8425e | 3 | public void save() {
if (poms != null) {
try {
init();
PrintWriter out = new PrintWriter(new FileWriter(poms));
out.println("# List of POM files for the package");
out.println("# Format of this file is:");
... |
b072e299-6e2f-41c5-97d3-570dd1dbc8c5 | 1 | public Object getCurrentElement()
throws IteratorException {
Object obj = null;
// Will not advance iterator
if (list != null) {
int currIndex = listIterator.nextIndex();
obj = list.get(currIndex);
} else {
throw new IteratorException();
}
return obj;
} |
eda0d5d2-8d6d-4471-af43-0592d30ae4a4 | 3 | public boolean singleWord() {
return (this.a==null || this.b == null) && !(this.a == null && this.b == null);
} |
50aeafb6-949a-4ee6-a0bc-3dbb7ea9485c | 9 | static private int jjMoveStringLiteralDfa4_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0);
return 4;
}
switch(curChar)
{
cas... |
d66b22c4-4782-498a-95e1-2a2be143b25f | 8 | private boolean recursive(Peg x, Peg y, Peg z, int n) {
Action newAction = null;
if (n > 0) {
newAction = new Action(x, z, y, getCurrAction(), 1, n-1);
actions.push(newAction);
if (!TowersOfHanoi.repaintAndWait()) {return false;}
// move n-1 disks from x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.