method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e896b3fe-2c55-4728-a5fc-df139394363f | 1 | private Map<String, Quantity> loadStock() {
if(stock == null) {
stock = Maps.newConcurrentMap();
declare(stock, "Coffee", 10);
declare(stock, "Chocolate", 10);
declare(stock, "OrangeJuice", 10);
declare(stock, "Tea", 10);
declare(stock, "To... |
9fa19b95-deb8-449a-b763-66337e6bd34e | 8 | public void assignAffectedPerts( Residue res ){
if(res.perts != null){
PriorityQueue<Integer> affected = new PriorityQueue<Integer>();
for(int b=0;b<res.perts.length;b++){
Perturbation pert = perts[res.perts[b]];
for(int c=0;c<pert.successors.length;c++){... |
445dace6-6515-4933-b084-d712647c2ee5 | 5 | @SuppressWarnings("unchecked")
char getCharValue(Object obj, int k) {
if ((obj instanceof ArgHolder<?>)
&& ((ArgHolder<?>) obj).getType().equals(Character.class)) {
return ((ArgHolder<Character>) obj).getValue();
} else if (obj instanceof char[]) {
return ((char[]) obj)[k];
} else {
... |
cfe51c1f-5e76-4b29-826b-3137cb265fa6 | 0 | private Salir() {
// JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
putValue(NAME, "Salir");
putValue(SHORT_DESCRIPTION, "Salir el programa");
putValue(LONG_DESCRIPTION, "Salir el programa");
putValue(ACCELERATOR_KEY, KeyStro... |
26a0468c-4fce-48f8-9516-b93eceb850ed | 7 | public void determinSched(int days, int[] sec, int min){
int num_sec = sec.length;
int [][] M = new int[days + 1][num_sec + 1];
int T = 0;
for(int j=0; j<=10; j++){
T = T + sec[j];
if(j == 0){
M[1][j] = (int)Math.pow(Math.max(min-0, 0), 4) + Math.max(0-min, 0);
}
else{
M[1][j] = (int)Math.po... |
8e59df29-03a1-4ba3-80d8-535b5f71ce7a | 5 | private void jj_rescan_token() {
jj_rescan = true;
for (int i = 0; i < 1; i++) {
try {
JJCalls p = jj_2_rtns[i];
do {
if (p.gen > jj_gen) {
jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
switch (i) {
case 0: jj_3_1(); break;
}
}
... |
4e4e674a-6121-49a2-bd18-3c146fdf0682 | 6 | private void inicializaPercentuaisDesconto() {
switch (diaDaSemana) {
case SEGUNDA:
descontosPorTipo.put(TiposDeIngresso.CRIANCA, 10);
descontosPorTipo.put(TiposDeIngresso.ESTUDANTE, 10);
descontosPorTipo.put(TiposDeIngresso.IDOSO, 10);
break;
case TERCA:
descontosPorTipo.put(TiposDeIngresso.CRIANC... |
41c86551-0997-4a46-876a-68a37557db10 | 0 | public UploadListener(HttpServletRequest request, long debugDelay)
{
this.request = request;
this.delay = debugDelay;
totalToRead = request.getContentLength();
this.startTime = System.currentTimeMillis();
} |
f6c7b613-c9a1-44f0-8280-c3149282eddf | 9 | @Override
public void doSomething() throws IOException, ParsingException, LexingException, IncorrectProofException {
String[] temp = in.readLine().split(Pattern.quote("|-"));
if (temp.length > 2) {
throw new IOException("more than one |- in first line");
}
String s = temp... |
acda2cbc-a536-4455-bccf-24bf0309c2c2 | 9 | public PogNode chooseNeighborWeighted_Fast(TreeQualifier qualifier, Random generator) {
Node editedNode = null;
boolean isAdded = false;
if (addableList.isEmpty() && removableList.isEmpty()) { // this is a null node; choose a node to add from the whole dataset
isAdded = true;
... |
2da2bb1e-3c57-4c5d-a6b8-9f321d6551e4 | 3 | private void validateParticipantsInCSVFile(List<Participant> participants) {
List<String[]> results = new ArrayList<String[]>();
try {
CSVReader reader = new CSVReader(new FileReader(csvPath));
results = reader.readAll();
reader.close();
} catch (FileNo... |
08b0cb3b-4c77-4618-883c-61593c0177d5 | 4 | public boolean canIssue(Instruction instruction) {
boolean freeResStat = false;
String opcode = instruction.getOpcode();
for (int i = 0; i < reservationStations.size(); i++) {
ReservationStation resStation = reservationStations.get(i);
if (resStation.getUnit().equals(opcode)) {
if (!resStation.isBusy())... |
6a827d41-a6b1-4476-985e-f8624ffe3f02 | 5 | private void computeRoutingTablesParser(String input){
boolean splitHorizon = false;
int i = 0;
Scanner inputscanner = new Scanner(input);
inputscanner.next(); //take away command
while(inputscanner.hasNext()){
String token = inputscanner.next();
if (token.charAt(0)=='t'|| token.charAt(0)=='T'){
... |
d3ba741e-2453-4723-b6dc-e15bf06c4df2 | 6 | private Integer Find(String key, Node node) {
if(node instanceof LeafNode){
for(int i = 0; i <= node.getSize() - 1; i++){
if(key.compareTo(node.getKey(i)) == 0){
return node.getValue(i);
}
}
return null;
}
if(node instanceof InternalNode){
for(int i = 1; i <= node.getSize();i++){
... |
df885da6-baa3-42fb-a075-aa419a8f916d | 5 | public static void handleEvent(int eventId)
{
// return to main menu
if(eventId == 1)
{
System.out.println("Exit new game menu selected");
Main.newGameMenu.setVisible(false);
Main.newGameMenu.setEnabled(false);
Main.newGameMenu.setFocusable(false);
Main.mainFrame.remove(Main.newGameMenu);
M... |
d52133df-e97d-47fa-97bc-61001db7490e | 5 | public void Start(String name)
{
Land_objects = new ObjectsThread(Land_Matrix);
Animal_objects = new ObjectsThread();
Char_objects = new ObjectsThread();
for (int ix = 0; ix < Land_Matrix.length; ix++)
for (int iy = 0; iy < Land_Matrix[ix].length; iy++)
... |
2d2f3d18-0804-4df4-aef5-de490c333f1e | 0 | public double getY2Coordinate()
{
return y2Coordinate;
} |
94e9b033-551e-4266-82a0-5d96b28518b4 | 3 | public CharacterBoard() {
try {
charSheetBig = ImageIO.read(new File("sprites/player.png"));
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
charSheet = new BufferedImage[charRows * charCols];
for (int i = 0; i < charCols; i++) {
for (int j = 0; j < charRows... |
0faacf1b-972e-4d25-88fa-8a860e912d95 | 4 | public void close() {
try {if (dataParser != null) dataParser.close();}
catch (IOException e) {}
try {if (resourceParser != null) resourceParser.close();}
catch (IOException e) {}
} |
7c37f3cb-7da8-4eb6-a7ed-3f91d5d5d848 | 3 | public static void main(String[] args) {
Map<Model,Model> map = new HashMap<Model, Model>();
for(int i = 0;i<100;i++){
Model m = new Model(i);
map.put(m, m);
map.put(m, m);
}
while(true){
Set<Model> set = map.keySet();
if(!"[57, 33, 20, 71, 4, 49, 42, 23, 39, 35, 15, 18, 74, 14, 94, 77, 58, 25, 8... |
01e75d04-cafe-4b20-a3b1-f8f571289f63 | 7 | public void operationManager(char symbol) throws DivisionByZeroException {
if (!"".equals(text.getText())) {
switch (symbol) {
case '+':
memory = memory + Double.parseDouble(text.getText());
break;
case '-':
... |
e3af6712-c25b-4b2e-ac72-be441436d8a9 | 6 | private void buildHotSpots() {
File hotSpotFile = new File(MODEL_PATH + name + ".hspot");
BufferedReader in;
String line;
try {
if (hotSpotFile.exists()){
in = new BufferedReader(new FileReader(hotSpotFile));
File transformFile = new File(MOD... |
f3d56537-9c6c-4df1-a4d5-5d50d476572d | 7 | public void visitIincInsn(final int var, final int increment){
if(currentBlock != null)
{
if(compute == FRAMES)
{
currentBlock.frame.execute(Opcodes.IINC, var, null, null);
}
}
if(compute != NOTHING)
{
// updates max locals
int n = var + 1;
if(n > maxLocals)
{
maxLocals = n;
}
}
// ... |
23675f60-7aeb-47de-b5ce-d8d6bf753e64 | 8 | public int individualHappy(Room r) {
int totalHappy = 0;
String good = this.roomList();
String bad = this.noRoomList();
String[] goodName = good.split(",");
String[] badName = bad.split(",");
for(Person q : r.roomies) // See how they feel about eve... |
ee52caf5-b91c-4d71-becb-8f3a48f364b7 | 0 | protected void end() {
} |
477701f7-729f-4335-b4ca-31f2cf4677e4 | 5 | public static String reverseSubstring(String string, int startIndex, int endIndex) {
if (string == null || startIndex < 0 || startIndex > endIndex || endIndex > string.length())
return null;
// build result
String result = string.substring(0, startIndex); // prefix
int currIndex = endIndex;
while (cu... |
d5eae037-6afc-4910-9d79-95873c7508fb | 6 | public String getHelpText(HelpType command) throws CheckersException {
String helpText = "";
switch (command) {
case INSTRUCTIONS:
case BOARD:
case GAME:
case REAL_PLAYER:
case LOCATION:
case MARKER:
helpText = comma... |
4f41a8ac-acea-4ce4-9a99-5a7cedab23c6 | 3 | public boolean openAndReadTemplate(){
try {
String line;
reader = new BufferedReader(new FileReader(file));
while ((line = reader.readLine()) != null) {
template.add(line);
}
reader.close();
return true;
} catch (FileNotFoundException e) {
writeLog(e);
return false;
} catch (IOExceptio... |
3c358761-01d0-4fe1-9de1-b54a9f360b95 | 5 | public List<Integer> getSCC(Graph graph, Graph reversedGraph) {
List<Integer> result = new ArrayList<Integer>();
System.out.println("Start sorting");
Stack<Vertex<T>> dfsSorting = getDfsSorting(graph);
System.out.println("End sorting");
Stack<Vertex<T>> stack = new Stack<Vert... |
c46fedd0-21ea-4b52-81f0-4d90867675a8 | 0 | protected Class getTransitionClass()
{
return MooreTransition.class;
} |
930429a5-114f-4343-82f6-7a6551635ff1 | 5 | public void displayCardValues() {
for (Card card : cards) {
if (card.isAce()) {
System.out.println(card.getType().toString() + " ACE");
} else if (card.getValue() == 11) {
System.out.println(card.getType().toString() + " JACK");
} else if (card.getValue() == 12) {
System.out.println(card.getType(... |
1e0d899f-bc86-49e8-9c07-3db9c42b1d5f | 3 | public void setEssensration( int rationssatz )
{
if ( rationssatz == 1 )
{
this.essensration = 1;
}
else if ( rationssatz == 2 )
{
this.essensration = 2;
}
else if ( rationssatz == 3 )
{
this.essensration = 4;
}
} |
051cf00e-6e3f-4fa0-b563-3ed07d5ac679 | 5 | @EventHandler
public void onClick(PlayerInteractEvent e){
Player p = e.getPlayer();
if(e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR){
if(p.getInventory().getItemInHand().equals(guns.ChickenGun())){
p.getWorld().spawnEntity(p.getEyeL... |
218a65cc-003e-4197-85b1-95156374159d | 1 | public Cell(int x, int y) {
// Passing default values to prevent null pointer exceptions during testing
this.pos[0] = x;
this.pos[1] = y;
this.rock = false;
this.adjacentAntsBlack = 0;
this.adjacentAntsRed = 0;
this.anthill = "none";
this.food = 0;
... |
750ffd61-f333-43f6-809d-38a379015d5f | 8 | public int[] getIntArrayArgument(String name, boolean required){
if(M.containsKey(name))
{
String a = M.get(name).trim();
if("iI".indexOf(a.charAt(0)) == -1){illFormedArray(a," expected integer array");}
if(a.charAt(1) != '[' || a.charAt(a.length()-1) != ']'){illForme... |
912cc8b7-9993-4751-86af-41c1b21869c0 | 0 | public AbstractFileProtocol() {} |
f8254cf8-ca9e-4b2a-a088-f06f145e4735 | 8 | public boolean contains(Info otherInfo) {
if ((otherInfo.color != null && otherInfo.color != color) ||
(otherInfo.size != null && otherInfo.size != size) ||
(otherInfo.location != null && otherInfo.location != location) ||
(otherInfo.image != null) && otherInfo.image != image) {
return false;
}
ret... |
8c7b4f00-c463-42f5-8c62-3e48554a5468 | 9 | public int tally(int[] parValue, String[] scoreSheet) {
int total = 0;
for(int i = 0; i < parValue.length; i++){
int current = 0;
if(scoreSheet[i].equals("double bogey")){
current = parValue[i] + 2;
}else if(scoreSheet[i].equals("bogey")){
current = parValue[i] + 1;
}else if(scoreSheet[i].equal... |
b80bd41c-86ae-4efe-8720-0049f4c94f8c | 7 | public void renderSprite(int xp, int yp, Sprite sprite, boolean fixed) {
if (fixed) {
xp -= xOffset;
yp -= yOffset;
}
for (int y = 0; y < sprite.getHeight(); y++) {
int ya = y + yp;
for (int x = 0; x < sprite.getWidth(); x++) {
int xa = x + xp;
if (xa < 0 || xa >= width || ya < 0 || ya >= heig... |
800de0d6-0849-41b3-9494-3e73834cb637 | 5 | public static ArrayList<ArrayList<Integer>> generate(int numRows) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
if (numRows == 0){
return result;
}
for (int i = 0;i<numRows;i++){
ArrayList<Integer> temp = new ArrayList<Integer>();
... |
df25f56f-c1cd-4240-bf4a-3d63a64ef110 | 9 | public synchronized void unlock() {
if (ASSERTS && owner != Thread.currentThread()) {
Thread.dumpStack();
throw new IllegalLockStateException("Don't own monitor");
}
locked = false;
if (waiters > 0) {
if (STATISTICS) {
unlock_waiting++... |
a5b712dc-8a69-4547-a393-d9cd2b79b5c9 | 2 | private static final int reduce(int current, int desired) {
if (current > desired) {
current -= current / 7;
if (current < desired) {
current = desired;
}
}
return current;
} |
661bc12b-c815-4152-a4e1-e3b6260d73d7 | 9 | private boolean SingleLineConditionCheck(String type,String string){
Scanner scanner = new Scanner(string);
boolean condition = false;
scanner.useDelimiter(type+"\t*");
while(scanner.hasNext()){
String getcontent = scanner.next();
if(type.equals("name")){
if(this.NameFieldCheck(getcontent)){
... |
e0c9555c-a9a9-4f31-8585-8ca67b1a9468 | 6 | private int unaryExecute(int i) {
switch(sim40.memory[i]) {
/* Unary Instructions */
case 4: /* cclear */
switchOffFlag(2);
break;
case 5: /* cset */
switchOnFlag(2);
break;
case 6: /* xinc */
sim40.memory[Simulator.XREG_ADDRESS]++;
checkResetOverflow(Simulator.XREG_ADDRESS);
break;
... |
2f7c5b92-33bf-4735-bd3d-e35372f49300 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Client other = (Client) obj;
if (this.ip == null) {
if (other.ip != null)
return false;
} else if (!this.ip.equals(other.ip))
return ... |
8a078aaa-adc0-4fc5-910c-ee457b5cfaed | 2 | public void put(Node node, long key) {
try {
if (node.previous != null) {
node.unlink();
}
Node previous = cache[(int) (key & size - 1)];
node.previous = previous.previous;
node.next = previous;
node.previous.next = node;
node.next.previous = node;
node.hash = key;
return;
} catch (Ru... |
ce8a7e32-7239-4d70-8876-ee1eea09ac06 | 5 | public boolean isPerson(String word) {
int i;
// Teste referente ao tamanho da palavra, excluindo palavras com menos
// de 3 caracteres e mais de 10.
//
if (word.length() < 3 || word.length() > 10) {
return false;
}
// Teste referente a primeira le... |
cb122e50-08e3-4f7c-9678-138ebe7b0c5b | 8 | private static boolean canInvokeWithArguments(Method method,
Object[] arguments) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length != arguments.length) {
return false;
}
for (int index = 0; index < arguments.length; index++) {
... |
e1f5580c-117b-42d9-82da-00d3330514f7 | 6 | public AIUnit yieldUnit(UnitType ut, AIObject o) {
float unitWeight = 99f;
AIUnit yieldedUnit = null;
boolean isOwnUnit = false;
Iterator<AIUnit> uit = getOwnedAIUnitsIterator();
while (uit.hasNext()) {
AIUnit u = uit.next();
//all units in one goal have... |
dd3f76a8-b172-452c-be7b-0541db3b3d1d | 3 | public static void backTrace (int[][] s, int[][] c, int f, int e, int base) {
if ( e == 0 || f == 0 ) {
return;
}
int p = c[f][e];
System.out.println(String.format("floor: %d, egg: %d, choose %d", f, e, p+base) );
if ( s[p-1][e-1] > s[f-p][e] ) {
backTrace(s, c, p-1, e-1, base);
} else {
backTra... |
efd15754-630c-48e9-8e9c-1b818e4e1589 | 3 | public IllegalOrphanException(List<String> messages) {
super((messages != null && messages.size() > 0 ? messages.get(0) : null));
if (messages == null) {
this.messages = new ArrayList<String>();
}
else {
this.messages = messages;
}
} |
edebdd10-114b-4995-9867-be50d26a40ae | 2 | protected int findColumnStrict(String col) throws IllegalArgumentException {
if (col == null) {
throw new IllegalArgumentException("Got null column name.");
}
int val = columnNames.indexOf(col);
if (val < 0) {
throw new IllegalArgumentException("Invalid column: " + col);
}
return val... |
5cdf93b3-ee65-4c4e-b434-196b91810683 | 0 | protected void match(int w, int j) {
matchJobByWorker[w] = j;
matchWorkerByJob[j] = w;
} |
6b17a246-f23b-4f9d-a2ab-c4dcfc4687cb | 8 | private void createOpdrachtLink(Opdracht opdracht) {
String type = opdracht.getClass().getSimpleName();
Connection con = maakVerbinding();
PreparedStatement createLink = null;
if (type.equals("EenvoudigeOpdracht")) {
try {
createLink = con.prepareStatement(insertEenvoudigeOpdracht);
createLink.setInt... |
7cd989f4-56b4-4ab9-b617-ad5bcf56cbd0 | 5 | @Override
public void run() {
for(int i = 0; i<active.length; i++){
for(int j = 0; j<active[0].length; j++){
if (strengthMap[i][j] != 0 && active[i][j] == Board.VISUAL_EMPTY_AREA){
active[i][j] = strengthMap[i][j] == Tetromino.STRENGTH_MANA ? Board.VISUAL_MANA_ORB : ViewController.getRandomVisual();... |
0281a1dc-d20d-47f4-8640-ec9aed57661c | 9 | private AccessToken requestAccessToken(Map<String, String> params)
throws AuthorizationException {
try {
HttpRequest request = HttpRequest.post("https://graph.renren.com/oauth/token");
request.form(params);
int statusCode = request.code();
String body ... |
47b8db37-0fa3-4a2f-a776-3bf02a47a994 | 6 | final public String literalPredicate() throws ParseException {
Token argument=null;
// LiteralVariable lv=null;
String predicate=null;
if (jj_2_30(7)) {
argument = jj_consume_token(NUMBER);
} else if (jj_2_31(7)) {
predicate = literalFunction();
} else if (jj_2_32(7)) {
argument = jj_con... |
8c4c17f7-59ad-4ba2-a171-069fb2f5b62a | 0 | public String getToolTip() {
return "De-expressionify Transition";
} |
807a3c48-0a78-4a6c-b914-5b749aae161f | 9 | public void useTransportableTool(State state, ObjectInstance tool, ObjectInstance container, String agent) {
if (ToolFactory.isEmpty(tool)) {
Set<String> contentNames = ContainerFactory.getContentNames(container);
Set<String> includes = ToolFactory.getIncludes(tool);
Set<String> excludes = ToolFactory.getExc... |
8183603d-fb2e-4577-a98d-673a22449a6b | 9 | public int search(int[] A, int target) {
if (A == null || A.length == 0)
return -1;
int leftIndex = 0;
int rightIndex = A.length - 1;
int middle;
while (leftIndex <= rightIndex) {
middle = leftIndex + (rightIndex - leftIndex)/2;
... |
7fe4626a-d8e1-47a1-96cf-bf9513b788af | 9 | public int method304(int i, int j, int k, int l)
{
Ground class30_sub3 = groundArray[i][j][k];
if(class30_sub3 == null)
return -1;
if(class30_sub3.obj1 != null && class30_sub3.obj1.uid == l)
return class30_sub3.obj1.aByte281 & 0xff;
if(class30_sub3.obj2 != null && class30_sub3.obj2.uid == l)
return cl... |
a81d3ff4-e6b0-42ef-afcf-360d5bfe7edd | 8 | public void step(SimState state) {//2 prey in same state with mating motor neuron firing
final WallBuilding wb = (WallBuilding)state;
if((wb.prey.allObjects.size() < WallBuilding.PREY_CAP) && WallBuilding.DO_PREY_CAP){//this is a bit harsh, but I need it! AND BROKEN
for(int x = 0; x < WallB... |
b9b941c4-70d1-4e38-b584-fe5545c4e8c1 | 7 | private static void setPropertyFromString(String line) {
line = line.trim();
/* ignore blank lines */
if (line.equals("")) return;
/* ignore comments */
if (line.startsWith("//")) return;
if (line.startsWith("##")) return;
/* ignore lines that do not have a space in them */
if (line.indexOf(" "... |
c43e41eb-f70d-418b-a707-c579c51494d4 | 9 | void processResponseHeaders(Map<String, List<String>> resHeaders) {
for (Map.Entry<String, List<String>> entry : resHeaders.entrySet()) {
String name = entry.getKey();
if (name == null)
continue; // http/1.1 line
List<String> values = entr... |
4b75494a-7117-4ad1-9dbf-18c19d54f21e | 7 | public static <T extends DC> Set<Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>>> getAllPhis(Set<Pair<PT<Integer>,T>> baseSetA,
Set<Pair<PT<Integer>,T>> baseSetB)
{ Set<Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,... |
f9b97429-d13e-4466-b995-8038fa291111 | 9 | public static Direction getOppositeDirection(Direction d) {
switch(d) {
case SOUTHWEST : return NORTHEAST;
case SOUTH : return NORTH;
case SOUTHEAST : return NORTHWEST;
case WEST : return EAST;
case NONE : return NONE;
case EAST : return WEST;
case NORTHWEST : return SOUTHEAST;
case NORTH : return SOU... |
b8473c03-0436-46ca-9e5d-db15bb6a65a8 | 6 | @DELETE
@Path("/{idres}")
public void deleteResena(@PathParam("idres") String idres) {
String username;
Connection conn = null;
Statement stmt = null;
String sql;
ResultSet rs;
try {
conn = ds.getConnection();
} catch (SQLException e) {
throw new ServiceUnavailableException(e.getMessage());
}
... |
ff063649-4881-489e-9ac1-9f4ceca9977a | 1 | public int saveUser(User userToSave) {
try {
// Erforderlicher SQL-Befehl
String sqlStatement = "INSERT INTO bookworm_database.users VALUES (default, '"
+ userToSave.getUserName()
+ "', md5('"
+ userToSave.getUserPassword()
+ "'), '"
+ userToSave.getUserRole() + "');";
// SQL-Befeh... |
2324cfbe-20db-420a-a5fd-05e213dce3f0 | 5 | public boolean equals(Object obj)
{
if (obj == this)
{
return true;
}
if (obj != null && obj instanceof Position)
{
Position other = (Position)obj;
if (super.equals(obj) && other.z == z)
{
return true;
}
}
return false;
} |
c3118ff8-1b85-4b85-b732-fa42a25709f1 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Resource other = (Resource) obj;
if (price != other.price)
return false;
if (resourceType == null) {
if (other.resourceType != null)
... |
d1a6e36b-682d-4028-858b-ae0e56c0d5ce | 1 | public Type getComponent() {
return dims == 1 ? (Type)component : new MultiArrayType(component, dims - 1);
} |
60cb18b1-2c28-402c-9e9c-fa89034c68ec | 5 | public byte[] read(long pos,int length){byte[] b=new byte[length];
try{if(VRAM){long[] disk;long end=pos+length;int r=0;
System.out.println("Read Ram Address: Position="+pos+",End="+end+"");
while(pos<end){disk=VraToPh(pos);
System.out.println("Reading Section: Position="+disk[0]+",End="+(disk[0]+disk[1])+"");
if(di... |
112e71ba-b240-4a36-a847-9602daf05566 | 8 | int numroots(int np, poly sseq[], int at[])
{
int atposinf, atneginf, s;
double f, lf;
atposinf = atneginf = 0;
/*
* changes at positive infinity
*/
lf = sseq[0].coef[sseq[0].ord];
for ( s =... |
99590679-7ab1-4541-b5c4-5e33ac26d999 | 0 | @Override
public boolean supportsAttributes() {return true;} |
59649e21-f3ca-4c7a-aa09-f4fa79f20ffa | 9 | public void create(TipoFreio tipoFreio) {
if (tipoFreio.getConfiguracaoFreioCollection() == null) {
tipoFreio.setConfiguracaoFreioCollection(new ArrayList<ConfiguracaoFreio>());
}
if (tipoFreio.getConfiguracaoFreioCollection1() == null) {
tipoFreio.setConfiguracaoFreioCol... |
8fa9c7fc-3bbb-43be-8c55-80a60ae7d6d2 | 5 | @Test
public void depth0opponent1() {
for(int i = 0; i < BIG_INT; i++)
{
int numPlayers = 2; //assume/require > 1, < 7
Player[] playerList = new Player[numPlayers];
ArrayList<Color> factionList = Faction.allFactions();
playerList[0] = new Player(chooseFaction(factionList), new SimpleAI());
... |
83acb4a4-6405-4b3c-b100-8d6dc7a68ee3 | 5 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
BeanFilter_train bf_train = null;
try {
bf_train = new BeanFilter_train();
if("yahoo".equals(request.getParame... |
d043848b-b225-419c-a383-60c183f5a54c | 6 | static private boolean jj_3R_10() {
if (jj_scan_token(ACTOR)) return true;
if (jj_scan_token(TYPEIDENT)) return true;
if (jj_scan_token(LBRACE)) return true;
Token xsp;
if (jj_3_4()) return true;
while (true) {
xsp = jj_scanpos;
if (jj_3_4()) { jj_scanpos = xsp; break; }
}
re... |
5a99966b-dc7a-4c72-a362-175008975242 | 0 | public EncoderDrive(double goal, double driveSpeed){
_goal = goal;
_driveSpeed = driveSpeed;
requires(Robot.driveTrain);
} |
bab4d79f-b958-46c6-b448-bbda93056830 | 4 | public void book_search(Member loginmem) throws Exception{
int a=0;
//ִܿµ & ԷѴܾԵȸ絵Ѵ.
String newtitle;
do{
System.out.println("*******************************************************************");
System.out.print(":");
newtitle = scan.next();
if(bookcollect.getequal2(newtitle)==1){
a=1;... |
44b1c9a6-139b-430d-8d6b-2f9881e07d4e | 7 | static private int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 40:
return jjStopAtPos(0, 12);
case 41:
return jjStopAtPos(0, 13);
case 42:
return jjStopAtPos(0, 7);
case 43:
return jjStopAtPos(0, 5);
case 45:
return jjStopAtPos(0,... |
9c4e67b4-6f65-483f-96ca-d71ba8cbe10d | 1 | public int puntajeTotal(){
int acum =0;
for(Pregunta pregunta: preguntas)
{
acum= acum + pregunta.puntaje;
}
return acum;
} |
57f04b8e-f853-4162-b3d9-3f958b20c784 | 0 | public Transition copy(State from, State to)
{
return new MooreTransition(from, to, getLabel(), getOutput());
} |
5f70c0bb-77a8-4b46-84d4-6a9aa48707cb | 1 | public void winn() {
SoundManager.play("win");
hasWinn = true;
player.setWinn(true);
new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
getStageManager().setStatge(StageManager.STAGE_SHOP, null);
}
... |
e9e79b76-5a12-456d-9025-605fe98302e3 | 9 | public void accessCell(int accessType,int x,int y)
{
if (accessType == 0) { //reveal
if (!cells[x][y].getRevealed() && !cells[x][y].getFlagged()) { //note if a cell is flagged in cannot be revealed until unflagged
score--;
cells[x][y].setRevealed(true);
if (cells[x][y].getMined()) { //this is the... |
305eeb43-077b-4d30-a40c-2532c0d104ec | 3 | public CtMember compile(String src) throws CompileError {
Parser p = new Parser(new Lex(src));
ASTList mem = p.parseMember1(stable);
try {
if (mem instanceof FieldDecl)
return compileField((FieldDecl)mem);
else {
CtBehavior cb = compileMeth... |
8d63eb17-af2d-44b8-aa27-368751eb4432 | 6 | final boolean method2500(int i, int i_0_) {
if (!((Class318_Sub3) this).aBoolean6401)
return false;
int i_1_ = (((Class318_Sub3) this).anInt6406
- ((Class318_Sub3) this).anInt6405);
int i_2_ = (((Class318_Sub3) this).anInt6404
- ((Class318_Sub3) this).anInt6402);
int i_3_ = i_1_ * i_1_ + i_2_ * i_2... |
fe0ce621-a75a-4b6a-bbb3-d656096cd158 | 2 | public CSVObject addLine() {
//protect against multiple calls to addLine()
if(actLine != null && lastIndex <= 0)
return this;
return addLineForced();
} |
4ad871f7-fcf5-4fcc-9715-6f25ff47f7d6 | 7 | public static boolean eat(final Player player, Item item, int slot) {
Food food = Food.forId(item.getId());
if (food == null)
return false;
if (player.getFoodDelay() > Utils.currentTimeMillis())
return true;
if (!player.getControlerManager().canEat(food))
return true;
String name = ItemDefinitions.ge... |
378245d3-b267-47ce-93f2-564f2fd1d531 | 7 | private void parseRxResponse() throws IOException {
//TODO untested after 64-bit refactoring
if (apiId == ApiId.RX_16_RESPONSE || apiId == ApiId.RX_64_RESPONSE) {
if (apiId == ApiId.RX_16_RESPONSE) {
response = new RxResponse16();
((RxBaseResponse)response).setSourceAddress(this.parseAddress16());
} ... |
58dafbe4-6b64-4295-8f84-237394a6bf2f | 3 | private void getPicturesPath(DefaultListModel<String> list) {
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Chose JPEG file");
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
if(ProjectMainView.actualFolder!=null)
chooser.setCurrentDire... |
0cd037f4-b259-4815-95ba-c4f10050381f | 3 | public void sortColors(int[] A) {
int i = 0;
int mm = -1;
int nn = A.length;
while(i < nn){
if(A[i] == 0){
// do need ++i actually because in the next iteration the 3rd condition would work
// A[i++] = A[++mm];
A[i] = A[++mm];
... |
e99e51fe-268d-4440-8f9d-ca6acda9810d | 0 | @Override
protected void setColoredExes() {
ParametricCurve besie = new BesieCurve(allex);
coloredEx = besie.Calculation();
} |
8da507ca-2031-4d34-bc67-3e63f8b88943 | 7 | public String [] getResultNames() {
int addm = (m_AdditionalMeasures != null)
? m_AdditionalMeasures.length
: 0;
int overall_length = RESULT_SIZE+addm;
overall_length += NUM_IR_STATISTICS;
overall_length += NUM_WEIGHTED_IR_STATISTICS;
overall_length += NUM_UNWEIGHTED_IR_STATISTICS;
... |
47f38a58-d08e-4a7c-94ba-05f6a7e2a94b | 0 | public GameSettingsDialog(Campaign campaign)
{
super();
setTitle("Ustawienia widok\u00F3w");
this.setSize(new Dimension(600, 262));
this.campaignRef=campaign;
this.setVisible(true);
this.setResizable(false);
getContentPane().setLayout(new FlowLayout());
background1Label=new JLabel("T\u0142o 1");
b... |
f83a2c17-0021-4bc2-ac9e-df0dde86a182 | 5 | public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_SPACE) {
fire();
}
if (key == KeyEvent.VK_LEFT) {
dx = -1;
}
if (key == KeyEvent.VK_RIGHT) {
dx = 1;
}
if (key == KeyEvent.VK_UP)... |
dca6eff5-0561-468c-88ed-ec79165e9b40 | 6 | public void init() {
for (int i = 0; i < TEST_SIZE; i++) {
graph[i] = new NonDirectedGraph<Integer>();
}
Scanner scanner = new Scanner(getClass().getResourceAsStream("/kargerMinCut.txt"));
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
... |
d2f38e72-4bf9-49ca-839f-1e3933f2f250 | 7 | public int getTotalCount(int itemID) {
int count = 0;
for (int j = 0; j < c.playerItems.length; j++) {
if (Item.itemIsNote[itemID+1]) {
if (itemID+2 == c.playerItems[j])
count += c.playerItemsN[j];
}
if (!Item.itemIsNote[itemID+1]) {
if (itemID+1 == c.playerItems[j])
count += c.playerIt... |
ad911f60-b8b1-40b8-9e93-c3cdb90a907c | 2 | public static long toLong(byte ... b) {
/*
long l = 0;
int len = b.length;
if (len > 0)
l += b[0];
if (len > 1)
l += ((long) l << 8 | b[1]);
if (len > 2)
l += ((long) l << 16 | b[2]);
if (len > 3)
l += ((long) l << 24 | b[3]);
if (len > 4)
l += ((long) l << 32 | b[4]);
if (len > 5)
l ... |
65821126-fc39-42c6-9149-230689f3eaa7 | 6 | /* */ @EventHandler
/* */ public void onPlayerQuit(PlayerQuitEvent event)
/* */ {
/* 61 */ if (Main.getAPI().isSpectating(event.getPlayer()))
/* */ {
/* 63 */ Main.getAPI().stopSpectating(event.getPlayer(), true);
/* 64 */ return;
/* */ }
/* 66 */ if (Main.getAP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.