method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
289ac9c5-6c87-4160-bf7f-e6154ea0831f | 4 | public DarkIRCBot() {
Properties prop = new Properties();
InputStream input = null;
try {
input = new FileInputStream(DarkIRCmain.getConfigFile());
// load a properties file
prop.load(input);
... |
df3f734f-857a-457e-a5f9-1d24bcbfe55d | 1 | @Override
protected void onKick(String channel, String kickerNick, String kickerLogin,
String kickerHostname, String recipientNick, String reason) {
ChannelEventsListener listener = getChannelEventsListener(channel);
if (listener != null)
listener.userKicked(kic... |
dfbec57c-996b-46e1-979b-ac7e232f2ff9 | 4 | public boolean Login() throws LoginFailException {
try {
String url_id = URLEncoder.encode(id, "UTF-8");
String url_pw = URLEncoder.encode(pw, "UTF-8");
String url = "https://www.melon.com/muid/login/web/login_informProcs.htm";
String param = "memberId=" + url_id ... |
caa1ff16-a7c7-4fb1-897b-3fac953c4ba3 | 1 | private boolean indexOK(int index) {
return (index >= 0 && index < array.length);
} |
f3f68f76-9a22-45df-9e82-5227fe174b04 | 9 | public SnmpPdu decodePDU(BerDecoder raw_packet)
throws SnmpMessageException, BerException {
SnmpPdu pdu = new SnmpPdu();
int length;
pdu.setPduType(raw_packet.decodeTag(-1));
if (debug) dump(pdu.pduTypeToString());
switch (pdu.getPduType()... |
f6a01eaf-3d09-4b0b-8546-14a92894b7c9 | 3 | public List<Account> findDeliquentAccounts() throws Exception {
ArrayList<Account> delinquentAccounts = new ArrayList<>();
List<Account> accounts = jdbcAccountDao.findAllAccounts();
Date thirtyDaysAgo = daysAgo(30);
for (Account account : accounts) {
boolean owesMoney = acco... |
ac171a67-0a88-46b8-be97-fa7d819f0c2b | 1 | public void addToStart(String value) {
ListElement current = new ListElement(value);
if (count == 0) {
head = current;
tail = current;
} else {
current.connectNext(head);
head = current;
}
count++;
} |
560e1059-d76a-4b5d-8fd8-c2eba1332cee | 9 | public static void main(String[] args) {
if (args.length != 5){
System.err.println("Incorrect number of arguments");
System.err.println("Syntax: java AllAssignmentsGrader " +
"<hw1|hw2|...> " +
"<gradesource_students_file> <ACMS_accounts_file> " +
"<test_cases_file> <directory_of_submission... |
e62f88be-82d1-4f00-8528-588b74b9c1d2 | 6 | public void sendBroadcast (Message message)
{
try
{
switch (message.getType())
{
// Etat 10 : On envoi un message en broadcast
case 10 :
{
// On cree une copie pour nous meme
program.getChat().getBroadcast().addMessage(message);
break;
}
// Etat 11 : On envoi un fichie... |
430bddae-0c80-43f8-bbd2-8def4a77d078 | 6 | public boolean parsePublicMessage(String message, Client client) {
if (status > 2 && !client.isModerator()) {
client.sendButlerMessage(channel.getName(),
"In diesem Channel kannst du nicht öffentlich sprechen.");
return false;
}
String msg = message.toLowerCase();
if (msg.contains(Server.get().getB... |
0409e028-6195-40ba-9e64-9041a833102a | 6 | @Test
/**
* This does not test the distribution, but if we belive in the random generators
* it tests the "border values" in that all possible values must be generated
*/
public void testGetRandomQuestion()
{
int testTries = 30;
boolean horseFound = false;
boolean houseFound = false;
bool... |
e77cbece-d486-4539-b508-d684aaee1e20 | 4 | public void setTotal(int total) {
this.total = total;
int pages = total / size;
boolean hasMore = (0 != total % size);
if (0 == pages) {
totalPage = 1;
} else {
if (hasMore) {
totalPage = pages + 1;
} else {
totalPage = pages;
}
}
if (curpage > totalPage) {
curpage = totalPage;
}
... |
c328caea-c968-4da6-ae63-4dc9dd59855e | 3 | public void setEqualizer(Equalizer eq)
{
if (eq==null)
eq = Equalizer.PASS_THRU_EQ;
equalizer.setFrom(eq);
float[] factors = equalizer.getBandFactors();
if (filter1!=null)
filter1.setEQ(factors);
if (filter2!=null)
filter2.setEQ(factors);
} |
cbf10f8e-c149-424a-b58a-96d47950153d | 0 | private static void getCommand() {
System.out.print("[Moves:" + moves + " Score:" + score + " Ratio:" + ratio + " Possible directions:" + possibleDirs + "] ");
Scanner inputReader = new Scanner(System.in);
command = inputReader.nextLine();
} |
046d1a65-f163-4e7f-bd89-670fa37d7067 | 9 | * @param body
* @return Stella_Object
*/
public static Stella_Object traceIf(Stella_Object keyword, Cons body) {
{ Cons test = Stella.NIL;
Cons elements = Cons.copyConsList(body);
if (Stella_Object.safePrimaryType(keyword) == Stella.SGT_STELLA_CONS) {
{ Cons keyword000 = ((Cons)(keyword... |
8eb6e172-cf37-49ad-8418-18aacf097b40 | 5 | public void InitMouseListener(){
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
setSelected(true);
}
@Override
public void mousePressed(MouseEvent arg0) {
... |
72ea177b-be5b-4494-80c6-790f9503a1ba | 2 | @SuppressWarnings("serial")
public JTableRenderer(final Object cell,
final mxGraphComponent graphContainer)
{
this.cell = cell;
this.graphContainer = graphContainer;
this.graph = graphContainer.getGraph();
setLayout(new BorderLayout());
setBorder(BorderFactory.createCompoundBorder(ShadowBorder
.getSh... |
e260eb6f-c0eb-4c8b-b1b1-f5d066ca0390 | 6 | @Override
public void apply(View view, Changes changes)
{
byte[] colors = new byte[(((rad2 * 2) + 1) * ((rad2 * 2) + 1)) - 1];
for(int x = -rad; x <= rad; ++ x)
{
for(int y = -rad; y <= rad; ++ y)
{
int index = 0;
for(int x2 = -rad2; x2 <= rad2; ++ x2)
{
for(int y2 = -rad2; y2 <= ... |
4c889519-c297-40f4-9fb9-97f0ce88bd6c | 8 | public void avancer() {
switch (position.getDirection()) {
case N:
if (position.getY() < gridMaximumValueY)
position.setY(position.getY() + 1);
break;
case E:
if (position.getX() < gridMaximumValueX)
position.setX(position.getX() + 1);
break;
case W:
if (position.getX() > 0)
... |
645ff774-eab9-474d-a0c0-c44b8c5dcf5a | 6 | public static void main(String argv[]){
File fullfolder = new File("/home/dharmesh/aditya/author_profiling/pan_author_profiling_training_data/enoutput/");
File trainfolder = new File("/home/dharmesh/aditya/author_profiling/pan_author_profiling_training_data/entraining/");
File testfolder = new File("/home/dharmes... |
230a1fd7-9488-4ce1-9c9d-08ad65733963 | 4 | private void SearchList(String s) {
DefaultListModel<Item> listModel = new DefaultListModel<Item>();
ArrayList<Item> items = (ArrayList<Item>) Main.getItemList();
for (Item item : items) {
if (item.getName().startsWith(s)
|| item.getName().contains(" " + s))
listModel.addElement(item);
}
if (list ... |
18018805-f72d-4425-bcad-1948258a3b4c | 7 | public static LogicObject dowKeywordToInstance(Keyword dow) {
if (dow == Timepoint.KWD_MONDAY) {
return (((LogicObject)(Timepoint.SGT_TIMEPOINT_KB_MONDAY.surrogateValue)));
}
else if (dow == Timepoint.KWD_TUESDAY) {
return (((LogicObject)(Timepoint.SGT_TIMEPOINT_KB_TUESDAY.surrogateValue)));
... |
2f2d2fc3-aa70-4787-9e3a-e139a25e3f64 | 5 | @Override
public V put(K key, V value) {
V oldValue = null;
int index = Math.abs(key.hashCode()) % SIZE;
if(buckets[index] == null) {
buckets[index] = new LinkedList<MapEntry<K, V>>();
}
LinkedList<MapEntry<K, V>> bucket = buckets[index];
MapEntry<K, V> ... |
99d5b5c6-d025-4a93-a0ca-7dea68fa701c | 7 | @Override
public void run() {
int answer = 0;
Set<Integer> answers = new HashSet<>();
for(int i = 1; i < 9999; i++) {
if(i % 10 == 0)
continue;
for(int j = 1; j < 999; j++) {
if(j % 10 == 0)
continue;
int sum = i * j;
if(sum > 987654321)
break;
if(verify(i, j, sum)) {
ans... |
713972f2-562f-4a8f-90c8-feae82811249 | 9 | private void makeLanguages(String str){
int end = 0;
while(end >= 0 && str != null){
end = str.indexOf("*, ");
if(end >= 0){
String tmp = str.substring(0, end);
int index = 0;
while(index >= 0){
index = tmp.indexOf(", ");
if(index >= 0){
languages.add(tmp.substring(0, index));
... |
caa01007-262d-4957-8f6b-96d5152ed274 | 0 | public void setDoubleOptin(boolean doubleOptin) {
this.doubleOptin = doubleOptin;
} |
1c9de17f-0890-4e1e-8940-ff8f8c550922 | 1 | public synchronized char getItemType(Position position){
if (field[position.getX()][position.getY()] != null) return field[position.getX()][position.getY()].getType();
return 0;
} |
e4f82dc9-90dc-4dc5-8403-da97063e3850 | 7 | public static Iterator allDirectSubcollections(LogicObject self, boolean performfilteringP) {
if (Stella_Object.isaP(self, Logic.SGT_LOGIC_DESCRIPTION)) {
Description.deriveDeferredSatelliteRules(((Description)(self)));
}
{ Iterator directlylinkedobjects = Logic.allDirectlyLinkedObjects(self, Logic.SG... |
0d4bebe8-865c-40d2-9053-f8fcf6b4b39d | 6 | @Override
public void actionPerformed(ActionEvent event) {
JButton selection = (JButton) (event.getSource());
if (selection.equals(craps)) {
new Craps(money, name);
this.dispose();
}
if (selection.equals(blackjack)) {
new Blackjack(money, name);
this.dispose();
}
if (selection.equals(slots)) {
... |
8f81fbb1-32e4-405c-a0d5-d175ec527f18 | 0 | @Override
public Message toMessage(Session session) throws JMSException {
Message message = session.createMessage();
setMessageProperties(message);
message.setJMSType(TYPE);
return message;
} |
edc09426-0fd8-4103-b25a-d586d2a41a12 | 7 | @Override
public Protein getProteinFromFile(File f)
{
Protein protein = new Protein();
try
{
BufferedReader br = new BufferedReader(new FileReader(f));
try
{
String line = br.readLine();
int start = line.indexOf(QUOTE, NAME_QUO... |
7f77ffb4-7aa8-4bdb-9142-17ac0ee30635 | 0 | public void setLogFileMessageFormatter(LogFileMessageFormatter msgFormatter) {this.msgFormatter = msgFormatter;} |
1d9f70fd-7620-4b35-9b49-9f131697a9c4 | 8 | public static void loadConfig(String filename) {
try {
Reader read = null;
read = new FileReader(new File(filename));
JSONTokener jsonReader = new JSONTokener(read);
JSONObject params = new JSONObject(jsonReader);
/*
* Reading in configuration information from the file, things like confidence, merg... |
2338048a-a7ee-445a-a7f1-2fb67111f59d | 3 | public void setValueAt(Object value, int row, int column) {
switch (column) {
case 0:
variables[row] = (String) value;
break;
case 1:
firstSets[row] = removeDuplicateCharacters((String) value);
break;
case 2:
followSets[row] = removeDuplicateCharacters((String) value);
break;
}
} |
6a8b5a0f-95af-458a-8b25-a1b8aa606097 | 7 | public void processCookies(MimeHeaders headers) {
if (headers == null)
return;// nothing to process
// process each "cookie" header
int pos = 0;
while (pos >= 0) {
// Cookie2: version ? not needed
pos = headers.findHeader("Cookie", pos);
// no more cookie headers headers
if (pos < 0)
break;
... |
99565238-c003-4778-8433-fab6c1dc1903 | 0 | public void addHurdle(Hurdle hurdle) {
hurdleList.add(hurdle);
} |
e53ea91b-ef15-41f4-a6e8-71b2b38eaaf4 | 1 | public int subtraction() {
if (stack.stackLength() > 1) {
int firstNum = stack.top();
stack.pop();
int secondNum = stack.top();
stack.pop();
return firstNum - secondNum;
} else {
return error;
}
} |
1c902ba6-409b-4d32-ab1c-aa572f716237 | 3 | public void actionPerformed(ActionEvent event) {
if(event.getSource().equals(close)) {
this.setVisible(false);
} else if(event.getSource().equals(versionTest)) {
VersionTester.testVersion(false, true);
} else if(event.getSource().equals(testForUpdatesAtStartup)) {
AppConfig.getAppConfig().checkForSinalg... |
1303aa2e-2339-4bdf-9cbb-6157d9b4e2bc | 8 | public void open() {
shell = new Shell(SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM );
//shell.setImage(RepDevMain.xxxxx);
FormLayout layout = new FormLayout();
layout.marginTop = 10;
layout.marginBottom = 10;
layout.marginLeft = 10;
layout.marginRight = 10;
layout.spacing = 8;
shell.setLayout(layout);... |
d544e811-db2f-4412-a6b3-d9222da2e76e | 4 | private File getConfigFile(String file)
{
if (file.isEmpty() || file == null) {
return null;
}
File configFile;
if (file.contains("/"))
{
if (file.startsWith("/"))
{
configFile = new File(plugin.getDataFolder() + file.replace("/", File.separator));
} else
{
configFile = new Fil... |
150060b3-797a-4e05-912a-77b0f76e3276 | 7 | public double partialContains(Instance instance) throws Exception {
int count = 0;
for (int i = 0; i < instance.numAttributes(); i++) {
if (i == m_ClassIndex) {
continue;
}
if (instance.isMissing(i)) {
continue;
}
double current = instance.value(i);
if (m_NumericBounds[i] != null) { //... |
8d7d0894-e0be-42fd-9afc-1c6db4293832 | 3 | public boolean isColliding(Rectangle rect, TileType type) {
for (int i = 0; i < tileList.size(); i++) {
if (type == tileList.get(i).getType()) {
if (rect.intersects(tileList.get(i).getRect())) {
return true;
}
}
}
return false;
} |
d31ed093-4417-4db2-ac9b-ca66e20f0055 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Skills)) {
return false;
}
Skills other = (Skills) object;
if ((this.skillsId == null && other.skillsId != null... |
8d005d07-37ec-433b-9387-84b1c4afb402 | 0 | private void addChromosome(Chromosome chromosome) {
population.add(chromosome);
} |
a4647153-a1a9-4c05-8aa3-2797f60a83fe | 9 | private void byteLoop(RasterAccessor src, RasterAccessor dst) {
int dwidth = dst.getWidth();
int dheight = dst.getHeight();
int dnumBands = dst.getNumBands();
int dstBandOffsets[] = dst.getBandOffsets();
int dstPixelStride = dst.getPixelStride();
int dstScanl... |
1c416937-289f-4dc7-a857-1805738a7d07 | 1 | @Test
public void removeActivityTest() throws InstanceNotFoundException {
Activity activity = null;
try {
activity = activityService.find(0);
} catch (InstanceNotFoundException e1) {
fail("Activity not exist");
}
activityService.remove(activity);
assertFalse("Activity not delete", activityService.g... |
973e9e8e-a2ac-444f-9586-51a28941e54c | 4 | @Override
public List<Integer> sort(List<Integer> list) {
// checking input parameter for null
if (list == null) {
throw new IllegalArgumentException("ArrayList not specified!");
}
// moving forward through array
for (int i = 0; i < list.size() - 1; i++) {
... |
4548f3d7-76fd-4656-a188-02c59bdacee4 | 1 | public void updateSubTypes() {
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
GlobalOptions.err.println("setType of " + local.getName() + ": "
+ local.getType());
local.setType(type);
} |
321fd5d8-57e4-4ff4-ad79-48d5900d91e6 | 5 | public void searchForPath() {
setDrawGraphInstance();
if(nodeFromKDV == -1 || nodeToKDV == -1) {
if(!pa.getMalformed()) {
JOptionPane.showMessageDialog(null, "One of the addresses could not be found", "Warning Message", JOptionPane.WARNING_MESSAGE);
}
return;
}
edgesOnPath.clear();
Iterable<MyE... |
5f3b1184-bbe5-4268-8482-d81929c54728 | 7 | private double[] getSeedFreq(String hash) {
String hashtag;
boolean inBase = false;
//check whether hashtag is baseline criteria
for(String basehash:Settings.baseKeywords){
if(hash.replace("#", "").equals(basehash.toLowerCase()) || hash.equals(basehash)){
inBase = true;
//System.out.println(hash+"... |
a9b6a2bd-ed81-480d-985a-006e0c918d90 | 2 | private void winTrick() {
// Examine cardsPlayed pile and determine which player won the trick.
int winnerIndex = determineWinner();
// Change firstToPlay to be the index of the player who won the trick.
this.firstToPlayIndex = winnerIndex;
// Show each player who won the trick and which cards were play... |
636d3b81-9aef-41b7-97ce-02604e24fb7c | 5 | public void update()
{
bg.update(heart.currentHappinessLevel);
heart.update();
for(int i=0; i<stars.size(); i++)
{
stars.get(i).update();
if(stars.get(i).xPos < 0)
{
stars.remove(i);
}
}
if (spaceCount > 5)
{
checkpoint1 = false;
checkpoint2 = true;
}
if (gsm.score > 2... |
d58ed34c-9571-4375-83fb-f27ad32cd859 | 5 | private void setEntityRelevant(String clientId, EntityRef entityRef, boolean relevant) {
if (relevant) {
if (relevantEntities.add(entityRef)) {
for (ClientEntityRelevancyRuleListener listener : listeners) {
listener.entityRelevancyChanged(clientId,... |
1115b60c-c08c-4b35-8c0a-fcc43623162a | 1 | public void setPrintStream(PrintStream printStream) throws IllegalArgumentException{
if(printStream == null)
throw new IllegalArgumentException( "Print stream can not ben null." );
this.printStream = printStream;
} |
47baadb2-b419-4b42-98f4-9b8530fb3f77 | 4 | public static void testFindAlgorithm(int[] ns, float[] ks, Random source, int repeatFactor, float myFactor){
Callback cb = new Collector();
Callback comp = new Collector();
RandomizedAlgorithm rand = new FindAlgorithm();
rand.setRandomSource(source);
for(int n : ns){
... |
19192507-4cb6-4c5a-82b4-4469b221ae9b | 7 | void setModelClickability() {
Bond[] bonds = frame.bonds;
for (int i = frame.bondCount; --i >= 0;) {
Bond bond = bonds[i];
if (bond == null || bond.atom1 == null || bond.atom2 == null)
continue;
if ((bond.shapeVisibilityFlags & myVisibilityFlag) == 0 || frame.bsHidden.get(bond.atom1.atomIndex)
|| ... |
d3ce8134-49bc-4464-98b0-c3b38c47a456 | 1 | private float[] simulateBowl(float[] currentFruits) {
float[] bowl = new float[NUM_FRUIT_TYPES];
int sz = 0;
while (sz < numFruitsPerBowl) {
// pick a fruit according to current fruit distribution
int fruit = pickFruit(currentFruits);
float c = 1 + random.nextInt(3);
c = Math.min(c,... |
3a86404e-497a-4028-a4ea-4e6c5f996b1a | 5 | private static int doEvents( int firedEvents, long startTime )
{
Iterator< Event > it = events.iterator(); // get the iterator for the untimed events
while ( it.hasNext() )
{
if ( TimeHelper.isOver( startTime, MaxTickTime ) )
{
return firedEvents; //... |
0e343dbb-a8a7-44bf-aeec-49eeade6262e | 6 | public final boolean process(Player player) {
if (delay > 0) {
delay--;
return true;
}
while (true) {
if (constructingRegion)
return true;
if (stage == actions.length) {
stopCutscene(player);
return false;
} else if (stage == 0)
startCutscene(player);
CutsceneAction action = acti... |
a79ca41a-6bc2-4ad4-9106-8c9663a1788a | 1 | public void sortLinkedList2() {
long start = System.currentTimeMillis();
Object[] arr= ll.toArray();
Arrays.sort(arr);
ll.clear();
LinkedList<Object> newLL = new LinkedList<>();
for (int i = 0; i < arr.length; i++) {
newLL.add(arr[i]);
}
long end = System.currentTimeMillis();
System.out.println(... |
577a1dae-cd52-4763-85f7-933504d6befe | 0 | public void setResultCode(int resultCode) {
this.resultCode = resultCode;
} |
58fe5e76-bec6-442a-adfa-492e5f4f897c | 8 | public CalRGBColor(PDFObject obj) throws IOException {
// obj is a dictionary that has the following parts:
// WhitePoint [a b c]
// BlackPoint [a b c]
// Gamma a
super(CS_sRGB, 3);
// find out what what is according to the CIE color space
// note that this is not reflexive (i.e. passing t... |
1997c267-adf0-40c9-9836-c5c5f2244b21 | 4 | public static DaoFactory getInstance() {
if(factory == null) {
String classname = PropertyManager.getProperty("persistence.factory");
if (classname != null) try {
factory = (DaoFactory) Class.forName(classname).newInstance();
} catch( Exception e) {
//TODO log this exception with Log4J
System.err... |
a13dafa7-ad06-4b7f-bf8f-c762783441ab | 3 | public String toString()
{
StringBuffer res = new StringBuffer("");
String piece = "";
String couleur = "";
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
if(this.tableau[i][j] == null)
{
piece = "Case vide";
couleur = "";
}
else
{
piece = this.tableau[i]... |
1b5a2f38-4a17-46e2-a46e-c39320d9b28a | 0 | public static String getHexString(byte [] src, int srcPos,int destPos,int length){
byte[] tmp=new byte[length];
System.arraycopy(src, srcPos, tmp, destPos, length);
return (Hex.rhex(tmp));
} |
ac4b4670-4349-4a68-8d2b-b3bcca0b8c52 | 8 | * of the <code>Tile</code> for. This object is also used to
* get the <code>ColonyTile</code> for the given <code>Tile</code>.
*/
public void displayColonyTile(Graphics2D g, Tile tile, Colony colony) {
boolean tileCannotBeWorked = false;
Unit occupyingUnit = null;
int pri... |
f90920dd-bf88-4620-a82a-0d73dce25723 | 5 | public void pickUpItem (int playerID) {
Player p = this.playerIDs.get(playerID);
if (p != null) {
Location l = Location.locationInFrontOf(p.getLocation(), p.getDirection());
InanimateEntity on = board.tileAt(l).getOn();
if (on != null && on instanceof Item) {
if(p.addItemToInventory((Item)on)) {
p... |
bce2b09e-f02f-4d09-843e-43fc2334960e | 7 | @Override
protected void onDisconnect() {
int reconnectAttempts = 0;
printLog("Connection to " + getServer() + " dropped, "
+ "trying to reconnect...");
// try to reconnect
while(!isConnected() && reconnectAttempts < 15) {
try {
// reconnect
reconnectAttempts++;
reconnect();
} c... |
6f67762d-dd19-4570-959a-134c6a579c46 | 6 | protected void resizeArrayToFit(int newCount) {
int steppedSize = buf.length;
if (steppedSize == 0)
steppedSize = 64;
else if (steppedSize <= 1024)
steppedSize *= 4;
else if (steppedSize <= 4024)
steppedSize *= 2;
else if (steppedSize <= 2 * 10... |
47134763-1875-4e06-9b1e-d36131caee88 | 5 | public static double jauDtdb(double date1, double date2,
double ut, double elong, double u, double v)
{
double t, tsol, w, elsun, emsun, d, elj, els, wt, w0, w1, w2, w3, w4,
wf, wj;
int j;
/*
* =====================
* Fairhead et al. model
* =========... |
374dca15-eee4-4d11-ad52-f8a017916af1 | 1 | @Override
public boolean onKeyDown(int key) {
if(key == Keyboard.KEY_ESCAPE) {
Application.get().getHumanView().popScreen();
return true;
}
return false;
} |
9c552c44-1a04-47c0-b6f6-073cf0d7dff5 | 7 | private void fill(Graphics g, int x, int y, int width, int height, boolean horizontal) {
if (horizontal) {
if (height > block) {
g.setColor(c_bg);
g.fillRect(x, y, width + evm, height - block + evm);
}
for (int i = 0; i < width; i += block) {
g.drawImage(hgradient, x + i, (height > block) ? (y + ... |
4661a04e-05bf-4a61-85fe-d194b8d8f5f2 | 7 | @Override
protected Match addInitialMatch(Edge e, Edge eP, String matchID)
{
Match m = new Match(graph, pattern, e, eP, matchID);
// get neighbor edges in pattern and all matches containing these neighbor edges
Set<Edge> neighborEdgePs = new HashSet<Edge>();
neighborEdgePs.addAll(pattern.getInEdges(eP.getFro... |
1bdef044-1fda-4f16-82bb-1b0369fbc003 | 4 | private boolean lukeminenVoidaanAloittaa() {
if (syote == null) {
return false;
}
if (!paikkaSisaltyySyotteeseen()) {
return false;
}
if (paikkaSisaltaaNumeron() || paikkaSisaltaaDesimaalipisteen()) {
return true;
}
... |
5b716ba0-d5f6-46af-8f7e-34dc12eed07e | 7 | public void requestFocus(short control) {
if (control == ADDNEW && buttonNewTask != null) buttonNewTask.requestFocus();
if (control == PRIORITY) textPriority.requestFocus();
if (control == CONTENT) textContent.requestFocus();
if (control == DATE) textDate.requestFocus();
if (control == COMPLETED) chec... |
d3374b1b-4a3c-43f7-918f-032732af939e | 8 | private void addStep(double startPrice, double endPrice, double fixedPrice, double variablePricePercent) {
if (billingServerSecure == null) {
System.out.println("ERROR: You are currently not logged in");
} // Checking for positive interval range
else if (endPrice != 0 && startPrice >= endPrice) {
System.out... |
23bd26ba-dfbb-47e0-86ed-915ecc710d3f | 3 | private void allocateQueueGridlet()
{
// if there are many Gridlets in the QUEUE, then allocate a
// PE to the first Gridlet in the list since it follows FCFS
// (First Come First Serve) approach. Then removes the Gridlet from
// the Queue list
if (gridletQueueList_.size() > ... |
e227cc4e-4ffb-45e4-b106-39e4402e4f73 | 6 | public String genFindOrb() {
String nextLine;
URL url;
URLConnection urlConn;
InputStreamReader inStream;
BufferedReader buff;
this.observations = "";
try {
for (NEOCP neocp : neocpData) {
url = new URL(
"http://... |
37509300-d768-4b95-8d31-dafabf9a1f70 | 7 | private void expParamChanged() {
if (m_Exp == null) return;
if (m_ExperimentTypeCBox.getSelectedItem() == TYPE_CROSSVALIDATION_TEXT) {
try {
m_numFolds = Integer.parseInt(m_ExperimentParameterTField.getText());
} catch (NumberFormatException e) {
return;
}
} else {
try {
m_train... |
b4a15e8b-3c67-489a-97a1-12f948768acf | 7 | public void move(int xa, int ya) {
if (xa != 0 && ya != 0) {
move(xa, 0);
move(0, ya);
numSteps--;
return;
}
numSteps++;
if (!hasCollided(xa, ya)) {
if (ya < 0)
movingDir = 0;
if (ya > 0)
... |
e3c116d5-2e7f-4b62-b170-97c15ba47fd4 | 6 | @Override
protected void handleProtocol() throws Exception {
handleLoop:
while(!aborted() && !isProtocolCompleted()) {
int timeout = getTimeout();
IPacket packet = socket.waitForPacket(timeout);
if(aborted()) {
return;
}
if(packet == null) {
int newTimeout = getTimeout();
... |
cb3992d6-9713-487c-9471-b63b332e5b4a | 3 | public synchronized void actualiza(long tiempoTranscurrido){
if (cuadros.size() > 1){
tiempoDeAnimacion += tiempoTranscurrido;
if (tiempoDeAnimacion >= duracionTotal){
tiempoDeAnimacion = tiempoDeAnimacion % duracionTotal;
indiceCuadroActual = 0;
}
while (tiempoDeAnimacion > getCuadro(ind... |
75827ebd-40bc-46eb-b96b-c3fad2d67c18 | 8 | private static void FFT(){
if (numPoints == 1) return;
final double pi = Math.PI;
final int numStages = (int)(Math.log(numPoints) / Math.log(2));
int halfNumPoints = numPoints >> 1;
int j = halfNumPoints;
// FFT time domain decomposition carried out by ... |
763ccd86-24f6-4f11-afe5-764e449d529e | 3 | public void solve()
{
solveStart = System.currentTimeMillis();
// The current state of the solver.
SolverState state = new SolverState();
// Clear solutions
solutions = new ArrayList<State<M>>();
// Clear initial state
initial.setParent( null );
initial.setDepth( 0 );
// Add the initial state... |
20cf203f-7b12-41ce-aa7c-58fa2e926794 | 2 | @Override
public int compareTo(Node otherNode) {
float thisTotalDistanceFromGoal = heuristicDistanceFromGoal + distanceFromStart;
float otherTotalDistanceFromGoal = otherNode.getHeuristicDistanceFromGoal() + otherNode.getDistanceFromStart();
if (thisTotalDistanceFromGoal < otherTotalDistanceFromGoal)
return ... |
d55bf27a-c230-4941-9a2e-043632cd845a | 2 | private boolean isStart(char c) {
return c == '(' || c == '[' || c == '{';
} |
5e4fcd2b-24b9-4d25-804b-d25e3b84a846 | 0 | public PacketFactory(String ip, int port) {
this.ip = ip;
this.port = port;
} |
3cb0461f-05a4-4226-b464-4db1979a2a72 | 2 | private static boolean handleBishopMove(Board b, ArrayList<Move> moves, Position p, Position currentPosition, int opponentColor) {
if (b.spaceHasOpponent(currentPosition, opponentColor)) {
moves.add(new Move(p, currentPosition));
return false;
} else if (b.spaceIsEmpty(currentPosition)) {
moves.add(new Mov... |
36873ac1-8e59-467f-84c0-f76dcd875abe | 3 | public BufferedImage[] loadStripImageArray(String fnm, int number)
/*
* Extract the individual images from the strip image file, <fnm>. We assume
* the images are stored in a single row, and that there are <number> of
* them. The images are returned as an array of BufferedImages
*/
{
if (number <= 0) {
S... |
27d61cc1-945e-41db-9c63-9728a03e3329 | 6 | private void superPlacing(List <Segment> prior) {
final Tile at = origin() ;
super.doPlace(at, at) ;
final Tile o = origin() ;
final World world = o.world ;
for (int i : N_ADJACENT) {
final Tile n = world.tileAt(o.x + (N_X[i] * 2), o.y + (N_Y[i] * 2)) ;
if (n == null) continue ;
... |
e5801349-1587-4e9d-acd8-47234defb553 | 5 | public List<String> getStringList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<String>(0);
}
List<String> result = new ArrayList<String>();
for (Object object : list) {
if ((object instanceof String) || (isPrimit... |
ab18ab75-169a-4cdd-80db-c676c6960b27 | 4 | @EventHandler
private void hit(ProjectileHitEvent evt) {
if (evt.getEntity() instanceof Arrow && ids.contains(evt.getEntity().getEntityId())) {
ids.remove(evt.getEntity().getEntityId());
Location l = evt.getEntity().getLocation();
try {
SpellCraft.fep.playFirework(l.getWorld(), l,
FireworkEffect.b... |
296521c0-aeb5-47c6-8ea4-a043c7a5db98 | 3 | private void InstanceComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InstanceComboBoxActionPerformed
try {
if (InstanceComboBox.getSelectedItem().toString().equals("<None>")) {
//Display 'no pack selected' content
loadPaneContentFromResource... |
4cbf6dae-87e7-4c2e-a021-2e50104a6567 | 2 | public static <T extends DC> Similarity getPhiSim(Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>> done)
{ if(done!=null)
{ if(done.getNext()!=null)
{ return new Similarity(done.getFst().fst().fst().delta(done.getFst().snd().fst()).simi().getValue()+(getPhiSim(done.getNext()).getValue()));
}
e... |
9904d187-b2b5-467a-a08c-2c72edc527b3 | 1 | public Options() {
pane = this.getContentPane();
pane.setLayout(null);
this.setTitle(TITLE);
this.setResizable(false);
this.setSize(WIDTH, HEIGHT);
this.setLocationRelativeTo(MainFrame.getThis());
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.setModal(true);
JLabel
them... |
5ac96fe9-30f2-4a14-b33d-cedd23382cf0 | 0 | public void destroy() {
textArea = null;
} |
24be0744-1a1a-409f-b39e-9ae55ddb1e56 | 3 | public void buildBuilding(Building b, int x, int y) {
if (x >= 0 && y >= 0) {
// check player's gold!
if (buildings[x][y] == null) {
buildings[x][y] = b;
}
} else {
throw new IllegalArgumentException("Field position must be positive");
}
} |
5549def1-f868-46b6-ab52-b52b36b9030d | 5 | public void testEmptyClass () {
MethodAccess access = MethodAccess.get(EmptyClass.class);
try {
access.getIndex("name");
fail();
} catch (IllegalArgumentException expected) {
// expected.printStackTrace();
}
try {
access.getIndex("name", String.class);
fail();
} catch (IllegalArgumentExceptio... |
f073a595-8b70-4c57-8434-7a655e51b211 | 7 | @SuppressWarnings("deprecation")
private void printStackTraceSync(Throwable t, boolean expected)
{
BukkitScheduler bs = plugin.getServer().getScheduler();
try
{
String prefix = "[AutoUpdate] ";
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
String[... |
0db60b76-c4c6-42f5-943f-e28705fae642 | 1 | public static int getPortFileTransfer(String inString)
throws JDOMException, IOException, TagFormatException {
SAXBuilder mSAXBuilder = new SAXBuilder();
Document mDocument = mSAXBuilder.build(new StringReader(inString));
Element rootNode = mDocument.getRootElement();
String protType = rootNode.getName();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.