method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1fe18d28-ae96-43eb-bbf2-95275139d503 | 1 | public Database(String databasePath) throws SQLException {
try {
Class.forName("org.hsqldb.jdbcDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
connection = DriverManager.getConnection("jdbc:hsqldb:file:" + databasePath, "SA", "");
Statement delayStmt = connection.createStatemen... |
3b113b48-c016-440a-a4f8-058617064891 | 4 | public boolean isInVillage(Point2D p)
{
if (p.getX() > getSideLength() || p.getX() < 0 || p.getY() > getSideLength() || p.getY() < 0)
return false;
return true;
} |
5ebc5755-e72f-48d6-acea-5f67bfa3a53d | 4 | protected void scanPCData(StringBuffer data)
throws IOException
{
for (;;) {
char ch = this.readChar();
if (ch == '<') {
ch = this.readChar();
if (ch == '!') {
this.checkCDATA(data);
} else {
... |
7dfb73c4-d40f-42c2-98dd-3bf2f00ec399 | 8 | @Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
Point point = snapMouseToBoard(arg0.getX(), arg0.getY());
if (availableMoves != null) {
for (Move m : availableMoves) {
if (m.getEndingTile().getX() == point.x
&& m.getEndingTile().getY() == point.y) {
if (... |
61fbcacf-45a3-4d38-aa81-4eeb583e85a9 | 1 | public void reset()
{
for (int i=0; i<BANDS; i++)
{
settings[i] = 0.0f;
}
} |
db371d23-b10d-4b43-887f-b8cfb704e187 | 3 | public String consumeAttributeKey() {
int start = pos;
while (!isEmpty() && (matchesWord() || matchesAny('-', '_', ':')))
pos++;
return queue.substring(start, pos);
} |
308cba85-b9a6-477e-a504-1f62771d9b35 | 3 | public void nPairsElimination()
{
ArrayList<ArrayList<Integer>> uniqueNPairs = getUniqueNPairs();
for(int i=0; i<9; i++)
{
for(int j=0; j<uniqueNPairs.size(); j++)
{
if(!cells[i].getPosNumbers().equals(uniqueNPairs.get(j)))
{
... |
d30ec6d8-b3ef-4b9d-bdb7-3652c05ae2bf | 8 | private void fall(Level var1, int var2, int var3, int var4) {
int var11 = var2;
int var5 = var3;
int var6 = var4;
while(true) {
int var8 = var5 - 1;
int var10;
LiquidType var12;
if(!((var10 = var1.getTile(var11, var8, var6)) == 0?true:((var12 = Block.blocks[v... |
0e0b68b2-1751-4781-9255-2fb62c872c95 | 1 | public final EsperParser.assign_return assign() throws RecognitionException {
EsperParser.assign_return retval = new EsperParser.assign_return();
retval.start = input.LT(1);
Object root_0 = null;
Token ASSIGN24=null;
Token IDENTIFIER25=null;
EsperParser.expr_return exp... |
4d115837-06e9-44f3-acbc-05c74b2c043a | 8 | public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... |
961060e8-6a3e-49b9-9748-d4e68418878f | 6 | @Override
public void keyPressed(KeyEvent event) {
switch (event.getKeyCode()) {
case KeyEvent.VK_LEFT:
setOpen(false, getTreeContainerRows(mSelectedRows, event.isAltDown()));
break;
case KeyEvent.VK_RIGHT:
setOpen(true, getTreeContainerRows(mSelectedRows, event.isAltDown()));
break;
case Ke... |
45115c7a-3567-4f79-a8d6-4a95d9be7a79 | 4 | public static void applyDamage(Actor target, double amount, DamageType type) {
switch (type) {
case SLASHING:
target.damage(amount - target.characterSheet.armor);
break;
case BASHING:
break;
case PIERCING:
break... |
89e15282-7e88-46c9-9968-579690b14cb6 | 1 | public String getAttributeDefaultValue(String name, String aname)
{
Object attribute[] = getAttribute(name, aname);
if (attribute == null) {
return null;
} else {
return (String) attribute[1];
}
} |
535c81f7-3612-46fe-b1b4-01ff60e04866 | 0 | public static void MSDsort(String[] a) {
String[] aux = new String[a.length];
msdSort(a, aux, 0, a.length - 1, 0);
} |
98f014db-1015-4a72-8846-cccbeaf00d9e | 6 | protected void execute() {
//Check if the climber is at the end
checkSwitches();
double speed = 0;
if (m_isRising){
//Use full speed on the upstroke
//if (Timer.getFPGATimestamp()-m_startRise < 0.6*RISE_STROKE_LENGTH){
speed =... |
f908f754-dc54-4be9-af61-dea4f7203d9b | 8 | public void playRound() {
previousBoard = DeltaBoard.cloneBoard(board);
// Checks if user's king is in check before moving
if (isChecked(userColor, getXOfKing(userColor), getYOfKing(userColor), true)){ // Check whether the user's king is in check prior to user's turn
System.out.print... |
70a51b5b-2bc2-4434-b352-e598ffb60e5c | 4 | @Override
public boolean isCellEditable(EventObject anEvent)
{
// Normally: from context menu -> Rename
if (anEvent == null)
return beforeEdition();
// Normally: from F2 press
if (anEvent.getClass() == java.awt.event.ActionEvent.class)
return beforeEdition();
if (anEvent.getClass() ... |
2a0a652c-3419-477c-b771-c14b4ee876c3 | 3 | public void breakCheck(int state){
if(state == ItemEvent.SELECTED)
linePattern = true;
else
linePattern = false;
if(selectedDrawings.size() != 0){
for(int i=0;i<selectedDrawings.size();i++){
selectedDrawings.elementAt(i).setBreak(linePattern);
}
}
} |
4ade2a10-1fca-422f-8a87-25ec2cf8e08a | 2 | public void increaseShieldEnergy() {
if(leftOverEnergy>0) {
shieldEnergy++;
leftOverEnergy--;
for(int i=0; i < ship.shields.size(); i++) {
ship.shields.get(i).setStrength(shieldEnergy*100);
}
}
} |
2067619f-6c0c-44e0-88de-5318fc38d45d | 7 | public void selectAttributesCVSplit(Instances split) throws Exception {
double[][] attributeRanking = null;
// if the train instances are null then set equal to this split.
// If this is the case then this function is more than likely being
// called from outside this class in order to obtain CV statis... |
554b4161-a9c3-4501-8de9-f7d3c52afa15 | 9 | protected void refreshAllCubes() {
if(this.cube != null)
{
for(int face = 0; face < this.cube.getNumFaces(); face++)
{
for(int row = 1; row <= this.cube.getDimension(); row++)
{
for(int column = 1; column <= this.cube.getDimension(); column++)
{
for(Window w:images){
if(face ... |
4e3702de-d663-44b4-bfd0-11bbf942132c | 5 | public void evaluate(int size) {
if (stop)
return;
if (size >= DANGEROUS_SIZE) {
System.out.printf("\nInformation for Collection %s (id: %d)\n", className, id);
System.out.printf(" * Collection is very long (%d)!\n", size);
if (reads == 0) {
System.out.printf(" * Collection was never read!\n");
... |
b4ada0e8-dc07-436d-8bb7-f7a96823d5b6 | 3 | public void actionPerformed(ActionEvent e) {
if(vulaux){vulaux=false;return;}
if(presionado==0){
this.boton1=(JButton)e.getSource();
presionado=1;
}
else if(presionado==1){
this.boton2=(JButton)e.getSource();
this.swap();
}
} |
197aa6cf-9cd7-481b-84d7-1cef49be096e | 1 | public void saveResizeToUndo(ArrayList<DrawableItem> selected) {
ArrayList<UndoableItem> toAdd = new ArrayList<>();
for (DrawableItem selection : selected) {
UndoableItem ud = new UndoableItem(selection, 3);
Panel temp = (Panel) selection;
int x = ((Panel) selection).... |
7578d204-7f79-4158-b7df-bc35583401e8 | 7 | public boolean areImagesSimilar(File image1, File image2) {
if ( image1 == null || image2 == null ||
!image1.exists() || !image2.exists() ||
image1.getAbsolutePath().equals(image2.getAbsolutePath()))
return false;
// Descriptors have to be loaded before every use (... |
a74ff941-d042-45f5-960d-fed960bcab05 | 0 | public void eliminate(Position pos){
board[pos.getY()][pos.getX()] = null;
} |
0042511f-7b64-46d8-9e1a-dfcfa99cd763 | 8 | private Boolean checkTables() throws Exception {
if (!this.db.checkTable("chunky_objects")) {
if (!db.createTable(QueryGen.createObjectTable())) return false;
Logging.info("Created chunky_objects table.");
}
if (!this.db.checkTable("chunky_ownership")) {
if (... |
eca53731-ceaa-414c-a321-90fdde941aa2 | 1 | public ComplexMatrix subtract(ComplexMatrix b) {
try {
return this.add(b.reverseSign());
} catch (Exception e) {
e.printStackTrace();
return null;
}
} |
acc7c096-ad4e-418f-836e-03b5c70502a0 | 8 | public boolean func_77648_a(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 == 0)
{
par5--;
}
if (par7 == 1)
{
par5++;
}
... |
242a181e-6c75-4bbe-abb1-da6d37a7b4f8 | 9 | @Override
@SuppressWarnings("unchecked")
public void setValue(@Nullable ThreadMirror threadMirror, @Nullable ObjectValueMirror thisObjectValue, @NotNull Value<?> value)
{
if(isStatic() && thisObjectValue != null || !isStatic() && thisObjectValue == null)
{
throw new IllegalArgumentException();
}
try
{
... |
17e7f15f-b0e2-4632-8017-33e900282e91 | 3 | * @return Returns the startsize for the given swimlane.
*/
public mxRectangle getStartSize(Object swimlane)
{
mxRectangle result = new mxRectangle();
mxCellState state = view.getState(swimlane);
Map<String, Object> style = (state != null) ? state.getStyle()
: getCellStyle(swimlane);
if (style != null)
... |
0dc32677-ef68-4845-9211-762b031c7f11 | 2 | public String toCSVString(){
StringBuilder builder = new StringBuilder();
for (int i = 0; i < cells.size(); i++) {
Cell cell = cells.get(i);
builder.append(cell.getCellValue());
if(i != cells.size() - 1) {
builder.append(",");
}
}
... |
e67ad204-93db-43cd-a63d-384006db050f | 2 | public void paintComponent(Graphics g) {
super.paintComponent(g);
Dimension ds = getSize();
d = Math.min(ds.width, ds.height) - 5;
float strokeWidth = (float) d / 200.0f;
stroke = new BasicStroke(strokeWidth);
Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(stroke... |
f2faf13a-a671-4cef-8fe1-efa88787441d | 2 | public void set(UsuarioBean oUsuarioBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.initTrans();
if (oUsuarioBean.getId() == 0) {
oUsuarioBean.setId(oMysql.insertOne("usuario"));
}
oMysql.updateOne(oUsuarioBean.... |
39511bd3-16aa-4548-a56e-d3513c63bb89 | 0 | public void setRef(String ref) {
this.ref = ref;
} |
bc87f02c-ce85-4bf4-a12c-158091b34591 | 3 | @Test
public void testEntrySet()
{
CaseInsensitiveStringMap map = new CaseInsensitiveStringMap();
//add some data
map.put("foo", "bar");
map.put("bar", "42");
Set<Entry<String, String>> entrySet = map.entrySet();
for(Entry<String,String>e:entrySet)
{
assertTrue(e.getKey().equalsIgnoreCase("foo")||e.g... |
e0b12bcf-6a4e-4d92-a6aa-feef37de221d | 2 | private void scheduleTasks() {
if (AutoSaveEnabled) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, saveRunnable,
SaveInterval, SaveInterval);
}
if (AutoBroadcastEnabled) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
broadcastRunnable, broadcastIntverval, broadcastIntverval);
}... |
336f44ee-4042-4a46-a8b5-b194bc195c61 | 7 | @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();
pushEvent(ev.getSo... |
c69fea5f-d406-4492-aabc-6c62976b3a24 | 8 | public void addConnections(PlayerMP player, Packet00Login packet) {
boolean alreadyExist = false;
for (PlayerMP p : connectedPlayers) {
if (player.getUsername().equalsIgnoreCase(p.getUsername())) {
if (p.getIp() == null) {
p.setIp(player.getIp());
}
if (p.getPort() == -1) {
p.setPort(play... |
e83ef4bc-5237-4215-8516-2a56be2a31e8 | 2 | private int getPreferredHeight() {
int maxHeight = 0;
for (int i=0, count=getComponentCount(); i<count; i++) {
Component component = getComponent(i);
Rectangle r = component.getBounds();
int height = r.y + r.height;
if (height > maxHeight) {
maxHeight = height;
}
}
maxHeight += ((FlowLayout) ... |
8f2f0bb2-7b44-4cdd-b35a-39cf3353604c | 6 | private static void addNewAnnotations() throws Exception
{
List<Holder> holders= getList();
for(Holder h : holders)
System.out.println(h.conting + " " + h.startPos+ " " + h.endPos+ " " + h.pcas.get(0));
BufferedReader reader =new BufferedReader(new FileReader(new File(
ConfigReader.getCREOrthologsDir... |
e8f8bfe5-cfbc-4caa-abbf-3f92ac8fb71d | 7 | @SuppressWarnings("deprecation")
public static void setHealth(Player player, String playerName,
String healPlayerName, String amount) {
ArrayList<Player> healPlayers = AdminEyeUtils
.requestPlayers(healPlayerName);
if (healPlayers == null && healPlayerName != null) {
StefsAPI.MessageHandler.buildMessage... |
d88089c9-6248-4f19-9b4c-ea641767d486 | 4 | public synchronized void write(Tag tag, Object obj){
if(obj == null || obj.toString().isEmpty())
return;
if(this.disableTag.contains( tag ))
return;
String formatted = "";
if(this.showCaller) {
StackTraceElement s = new Exception().getStackTrace()[1];
formatted = String.format( "%s.%s ", s.getClass... |
995b6a02-0945-42c3-84b6-15f356d44186 | 3 | ViewPanel(Session session)
{
this.session = session;
final int ROWS = 1;
final int COLUMNS = 1;
String querry = "SELECT * FROM records";
ResultSet results = null;
Statement stmt = null;
this.setLayout(new GridLayout(ROWS, COLUMNS));
this.conn = session.getConnection();
// Attempt to c... |
2fbafc96-c1bf-4af0-bf2a-6e5a43fcc8e9 | 2 | private void closeStream(Closeable stream) {
if (stream == null) {
return;
}
try {
stream.close();
} catch (IOException ex) {
System.out.println(ex);
}
} |
b7b2766c-4e29-4035-9b7b-1f3fc22527cb | 6 | @EventHandler
public void IronGolemInvisibility(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getIronGolemConfig().getDouble("Iro... |
7346666e-e760-4f08-8295-9ee3ad5e6cc4 | 3 | public String getTrappingInformation() {
Object value = library.getObject(entries, "Trapped");
if (value != null && value instanceof StringObject) {
StringObject text = (StringObject) value;
return cleanString(text.getDecryptedLiteralString(securityManager));
}
el... |
fa51340b-4d79-4055-befe-62abb2cc7b0a | 0 | public void setCheckStart(int checkStart)
{
_checkStart = checkStart;
} |
bfa0954b-3192-4a04-9c7d-6885b7625839 | 8 | @Override
protected void execute(Path file) throws Exception {
BufferedImage img = ImageIO.read(file.toFile());
if (img.getWidth() > img.getHeight()) {
rotate(file, file, PI_BY_2);
}
String targetName = null;
String name = getName(file);
... |
e48921c2-afa8-4f5f-84f6-592dd5cf875d | 3 | public User getUser(String login, String password) throws Exception {
// On cherche le login
Iterator<User> it = users.iterator();
while (it.hasNext()) {
User user = it.next();
if (user.getLogin().equals(login)) {
// On a trouvé le login
... |
cc448b71-4879-4ed5-bba7-9c9dd2f58099 | 1 | public boolean opEquals(Operator o) {
return (o instanceof LocalLoadOperator && ((LocalLoadOperator) o).local
.getSlot() == local.getSlot());
} |
5e3df8c9-92b1-4a42-902a-ab78bce8a0df | 7 | public static HandshakeBuilder translateHandshakeHttp( ByteBuffer buf, Role role ) throws InvalidHandshakeException , IncompleteHandshakeException {
HandshakeBuilder handshake;
String line = readStringLine( buf );
if( line == null )
throw new IncompleteHandshakeException( buf.capacity() + 128 );
String[] f... |
8ad74cf6-b437-4bcd-80ea-1ddd662c7659 | 4 | public Direction getInverse()
{
switch (this)
{
case left: return right;
case up: return down;
case right: return left;
case down: return up;
default: return up;
}
} |
001f078a-d50c-4aef-aa86-75a0d29a8aa7 | 3 | @Override
public void callChangeOfferStatus(String username, String status,
String servicename) {
Service service = new Service();
Call call;
try {
call = (Call)service.createCall();
Object[] inParams = new Object[]{username, status, servicename};
call.setTargetEndpointAddress(new URL(SERVICES... |
a674e18e-d118-449d-9f80-5cba7442365f | 7 | private void addNodeAndDaughtersToXML( ENode node, BufferedWriter writer, int level, HashMap<String, NewRDPParserFileLine> rdpMap ) throws Exception
{
String tabString = "";
for( int x=0; x <= level; x++ )
tabString += "\t";
String taxaName = "" + node.getLevel();
String rank = null;
String commo... |
6a1fc47c-e29b-463d-8098-10d26bc2eebc | 7 | public static void main (String[] args) {
Scanner kb = new Scanner(System.in);
System.out.println ("Inserisci Il Numero Di Tipi Di Francobolli: ");
int franc_num = kb.nextInt();
kb.nextLine();
Francobollo [] franc_arr = new Francobollo[franc_num];
for (int i=0; i<franc_num; i++) {
franc_ar... |
5f5ada38-f2bf-4b5b-8dda-0f3a2544cd26 | 5 | public void displayError(String message){
Object[] buttons = {"Continue", "Quit"};
int userInput = JOptionPane.showOptionDialog(null,
message,
"Quantum Werewolves",
JOptionPane.YES_NO_OPTION,
JOptionPane.ERROR_MESSAGE,
null,
buttons,
buttons[0]);
swit... |
f66cdc0b-3bf2-4ca2-87aa-19ad8759d5b6 | 4 | public int reverse(int x) {
boolean isNeg = false;
if(x < 0) {
isNeg = true;
x = -1 * x;
}
int res = 0;
while (x > 0){
res = 10 * res + x % 10;
x /= 10;
}
if (res < 0){ // probably res > MAX_VALUE
return ... |
6cdfd5b3-8a49-4745-b6d6-333c0c770632 | 2 | public static int countCommElmts(ArrayList<Integer> newScores1,
ArrayList<Integer> newScores2) {
int count = 0;
for (int i = 0; i < newScores1.size(); i++) {
if (newScores1.get(i) == newScores2.get(i))
count++;
}
return count;
} |
d49f9562-ceab-44f7-8f16-bffcb7c6c886 | 1 | public void deleteSong(BESong aSong) throws Exception {
try {
ds.deleteSong(aSong);
} catch (SQLException ex) {
throw new Exception("Could not create the song " + aSong.getId());
}
} |
6a4897a3-073f-46a5-b565-12281541b05b | 1 | public void setBackLeftThrottle(int backLeftThrottle) {
this.backLeftThrottle = backLeftThrottle;
if ( ccDialog != null ) {
ccDialog.getThrottle3().setText( Integer.toString(backLeftThrottle) );
}
} |
3aed4bc6-3c80-4b44-a1fd-050a0ec45d41 | 8 | public static void main(String[] args) {
float x,y,z;
final float PI=3.14f;
boolean a,b,c,d,e,f;
a=((4-2)*(5+1)/2)>2-(4+3);
System.out.print("\nEl resultado es: "+ a);
b=(6+3)>8 && (6... |
7be4d6bf-f75f-4b76-9032-f6910067e4c6 | 7 | private boolean detect50Sync(CircularDataBuffer circBuf,WaveData waveData) {
int pos=0,b0,b1;
int f0=getSymbolFreq(circBuf,waveData,pos);
b0=getFreqBin();
// Check this first tone isn't just noise the highest bin must make up 10% of the total
if (getPercentageOfTotal()<10.0) return false;
pos=(int)samplesPe... |
8b217d69-1375-4021-a280-ee15bda504a5 | 6 | public static Snake crossover(Snake parent1, Snake parent2) {
Snake child = new Snake();
int takenFromOne = 0;
for(int i = 0; i < 6; i++) {
Gene g = parent1.getGenes()[i];
child.setGene(takenFromOne, g);
takenFromOne++;
}
int takenFromTwo = 3;
for(int i = 3; i < 6; i++) {
if(takenFromTwo... |
019405d0-3041-46bd-9767-ec5fc6d7edc1 | 3 | public static void main(String[] args) {
System.out.println("Starting");
CycAccess access = null;
try {
access = new CycAccess("localhost", 3660);
String query = "(#$isa ?X #$Dog)";
InferenceWorkerSynch worker = new DefaultInferenceWorkerSynch(query,
CycAccess.inferencePSC, null, ... |
5f83e044-b4f9-4b1e-9d67-44dcb09d8c4f | 2 | public void test_08_alt_del() {
initSnpEffPredictor("testCase");
String file = "./tests/alt_del.vcf";
VcfFileIterator vcf = new VcfFileIterator(file);
vcf.setCreateChromos(true);
// They are so long that they may produce 'Out of memory' errors
for (VcfEntry vcfEntry : vcf) {
System.out.println(vcfEntr... |
de687962-6195-484d-b197-c07f1e0f3a37 | 3 | public void makeMoves()
{
if (showStuff == true)
{
System.out.println(toString());
}
isRunning = p1.canMove(theBoard, '$');
theBoard = p1.move(theBoard, '$');
maintenence();
incrementTurn();
// System.out.println(timeSinceJump);
isRu... |
8ef57076-7f0d-43a5-94ea-e3d033a9cf74 | 5 | @Override
public void putAll(Map<? extends String, ? extends Object> map) throws ClassCastException {
Set<? extends String> keys = map.keySet();
for (String key : keys) {
if (key == null)
throw new NullPointerException();
this.checkInstance(map.get(key));
}
super.putAll(map);
} |
515fee4a-4d18-4fe2-961f-b6e768e055a6 | 5 | public void read(BufferedReader buff)
{
try
{
while(buff.ready())
{
line = buff.readLine();
piecePlace = pattern[0].matcher(line);
pieceMove = pattern[1].matcher(line);
if(piecePlace.find())
{
String chessPiece = piecePlace.group("ChessPiece");
String chessColor = piecePlace.g... |
153cb728-5a72-41bc-a5c8-da02942f2125 | 7 | private final void initUI()
{
// initialize a layout manager:
this.setLayout(new BorderLayout());
// create a menu bar:
JMenuBar menubar = new JMenuBar();
// ---------------------------------------------------------
// First dropdown menu: "File"
// --------------------------------------... |
3002f49b-9ccc-4cf1-98ee-e67b82892e7c | 5 | public static void saveLocal(String tt,String text_temp,
String linkUrl){
try {
FileOutputStream out = null ;
OutputStreamWriter out1 = null ;
BufferedWriter bw=null;
if("else".equals(DivideText.divide(text_temp))){
... |
b168944f-87a7-4868-902b-99203045f609 | 0 | @Override
public String toString() {
final StringBuilder sb = new StringBuilder("Product { ");
sb.append("productCode=").append(productCode);
sb.append(", prices=").append(prices);
sb.append('}');
return sb.toString();
} |
25500beb-3646-4cb1-a933-5b82a9cc592e | 7 | @Override
public void renderMoving(Engine e, Graphics g, int i, int j) {
for(Particle par:e.getWorld().getParticleArray()){
if(par == null)
continue;
g.drawImage(par.getImage(), par.getLocation().getX()-i+e.getWidth()/2, par.getLocation().getY()-j+e.getHeight()/2, null);
}
for(Entity en:e.ge... |
57f3e0e3-1629-4fa2-87f8-cbe8972b0e36 | 8 | public int getIdxNum() throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
int x = 0;
try{
conn=getConnection();
String sql = "select max(idx) from food";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next()){
x = rs.getInt(1... |
5be1caa3-7c90-401d-9d9e-aaa9d02595d7 | 6 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
String pw = plugin.config.getString("Apply.Password");
String defaultgroup = plugin.config.getString("Apply.Defaultgroup");
String group = plugin.config.getString("Apply.Group");
if(sender instanceof Player)
{
... |
d9dbfc4f-0baf-4bc6-8cfb-6546d59ab658 | 1 | public void saveImage() {
BufferedImage bi = new BufferedImage(this.getSize().width, this.getSize().height, BufferedImage.TYPE_INT_RGB);
Graphics g = bi.createGraphics();
this.paint(g);
g.dispose();
try {
ImageIO.write(bi, "png", new File(System.getProperty("resources") + "/TempCol.png"));
} catch(IOE... |
b83c1937-c502-430e-8f2c-2e85fe82eefa | 2 | public void excluir(int id){
dlo.excluir(id);
for (int i = 0; i < categorias.size(); i++){
if (categorias.get(i).getId() == id){
categorias.remove(i);
break;
}
}
exibirMensagem("Categoria excluída com sucesso");
} |
2ba2c977-29e5-42f0-a4a3-6d752ce68dde | 3 | @Override
public void loadRecipes(File dir) {
if (!this.open) {
BackpacksPlugin.getInstance().getLogger().warning("**** No longer accepting new registrations!");
}
if (!dir.isDirectory()) {
throw new IllegalArgumentException("Given file: " + dir.getName() + " is not ... |
47222ae7-3c68-4c44-9fe7-96c79087fdd9 | 5 | private void updateStopHistory() {
ArrayList<StopAdapter> stops = GTFS.getCurrentStopWindow();
LinkedList<StopAdapter> closest = calcClosestStops();
if (closest != null) {
if (mStopHistoryIndex == -1) {
mStopHistory.set(0, closest);
mStopHistoryIndex = 0;
} else {
boolean duplicate = false;
... |
c1039832-086a-4c71-9d53-f4f394295dce | 5 | public boolean peekMap(String fname){
int max_length = 0;
ArrayList <String> lines = new ArrayList <String> ();
try {
InputStream in = this.getClass().getClassLoader().getResourceAsStream(fname);
if (in == null) {
System.out.println("no hay nivel " + fname);
return false;
}
BufferedReader read... |
d4c33897-7d11-44a1-9916-fe410bcc6e45 | 1 | private void savePreferences() {
try {
preferencesFile.createNewFile();
preferences.storeToXML(new FileOutputStream(preferencesFile), null);
print("Preferences saved successfully.");
} catch (IOException e) {
// TODO Auto-generated catch block
print("ERROR: Failed to save preferences.");
}
} |
8bae226b-af67-4e6c-aea3-3c63c59cb44f | 6 | public static MethodSlot lookupOptionHandler(StorageSlot slot) {
{ Symbol handlername = ((Symbol)(KeyValueList.dynamicSlotValue(slot.dynamicSlots, Stella.SYM_STELLA_SLOT_OPTION_HANDLER, null)));
MethodSlot handler = null;
if (handlername == null) {
if (Stella.$DEFAULT_OPTION_HANDLER$ != null) {... |
fdb21d90-77e4-4c1d-b9da-06d35a3daf7f | 3 | public Percolation(int N) // create N-by-N grid, with all sites blocked
{
if (N<=0)
{
throw new IllegalArgumentException();
}
this.N = N;
uf_inst = new WeightedQuickUnionUF (N*N+2);
uf_real = new WeightedQuickUnionUF (N*N+1);
grid = new boolean [N*N];
for (int i=0; i<N; i++)
{
for (int ... |
6d3438af-a61f-467f-b9aa-fd28a952b220 | 3 | @Override
public SymptomDTO getSymptomById(Long id) throws SQLException {
Session session = null;
SymptomDTO symptom = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
symptom = (SymptomDTO) session.load(SymptomDTO.class, id);
} catch (Ex... |
f9d24e6a-6c81-468a-926b-16373ccb8e18 | 9 | public static Description extractGoalDescription(Proposition goal, Keyword headortail) {
{ Vector arguments = goal.arguments;
{ Keyword testValue000 = goal.kind;
if ((testValue000 == Logic.KWD_ISA) ||
((testValue000 == Logic.KWD_PREDICATE) ||
((testValue000 == Logic.KWD_FUNC... |
c5830991-dea3-418a-ad71-46eb7b84df61 | 7 | @Override // update the cardHandler -> cardHandler.update() pls keep this method as clean as possible
public void update( GameContainer container, StateBasedGame game, int delta ) throws SlickException
{
Score currentScore = new Score();
input = container.getInput();
//Update the CardHandler
CH.update(c... |
cb65290c-d583-4e20-8bb6-9b2d6a8d0817 | 0 | public void render(Graphics g)
{
unit.render(g);
} |
5f33a37a-d383-4c46-9f7e-92bfdc10e2a0 | 0 | @Basic
@Column(name = "FES_ID_POS")
public Integer getFesIdPos() {
return fesIdPos;
} |
3c906e70-2651-4ae5-ad53-22b6fb0a77ad | 6 | public void decouvrir(Position pos, int dist){
for (int x=pos.getX() - dist; x <= pos.getX() + dist; x++){
for (int y=pos.getY() - dist; y <= pos.getY() + dist; y++){
if ((x >= 0) && (x < IConfig.LARGEUR_CARTE) && (y >= 0) && (y < IConfig.HAUTEUR_CARTE)){
map[... |
a0df4da8-81af-448d-bf3c-4b6f93587167 | 8 | public static void eightdrome(int a, int b) {
if(b <10000000) { return; }
for(int d=1; d<10; d++) {
for(int d2=0; d2<10; d2++) {
for(int d3=0; d3<10; d3++) {
for(int d4=0; d4<10; d4++) {
int test = 10000000*d +1000000*d2 + 100000*d3 + 10000*d4+1000*d4 +100*d3 + 10*d2 + d;
if(isPrime(test) &&... |
16ba544f-5cf9-4b4e-8973-bf11d732079d | 0 | public boolean isMarker(Position position) {
return (board[position.getY()][position.getX()] instanceof Marker);
} |
935de2b1-c842-4f2c-8c3a-214bfb82cf85 | 1 | public void setImage(Image image) {
button.setIcon(image == null ? null : new ImageIcon(image));
} |
01b36591-3838-49b9-aeb0-d8176b2d3eb5 | 6 | public boolean isValid(Event event)
{
int commandType = event.getCommandType();
int minExpectedArgCount = minExpectedArgByteCount(commandType);
int maxExpectedArgCount = maxExpectedArgByteCount(commandType);
if (minExpectedArgCount == maxExpectedArgCount)
{
if (... |
7f389650-9a19-47a7-a99f-4d97395ace43 | 5 | public static void disposeImages() {
// dispose loaded images
{
for (Image image : m_imageMap.values()) {
image.dispose();
}
m_imageMap.clear();
}
// dispose decorated images
for (int i = 0; i < m_decoratedImageMap.length; i++) {
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decora... |
86359997-cc48-459d-a1aa-aa2161902817 | 5 | final int[] method3042(int i, int i_16_) {
if (i_16_ != 255)
return null;
anInt9409++;
int[] is = ((Class348_Sub40) this).aClass191_7032.method1433(0, i);
if (((Class191) ((Class348_Sub40) this).aClass191_7032).aBoolean2570) {
int i_17_ = Class348_Sub40_Sub6.anInt9139 / anInt9405;
int i_18_ = Class28... |
814b82f1-3a69-4d9f-a190-df8195d0e185 | 7 | private void createClassView( FileOutputStream fos, ModClass modClass ) throws Exception
{
String[] menus =modClass.getMenuPath().split( "/" );
if( ( menus.length == 0 ) || menus[ 0 ].isEmpty() )
{
throw new Exception( "The class '" + modClass.getName() + "'menu Path with errors.... |
14278482-5ec1-4e71-a2a4-ba8ce257ae67 | 5 | public IMessage crypter(IMessage clair, String key) {
/*
* Les caractres sont encods un un via oprations elementaires
* Les caractres ne correspondant pas des lettres sont ajouts tel quels.
*/
long d=new Date().getTime();
this.remplirHashMap(this.adapterCle(key));
IMessage m=this.adapterMessage(clair... |
5a4eac57-bb6e-42a1-b090-a1a2ec704c45 | 2 | public <T extends GraphItem> void addCapability( CapabilityName<? super T> name, T capability ) {
if( getCapability( name ) != null ) {
throw new IllegalStateException( "there is already a capability for " + name );
}
setCapability( name, capability );
addChild( capability );
} |
38ebcded-c777-49e2-9551-31f9c3ec7f47 | 1 | public JPanel getUserlistImageframeMenu() {
if (!this.init_1) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.userlistImageframeMenu;
} |
17736793-8b28-4ded-8f7c-58d8fdcd56a1 | 7 | public boolean verifyWeeks() {
boolean[] w = selectedWeeks();
return w[0] || w[1] || w[2] || w[3] || w[4] || w[5] || w[6] || w[7];
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.