method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c5354ed5-e808-406d-ad6e-0559fba802e3 | 1 | @Override
public boolean matches(String inputExt, String outputExt) {
return StringUtils.equalsIgnoreCase(inputExt, "xls") && StringUtils.endsWithIgnoreCase(outputExt, "properties");
} |
e17fab94-142a-460f-b8fd-54ad9c15e54c | 7 | public Map getRecordByID(String table, String primaryKeyField, Object keyValue, boolean closeConnection)
throws SQLException, Exception
{
Statement stmt = null;
ResultSet rs = null;
ResultSetMetaData metaData = null;
final Map record=new HashMap();
// do this in an excpetion handler so that we can depend o... |
5a2178a8-7097-4ae4-b34b-df488ffd413b | 2 | @Override
public void run()
{
while(run){
System.out.println(
String.format("[monitor] [%d/%d] Active: %d, Completed: %d, Task: %d, isShutdown: %s, isTerminated: %s",
this.executor.getPoolSize(),
this.executor.getCorePoo... |
3d6e2b35-8667-4ce8-b757-085b6eb831e6 | 9 | public void analyzeLine (String instr) {
//clear the map for new input string
tf_idf_map.clear();
core_words.removeAllElements();
non_core_words.removeAllElements();
System.out.println("analyzing...");
long start = System.currentTimeMillis();
//tokenization
instr = getTokenized(instr);
//regex
... |
c7cd082f-a2c6-4eba-b6d8-e7105756e33f | 1 | private void init() {
for (int i = 0; i < CAPACITY; i++) {
arr[i] = null;
}
topPtr = CAPACITY;
} |
d3c0b20c-d90a-47e9-b095-0a3fa8ad9b63 | 3 | private boolean startAlgorithm () {
addToOpenedCells(startCell);
while (true) {
int selectedCellIndex = getNextCellIndex();
Point selectedCell = openedCells.get(selectedCellIndex);
removeFromOpenedCells(selectedCellIndex);
addToClosedCells(selectedCell);
... |
19f39987-3597-4702-b7cd-490192b79472 | 5 | @Override
public void add(String word) {
// char[] lWord = word.toLowerCase().toCharArray();
if (this.root == null) {
this.root = new WordNode();
this.nodeCount++;
}
WordNode currentNode = root;
// for (char c : lWord) {
// boolean nodeAdd = c... |
72be2b20-c0aa-4148-b17b-a847ed2f055c | 1 | public void removeConstructor(CtConstructor m) throws NotFoundException {
checkModify();
MethodInfo mi = m.getMethodInfo2();
ClassFile cf = getClassFile2();
if (cf.getMethods().remove(mi)) {
getMembers().remove(m);
gcConstPool = true;
}
else
... |
97d1f8c9-8563-48c0-8721-4c3404cddebf | 1 | private void setAttr(Attributes attr) {
if (attr.getIndex("nome") >= 0) {
this.nome = attr.getValue("nome");
} else {
System.out.println("tabela: falta o atributo 'nome'");
}
} |
ba70f99a-2792-4eb0-b6ee-a7c1b4e1ebda | 7 | @Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
ConnectionEvent that = (ConnectionEven... |
328f7ba8-ffa5-4b10-8c26-e9ab2f544d0f | 8 | public void setNspgStats(IntVO gap) {
int v=gap.val();
switch (v) {
case 0:
//gap 0, 1
nspg0++;
break;
case 1:
//gap 0, 1
nspg1++;
break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
//gap 2,3,4,5,6,7
nspg2++;
break;
default:
//gap 2,3,4,5,6,7
nspg3++;
break;... |
f3f3cf77-6854-45ec-9671-d985f263819b | 0 | public static void main(String[] args) {
System.out.println(getLongValue("queryTime"));
} |
7efe5963-867d-4b6c-be95-34a1da60afb0 | 7 | public boolean getInput() {
while(Keyboard.next()) {
if(Keyboard.getEventKeyState()) {
onKeyDown(Keyboard.getEventKey());
} else {
onKeyUp(Keyboard.getEventKey());
}
}
// mouse input
//float mDX = Mouse.getDX() * 2.5f; // mouse sensitivity 2.5, t... |
99b636f0-ee72-441b-a176-65f52911d483 | 5 | public void wdgmsg(Widget sender, String msg, Object... args) {
if(sender == y) {
ui.sess.close();
} else if(sender == n) {
ui.destroy(this);
} else if(sender == this) {
if(msg == "close")
ui.destroy(this);
if(msg == "activate")
ui.sess.close();
} else {
super.wdgmsg(sender, msg, args);... |
5473a585-7455-4725-a361-a28155387bdb | 2 | public Scope getScope(Object obj, int scopeType) {
int count = scopes.size();
for (int ptr = count; ptr-- > 0;) {
Scope scope = (Scope) scopes.elementAt(ptr);
if (scope.isScopeOf(obj, scopeType))
return scope;
}
return null;
} |
5c365154-6fcb-479d-98c9-73db1fd18ac8 | 2 | private static String getVal(String[] lines, String field)
{
for (String line : lines)
{
String[] part = line.split(":", 0);
if (part[0].equalsIgnoreCase(field))
return part[1];
}
return "No value set for "+field;
} |
4bc798e3-595a-40ec-b1f9-53965875edee | 0 | public static GeneralNameValueConfig getVorbisConfigByField(String field) {
return Registry.getConfigByField(field,vorbisFields);
} |
8056506a-5ca8-4199-8010-48ffcbcab8ec | 1 | public void addButton(BasicAction action)
{
JButton button = new JButton(action) {
/**
*
*/
private static final long serialVersionUID = -8635984393664103035L;
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
... |
e869f553-be2f-4ca3-88e8-ee8352a17007 | 4 | public void deleteMarkedEntities(){
for(Mob m:mobsToDelete) mobs.remove(m);
for(Projectile p:projectilesToDelete) projectiles.remove(p);
for(Explosion e:explosionsToDelete) explosions.remove(e);
for(Particle p:particlesToDelete){
particles.remove(p);
bgParticles.remove(p);
}
mobsToDelete.clear();
pr... |
58125538-7c0a-4c93-8656-a6fb6f2954cb | 2 | public static void seq_ief(CompList<?> t) throws Exception {
for (Compound c : t) {
ComponentAccess.callAnnotated(c, Initialize.class, true);
c.execute();
ComponentAccess.callAnnotated(c, Finalize.class, true);
}
} |
2d4c9522-23d3-4e48-87d1-2cc42fe318b6 | 7 | public void drawCard(PlayerClass pPlayer){
pPlayer.cout.printFerryClass(dobbelt);
if(pPlayer.getPlayerPos() == 37 || pPlayer.getPlayerPos() == 3){
pPlayer.setPlayerPos(6);
}
else if(pPlayer.getPlayerPos() == 8){
pPlayer.setPlayerPos(16);
}
else if(pPlayer.getPlayerPos() == 18 || pPlayer.getPlayerPo... |
3e9ae05a-5a35-4228-8d93-2199392e5cff | 4 | @Override
public boolean matches(List<Character> currentMatching) {
if(currentMatching.size() > 1)
return false;
if(currentMatching.get(0).charValue() == '\n' ||
currentMatching.get(0).charValue() == '\r' ||
currentMatching.get(0).charValue() == '... |
a67b6e50-61c8-49b0-bd3b-1793ff4f4576 | 7 | public void enableBottomBar(boolean b) {
if (moviePanel != null)
remove(moviePanel);
if (runPanel != null)
remove(runPanel);
if (b) {
if (model.getRecorderDisabled()) {
if (runPanel == null)
createRunPanel();
add(runPanel, BorderLayout.SOUTH);
}
else {
add(moviePanel, BorderLayout.... |
de88183c-8f27-4d25-b207-f76a7aab59f6 | 8 | private void renderScene(Scene scene)
{
long t = System.currentTimeMillis();
// HINT - always the getGraphics()-Method is called,
// the background buffer will be cleared automatically
Graphics2D g = canvas.getGraphics();
// enable anti aliasing
g.ad... |
0dd8d496-9da9-41b4-b85c-fc0839300116 | 1 | public void delete() throws SQLException {
Reminder.deleteByAppt(this.getId());
if (this.isJoint)
{
this.deleteArray("aWaitingId");
this.deleteArray("aRejectedId");
this.deleteArray("aAcceptedId");
}
super.delete();
} |
12507be1-ad8a-4466-9bf6-f9726a2b03ac | 4 | public static void main (String[] args) throws IOException, InterruptedException {
final int port = 7000;
final int writeBufferSize = 16384;
final int objectBufferSize = 2048;
final AtomicBoolean received = new AtomicBoolean();
// Creating server
final Server server = new Server(writeBufferSize, objectBuff... |
398ea0ee-f510-40e9-bb7a-22439f6b5dfe | 9 | static public ParseException generateParseException() {
jj_expentries.removeAllElements();
boolean[] la1tokens = new boolean[17];
for (int i = 0; i < 17; i++) {
la1tokens[i] = false;
}
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 2; i++... |
bbc8558a-1577-4797-b5d2-f3749c4c921a | 6 | public void valueChanged(TreeSelectionEvent e)
{
JTree tree = (JTree) e.getSource();
TreePath treepath = tree.getSelectionPath();
if (null == treepath) return;
NamedDataSectionable parentDataSectionable = null;
if (treepath.getPathCount()... |
d29c6a18-c8c1-424c-9972-60581fc71517 | 3 | @Override
public BufferedImage getImage(){
if(!running){
return images.get(0);
}else{
long curTime = (System.currentTimeMillis() - startTime) ;
for(int i=0; i<times.size(); i++){
if(curTime - times.get(i) <= 0){
return images.get(i);
}else{
curTime -= times.get(i);
}
}
}
retur... |
f23286a5-eb2d-4ec6-ba1b-f6773e790b52 | 5 | public void actionPerformed(ActionEvent e) {
String nick = GUIMain.userList.getSelectedValue().toString();
if (nick.startsWith("@")) {
nick = nick.replace("@", "");
} else if (nick.startsWith("$")) {
nick = nick.replace("$",... |
4d7ce855-1b34-420f-81a3-9614a47a4a7d | 3 | private void songEditMenu() {
System.out.println(" Edit Menu ");
System.out.println("1. |Create a song|");
System.out.println("2. |Delete a song|");
System.out.println("0. |Return|");
int option;
option = new Scanner(System.in).nextInt();
switch (option) {
... |
4fc1960e-beb8-4b19-84fc-727ce9de0ad1 | 1 | public Timer() {
huidigeTijd = BEGIN_TIJD;
timer = new javax.swing.Timer(10, new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Date metingEindTijd = new Date();
long verschil = (metingEindTijd.getTime() - metingBeginTijd.getTime()) / 1000;
if (verschil >= 1) {
h... |
6a091418-481a-4073-9cea-eeb0a2bc45b8 | 2 | public static String moveBlank(String string)
{
if (null == string || blankPattern.matcher(string).matches())
{
return null;
}
return string.replaceAll("^[\\s ]*|[\\s ]*$", "").trim();
} |
2386213b-4356-4494-987a-85e064eb0898 | 6 | public String execute() throws Exception {
User user = userService.getCurrentUser();
if (user == null)
return "login";
job = this.userService.userJob(user.getUid(), Integer.parseInt(cid));
System.out.println("job:" + job);
Map<String, Object> details = new HashMap<String, Object>();
if (job.e... |
b4bcbaa9-bac5-4495-b898-4c13fdb1b41a | 8 | public void buttonClick(ClickEvent event) {
final Button source = event.getButton();
String initialText = "";
PersonContainer pc = as.getDataSource();
SearchFilter sf = as.getSf();
if(source==generate){
if (sf != null) {
pc.removeAllContainerFilters();
pc.addContainerFilter(sf.getPropertyId(), sf.g... |
6b3b3602-5aa9-4d2d-9bad-5ee00a9f0a79 | 5 | public static String expectedLocalPath(Case CASE) {
String result = null;
switch (CASE) {
case CASE_1:
result = "0000";
break;
case CASE_2_3:
result = "000";
break;
case CASE_4:
result = "... |
6ef6ba3f-1951-4a1e-bf9e-4e9bd0b437da | 6 | private void assertBoardsSize(int size8, Chessboard chessboard, int expectedBoardsSize) {
assertThat("all elements are not present on each board",
chessboard.placeFiguresOnEmptyBoard()
.parallel()
.filter(board -> !board.contains(KING.getFigureAsSt... |
4b502b9e-c367-429f-bdaa-59f19647a4e2 | 1 | public static void main(String args[]) {
String filePath = "./b/c.txt";
File file = new File(filePath);
try {
boolean created = createFile(file);
} catch (IOException e) {
e.printStackTrace();
}
} |
55f07f88-2b1e-4dfc-b7a8-3b9df58ca210 | 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
... |
7ae10268-f78f-420e-9612-7c8ecc4efdc4 | 0 | public boolean isMovingDown() {
return isMovingDown;
} |
f55d7f6b-12b6-429f-b03e-5fe62295b2f3 | 3 | @Override
public void run() {
try {
//Keep a socket open to listen to all the UDP trafic that is destined for this port
socket = new DatagramSocket(port, InetAddress.getByName("0.0.0.0"));
socket.setBroadcast(true);
while (true) {
System.out.pr... |
13993df5-2d55-4a9f-b220-8c828363d0d4 | 3 | private int getIntFromElement(Element ele, SPSelector sel) {
Elements els = subSelect(ele, sel.getSelector());
if(els.size() == 0) {
return -1;
}
String text = els.get(0).outerHtml();
Modifier mod = sel.getModifier();
if(mod != null) {
text = mod.getResult(text);
}
int res = -1;
try {
... |
349b5b9f-703c-4c58-a3f1-cc926625ff66 | 2 | public void testPropertySetSecond() {
TimeOfDay test = new TimeOfDay(10, 20, 30, 40);
TimeOfDay copy = test.secondOfMinute().setCopy(12);
check(test, 10, 20, 30, 40);
check(copy, 10, 20, 12, 40);
try {
test.secondOfMinute().setCopy(60);
fail();
... |
34e5cabc-7e77-4253-ab94-a2d33356d844 | 2 | public void setTime(int hhmmss) {
if (!hiding && clockmode != MODE_TSET) {
clocktime = hhmmss;
}
clkcanvas.repaint();
} |
686ea202-9330-477d-b165-d7464b3fc5f7 | 1 | public ArrayList<Integer> ShuffleDeck(ArrayList<Integer> shuffledDeck){
for (int i=0;i<numOfCards;i++)
{
shuffledDeck.add(i);//populates arraylist with 0-51
//System.out.println(shuffledDeck.size()); Testing statement
}
shuffledDeck = Shuffle(shuffledDeck); //calls another shuffling method
return ... |
e190c5ea-a4d2-4c8e-8f82-020d91be525d | 1 | private boolean isMediumPriorityOperator(String o) {
return o.equals(OPERATION_MULTIPLY) || o.equals(OPERATION_DIVISION);
} |
f8d15c7c-8006-4d3a-841c-93a8220d757d | 8 | String sendSSAPMsg(String msg)
{ String ret="";
int err=0;
deb_print("KpCore:message to send:_"+msg.replace("\n", "")+"_");
deb_print("KpCore:SSAP:Open connection...");
if((err = openConnect()) <0) {err_print("KpCore:SSAP:ERROR:"+ERR_MSG[(err*-1)] ); KP_ERROR_ID=err; return null;}
else {deb_print("KpCore:SSA... |
c818471f-cbf2-4132-a59c-fed4bfad59ee | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
return false;
final List<DeadBody> DBs=CMLib.utensils().getDeadBodies(target);
for(i... |
0829570e-5092-4c1d-b034-dc0e540418e8 | 2 | @RequestMapping(value = {"/MovimientoBancario/{idMovimientoBancario}"}, method = RequestMethod.PUT)
public void update(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idMovimientoBancario") int idMovimientoBancario, @RequestBody String json) {
try {
Object... |
53f058a3-7b17-46af-81af-a22f4c1c69ae | 3 | public boolean replace(int index, T newV) {
if (index < 0 || index >= size)
return false;
T oldV = heap.get(index).element();
heap.get(index).setElement(newV);
if (comp.compare(oldV, newV) < 0)
trickleUp(index);
else
trickleDown(index);
return true;
} |
d255ba75-447e-4d16-9679-9341f31c1fd6 | 9 | public boolean spacesAvailable(Vehicle v) {
// Test for Cars.
if (v instanceof Car) {
// Test for small cars.
if (((Car) v).isSmall()) {
if (smallCarsParked.size() < maxSmallCarSpaces) {
return true;
} else if (carsParked.size() < maxCarSpaces) {
return true;
}
}
// Test for norma... |
a931f22a-3836-4725-b685-444f923cf46c | 4 | public int sqrt(int x) {
if (x == 0)
return 0;
if (x == 1)
return 1;
double value = x;
int intvalue = x;
while (intvalue > 46340 || intvalue * intvalue > x) {
value = (value * value + x) / (2 * value);
... |
46256e63-03aa-4dac-ae24-305327cbc8cb | 6 | private void completeAllEffects() {
if(pendingEffects.isEmpty())
return;
Collection<ForkJoinTask> receipts = new LinkedList<>();
//submit all actions. For each agent they happen in sequence
for(Map.Entry<Agent,Collection<Effect>> effects : pendingEffects.asMap().entrySet()... |
14104512-0056-4884-b031-73f4ff1c94b3 | 2 | public void pickup(Item i, Player p){
if(id == 0.0f){
return;
}
scheduleRespawn();
ClassType ct = PluginData.getPlayerData(p).getPlayerClass();
if(ct == null) return;
p.setHealth(ct.getMaxHealth());
i.setFireTicks(999);
} |
72f4cdf9-036f-45e5-a740-cfe821bfb599 | 9 | @Override
public long read(T target) throws IOException {
long totalRead = 0;
while (target.remainingSpace() > 0) {
if (buffer.remainingData() > 0)
totalRead += buffer.read(target);
else if (parentMightBeEmpty && totalRead > 0)
break;
else {
long read = parent.read(buffer);
if (buffer.r... |
d59ae7ed-f814-4985-9c86-23e9d9a112a6 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Predicate predicate = (Predicate) obj;
if (!getArgs().equals(predicate.getArgs())) return false;
if (!getName().equals(predicate.getNam... |
9ef8b7ec-61cf-4179-84a4-4c68d2feed88 | 0 | public void DisPlayPic(String _title, int _x, int _y)
{
JFrame frame = new JFrame();
frame.setTitle(_title);
frame.setLocation(_x, _y);
JLabel label = new JLabel(new ImageIcon(img));
frame.getContentPane().add(label, BorderLayout.CENTER);
frame.pack();
frame.s... |
47d0dfc5-3a52-4e46-92c2-e85e8ee85a12 | 6 | @Override
public void send(String msg, User user) {
for (User u : users) {
if (!u.equals(user) && user instanceof PrivilegedUser && u instanceof PrivilegedUser) { // security workaround
((PrivilegedUser) u).handleSecret(msg);
} else if (!u.equals(user) && !(user insta... |
fbac4a85-59bb-4323-aae3-5cbb37fef698 | 3 | public Screen() {
super();
paused = false;
screen = new Square[22][10];
for (int row = 0; row < 20; ++row) {
for (int col = 0; col < 10; ++col) {
screen[row][col] = new Square(true, Color.BLUE);
}
}
for(int i = 0; i < 10; ++i){
screen[20][i] = new Square(false, Color.BLACK);
screen[21][i] = ... |
e78123bc-d8e2-4bfb-920d-0c86c065e523 | 3 | private String createEventMessage(long time, String eventName, List<MMTFieldValueHeader> fieldValueElements) {
String retval = "";
if(this.payloadFormat.equals(this.RFC2822)){
retval = createRequestLine(time, eventName);
for (MMTFieldValueHeader fvh : fieldValueElements) {
... |
9bebf586-d320-48d9-a189-1ffdbba8b499 | 6 | public static Keyword invertUpdateMode(Keyword updatemode) {
if (updatemode == Logic.KWD_ASSERT_TRUE) {
return (Logic.KWD_ASSERT_FALSE);
}
else if (updatemode == Logic.KWD_PRESUME_TRUE) {
return (Logic.KWD_PRESUME_FALSE);
}
else if (updatemode == Logic.KWD_RETRACT_TRUE) {
return (L... |
d6f69bf5-349e-4c18-bc21-0a4401b00664 | 2 | @Override
public int compareTo(AstronomicalObject o) {
return (this.mass < o.mass) ? -1 : (this.mass > o.mass) ? 1 : 0;
} |
06fd0f13-a1af-4149-b858-ece3e71dbc95 | 4 | @Override
public void mouseClicked(MouseEvent e) {
p = e.getPoint();
if(hideButton.contains(p) && hide == false){
hide = true;
}else if(hideButton.contains(p) && hide == true){
hide = false;
}
} |
f51da46c-fc7b-4696-96f9-1ea356455a76 | 5 | public void run()
{
while (true)
{
if (server.quit)
return;
try
{
//System.out.println("Reading...");
PlayerCommand pc = (PlayerCommand) ois.readObject();
if (pc.command == PlayerCommand.MESSAGE)
{
String message = pc.message;
if (p... |
09d685ce-3b6e-4587-8013-3e44b86b555d | 4 | * @return the percent as a float
*/
public float getUniquePercentage( short version )
{
int totalLen = 0;
int uniqueLen = 0;
if ( numVersions()==1 )
return 0.0f;
else
{
for ( int i=0;i<pairs.size();i++ )
{
Pair p = pairs.get( i );
if ( p.versions.nextSetBit(version)==version )
{
... |
2b98e1ad-5eae-4b84-9e9a-f42b499f05a6 | 7 | protected static Ptg calcLarge( Ptg[] operands ) throws CalculationException
{
if( operands.length != 2 )
{
return new PtgErr( PtgErr.ERROR_VALUE );
}
Ptg rng = operands[0];
Ptg[] array = PtgCalculator.getAllComponents( rng );
if( array.length == 0 )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
i... |
fbc17dd9-0403-4551-a1fe-4bc3f2c1fb7b | 0 | public boolean isAlive() {
return this.health <=0 ;
} |
56339486-f9e9-428e-bd9b-fb12dfc04ec0 | 3 | private String CharToPN(char c)
{
// binary format of ascii of char c
String binaryStringShort = Integer.toBinaryString((int)c);
// fill the 0s to get 8 bits
StringBuffer paddingBuffer = new StringBuffer();
while(paddingBuffer.length() < 8 - binaryStringShort.length())
{
paddingBuffer.append("0");
... |
e97659d5-2760-4313-8620-c4bea40be0eb | 7 | public ModularityDetection(LinkedList<KeyWord> partKeywords, double[][] correlations, float startDay, float endDay, int window_, String nwtFolder_) throws Exception{
this.startDay = startDay;
this.endDay = endDay;
window = window_;
nwtFolder = nwtFolder_;
// instantiate structure
NodeFactory<Node> node... |
f2339511-76f3-429c-827b-4ac61e8e7bb7 | 5 | private static ArrayList<Branch> loadBranch(ArrayList<String> texts)
{
ArrayList<String> strings = new ArrayList<String>();
ArrayList<Branch> branches = new ArrayList<Branch>();
int startLine = 0;
for(int lineNumber = 0;lineNumber < texts.size();lineNumber++){
String aString = texts.get(lineNumber);
if(... |
8c49b627-836a-4bef-a71f-515902752146 | 2 | private void commenceTrade()
{
try
{
if(host)
{
Pokemon temp=new Pokemon(Pokemon.Species.BULBASAUR);
//Strings
temp.species=Pokemon.Species.valueOf(inTacular.readUTF());
outTacular.writeUTF(""+JokemonDriver.partyPokemon[JokemonDriver.offerIndex].species);
o... |
2a36bbad-e718-453a-a498-2f283a73cc86 | 9 | public void moveEntity(Entity e, int dx, int dy)
{
//move entity
//attempt to animate the movement
//if cursor...
if (e==input.entity)
{
//if within the map boundaries (0,0) to (map[0].length, map.length)...
if (! (e.x+dx < 0 || e.y+dy < 0 || e.x+dx >= map[0].length || e.y+dy >= map.length))
{
... |
f1e27a79-e100-4e56-9151-f0b5630d2e00 | 2 | @Override
public void run() {
while (true) {
try {
// take next action and handle it
DoItLater action = actionQueue.take();
action.doIt();
} catch (InterruptedException e) {
}
}
} |
f109a37a-e56c-42a8-abbd-93103845016c | 3 | public int available()
throws IOException {
if( this.isClosed )
return 0;
if( this.currentReplacementBuffer != null )
return this.currentReplacementBuffer.available();
if( this.multiIn.eoiReached() )
return 0;
else
return 1;
} |
553bccef-e228-405b-a42a-22ca16b9a61d | 2 | public int GetDeviceID(String deviceName, int userID) throws Exception {
String s = "-8";
int id = -2;
try {
// This will load the MySQL driver, each DB has its own driver
Class.forName("com.mysql.jdbc.Driver");
// Setup the connection with the DB
_connect = DriverManager.getConnection(_url, _user, _p... |
f572d33e-8d3b-410a-9abd-cf7bebaa63e7 | 2 | private void doViewAllXinWen(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pageNum = StringUtil.toString(request.getParameter("pageNum"));
if("".equals(pageNum)) {
pageNum = "1";
}
try {
Pager<XinWen> page... |
edd60d70-21ba-49b0-b80c-7ca67d1494ed | 3 | public void setMatrix(int rows, int columns){
if ((rows<1)||(columns<1)) {
System.out.println("number of rows and columns must be positive integer");
}
this.rows=rows;
this.columns=columns;
elements=new double[rows][columns];
if (columns==rows){
de... |
0acbb860-4c69-4a70-9b7e-b2544b90918d | 6 | public void criarEncarregado(Usuario Encarregado, Usuario userLogado) throws SQLException, excecaoEncarregadoExistente, excecaoControleAcesso {
UsuarioDAO userDAO = new UsuarioDAO();
DepartamentoDAO DepDAO = new DepartamentoDAO();
Usuario EncarregadoExistente = userDAO.selectEncarregado(Encarre... |
ed87e08c-4e1a-407f-ad46-98583f3fd526 | 8 | public ControlsFrame(String title, final CropScreen attatched) {
super(title);
this.attatched = attatched;
ActionListener langChanged = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
ControlsFrame.this.attatched.setLanguage(((JRadioButton)arg0.getSource()).get... |
8a598cdb-ff32-4f66-941e-543ff2899edb | 5 | public void sortingPricesForRefrigirators() {
getDriver().findElement(By.xpath(SortingLine.SORT_PRICE)).click();
List<Item> data = new ArrayList<Item>();
int pageCount = 0;
while (true && pageCount++ < 3) {
data.addAll(grabItems());
if (hasNext()) {
next();
} else {
break;
}
}
System.ou... |
dd437b15-b5a3-40ea-bad0-7bfa07e6b1c4 | 6 | public void RestoreOriginalPHPFile(DatabaseAccess JavaDBAccess, int TARGET_PHP_FILES_ID) {
PreparedStatement ps = null;
String PHPFileText; //The text of the PHP file where we want to inject the vulnerabilities
String PATH = "";
Connection conn = null;
try {
if ((co... |
6f803a1d-5e97-426a-a540-be5f1e4fbcc6 | 3 | private Player getPlayer(String name){
if(name == null) return null;
for(Player p : allPlayers){
if(p.getName().equals(name)){
return p;
}
}
return null;
} |
cef706c6-c2d4-4481-baf0-c68edb86802a | 3 | private Boolean checkForValidFile(File dataFile){
final JPanel frame = new JPanel();
if(!checkForCommas(dataFile)){
JOptionPane.showMessageDialog(frame,
"File not compatible (contains no commas)",
"File error",
JOptionPane.ERROR_MESSAG... |
243a40c4-6fdf-441e-a642-963b9040959f | 0 | public CommandParams addParam(Object value) {
params.add(value);
return this;
} |
899ed385-f200-4058-9cea-8c9cf29cb323 | 3 | public void startFadeOut() {
if(transitionTime > 0.0f && getCurrentSong() != getNextSong(false) && !stopping) {
EIError.debugMsg("startFadeOut");
hitFadeOutNext = true;
startNextSong();
}
} |
e3f7a4fb-b2ca-47d1-b9d0-f6a128d5f9df | 1 | public void processSaveAndExit()
{
// write to the RefereesOut.txt file
writeRefereesOutFile();
// write to the MatchAllocs.txt file
if (matchList != null)
writeMatchAllocationsFile(matchList);
System.exit(0);
} |
18d11db7-5285-4a0e-9e3d-5fa19fdcfa25 | 6 | public CobolLine getCobolLine(final String sourceLine, final int lineNumber) {
final Matcher m = sourceFormat.matcher(sourceLine);
final boolean fixedLine = (m.matches() && sourceLine.startsWith("$")) ? false : fixedFormat;
final int[] tabs = (fixedLine) ? CobolLineFixed.getTabs()... |
d13f5af4-4565-48fd-ae29-2dd556ac343a | 0 | public double getStrength() {
return strength;
} |
c524b3ff-81b7-41b4-a42c-589bb2de6406 | 6 | public ResultSet BuscarFuncionarios(String Departamento) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_SELEC... |
beda2273-86ac-4977-a851-73f8c978039a | 4 | public void handleError(Client source, Throwable t) {
if (networkClient != null && !networkClient.isConnected()) {
System.err.println("CLIENT: network error. Connection is closed");
} else {
System.err.println("NETWORK ERROR: " + t.getMessage());
if (t instanceof Co... |
d188830f-849b-4c04-af24-998013314a31 | 1 | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... |
0a899001-e697-4f53-9a54-3612061a54ea | 4 | private char[][] build_sub_block(String setting, char[] key_alphabet, int[] key_block)
{
int set_len=setting.length();
char[][] result=new char[set_len+1][26];
char[] pt=read_pt(key_alphabet,key_block);
for(int i=0;i<26;i++)
{
result[0][i]=pt[i];
}
//create ct: set_len*26
String setting_u=setting.to... |
5339c936-52ea-4463-894d-01e2b671ef50 | 6 | * @return returns true if Thing is clicked, false otherwise.
*/
public boolean checkIfClicked(Point mousePos){
//Transparent color seems to give two different results depending on which program exported them
int transparentColorID1 = 16777215;
int transparentColorID2 = 0;
System.out.println(img.getRGB(... |
f96f88b1-73d2-4b3b-8989-1b925b4618f8 | 5 | public boolean equals(Object obj)
{
if (obj == this)
{
return true;
}
if (obj != null && obj instanceof Point)
{
Point other = (Point)obj;
if (other.x == x && other.y == y)
{
return true;
}
}
return false;
} |
6f6969e3-0164-42d3-8184-d86482cdbcc6 | 8 | private boolean r_Step_1c() {
int v_1;
// (, line 51
// [, line 52
ket = cursor;
// or, line 52
lab0: do {
v_1 = limit - cursor;
lab1: do {
... |
d54ab640-b761-4928-9ba9-155835d741bf | 7 | public static void main(String[] args) throws InvalidPositionException,
NoEmptyTreeException, InvalidKeyException,
BoundaryViolationException, EmptyTreeException {
// test binary tree
AdvancedBinaryTree<Integer> tbt = new AdvancedBinaryTree<>(
new Comparator<Integer>() {
@Override
public int c... |
baaf62cb-68c7-4fff-8b04-42abcf61b01a | 2 | private ArrayList rewriteJListToArrayList(JList list) {
ArrayList newList = new ArrayList();
for (int i = 0; i < list.getModel().getSize(); i++) {
if (list.getModel().getElementAt(i) != null)
newList.add(list.getModel().getElementAt(i));
}
return newList;
} |
f29cab4d-b46c-4510-99e4-b07074928757 | 4 | public String getMessage() {
switch (reason) {
case BAD_ARGS:
return "Bad Arguments";
case BAD_TARGET:
return "Bad Target Entity";
case BAD_COMMAND:
return "Bad Command";
case BAD_STRING:
return "Bad String";
default:
return null;
}
} |
1fefc726-f08e-4f81-bb95-bbdad317fcec | 7 | public BufferedImage getBitmap(int id) {
BufferedImage value;
if(!low_memory && bmp_loaded != null && (value = bmp_loaded[id]) != null) {
return value;
} else {
long offset = getBitmapOffset(id);
if(offset == -1)
throw new NXException("NX file does not this canvas.");
lock();
try {
Seek... |
c72cca49-8206-4cc1-8ec5-80a70393ab66 | 7 | private void saveDependencies() throws ConfigurationChangeException {
// Abhängigkeiten nur speichern, wenn mindestens Version 9 des Metamodells vorliegt
if(!_storeDependencies) return;
synchronized(_areasDependencies) {
// Alle Aufrufe in diesem Block können zu Festplattenzugriffen führen. Das kann diese Me... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.