method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ddbaf1a9-8be7-4ab3-a5e5-1e674249e759 | 2 | @Override
public void onEnable(){
getDataFolder().mkdirs();
instance = this;
FruitManager fm = new FruitManager();
try {
FruitManager.getInstance().loadFruits();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e... |
10aa21c1-0003-4292-b3ff-8f70605e1a4e | 9 | @Override
public void run() {
Session session = plugin.getSession();
while (true) {
try {
List<String> queuedJobs = plugin.getQueuedJobs();
for (String jobID : queuedJobs) {
int status = -1;
try {
... |
913fb3ee-fb69-4a7d-b90e-c94059702097 | 7 | public static void main(String[] args) throws FileNotFoundException, IOException{
Set<String> sw = StopWord.getStopWords();
List<String> dataFiles = new ArrayList<String>();
File[] files = new File("data").listFiles();
// Detect what files to clean.
for (File file : files) {
if (file.isFile()) {
... |
b5c65ea2-c977-4fcf-bfc0-03f8c8c0752d | 5 | public synchronized void scheduleLeakCheck(Object target, String desc, final boolean forceClean) {
try {
if (forceClean)
scheduledThreadPoolExecutor.schedule(new CleanerTask(target), Math.min(waitTimeSeconds / 2, 20),
TimeUnit.SECONDS);
final long id = UnsafeUtils.addressOf(target);
final String oD... |
43dc953f-145b-4796-bdfb-d770e5222681 | 3 | public Node<Integer> partition(Node<Integer> head, int x) {
if (head == null)
return null;
Node<Integer> newHead = head;
Node<Integer> tail = head;
Node<Integer> p = head.next;
while (p != null) {
Node<Integer> q = p;
p = p.next;
if (q.data <= x) {
q.next = newHead;
newHead = q;
} else... |
6a2cef20-3b86-4cfe-8400-ad100bbee5df | 8 | public void move() {
int roverXCor = getXCoordinate();
int roverYCor = getYCoordinate();
if (direction.equals("S") && plateau.isSpaceValid(roverXCor, roverYCor - 1)) {
y -= 1;
} else if (direction.equals("W") && plateau.isSpaceValid(roverXCor - 1, roverYCor)) {
... |
b21c32de-307b-4023-8fd4-a9d42932e017 | 3 | public static void IfPotion() {
for (int i = 0; i < playerInventory.length; i++) {
Item playerInventoryVariable = playerInventory[i];
if (playerInventoryVariable != null) {
if (playerInventory[i].getId() == 2) {
// playerInventoryVariable = true;
playerHealth = playerHealth + 125;
System.out... |
f327ad72-19cc-41cd-8dc7-d1b2657a98c6 | 7 | public static void main(String[] args) {
final String method = CLASS_NAME + ".main()";
try {
if (3 != args.length) {
throw new IllegalArgumentException("Invalid number of arguments. " + USAGE_HELP);
}
if (!Peer.start(args)) {
throw ... |
05adf280-b285-4592-bef6-37c148a637d9 | 7 | protected <R extends Model> R[] getConnectionArray(String field,
Class<R> type, Connection c) {
field = field.toLowerCase();
if (!fetched.containsKey(field)) {
R[] objs = (R[]) factory.fetch(type, this, c);
List<Model> list = new ArrayList<Model>();
String id = factory.getCache().getModelI... |
1646e16e-3470-4c9a-9bef-993609f50c8e | 1 | protected HttpURLConnection makeConnection(String localMd5) throws IOException {
HttpURLConnection connection = (HttpURLConnection)this.url.openConnection(this.proxy);
connection.setUseCaches(false);
connection.setDefaultUseCaches(false);
connection.setRequestProperty("Cache-Control", "no-store,max-age... |
2a50fbc4-a8c8-43f6-8682-a769b9790395 | 6 | public static String extractWord(List<Location> wordPlayed){
if(wordPlayed == null ||
getDirection(wordPlayed)==INVALID_DIR ||
!isContinuous(wordPlayed)){
return null;
}
StringBuffer sb = new StringBuffer();
sortLocation(wordPlayed);
for(int i=0;i<wordPlayed.size();i++){
Location loc = wordPlaye... |
66aaaac4-5dcd-46de-b4fe-b47b9a1a2524 | 8 | public long count(int[] skill){
int total=0;
int max=0;
for(int value : skill){
total+=value;
max=Math.max(value, max);
}
int lower = total/2+1;
int upper = Math.min(max+(total-1)/2, total-1);
long result=0;
for(int i=0; i<skill.len... |
77bae8df-bafb-4936-b593-38cad79bd1c7 | 8 | public PrimitiveOperator combineRightNRightOnLeft(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[8];
// the other gate is on the left side - on the MSB
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 4 : 0) | 0]; //000
newTruthTable[1] = truthTable[((other.truthTable[1]) ? 4 : ... |
aae18467-3054-409d-a80e-d3b26dcde907 | 1 | public void reloadPlugins() {
try {
createNewClassLoader();
}
catch(MalformedURLException ex) {
// big problem here, should not happen because of check at
// construction
ex.printStackTrace();
}
erasePluginClasses();
loadPlugins();
} |
220838a7-1bdf-45a2-a800-7ac96a14ace7 | 6 | public boolean[][] read() throws IOException{
if (size<=0) return null;
boolean[][] polyomino = new boolean[size][size];
int numBytes = (polyomino.length * polyomino[0].length + 7)/ 8;
byte[] b = new byte[numBytes];
if (-1 == i.read(b)) return null;
... |
fb4d0c9e-88e4-4fee-a19d-69859e086f93 | 4 | public void modifyBookLanguage(BookLanguage lng) {
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... |
6c6bdb28-8f85-47bb-a55a-49be5c89197f | 6 | public static <E extends Comparable<E>> E[] getTop(E[] array, int k) {
if (array == null || array.length == 0 || k <= 0)
return null;
MinHeap<E> minHeap = new MinHeap<E>();
minHeap.add(array[0]);
for (int i = 1; i < array.length; i++) {
if (minHeap.size() < k)
minHeap.add(array[i]);
else if (... |
d4fe79e5-362d-4a59-aa90-af7b8e672d02 | 7 | @Override
public void run() {
//Bandera para salir del hilo si una de las conexiones falla
boolean continuar = false;
/*Gavarela: se pasará la excepción para poner en pantalla en mensaje de esta
switch(pruebaOlib()){
case 0://Conexión Exitosa
continuar = ... |
9f7fbd5c-3970-4954-8e2d-3c2ed2949daa | 0 | public int getMin() {
return this.lowerBound;
} |
143babde-b002-44bc-a429-128b5a1bc9f3 | 9 | public void addMark(Service service) {
// Service service = (Service) node.getUserObject();
List<Mark> markList = service.getMark();
List<BigInteger> mIdList = new ArrayList<BigInteger>();
for (Mark m : markList) {
mIdList.add(m.getId());
}
List<BigInteger> idList = new ArrayList<BigInteger>();
List<St... |
5ad247b1-d751-4e47-9f51-ff9e417018e6 | 0 | public void setCityCode(String cityCode) {
this.cityCode.set(cityCode);
} |
46f31e65-7865-4683-b710-ede73da578eb | 6 | public static String htmlEscape(String text) {
if (text == null) {
return "";
}
StringBuilder escapedText = new StringBuilder();
for (int i = 0; i < text.length(); i++) {
char ch = text.charAt(i);
if (ch == '<')
escapedText.append("<");
else if (ch == '>')
esca... |
2ddec8b8-3c83-4da5-820a-11e48fa93c98 | 1 | public double bonusDefense(Territoire t, Peuple attaquant) {
return t.has(SallePartiel.class) ? Double.POSITIVE_INFINITY : 0;
} |
ec2f4421-a87d-4aba-86dc-96c98fa8f572 | 4 | private static void initModules() {
for (File f : ModuleUtil.getModuleList()) {
ModuleUtil.loadModule(f);
ModuleUtil.loadExtJars(f.getParentFile().getAbsolutePath());
}
Settings setting = SettingsUtils.getSettings();
ArrayList<BaseModule> modules = ModuleUtil.getModules();
for (BaseModule m : modu... |
7e695ced-155c-4352-8b28-085d638279c3 | 7 | @EventHandler
public void SkeletonSpeed(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.getZombieConfig().getDouble("Skeleton.Speed... |
3e299a93-1c03-4e4d-afd0-98a0c489a87b | 4 | public int[] minmax(Board curr)
{
// base case
if(curr.children.size()==0||curr.isOver())//has no children
{
this.bottom=curr.player;
int [] result=new int [2];
result[0]=curr.computeUtility(curr.player);
return result;
}
// recursive case
ArrayList<Board> myChildren=curr.children;
in... |
2102e853-0bdd-4a4a-81e6-c809d72521e2 | 0 | public DtoExtractor(ArrayList<ClientHandeler> clients){
this.clients = clients;
} |
19983055-e205-4c39-b939-e178df8afad0 | 4 | private boolean turn_left_or_right() {
boolean has_turned;
Random random = new Random();
int r = random.nextInt(2);
boolean keep_right;
if(r == 0) { keep_right = false; } else { keep_right = true; }
Direction d = new Direction(dx,dy);
//has_turned = true;
if(keep_right && can_go_right()) {
d.turnR... |
f55a58e5-3aa3-45d7-a17e-a60609071936 | 4 | public boolean check(BattleFunction iface, PokeInstance user, PokeInstance target, Move move) {
if (disabled && target.battleStatus.flags[4]) {
iface.print("The move failed...");
return false;
}
if (isAsleep && target.status != Status.Sleep) {
iface.print("The move failed...");
return false;
}
ret... |
1b9e8789-5016-4d6d-9584-9acd263d11b1 | 2 | public static AccommodationFacilityEnumeration fromValue(String v) {
for (AccommodationFacilityEnumeration c: AccommodationFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
4cebfe06-f302-4c12-bb2d-6413efa2c719 | 5 | private void put(JsonElement value) {
if (pendingName != null) {
if (!value.isJsonNull() || getSerializeNulls()) {
JsonObject object = (JsonObject) peek();
object.add(pendingName, value);
}
pendingName = null;
} else if (stack.isEmpty()) {
product = value;
} else {
... |
76590125-8480-40f4-9742-60c041209a08 | 6 | public void remove(int key) {
HashPrinter.tryRemove(key);
/** Run along the array */
int runner = 0;
int hash = (key % table.length);
while (table[hash] != null && runner < table.length) {
if (table[hash].getKey() == key) {
break;
}
runner++;
hash = ((key + runner) % table.length);
... |
7ff9ef15-8562-4c79-9135-88456317b7a5 | 3 | @Override
public void playbackFinished(PlaybackEvent playbackEvent) {
if(gamePlayList != null) {
if(playOnce) {
gamePlayList.removeByFileName(filePath);
}
}
stop();
if(gamePlayList != null) {
gamePlayList.stoppedCurrentSong();
... |
d6147e2c-09f2-417e-94cf-93040b07967b | 9 | public boolean unifyStatement(Statement rule, Structure query) {
if (unify(rule.left, query)) {
HashMap<String, Argument> tempMap = new HashMap<String, Argument>();
boolean ok = true;
if (rule.right==null) return true;
// pullUpVariables();
Lin... |
bd0bcbcb-f3d2-496b-803e-d9426e982006 | 2 | private ArrayList<Node> getNodes() {
Node node = null;
try {
//Get time, Connection and ResultSet
Long time = System.currentTimeMillis();
String sql = "SELECT * FROM [jonovic_dk_db].[dbo].[nodes];";
Connection con = cpds.getConnection();
Prep... |
ed426d65-70c8-482d-afad-5ade55817207 | 6 | public BlockMap$Slot init(float var1, float var2, float var3) {
this.xSlot = (int)(var1 / 16.0F);
this.ySlot = (int)(var2 / 16.0F);
this.zSlot = (int)(var3 / 16.0F);
if(this.xSlot < 0) {
this.xSlot = 0;
}
if(this.ySlot < 0) {
this.ySlot = 0;
}
if(this.... |
e4c13b29-f745-400f-a275-a21f2663abc8 | 7 | public boolean crafting() {
if (playerLevel[playerCrafting] >= crafting[1] && playerEquipment[playerWeapon] >= 0) {
if (actionTimer == 0 && crafting[0] == 1) {
actionAmount++;
actionTimer = 4;
OriginalShield = playerEquipment[playerShield];
OriginalWeapon = playerEquipment[playerWeapon];
player... |
954bcb9c-b1df-40fb-9251-7655831adae0 | 3 | private Unit getAppCntxtInsPt(){
for(Unit u : b.getUnits()){
Iterator it = u.getUseBoxes().iterator();
while(it.hasNext()){
Value v = ((ValueBox)it.next()).getValue();
if(v instanceof IdentityRef){ //includes ThisRef and ParameterRef
continue;
}
else{
return u;
}
}
}
return... |
a52bbfda-3bca-4af0-a6ac-301d584b4138 | 8 | private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... |
97361851-f762-4206-a6db-4ada023f015f | 4 | public static <T> Set<T> getAdjecentTrackObjects(World world, int x, int y, int z, Class<T> type) {
Set<T> tracks = new HashSet<T>();
T object = getTrackObjectFuzzyAt(world, x, y, z - 1, type);
if (object != null)
tracks.add(object);
object = getTrackObjectFuzzyAt(world, x,... |
e2b500c6-9ca2-44d1-af2c-0ea5b113637a | 3 | public HashMap<String,String> getFileMsg(String IP_PORT,String apiKey,String id){
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://"+IP_PORT+"/cms/api/file?apikey="+apiKey+"&id="+id);
String backRes = "-1";
try {
HttpResponse httpResponse... |
d683e4cc-bc93-435c-9e16-1e0cbc3c9030 | 5 | public WarGameGUI()
{
setTitle("War");
going=true;
this.setBounds(100, 100, 800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
buildPanel();
add(panel);
setVisible(true);
while(going)
{
while(start.isVisible())
{
start.doClick();
}
while(fight.isVisible())
{
fight.do... |
be7fad85-b91b-48de-8a3e-65bec22ebfea | 4 | public static Date parsDateString2Date(String theDateStr)
throws ParseException {
theDateStr = theDateStr.trim();
if (!startsWithYear(theDateStr)) {
theDateStr = getCurrentDate("yyyy")+"-"+theDateStr;
}
String sepRegEx = "[^0-9]";
Pattern pattern = Pattern.compile(sepRegEx);
String[] terms = pattern.s... |
6fc332c8-c2d8-4e25-9caf-cbb762f476b1 | 2 | @Override
public void render() {
Game.getUserInterface().drawTextCentered(Game.WIDTH / 2, 100, UserInterface.PRIMARY_FONT_SIZE, "Tank Game",
Color.white);
Game.getUserInterface().drawTextCentered(Game.WIDTH / 2, 150, UserInterface.SECONDARY_FONT_SIZE, "Singleplayer",
selectedOption == 0 ? Color.red : Color... |
683f23fa-fb6c-44b9-9aa2-8dd879ec2c00 | 4 | public int pageout(Page og){
// all we need to do is verify a page at the head of the stream
// buffer. If it doesn't verify, we look for the next potential
// frame
while(true){
int ret=pageseek(og);
if(ret>0){
// have a page
return (1);
}
if(ret==0){
/... |
1c774542-8eba-452e-831b-b5d71815a565 | 3 | public Boolean actualizar_propietario(String propietario, String propietarioNuevo) {
Boolean est = false;
List DNList = new cDN().leer_por_propietario(propietario);
System.out.println("tamanio con propietario igual:" + DNList.size());
Transaction trns = null;
sesion = HibernateUt... |
85ebac1b-930b-4e48-897a-d7441e9453b5 | 5 | public static void main(String []arg) throws IOException{
int numBanks, i, loanCount;
double limit;
Bank[] bankList;
Stack<Integer> unsafeBanks = new Stack<Integer>();
String filepath;
Scanner fileinput = new Scanner(System.in);
Scanner input = null;
try {
//gets the location of the file co... |
068c6e0c-6569-4d12-9c5b-cbb1a373cdc8 | 1 | public boolean addModerator(User mod){
if(isModerator(mod)) return false;
this.moderators.add(mod);
save();
return true;
} |
f097b46f-54b6-48fb-82a1-b8f393654db9 | 4 | public void CopyBlock(int distance, int len) throws IOException
{
int pos = _pos - distance - 1;
if (pos < 0)
{
pos += _windowSize;
}
for (; len != 0; len--)
{
if (pos >= _windowSize)
{
pos = 0;
}
... |
dd85b777-bb28-4a3e-b023-ed3d6f59bf06 | 8 | static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[14];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 7; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
... |
f2dcc92e-4bcc-41e1-b50b-1aa166ee3030 | 7 | public void moveItem(final ThePacman theItem, final PacmanItem.Direction theDirection) {
controlTouch = false;
if (theDirection == null) {
return;
}
theItem.setFacingDirection(theDirection);
final byte itemInNextDirection = getItemInNextMove(pacman, theDirection);
if (itemInNextD... |
f9386c27-f355-4db6-9ac0-70572c172df9 | 1 | public boolean estEnLocation(){
if(this.situation == LOUE){
return true ;
}
else {
return false ;
}
} |
fe8c1b51-0dfb-4dc7-bda1-859249c226ef | 9 | void mutateSelectedAtom() {
if (!(selectedComponent instanceof Atom))
return;
final Atom at = (Atom) selectedComponent;
if (at.isAminoAcid()) {
EventQueue.invokeLater(new Runnable() {
public void run() {
if (acidPopupMenu == null)
acidPopupMenu = new AminoAcidPopupMenu();
acidPopupMenu.s... |
374468d7-7f46-40cb-9973-c2513b4e79d9 | 3 | public void render(Graphics g){
// render the header and footer
g.drawImage(header_ss.grabImage(1, 4, 642, 50), 0, 50, null);
g.drawImage(header_ss.grabImage(1, 5, 642, 50), 0, Cong.HEIGHT * Cong.SCALE - 65, null);
// render the score
for(int i = maxScore; i >= 1; i--){
... |
ea15452f-72a2-4694-818d-9cb222e1edc7 | 5 | public void setTopics4GibbsCluster(int k, double[] alpha, int clusterNum, int vocalSize){
createSpace(k, 0);
setWordTopicStatCluster(k, vocalSize);
boolean xid = false;
m_alphaDoc = 0;
for (int i = 0; i < k; i++) {
xid = m_rand.nextBoolean();
m_topicIndicator[i] = xid;
if (xid == true) {
m_ind... |
87574d31-81a6-4898-b79f-f81409546fa2 | 6 | public ResultSet preencherTabelaEncarregado(String Departamento) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(S... |
05ca1df2-9646-4805-9ebf-997cb79b50f2 | 4 | public void drawBackground(Graphics g) {
// draw the background graphics from the superclass
super.drawBackground(g);
ImageManager im = ImageManager.getSingleton();
Image img;
Position p;
// draw the map as a matrix of tiles with cities on top
for ( int r = 0; r < GameConstants.WORLDSI... |
4af1e1bd-1a38-4284-aa78-52ef8a5c8d4f | 7 | public static int minPathSum(int[][] grid) {
int r = grid.length;
int c = grid[0].length;
int[][] s = new int[r][c];
for (int i = 0 ; i < r ; i++) {
for (int j = 0 ; j < c ; j++) {
int v1 = Integer.MAX_VALUE;
int v2 = Integer.MAX_VALUE;
... |
7661261b-6aba-465c-bffc-1e84b6a4c0de | 2 | @Override
public void close() throws IOException {
if (fileChannel != null) {
fileChannel.close();
}
if (rf != null) {
rf.close();
}
} |
052e3b55-25eb-4e65-8c83-756b65e45b0c | 2 | @Override
public void close() {
//Connection connection = open();
try {
if (connection != null)
connection.close();
} catch (Exception e) {
this.writeError("Failed to close database connection: " + e.getMessage(), true);
}
} |
b023fc44-8ffe-45ab-ba07-63e26f6cc488 | 8 | public void capture (int i, int j, Node n)
// capture neighboring groups without liberties
// capture own group on suicide
{
int c = -P.color(i, j);
captured = 0;
if (i > 0) capturegroup(i - 1, j, c, n);
if (j > 0) capturegroup(i, j - 1, c, n);
if (i < S - 1) capturegroup(i + 1, j, c, n);
if (j < S - 1) ... |
3d387d3a-cb90-425f-ae56-88d165017822 | 2 | public Quantity add (Quantity target) throws IllegalArgumentException
{
if(target.unit == null || !target.unit.equals(this.unit))
{ throw new IllegalArgumentException(); }
Quantity result = new Quantity (this.value + target.value, target.numerator, target.denominator);
return result;
} |
0428df61-562e-43e3-bb58-07d2a4a5d5e8 | 4 | @Override
public boolean accept(File f) {
// Allow directories to be seen
if (f.isDirectory()) {
return true;
}
// Exit if no extensions exist
if (extensions == null) {
return false;
}
// Only show files with extensions we defined
... |
d6c54c78-b7ea-4094-b1aa-520c11364eb8 | 1 | public static AccesBDInfo getInstance() {
if (instance == null) {
instance = new AccesBDInfo();
}
return instance;
} |
447a1ea1-bc32-414c-ae12-d7670a9747e6 | 7 | public boolean matches(int material, int data) {
if (this.material != material) {
return false;
}
if (this.data == null) {
return true;
}
for (int i = 0; i < this.data.length; i++) {
int val = this.data[i];
... |
1187f19e-92da-4b20-943e-b830fa4f05cb | 2 | @Override
public BencodeDictionary parse(BufferedInputStream inputStream) throws IOException, BencodeParseException {
readAndCheckFirstByte(inputStream);
TreeMap<BencodeString, BencodeType> bencodeValuesMap = new TreeMap<BencodeString, BencodeType>();
int currentByte;
while ((curren... |
bd8b93f5-e86f-4541-8d29-11ab77c435e8 | 1 | public void act()
{
if (canMove())
move();
else
turn();
} |
ad054da6-ae9f-4f6a-b8fd-200de5ff7376 | 7 | public void mouseEntered(MouseEvent paramMouseEvent) {
String str = null;
if (ImageButton.this.Enabled)
{
if (ImageButton.this.MouseOverImage != null)
{
if (ImageButton.this.ImageMap != null)
{
str = ImageButton.this.checkMap(paramMouseEvent.getX(), par... |
606642df-88bd-43e2-a56e-ef33f23913ea | 4 | @Override
public ValueType returnedType(ValueType... types) throws Exception {
// Check the number of argument
if (types.length == 1) {
// if array
if (types[0] == ValueType.NONE) {
return ValueType.NONE;
}
// If numerical
if (types[0].isNumeric()) {
return ValueType.DOUBLE;
}
// if ... |
a795be98-1473-4d9b-af60-311fbbf18a62 | 1 | public void testGetIntervalConverterRemovedNull() {
try {
ConverterManager.getInstance().removeIntervalConverter(NullConverter.INSTANCE);
try {
ConverterManager.getInstance().getIntervalConverter(null);
fail();
} catch (IllegalArgumentException... |
a7031fe9-1534-4c82-8cc2-cda0386164b3 | 2 | public void nextScene()
{
if (current_scene < scene_texture.size())
{
current_scene++;
}
else if (current_scene == scene_texture.size())
{
current_scene = scene_texture.size();
}
} |
766c6832-ee1f-459c-a4a7-b4f5e94ed6e2 | 3 | @Override
public void leenUit(Product product) throws DomainException {
if(product.getStaat().equals(UitgeleendState.class))
throw new DomainException("Product is al uitgeleend");
if(product.getStaat().equals(BeschadigdState.class))
throw new DomainException("Product is beschadigd");
if(product.getStaat().... |
4fa0361a-a1a8-423d-9215-e76c4badfb69 | 7 | private void collisionCheck() {
Map<Double, Double> corners = new HashMap<Double, Double>();
corners.put(ball.getX(), ball.getY()); //left-top
corners.put(ball.getX(), ball.getY() + diameter); //left-bottom
corners.put(ball.getX() + diameter, ball.getY()); //right-top
corners.put(ball.getX() + diam... |
dc209e9f-feae-439e-b70a-0d52d832c3ba | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected instanceof Item)
&&(((Item)affected).owner() instanceof Room)
&&(((Room)((Item)affected).owner()).isContent((Item)affected))
&&(msg.sourceMinor()==CMMsg.TYP_SPEAK)
&&(invoker!=null)
... |
1920bb32-d37a-4bbc-967f-ad67edc48c79 | 6 | public int[] remplissageMax(){
int positionMax = 0;
// On veut bien commencer par la premiere case non null
// pour ne pas avoir des problemes a la comparaison plus tard
for (int i=0; i<table.length; i++)
if (table[i] != null){
positionMax = i;
... |
997bf6ad-256f-4e53-967b-4d3ba29a3c6e | 6 | private void getRoom(Element roomElement) {
String spriteName=roomElement.getAttribute("sprite");
String name=getTextValue(roomElement,"name");
String description=getTextValue(roomElement,"description");
String backgroundLayer=getTextValue(roomElement, "background");
String objectLayer=getTextValue(roomElemen... |
a106e9b7-fee2-46ac-9df4-cb452900bb3f | 3 | public static void polygon(boolean fill, double... points) {
int[] xPoints = new int[points.length / 2];
int[] yPoints = new int[points.length / 2];
for (int i = 0; i < points.length; i ++) {
if (i % 2 == 0) {
xPoints[i/2] = (int)points[i];
} else {
yPoints[i/2] = (int)points[i];
}
}
if (fill... |
b1073eb6-c4b6-4d22-b90c-f85f0541a642 | 8 | public static String cleanPath(String path) {
if (path == null) {
return null;
}
String pathToUse = replace(path, WINDOWS_FOLDER_SEPARATOR, FOLDER_SEPARATOR);
// Strip prefix from path to analyze, to not treat it as part of the
// first path element. This is necessary to correctly parse paths like
// "f... |
b28417dd-5b94-4664-a461-4d093c2967c2 | 6 | public Boolean checkBalance(privAVLNode x)
{
if(x == null)
return true;
int bal = 0;
if(x.getChild(0) != null)
bal = x.getChild(0).getHeight()+1;
if(x.getChild(1) != null)
bal = bal-(x.getChild(1).getHeight()+1);
if(!(bal==-1 || bal==0 || bal==1))
return false;
return true;
} |
1222e763-d9e0-4d66-8eee-c17484da846a | 3 | public static boolean resetSeason() {
File f = new File(pathGame);
f.delete();
File fB = new File(pathBonus);
fB.delete();
List<User> users=GameData.getCurrentGame().getAllUsers();
File fUser; //remove all of users previous answers
for(User u:users){
fUser = new File(pathUserAnswer+u.getID()+".dat")... |
9604c8b7-1a5e-4a91-9cae-8cb0c4bb1242 | 5 | public void update() {
if (end) gsm.setState(lastState);
handleInput();
ticks++;
if (ticks > wait) {
if (speed == 0) pos--;
else if (ticks % speed == 0) pos--;
}
if ((pos + line(8) + (lineGap / 2)) < 0) end = true;
} |
1fbcd55c-04d4-41c8-a408-86631a6a1a05 | 8 | private static Normalization determineNormalization(Element model) {
Normalization normMethod = Normalization.NONE;
String normName = model.getAttribute("normalizationMethod");
if (normName.equals("simplemax")) {
normMethod = Normalization.SIMPLEMAX;
} else if (normName.equals("softmax")) {
... |
3197a487-e509-4904-8638-843c65a107e1 | 4 | public void addCarEventCount(int count) {
if(count < 0) count = 0;
if(carEvents.getSize() == 0) {
carEventMin = count;
carEventMax = count;
} else {
if(count < carEventMin) carEventMin = count;
if(count > carEventMax) carEventMax = count;
}
... |
c7fb4034-88f2-4a3d-8c88-626f57859a5e | 4 | private void update() {
if(menu==null){
if(story==null){
lvl.update(inHandler);
long timeElapsed = System.currentTimeMillis() - oldTime;
// System.out.println(timeElapsed);
if (timeElapsed < 40) {
try {
Thread.sleep((long) 40 - timeElapsed); // ~25 updates per second
} catch (InterruptedException... |
51422f3e-dbd0-45ec-9df9-a9cf1adef3c6 | 2 | String readFile(String fileName) {
File file = new File(fileName);
if (!file.exists()) fatalError("No such file '" + fileName + "'");
if (!file.canRead()) fatalError("Cannot open file '" + fileName + "'");
return Gpr.readFile(fileName);
} |
89bbb758-50d4-457d-927f-f79a1b8ea572 | 7 | @Override
public int compareTo(Card o) {
if (o == null) {
throw new NullPointerException();
}
if (getSorting() == o.getSorting()) {
int sign = Main.ascending ? 1 : -1;
if (rank == 1 && o.rank != 1) {
return sign;
} else if (o.rank == 1 && rank != 1) {
return -sign;
}
return sign * Integ... |
dcc1197c-d6ac-4c02-8e73-bd2d00102265 | 3 | public static void Read(String book) {
if(!book.startsWith("Book:")) {
book = "Book:" + book;
}
for(int j=0; j<Inventory.length; j++) {
if(GetItemName(Inventory[j]).equalsIgnoreCase(book)) {
GUI.log(Books.getName(Inventory[j]) + "\n~~~~\n" + Books.getBook(Inventory[j]));
break;
}
}
} |
bb7b9c52-0135-4336-ba0b-9ef3fa5b94e0 | 3 | public ResultSet retrieveStockData() throws SQLException {
try {
databaseConnector = medicineConnector.getConnection();
stmnt = databaseConnector.createStatement();
SQLQuery = "SELECT * FROM familydoctor.medicine";
dataSet = stmnt.executeQuery(SQLQuery);
... |
ffcbc899-6a02-48e4-9dd8-f0aaa6a0f09b | 9 | public void updateStatus(Object obj) {
Space p = (Space) obj;
if (spaceObj_.getName() == p.getName()) {
spaceObj_ = p;
String status = "";
status += spaceObj_;
bg_pic.setToolTipText(status);
if (spaceObj_ instanceof PropertySpace) {
... |
30e75ca0-5740-4ecc-b996-ca678abf0916 | 2 | public PlayerPanel(Player p) {
this.player = p;
this.hand = this.player.getHand();
this.books = this.player.getBooks();
this.playerName = new JLabel(p.getName());
this.add(this.playerName);
// Add the player's books to the panel
BookStack bs;
for (int i = 0; i < this.books.size(); i++) {
bs = new B... |
e938bb68-9bf6-4a51-bbf0-bd1357832983 | 6 | @Override
public void processPacket(Client c, int packetType, int packetSize) {
int itemId = c.getInStream().readSignedWordA();
if (!c.getItems().playerHasItem(itemId,1))
return;
switch (itemId) {
case 11694:
c.getItems().deleteItem(itemId,1);
c.getItems().addItem(11690,1);
c.getItems().add... |
ed674d18-38a6-40df-94b7-b7946a774259 | 1 | public void testConstructor_long_long3() throws Throwable {
DateTime dt1 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
DateTime dt2 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
try {
new MutableInterval(dt1.getMillis(), dt2.getMillis());
fail();
} catch (IllegalArgumentExce... |
7b26e898-7322-4fa4-a053-2ae4a5463582 | 2 | @SuppressWarnings("empty-statement")
public JDialog initJdAdd() {
jd_add = new JDialog(this);
jd_add.setModal(true);
if (temp == false) {
jd_add.setTitle("添加键值对");
} else {
jd_add.setTitle("编辑键值对");
}
jd_add.setLayout(null);
// jd_add.s... |
d16e5e43-0c4b-400e-82e4-157865bccfab | 2 | @Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if (!Commands.isPlayer(sender)) return false;
Player p = (Player) sender;
if (args.length != 1) return false;
channel.removeChannel(p, args[0]);
return true;
} |
78679942-a04a-4a26-8b4d-f191b5df912d | 5 | public void removeIrrelevantArtists() throws SQLException
{
List<Integer> nonPersonnel = new LinkedList<Integer>();
String sql = "select * from artist LEFT JOIN personnel ON artist_id = artistnumber WHERE artistnumber IS NULL";
PreparedStatement ps = Connect.getConnection().getPreparedStatement(sql... |
794bbb81-6a10-4204-a6a0-e084aaf03dda | 2 | public void HangupBridgeCalls(){
Iterator<Entry<CallFrame, List<String>>> bridgeIterator = bridgeLines.entrySet().iterator();
while (bridgeIterator.hasNext()) {
Entry<CallFrame, List<String>> entry = bridgeIterator.next();
List<String> bridgeList = (List<String>) entry.getValue();
if(bridgeList.get(0).star... |
114cd470-49b0-40e7-911f-c9651aeb3254 | 2 | public static int search_function_by_name(Function_table function_table, String name) {
int num = function_table.function_name.size();
for (int i = 0; i < num; i++) {
if (function_table.function_name.get(i).toString().equals(name)) {
return i;
}
}
... |
741cc140-c885-4105-9e5a-fa1cee6e817d | 8 | private void formLine(boolean create,
int playBookNumber,
int setNumber,
int formationNumber,
int playNumber,
Connection database,
PrintWriter webPageOutput)
{
... |
ec84b2f1-d510-48c1-a423-7228dfd1870f | 5 | public void paint( Graphics g ){
super.paint(g);
// actualizamos dimensiones
int cantAtr = getSizeAtributos();
int cantMet = getSizeMetodos();
int px=this.getX();
int py=this.getY();
int w=this.getWidth();
int h=this.getHeight();
... |
6b5168a3-f705-4ad2-abbd-ea279b03007a | 5 | public void click(Point loc) {
Rectangle[] rects = buildHeaders();
for (int i = 0; i < rects.length; i++) {
if (rects[i].contains(loc)) {
if (i == defaultTab)
defaultTab = -1;
else
defaultTab = i;
break;
}
}
if (curTab != -1) {
Rectangle rect = getMainRect(curTab);
if (rect.con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.