method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
435bdb64-c2b9-4ac5-b292-63e40b2b6665 | 7 | @Override
public void actionPerformed(ActionEvent ev)
{
String auxOpcion = ev.getActionCommand();
Agenda agenda = new Agenda();
switch(auxOpcion)
{
case "Cancelar":
this.dispose();
break;
case "Cre... |
0a1eeee6-2757-4604-b52b-ff48de622372 | 8 | public static Stella_Object accessCheckTypesRecordSlotValue(CheckTypesRecord self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Logic.SYM_LOGIC_PROPOSITION) {
if (setvalueP) {
self.proposition = ((Proposition)(value));
}
else {
value = self.proposition... |
1a84fd53-e5e0-4402-9f75-203a9f963103 | 4 | private int parseArrayLength(String str){
int len;
String digits = "";
int i = 0;
while(i<str.length()-1){
do
i++;
while(str.charAt(i) != '[');
i++;
while (str.charAt(i) !=']'){
digits = digits+str.charAt(i++... |
65527e79-a6a4-4b7c-a2eb-d57c6aecb40e | 3 | public void testForStyle_invalidStrings() {
try {
DateTimeFormat.forStyle("AA");
fail();
} catch (IllegalArgumentException ex) {}
try {
DateTimeFormat.forStyle("--");
fail();
} catch (IllegalArgumentException ex) {}
try {
... |
bcde54b4-d0f6-46a8-9ec9-c4752adcf0cf | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.pas... |
15696866-70ea-4862-a3e6-cc8e2fd14993 | 5 | public static void solve(Maze m)
{
boolean filledDeadEnd = true;
do
{
filledDeadEnd = fillDeadEnd(m);
} while (filledDeadEnd);
for(int i = 0; i < m.width(); i++)
{
for(int j = 0; j < m.height(); j++)
{
if(m.get(i, j) == 0)
m.set(i, j, 3);
else if(m.get(i, j) == 2)
m.set(i, j, ... |
21031649-4336-478e-8147-ca2bdbd7f150 | 1 | public void removeValueChangeListener(ValueChangeListener l) {
if(l == null) {
return;
}
this.valueChangeListener = null;
} |
e61e47a7-c0f6-4dc2-9e37-e713bc271326 | 7 | public static void changeFineBorrow(int memberID, int itemID, String item, int method) {
try {
//*********************************************************************************//
// INSTANCIAMOS UN OBJETO QUE NOS PERMITA ALMACENAR TODA LA INFORMACIÓN DE NUESTRO //
// FICHER... |
e9cc9455-12e9-49c5-a692-b27cd7c1da6f | 1 | public static void send(String msg)
{
for(ClientHandler c : clients)
c.send(msg.toUpperCase());
} |
23e940ae-b1eb-43ea-91ac-9affe16132f6 | 8 | public void createChartAd()
{
setPieChartAd(new PieChartModel());
setHost("root.intt.tn");
setPriority("emerg");
int emerg= getfacilityByHost().size();
if(emerg!=0)
pieChartAd.set("Emergency", emerg);
setPriority("Alert");
int alert= getfacilityByHost().size();
if(alert!=0)
pieChartAd.s... |
7e1c16ee-ebdc-4fc8-a72c-09989df6c9eb | 2 | public void jump(){
if (this.state == Player.STATE_RUNNING || this.state == Player.STATE_STANDING){
this.speedY = -LivingEntity.JUMPFORCE;
this.state = Player.STATE_JUMPING;
}
} |
adce8b67-508c-4825-a9c5-98d63d8542ec | 2 | public static Tile[][] getEmptyWorld(int width, int height) {
Tile[][] tiles = new Tile[width][height];
for(int x = 0; x < tiles.length; x++) {
for(int y = 0; y < tiles[0].length; y++) {
tiles[x][y] = new Tile(new Position(x, y), 0);
}
}
return tiles;
} |
58656d01-aab7-4165-a16e-f5928456a1cc | 7 | private void removeChar(int c) {
for (int i = 0; i < size / 2; i++) {
if (ranges[i * 2] <= c && ranges[i * 2 + 1] >= c) {
if (ranges[i * 2] == c) {
if (ranges[i * 2 + 1] == c) {
for (int j = i * 2 + 2; j < size; j++) { // shift left
ranges[j - 2] = ranges[j];
}
size -= 2;
} e... |
2df4d3da-1f7f-4454-8ada-116892bde15c | 1 | public void writeToFile(int file, String textLine, String t) throws IOException
{
String path;
if(t.equalsIgnoreCase("acc"))
{path = accDir+file+".txt";}
else
{ path = appDir+file+".txt";}
boolean append_to_file = true;
FileWriter write = new FileWriter(path, append_to_file);
PrintWr... |
9610de8f-ed1b-4e89-8858-7f8aa645b77b | 6 | * @param class2
* @return Stella_Class
*/
public static Stella_Class twoArgumentLeastCommonSuperclass(Stella_Class class1, Stella_Class class2) {
if (Stella_Class.subclassOfP(class1, class2)) {
return (class2);
}
if (Stella_Class.subclassOfP(class2, class1)) {
return (class1);
}
... |
de421027-a6b4-447f-ae62-2a3f7fa29548 | 9 | public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... |
e5797ecc-b831-49c9-8d3d-c25d2cc7806f | 8 | final public Iterator <K> iterator() {
final int height = heightFor(root) ;
final Node nodeStack[] = new Node[height + 1] ;
final Side sideStack[] = new Side[height + 1] ;
if (root != null) {
nodeStack[0] = root ;
sideStack[0] = Side.L ;
}
return new Iterator <K> () {
int level... |
2dcea893-b682-4988-813c-0fae796eaa6f | 2 | public void test_add_RP_int_intarray_int() {
int[] values = new int[] {10, 20, 30, 40};
int[] expected = new int[] {10, 20, 30, 40};
BaseDateTimeField field = new MockStandardDateTimeField();
int[] result = field.add(new TimeOfDay(), 2, values, 0);
assertEquals(true, Arrays.equal... |
3744c57a-1fc3-4a69-9034-3f4968944d17 | 3 | private void drawArrow(Graphics g, int x1, int y1, int x2, int y2) {
if (x1 == x2 && y1 == y2) {
} else {
g.drawLine(x1, y1, x2, y2);
double directionCorrection = 1;
if (x2 > x1) {
directionCorrection = -1;
}
double alpha = Math.atan((double) (y2 - y1) / (double) (x2 - x1));
double ... |
b12cf89f-d312-481b-ac1e-370a8f6013ca | 0 | public String getHouseNumber() {
return HouseNumber;
} |
9b98eddf-c1c4-4c9e-9093-fc95a49c92cb | 2 | private void getPixel() {
int i = 0;
for (int y = 0; y < imageHeight; y++) {
for (int x = 0; x < imageWidth; x++) {
pixel[i] = bufferedImage.getRGB(x, y);
i++;
}
}
} |
b38f7861-1548-49ec-b2ed-bd6321cf0a0b | 4 | public void draw(GOut g) {
Widget next;
for (Widget wdg = child; wdg != null; wdg = next) {
next = wdg.next;
if (!wdg.visible || (!ui.root.visible && wdg.isui))
continue;
Coord cc = xlate(wdg.c, true);
wdg.draw(g.reclip(cc, wdg.sz));
}
} |
da8ec62a-0f62-446b-a57d-63a23a43ff12 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VideoMDMetadata other = (VideoMDMetadata) obj;
if (videoMD == null) {
if ... |
1a9ba554-6e13-4504-8b35-44e604935b4e | 0 | protected final void dccReceiveFile(File file, long address, int port, int size) {
throw new RuntimeException("dccReceiveFile is deprecated, please use sendFile");
} |
0c50867e-ed36-4f3d-ac23-6662e0fad196 | 7 | public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 0, 12, 4, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
this.fillWithBlocks(par1World, par3Structur... |
7e8e2c32-9006-488c-ac9e-899398ff2dc9 | 9 | @Override
public void rightThumb(boolean pressed) {
if(enabled) {
if(ses2 != null) {
setFlagsFalse();
if(future != null) {
future.cancel(true);
}
}
if(pressed == true) {
r5Flag = true;
dllProc.dll_keyPressed(container.xgetCurrentPreset().xgetR5AssignedKeyCode());
... |
a9ebe21a-3c83-4b63-98e9-7d76c53d85c4 | 1 | public static void pause() {
// Pause the game to make it look like they are taking turns
try {
Thread.sleep(speed);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} |
4995c081-2e87-4e71-a545-072b3ea80728 | 2 | public double rawAverageCorrelationCoefficientsWithTotals(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.rawMeanRhoWithTotals;
} |
8de6b927-0cb0-4ba7-8ece-3d47af393d6a | 9 | public CellSimProgramReader(File input) throws IOException, ClassNotFoundException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder=null;
Document document=null;
try {
builder = factory.newDocumentBuilder();
document = builder.parse(new FileInputStream... |
83644de8-9517-4470-b131-e7e1db2bdbce | 5 | private int[] get_most_relevant() {
ArrayList<Integer> holder = new ArrayList<Integer>();
int min = (notes.size() < 4 ? notes.size() : 4);
int counter = 0;
sort_notes();
while (holder.size() < min) {
if(notes.size() == counter) break;
int note = notes.get(counter) % 12;
if (!holder.contains(note)) ho... |
21d1be73-7d6f-4ded-a61f-bffb48c23d8f | 2 | public static String getPrefix(IrcUser u)
{
System.out.println("getprefix");//debug
for(String s : Prefixes)
{
System.out.println("prefixindb - " + s);//
String[] split = s.split(" ");
if(u.getSource().equalsIgnoreCase(split[0])) return split[1].replaceAll... |
c43c3dc3-6e39-4b8c-9154-daf5bd561f59 | 7 | @Override
public void draw(Object obj, Component comp, Graphics2D g2) {
Color color;
if (obj == null) {
color = null;
} else {
color = (Color) getProperty(obj, "color");
}
String imageSuffix = (String) getProperty(obj, "imageSuffix");
if (image... |
93f1f187-3d08-48d0-9c45-ee7b36f45c2c | 9 | public static void doWithMethods(Class<?> clazz, MethodCallback mc, MethodFilter mf) throws Exception {
// Keep backing up the inheritance hierarchy.
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
if (mf != null && !mf.matches(method)) {
continue;
}
try {
mc.doWit... |
35a32fd5-cdd1-45dd-aaf9-f7e66ef47096 | 7 | protected boolean[] incrementingEquality(AttrTypes attrTypes,
int classType) {
print("incremental training produces the same results"
+ " as batch training");
printAttributeSummary(attrTypes, classType);
print("...");
int numTrain = getNumInstances(), numTest = getNumInstances(),
... |
dfb26c1e-5bab-4edb-8bcb-21d053b5c907 | 7 | public static WUGraph minSpanTree(WUGraph g){
// 1: Create new graph t having the same vertices as G, but no edges yet.
WUGraph t = new WUGraph();
for (Object item : g.getVertices()) {
t.addVertex(item);
}
// 2: Make a list of all edges in G by calling multiple times getNeighbors()
Object[]... |
40426b18-dd3f-4771-81b9-50c82a4e72f9 | 0 | @Override
public void greeting(Context ctx) {
System.out.println("Good Morning! " + LoggerUtils.getSig());
ctx.setState(new ConcreteState_Daytime());
} |
bd68d9c5-8657-4903-a47f-77f40ed23648 | 6 | private boolean checkValidDetectiveTickets(boolean check, Detective player,
MrX mrXPlayer, TicketType ticketType) {
if (ticketType == TicketType.Bus && player.bus.size() > 0) {
player.bus.remove(player.bus.size() - 1);
mrXPlayer.bus.add(ticketType);
player.used.add(ticketType);
} else if (ticketType == ... |
fa835d9a-7cb1-4576-9bf2-9e5ee1d31059 | 9 | private void saveTree(List<Component> roots, Map<String, Object> stateMap) {
List<Component> allChildren = new ArrayList<Component>();
for (Component root : roots) {
if (root != null) {
PropertySupport p = getProperty(root);
if (p != null) {
... |
c5035907-fe66-4f35-8d64-bf25972e7ac6 | 0 | public void init() throws IOException {
Configuration mc = new Configuration();
mc.set("fs.default.name", "hdfs://192.168.178.40:9000");
this.fs = FileSystem.get(mc);
System.setProperty("HADOOP_HOME", hadoopContext.getHome());
System.setProperty("HADOOP_USER_NAME", hadoopContext.... |
2f037378-d039-4600-bcb8-2824088f6fba | 2 | public void render(){
BufferStrategy bs = getBufferStrategy();
if(bs == null){ createBufferStrategy(2); return; }
Graphics g = bs.getDrawGraphics();
{
LinkedList<Tile> renderTiles = TileManager.getImportantTiles();
for(int i = 0; i < renderTiles.size(); i++){
Tile tile = renderTiles.get... |
a178f602-c658-43a7-b0db-7b975e44019b | 4 | public Stack<Labyrinth> launch(String file) {
Stack<Labyrinth> labyStack = new Stack<Labyrinth>();
try (
FileInputStream fInputStream = new FileInputStream(new File(file));
ZipInputStream zInputStream = new ZipInputStream(fInputStream);
) {
while (zInp... |
f5b7ad79-b2a1-45d1-80c6-12cb2e05a30a | 3 | public static ArrayList<bAssistecConsulta> getSintomas(
// String arg_prod,
// String cod_comp,
String arg_serial // String arg_dt1,
// String arg_dt2
) throws SQLException, ClassNotFoundException {
ResultSet rs;
ArrayList<bAssistecC... |
a25b53c9-cb8e-4118-8f9f-4be1154c0478 | 3 | public void escribirArchivo(String nombre, ArrayList<String> datos) {
try {
FileWriter fw = new FileWriter("./Data/" + nombre + ".o");
PrintWriter pw = new PrintWriter(fw);
for(int i=0; i<datos.size(); ++i){
pw.println(datos.get(i));
}
... |
137ac6df-d22a-4cca-b40f-b278b023cd8c | 1 | public Object get(int index) throws JSONException {
Object object = this.opt(index);
if (object == null) {
throw new JSONException("JSONArray[" + index + "] not found.");
}
return object;
} |
945d9851-409d-4d36-a761-322a02e19fad | 3 | public Boolean UploadFileAsync(String fileName, String description) throws Exception {
File fileToUpload = new File(fileName);
Date startTime = new Date();
if (fileToUpload.exists()) {
System.out.println("Uploading file " + fileToUp... |
c03b5428-bd4b-484c-809a-6feeb8abcbc6 | 0 | void setAcceleration(float ax, float ay, float az) {
this.acceleration.set(ax, ay, az);
} |
c0b7b100-b735-4fcf-ac17-5c3f59dd3d5b | 4 | @Override
public void run() {
int totalConsumedByThisConsumer = 0;
try {
while (true) {
Integer item = warehouse.retreiveItem();
if (item == null) {
// nothing to consume. warehouse is empty. Too slow producer or producer is dead
if (Producer.getNumberOfActiveProducers() <= 0) {
br... |
b23e975a-78d7-46f5-8197-df543724a659 | 9 | private PickVO getList13PVO(PickVO pvo, ArrayList<LineAnaVO> list13) {
if (list13.size() == 3) {
LineAnaVO v = getGap(3, list13);
if (v != null) {
pvo.add(v.getBnu());
}
v = getGap(2, list13);
if (v != null) {
pvo.add(v.getBnu());
}
} else if (list13.size() ==... |
a5161357-789d-4c86-82e9-62c9b3febb50 | 2 | protected void redirectToLoginPage(HttpServletRequest request, HttpServletResponse response,
List<Pair<String, String>> queryParams) {
try {
StringBuilder pathBuilder = new StringBuilder();
pathBuilder.append(request.getContextPath());
pathBuilder.append("/");
... |
d3111ee5-27ba-4fca-b618-94d02e467c61 | 1 | public void paataLohko() throws IllegalStateException {
asetaJonoonArvollinen();
for (Suoritusjono taso : suoritustasot) {
taso.paataJono();
}
} |
37c92652-15f4-4a9d-85f7-72ce13b1afd7 | 0 | public void addPerson(Villager newPerson) {people.add(newPerson);} |
968bba12-e827-4cc0-8c3a-965a0910e457 | 0 | public double magnitude()
{
return Math.sqrt(a.multiply(a).add(b.multiply(b)).doubleValue());
} |
5ccec148-ccd5-42d9-b512-044cb5d7376c | 8 | @Override
public void caseADeclAvalieDefinicaoComando(ADeclAvalieDefinicaoComando node)
{
inADeclAvalieDefinicaoComando(node);
if(node.getPontoVirgula() != null)
{
node.getPontoVirgula().apply(this);
}
if(node.getFimAvalie() != null)
{
node... |
75d064b4-7865-445b-aa02-4d9b8561a921 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Client client = (Client) o;
if (id != client.id) return false;
if (!firstName.equals(client.firstName)) return false;
if (!lastName.equ... |
6f41effa-ab36-43c3-8bc9-32ada6144256 | 0 | public byte[] getValueMAC() {
return valueMAC;
} |
64cdae19-81c3-444c-83b2-6e23ed40460e | 3 | public Collection<?> getNodes() {
ArrayList<GenericNode> nodes = new ArrayList<GenericNode> ();
Set<String> keys = this.nodes.keySet();
for(String key : keys){
nodes.add(this.nodes.get(key));
}
return (Collection<?>) keys;
} |
900a19fe-bfc6-46ca-a124-332a035c7bbc | 0 | public KeyType getKey() {
return key;
} |
27562bcd-0fff-4d63-8655-e601e23c01fd | 8 | @Override
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case statePackage.PLAYER: {
Player player = (Player)theEObject;
T result = casePlayer(player);
if (result == null) result = defaultCase(theEObject);
return result;
}
case statePackage.STATE: {
... |
66382951-e04c-4920-a990-5772600441e5 | 0 | public int getWidth() {
return width;
} |
f10fb906-b56e-40e7-9e08-bfc717879391 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
2496c00a-1ca6-420f-b876-a14f7fb50b86 | 3 | public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
t... |
783dfccb-7f71-448e-971b-696a275d2b25 | 0 | public final void setDebug(byte debug) {
this.debug = debug;
} |
6ea49052-29b7-4167-ac49-7f5a2ec0b898 | 9 | private void collectiveVolitiveMovement(boolean overallWeightIncreased) {
double[] barycenter = new double[dimensions];
double totalWeight = 0;
// calculating barycenter
for (int i = 0; i < school.size(); i++) {
Fish _fish = school.get(i);
for (int j = 0; j < dimensions; j++) {
barycenter[j] +=... |
562628a4-5a24-4660-ba1e-2148ceafd993 | 9 | public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int caso=1;
for (StringTokenizer st;(st=new StringTokenizer(in.readLine()))!=null;caso++) {
int[] arr=new int[6];
int sum=0;
for(in... |
fc6bf24b-ece3-41a1-8807-aabcec315ac6 | 7 | void parseVBR(byte[] firstFrame) throws IOException {
// trying Xing header
byte[] tmp = new byte[4];
int offset;
if (version == VERSION_MPEG1) {
if (mode == MODE_SINGLE_CHANNEL) {
offset = 21 - 4;
} else {
offset = 36 - 4;
... |
770cf20b-e163-4a1c-9d0b-f11bac91b91f | 9 | private static void addPuttingOutMoves(ArrayList<BoardState> listPositions, BoardState state, boolean whitesTurn, int[] movesToMake, int position) {
if(whitesTurn) {
for(int i=18; i<=23; i++) {
if(state.isPositionWhite(i) && state.getCountAt(i)>0 && movesToMake[position] + i >= BoardUtils.BOARD_SIZE) {
Bo... |
22157999-996c-4abe-a503-0572d49f6412 | 2 | void conflictsWith(LocalInfo l) {
if (shadow != null) {
getReal().conflictsWith(l);
} else {
l = l.getReal();
if (!conflictingLocals.contains(l)) {
conflictingLocals.addElement(l);
l.conflictingLocals.addElement(this);
}
}
} |
5e143697-f08b-4b0b-8845-465c1696a307 | 5 | public void run()
{
// Chaque navette commence a un site aleatoire.
int n = (int) (Math.random() * Festival.nSites);
while (true)
{
if (n != (Festival.nSites - 1)) {
// Si la navette n'est pas sur le dernier site, elle prend les festivaliers.
tSite[n].arret.emmener(this);
// Simulation d... |
09717c1f-1ead-4372-889c-38c5d8765cb0 | 3 | public List<List<Integer>> generate(int numRows) {
List<Integer> list = new ArrayList<Integer>();
list.add(1);
if(numRows == 0) return result;
if(numRows == 1){
result.add(list);
return result;
}
generate(numRows-1);
List<Integer> pre = res... |
d0953675-504b-4871-9cf6-56ef3a193f0e | 5 | private GameResult checkBoardState() {
boolean hasEmpty = false;
for (int y = 0; y < BOARD_SIZE; y++) {
for (int x = 0; x < BOARD_SIZE; x++) {
if (board[y][x] == GAME_WIN_NUMBER) {
return GameResult.WIN;
}
if (isEmpty(y, x)) {
hasEmpty = true;
}
}
}
return hasEmpty ? GameResult.U... |
29e26b3b-a37c-46f7-8866-f29166db20ca | 4 | protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
try {
Library library = new Library();
ResultPage<Book> books = library.getPatronRecord(
((Patron) request.getSession().getAttribute("patron"))
.getCardNumber(),
request.getP... |
3a2ed43f-081f-4f45-a5b4-be9f4e6ae150 | 7 | public static String parseRuleDescription(String xmlRule)
{
String ruleDescription = "";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try
{
DocumentBuilder db = dbf.newDocumentBuilder();
Reader reader=new CharArrayReader(xmlRule.toCharArray());
Document document = db.parse(new... |
7f86dbb2-3232-4254-84c7-62c6af13f606 | 6 | public static double[] sumArray(double[] a1, double[] a2) throws IllegalArgumentException{
if (a1 == null && a2 == null){
throw new IllegalArgumentException("Given array size mismatch");
}
else if (a1 == null) {
a1 = new double[a2.length];
}
else if (a2 ==... |
ffbbeb50-5edf-4803-9f75-c605369f0f30 | 9 | @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
lastEvent = e;
lastActivity = System.currentTimeMillis();
//Grab command byte and message
Object[] obj = (Object[])e.getMessage();
ChatCommand cmd = (ChatCommand)obj[0];
String message = (String)obj[1];
switch (cmd... |
48e2a2aa-0960-4dde-b52e-bd16113b2dae | 6 | public boolean isCool() {
if(playerName.toLowerCase().equals("situations") || playerName.toLowerCase().equals("square") || playerName.toLowerCase().equals("xyle") || playerName.toLowerCase().equals("underoath") || playerName.toLowerCase().equals("im not bryce") || playerName.toLowerCase().equals("yonkers")) {
ret... |
b9b52bf5-3c83-4911-a6fe-198988402879 | 1 | public static void main(String[] args) {
System.out.println("Enter exam marks. Type -1 to terminate.");
Exam exam1 = new Exam(-1);
int examMark = 0;
do {
System.out.println("Input a mark: ");
Scanner sc = new Scanner(System.in);
examMark = sc.nextInt();
exam1 = new Exam(examMark);
} while (examM... |
2d468cf7-f514-41b5-8175-4a9674df7324 | 0 | public static void loadAndSetUpAllCardImages(JComponent theJPanelInstance) {
imagesHaveBeenLoaded = false;
MediaTracker tracker = new MediaTracker(theJPanelInstance);
cardImageFileNames = getArrayOfCardFileNames();
loadAllTheCardImagesFromFileNames(cardImageFileNames,... |
827244f0-cd85-4390-b9e6-0f8597d42e97 | 7 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for(String line ; (line=in.readLine())!=null;){
int n = Integer.parseInt(line);
String colours = in.readLine();
int remove = 0;
boolean red = true;
boolean green = true;
... |
680d36e5-1a0d-4cec-bb0c-0f3de27fd9da | 6 | private int binarySearch(int[] A,int b, int e, int target)
{
if (b == e) return -1;
if (b == e + 1)
{
if (A[b] == target) return b;
else return -1;
}
int mid = (b + e ) /2;
if (A[mid] < target) return binarySearch(A, mid + 1, e, target);
int rt =binarySearch(A, b, mid, target);
if (rt != -1) ret... |
8ccb5184-8ad5-4808-92a3-820e19895c5e | 5 | public void addToken(Token t)
{
if (t.getType() == Token.TokenType.COMMENT)
{
//do nothing, just what comments do.
}
else if (t.getType() == Token.TokenType.L_PAREN)
{
if (parentStack.size() == 0)
{
root = new Node();
currentNode = par... |
0f515c27-1b65-49a2-bde9-32b880939bd2 | 7 | private void signalEditorAddSignal() {
if(se_signal.getSelectionIndex() == -1) return;
if(signals == null) signals = new SignalBundle();
Contact contact = new Contact(se_signal.getText());
Signal signal = new Signal();
String text = se_time.getText().replaceAll("[^0-9]+", " ").tr... |
4494e523-4ffc-4247-b1e8-eb162df8ba31 | 4 | private void cbxFiltroItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbxFiltroItemStateChanged
/*JOptionPane.showMessageDialog(rootPane,"ssdfs");
lblFiltro.setVisible(false);*/
if(cbxFiltro.getSelectedItem().equals("Selecione")){
lblNome.setVisible(false);
... |
3ce32d2b-46b4-4f9f-8f97-8e576bf7ba86 | 2 | public void compute() {
if (opponent == null)
return;
// Obtain angle between us and the prey
double angleToPrey = getLocation().orientTo(opponent.getLocation());
// Fire as continuously as gun heating will allow.
if (getGunCurrentTemp() < getGunUnjamTemp())
fire((float)angleToPrey);
// Steer towar... |
028f6523-754c-4f28-8e3c-215f41f01552 | 3 | public void run()
{
if(ThrdCnt==1||ThrdCnt==2)
{
a.delayAndPrint(ThrdCnt);
new syncobj().delayAndPrint2(ThrdCnt);
}
if(ThrdCnt==3)
a.iterateArrayList();
} |
bf516baa-9993-461e-9f73-819d8ff3773e | 2 | public Integer compute(Integer number) {
if (number < 0){
throw new IllegalArgumentException();
}
if (number == 0){
return 1;
}
return number * compute(number - 1);
} |
47836b63-dde5-4c83-842f-0342b9d472b8 | 4 | public Script interact(){
if (interactable == null) return null;
if(snoozing) wake();
killVelocity();
Entity interactable = getInteractable();
if(interactable!=null) interactable.killVelocity();
if(interactable instanceof Mob)
((Mob)interactable).watchPlayer();
return interactable.getScript();
} |
a52f4542-7829-4412-b7c3-979710346413 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
75b7c26d-2cf0-4c06-b422-af01f090d8db | 1 | public void NotifyUsersChanged(Users users) {
for (IUsersChangedNotification uc : usersChangedNotificationListeners) {
uc.onUsersChanged(users);
}
} |
430e0e93-342e-4a09-b2db-e45db0267ca1 | 2 | public double[] subarray_as_imaginay_part_of_Complex(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
Complex[] cc = this.getArray_as_Complex();
double[] imag = new double[end-start+1];
... |
45d37832-fa0f-4098-9260-844204676a3e | 9 | public String processInput(String inputLine) {
if (inputLine == null) {
return null;
}
if (state == WAITING) {
try {
writer = new PrintWriter("/tmp/testlogfile45_" + suffix, "UTF-8");
} catch (FileNotFoundException e2) {
System.out.println("File not found, creating");
} ... |
1b6d2c59-8e19-4002-a864-d70d5668ff75 | 9 | private static void writeMetrics(Node node, PrintStream out) {
Stack<Node> stack = new Stack<Node>();
stack.push(node);
int nodes = 0;
int consumedStrings = 0;
int bucketStrings = 0;
int bucketSpace = 0;
int nonEmptyBuckets = 0;
int smallest = Integer.MAX_... |
7b656578-c5be-46a3-9e25-c6c9ac4d75f7 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
07b3101f-cf9c-4d9f-965a-8c91a14a6229 | 1 | public final static XMLGregorianCalendar DateToXMLGregorianCalendar(Date date)
throws DateConverterException {
XMLGregorianCalendar xmlGrogerianCalendar= null;
try {
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTimeZone(TimeZone.getTimeZone("CET"));
gregori... |
2c9ae373-3a37-4b0f-a649-1225cf3a0f02 | 2 | public void setQuantities()
{
if(!isIon()) //if its not an ion, the charges must add to zero
{
int totalCharge = getCharge();
for(int i = 0; i < elements.length; i++)
{
}
}
} |
921f9c35-65a6-441c-af1e-d7b9deb1e770 | 9 | private void checkState(String key){
switch(key){
case "Aguante": if (secondary_attr.get(key).getRemaining() - State.Agotamiento
.getEffectValue() <= 0 && !states.contains(State.Agotamiento)) states.add(State
.Agotamiento);
else states.remo... |
4591e5c0-4063-4c1e-ac84-b009bf3f985b | 1 | public void setEngineHook(boolean disableRendering) throws IOException {
sendPacket(GWCAOperation.SET_ENGINE_HOOK, disableRendering == true ? 1 : 0);
} |
fbc10143-e503-41ab-9274-431f5d9d6c34 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Team other = (Team) obj;
if (direction != other.direction)
return false;
if (identifier == null) {
if (other.identifier != null)
retu... |
2aeb2ecd-a3d9-461e-83af-9df4b7bcb6bd | 3 | @Override
public void run() {
while (this.isRunning) {
try {
// Tell model to update, send next key press.
// or 0 if no new keypress since last update.
this.gameModel.gameUpdate(nextKeyPress());
this.view.repaint();
Thread.sleep(this.updateInterval);
} catch (GameOverException e) {
/... |
7feaa9dc-bfb4-4bc1-a164-d5465e0de8c8 | 0 | public Boolean containsParticipant(String id) {
return participants.containsKey(id);
} |
8aeeb2f3-3605-4276-b93e-437515e06a91 | 3 | public static <T> T[] toArray(final List<T> obj) {
if (obj == null || obj.isEmpty()) {
return null;
}
final T t = obj.get(0);
final T[] res = (T[]) Array.newInstance(t.getClass(), obj.size());
for (int i = 0; i < obj.size(); i++) {
res[i] = obj.get(i);
}
return res;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.