method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0534afc9-3b80-464d-b35e-26d6b019934a | 6 | private void writeHashDigests(List<Boolean> digestsDefined, List<Integer> digests) throws IOException {
int numDefined = 0;
int i;
for (i = 0; i < digestsDefined.size(); i++)
if (digestsDefined.get(i))
numDefined++;
if (numDefined == 0)
return;
... |
898f4c2c-a657-49c7-a34e-25300114e8d8 | 5 | private int merge(T[] a, T[] aux,int lo, int mid, int hi)
{
// i and j is used to point to the currently processing element in the
// first and 2nd half respectively
int i = lo, j = mid + 1;
int inversions = 0;
// Copy a[lo..hi] to aux[lo..hi].
for (int k = lo; k <= hi; k++)
aux[k] = a[k];
// Merge... |
4b91b051-400a-44b0-b729-9e9b7bfab82c | 5 | @Override
public void mouseReleased(MouseEvent e)
{
if (e.getButton() == MouseEvent.BUTTON1)
{
if (down)
{
if (Hub.simWindow.loadPresetButton.isChecked())
loadPreset(file.getName());
else if (Hub.simWindow.deletePresetButton.isChecked()
&... |
2f8f30b6-59d0-4d74-a0a8-15e8c2264a37 | 5 | public static void testSolver(Solver solver, int max, HashMap<Integer, HashMap<Integer,Integer>> correct){
TiliaCollection collection = new TiliaCollection(max,42);
boolean isCorrectSolution = true;
for(int i = 1; i <= max; i++){
Tilia test = collection.getGrid(i);
Cutti... |
11f067a1-de7f-409a-a766-628513521d1c | 8 | private Collection<Record> getRecordCollection(Date from,
Date until,
String mdPrefix) {
List<Record> list = new ArrayList<Record>();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH-mm-ss");
String[] na... |
4388231f-b2ff-4bc1-a374-71e070768c34 | 9 | private static int getReturn(Class type) {
if (type.equals(Void.TYPE))
return 0xb1;
if (type.equals(Boolean.TYPE) || type.equals(Byte.TYPE)
|| type.equals(Character.TYPE) || type.equals(Short.TYPE)
|| type.equals(Integer.TYPE))
return 0xac;
if (type.equals(Long.TYPE))
retur... |
59b21b4c-3eba-4038-af9f-252a757d1797 | 0 | public void setGame(String newGame) {
game = newGame;
} |
a9722583-c86d-429b-bbac-859f51e435b7 | 3 | private void saveConfig() {
FileWriter fw;
try {
fw = new FileWriter(configFile);
if(cubeFileText.getText() != "") {
fw.write("cube\t" + cubeFileText.getText() + "\n");
}
if(saveDirText.getText() != "") {
fw.write("save\t" + saveDirText.getText() + "\n");
}
fw.close();
} catch (IOExc... |
bab7651d-2951-486a-981b-dbfd946aac98 | 2 | @Override
public void caseAExplist(AExplist node)
{
inAExplist(node);
{
List<PExprest> copy = new ArrayList<PExprest>(node.getExprest());
Collections.reverse(copy);
for(PExprest e : copy)
{
e.apply(this);
}
}
... |
965d26a4-1e45-4496-8515-4e6ecf55cc78 | 4 | public Checkout_Frame(final DefaultTableModel md, final double total) {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JLabel lblTotal = new JLabel("Total: ");
lb... |
a7316334-0b83-4342-8855-2610752aa8df | 8 | public String[] getStatCodes(Physical P, Modifiable m)
{
SLinkedList<String> codes;
if(!UseGenBuilder(P,m))
codes=new SLinkedList<String>(m.getStatCodes());
else
if(m instanceof MOB)
codes=new SLinkedList<String>(CMParms.toStringArray(GenericBuilder.GenMOBCode.values()));
else
if(m instanceof Item)
... |
55ddfa95-719b-4d15-b059-62f0272d23d1 | 1 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
protected void initComponents() {
DadosGerais = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
btnNome = new javax.swing.JLabel();
jLabel1... |
4aa30a66-1105-4833-a4bb-85b0fe666a0f | 5 | private void rotateCamera(long ticks) {
int t = 1;
if(rotate) {
mouseListener.hide();
t = -1;
}
Matrix rot = cam.getBack();
int dx = mouseListener.getDeltaX()*t;
int dy = mouseListener.getDeltaY()*t;
float ts = 0.2f * ticks;
float t... |
a8b0e822-6cdd-4adb-b770-bebf39310186 | 8 | public boolean hasNext(int column, int row, Direction dir){
switch (dir) {
case NORTH:
return row == 0 ? false : true;
case SOUTH:
return row == 9 ? false : true;
case WEST:
return column == 0 ? false : true;
case EAST:
return column == 9 ? false : true;
}
return false;
} |
dc2183ab-bcc8-45b9-82bd-cf0951637d9d | 4 | @EventHandler(priority = EventPriority.LOWEST)
public void onBlockedMobDamage(EntityDamageEvent e) {
if (!Settings.amrs) {
return;
}
if (Settings.world
|| WorldSettings.worlds.contains(e.getEntity().getWorld()
.getName())) {
final String mob = e.getEntityType().toString().toLowerCase();
if (Se... |
4ffff0d7-3731-45b1-a7e5-426d16b5e059 | 9 | void checkin() {
if(bezet == kamer.length){
System.out.println("Er zijn momenteel helaas geen kamers vrij\n");
} else {
for(int i = 0; i < kamer.length; i++) {
if(kamer[i].ruimte == true) {
System.out.print("Voornaam nieuwe gast: ");
if(scanner.hasNext()) {
voornaam = scanner.next();
... |
6716deab-0b79-4226-906a-67399d8d13c9 | 1 | public void visit_lstore(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
daa1854c-6ca8-4fec-a265-775178f2c1d0 | 0 | public static void Quicksort3way(String[] a) {
qsort3way(a, 0, a.length - 1, 0);
} |
ddfd47de-308a-4c06-ad39-28c31b77d9dc | 8 | private LegacyInstr decode_1(int word1) throws InvalidInstruction {
// get value of bits logical[13:15]
int value = (word1) & 0x00007;
switch ( value ) {
case 0x00002: return decode_BRPL_0(word1);
case 0x00004: return decode_BRGE_0(word1);
case 0x00006: return... |
f59e7c24-7b30-4cf7-9f87-be1aeadae214 | 8 | private double get2PointDirectionAngle(long x1, long y1, long x2, long y2){
long dx = x2-x1;
long dy = y2-y1;
double m = (double)dy/(double)dx;
if (dx > 0 && dy > 0){
return Math.atan(m);
}else if(dx<0 && dy>0){
return 180 + Math.atan(m);
}else if(dx<0 && dy<0){
return 180 +Math.atan(m);
}else if... |
bad3d254-8571-4955-a2d7-1e4d459c7bc5 | 2 | public void checkPassiveEffects(Player p, Fruit f)
{
for (PotionEffect effect : f.getPassiveEffects())
{
if(!p.getActivePotionEffects().contains(effect))
{
p.addPotionEffect(effect);
}
}
} |
35624d2b-9bec-40e0-ad1d-88d304512af0 | 5 | @Override
public void execute(Step.Data step) throws Exception {
// Path
String libPath = getModel().getLibpath();
if (libPath != null) {
System.setProperty("jna.library.path", libPath);
if (log.isLoggable(Level.CONFIG)) {
... |
2c330ad6-dd9d-4fe5-9108-383df30261c6 | 5 | public static int binarySearch(int element, int... array) {
// Utils.killMeIfIGetStuck();
int low = 0;
int high = array.length - 1;
int mid = (low + high) / 2;
while (high - low > 1) {
if (element == array[mid]) {
return mid;
}
... |
9040ae84-1d5c-41e4-b98f-b7e193e50d79 | 7 | @Override
public Parameter getParameter(final int parameterIndex) {
Parameter parameter;
switch (parameterIndex) {
case 0:
parameter = mode;
break;
case 1:
parameter = rate;
break;
case 2:
... |
09ee553d-d83f-4851-b3ba-44c79cf76f2a | 9 | @SuppressWarnings("unchecked")
public static void readCategories(){
ObjectInputStream inputStream = null;
ArrayList<CategoryModel> obj = new ArrayList<CategoryModel>();
try {
inputStream = new ObjectInputStream(new FileInputStream("AllCategories.ser"));
obj = null;
while((obj = (ArrayList<CategoryM... |
5294fca3-2718-44e4-9593-35a2e47197db | 5 | public static void main(String[] args) throws Exception {
final String token = args[0];
final DiskOperation operation = DiskOperation.getDiskOperation(args[1]);
if (operation == null) {
throw new IllegalArgumentException("There is no command: " + args[1]);
}
final Li... |
cee726ca-83cf-4600-9030-cd6d85d3516a | 0 | @Override
public String next() {
int position = (int) Math.floor(Math.random() * alternatives.size());
return String.format("'%s'", this.alternatives.get(position));
} |
d0ebceaf-b596-46bf-9fcd-27929c6c3296 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final JTpruPK other = (JTpruPK) obj;
if (!Objects.equals(this.IdOrder, other.IdOrder)) {
return fal... |
45c5d849-f2e5-4081-be85-4f2b3abd6d68 | 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... |
df5e93ab-2438-4a2f-8e4c-e6caaed23ea7 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected))
&&(msg.targetMinor()==CMMsg.TYP_GET)
&&(msg.target() instanceof Item)
&&(((msg.tool()==null)||(msg.tool() instanceof MOB))))
{
final MOB m... |
2b8b52da-d443-403d-b36d-4bc215df3e30 | 3 | public void draw(Graphics g, int x, int y, int width, int height){
if(img == null)
return;
at = new AffineTransform();
at.translate(x, y);
if (img.getWidth() != width) {
at.scale((double)width/(double)img.getWidth(), 1);
}
if (img.getHeight() != height) {
at.scale(1, height/(double)img.getHeight())... |
d9404eb9-07f6-4033-83a4-fb32e88353d2 | 6 | public double getMax() {
if (total_size == 0) return Double.NaN;
double max = Double.NEGATIVE_INFINITY;
if (type == Integer.class) {
for (int i = 0; i < total_size; i++) {
if (max < ((int[])vals)[i]) max = ((int[])vals)[i];
}
} else {
... |
0d44599a-9a59-4fed-ab7d-15cc49d08491 | 4 | @Override
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == conect)
{
/*NickWindow nick = new NickWindow();
try
{
nick.start();
nick.join();
// while (this.getClientNickName().equals("Default"))
{
//Thread.sleep(3000);
}
} catch (InterruptedException e1)
{
... |
fc8f9700-d81c-4022-9049-f4b207e7be0c | 1 | public void removeTab(AbstractTab tab) {
tabContainer.removeTab(tab);
if ( tabContainer.getTabCount() == 0 ) {
menuBar.toggleConnectionActions(false);
menuBar.toggleUserMenuBar(false);
menuBar.togglePanelActions(false);
}
} |
d05c3f54-be8b-4d97-9dc2-1f9ae90d4b4f | 0 | @Column(name = "FES_CEDULA")
@Id
public long getFesCedula() {
return fesCedula;
} |
d81d436a-dd85-41c4-86dd-630775c685b6 | 1 | private Flyweight innerFactory(String data) {
if (flies.containsKey(data)) {
return flies.get(data);
} else {
Flyweight fly = new ConcreteFlyweight(data);
flies.put(data, fly);
return fly;
}
} |
d85db933-3ba5-4708-85b0-15804e306543 | 3 | public static void addTask(Task task){
Session session = HibernateUtil.getSessionFactory().openSession();
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(task);
session.getTransaction().commit();
... |
11177539-6bef-4631-b65a-53f60dc0579c | 7 | private boolean validoi(String syote) {
if (syote == null) {
System.exit(0);
return false;
}
if (!h.onKahdenPotenssi(syote.length()) //Tasasivuinen ruudukko?
|| syote.length() < 3 //Liian pieni
|| syote.length() > 81 //Liian iso?
... |
1b3f4f3e-ebaf-424f-b4a0-3236274cc58c | 7 | public void getForecast() throws IOException
{
String url = API_URL + this.api + "/" + this.lat + "," + this.lon;
URL request = new URL(url);
BufferedReader br = new BufferedReader(new InputStreamReader(request.openStream()));
JsonObject forecast = JsonObject.readFrom(br.readLine());
try {
this.current... |
43920afc-6b35-46f4-a822-d2036b2fc932 | 1 | @Override
public void actionPerformed(ActionEvent e) {
Iterator it = new StationCtrl((JButton) e.getSource()).positions.iterator();
while(it.hasNext()) {
int[] coord = (int[]) it.next();
System.out.print(coord[0]+":"+coord[1]+",");
}
System.out.print("\r\n");
new StationCtrl((JButton)... |
25aee462-f018-44cd-9093-a3a6df7d4490 | 4 | public void change_board(Board b){
reset();
n_cell = 0;
BLACK_SCORE = 0;
WHITE_SCORE = 0;
for(int i=0; i<8; i++){
for(int j=0; j<8; j++){
if (b.get(i, j)==BLACK_PIECE){
board[i][j].set_value(b.get(i, j));
n_cell++;
BLACK_SCORE++;
}else if(b.get(i, j)==WHITE_PIECE){
board[i][j].s... |
cfa52e17-7899-44bc-85e6-014a3a0bc570 | 4 | @SuppressWarnings("CallToThreadDumpStack")
private String getFieldExpression(String field) {
try {
listObjectExtractors(); //>>>> Sérgio: É melhor deixá-la aqui ou movê-la para o Singleton?? <<<<
if (field != null) {
for (int j = 0; j < list.size(); j++) {
... |
341ae839-e4ae-4aae-878c-b84387da987e | 7 | @Override
public boolean equals(Object o)
{
if(o == null || !(o instanceof Champion))
return false;
Champion c = (Champion)o;
if(!locale.equals(c.locale))
return false;
if(id >= 0 && id == c.id)
return true;
if(name != null && name.equals(c.name))
return true;
//Unlikely to ever g... |
00d05932-4037-4375-a318-c845eace3c66 | 0 | public FileProtocol getProtocol() {
return this.protocol;
} |
0d1d1135-9b57-40d5-becc-b0f4f6675a4c | 2 | public WikiPage(Widget parent, String request, boolean closable) {
super(parent, request, closable);
content = new RichTextBox(Coord.z, sz, this, "", fnd);
content.bg = new Color(255, 255, 255, 128);
content.registerclicks = true;
final HWindow wnd = this;
busy = false;
callback = new RequestCallback() {
... |
3030875c-5152-44a0-846c-ef73bfdff22b | 9 | @Override
public void run() {
for (Player player : main.getServer().getOnlinePlayers()) {
if (player.getLocation().getX() < -main.radius) {
Location target = player.getLocation().clone();
target.setX(-main.radius);
if (player.isInsideVehicle()) {
... |
98c9820b-1cf0-4873-b187-a807f999d735 | 7 | public static int[] walk(Graph g, int start, int end) {
Logger logger = Logger.getLogger("fr.upem.algoproject");
int nNodes = g.nodeCount();
final int dist[] = new int[nNodes];
boolean visited[] = new boolean[nNodes];
int previous[] = new int[nNodes];
for (int node : g.getAllNodes()) {
dist[node] = -1;
... |
c97287bb-06cc-4cbf-9fd2-21623eabace1 | 9 | public void fillTableMonthBack() {
// SWAP 2, TEAM 6
// REFACTORING FOR ENHANCEMENT FROM BAD SMELL
// Primitive Obsession handled and method shortened. Now it can be maintained easier
// SWAP 1, TEAM 5
/*
* SMELL: Primitive Obsession - There are a lot of instances of primitive types that can be clean... |
6a5deec8-6e4f-471f-a9b6-39364d906630 | 6 | public static final boolean usingGoliathGloves(Player player) {
String name = player.getEquipment().getItem(Equipment.SLOT_SHIELD) != null ? player
.getEquipment().getItem(Equipment.SLOT_SHIELD).getDefinitions()
.getName().toLowerCase()
: "";
if (player.getEquipment().getItem((Equipment.SLOT_HANDS)) != ... |
8cb8bde6-19ee-4312-a253-4f63b0a9ad7b | 6 | private Composante ajouterComp(Element n) {
Composante comp;
switch(n.getNodeName()) {
case "RESISTANCE" :
double resistanceEqui = Double.parseDouble(getInfo("VALEUR", n));
int ID = Integer.valueOf(getInfo("ID", n));
... |
931e9e0d-f526-4d59-a77c-8b35f91471b5 | 0 | public void setFirstpoint(Point firstpoint) {
this.firstpoint = firstpoint;
} |
8da21edc-4153-49e7-978b-2295b34cd3c4 | 7 | public static void main(String args[]) {
label = new JLabel();
frame.setMinimumSize(new Dimension(500, 200));
frame.setBounds(100,100,450,300);
label.setText("Clients can be run now to play the game. To quit, press end game.");
frame.setDe... |
d75af17c-7170-46b7-b7c0-f02f65a6edd5 | 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 fe... |
7ade5e99-da65-4869-8954-2453a84caa02 | 3 | public Configuration loadEmbeddedConfig(final String resource) {
final YamlConfiguration config = new YamlConfiguration();
final InputStream defaults = this.getResource(resource);
if (defaults == null) return config;
final InputStreamReader reader = new InputStreamReader(defaults, Custo... |
09653eec-b5a6-481e-bc87-ac8a84ae3f6f | 4 | private String[][] getCoastLineArray() {
String[][] coastLineArray = new String[136][];
File coast = new File("coast.txt");
File coastPolygon = new File("coastPolygon.txt");
int i = -1;
int j = 0;
try {
Scanner sc1 = new Scanner(coastPolygon);
for(int k = 0; sc1.hasNextInt(); k++) {
int x = sc1.ne... |
35d34617-7807-4ac4-93b7-7d8336d67e79 | 8 | static final public void Entry() throws ParseException {
Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SERVICE_NAME:
t = jj_consume_token(SERVICE_NAME);
currName=t.image;
break;
case SERVICE_PORT:
t = jj_consume_token(SERVICE_PORT);
... |
fecd7ae8-058a-40c7-a986-4fc031051ce7 | 1 | public void init() {
if (mySettingsController.isValid()) {
initGame();
}
} |
4c06f703-909d-401c-9fef-7d18c4669efc | 6 | public int getNextHeading() {
while (true) {
Node nextNode = getNextNode();
if (nextNode == null) {
destination.setStatus(3);
continue;
}
System.out.println("ND:" + nextNode.getCordinates()[0] + "," + nextNode.getCordinates()[1] + " > " + nextNode.getStatus());
if (nextNode.getCordinates()[0] >... |
529c6ba9-8a11-4cd4-ae12-4788ebc1eaf1 | 8 | public void loadRecipes() throws URISyntaxException {
URL fileUrl = getClass().getResource("res/recipes.csv");
File recipeFile = new File(fileUrl.toURI());
DataAccessObject.LOGGER.log(Level.SEVERE,"File not found.");
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(recipeFile)... |
75c12416-2ec8-4b7a-9b85-413e35116192 | 1 | public void makeInitializer(Type type) {
if (type.getHint().isOfType(getType()))
isInitializer = true;
} |
dab30f6d-dd61-4a33-842a-95cde99d500e | 3 | private int readID3v2Header(InputStream in) throws IOException
{
byte[] id3header = new byte[4];
int size = -10;
in.read(id3header,0,3);
// Look for ID3v2
if ( (id3header[0]=='I') && (id3header[1]=='D') && (id3header[2]=='3'))
{
in.read(id3header,0,3);
in.read(id3header,0,4);
size = (int) (id3he... |
d9a9a5dd-7089-41c4-8346-9f8da532ceaa | 3 | @Override
public Iterable<PlanTicket> filter(Iterable<PlanTicket> source,
final TicketPoolQueryArgs args) throws Exception {
return Queries.query(source).where(new Predicate<PlanTicket>(){
@Override
public boolean evaluate(PlanTicket ticket) throws Exception {
SalableRange range = ticket.getSalableRan... |
ed696e89-132e-4ea0-b3b7-908be66998c9 | 2 | public static Browser valueOf(short id)
{
for (Browser browser : Browser.values())
{
if (browser.getId() == id)
return browser;
}
// same behavior as standard valueOf(string) method
throw new IllegalArgumentException(
"No enum const for id " + id);
} |
606cb8f2-4950-42ad-be0b-9ceba4393819 | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
ClientView window = new ClientView(null, null);
window.frmProgrammingContestSystem.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
b26bcbd2-2597-46ef-b5f2-27aaff7c8fbc | 4 | public ArrayList<Double> simulaPerRunReplicati() {
/* Simula fino al numero di job richiesti. */
while (this.getTempiUscita().size() < this.getJobTotali()) {
Event next = this.getCalendar().get_next();
this.setClock(this.getCalendar().get_next_time(next));
switch (ne... |
288c6b25-374e-4cc3-ac87-b9573ebfdc4c | 7 | @Override
public void visitClass(XTreeClass _class) {
XCodeGen code = getCodeExpr(_class);
XCompiledPart part = null;
if (_class.name != null) {
part = new XCompiledPartVar(_class.name, scope, _class.name, _class.access);
part.setup(this, code);
}
if (_class.superClasses == null) {
code.addInstructi... |
cc0461c8-54d5-4161-a874-0a174c62fad4 | 4 | @Override
public void map(String key, String value, Context context) {
String[] toks = value.split(" ");
int count = 0;
for(String s : toks) {
context.write(s, "1");
count++;
//Artificial delay
if(DEBUG && count % 100 == 0) {
try {
//50 ms delay for every 300 words
Thread.sleep(50);
... |
7a7ac437-60f5-490d-a74d-9e5ab868e638 | 9 | private int calculate(int currentTotal, Token currentOperation) {
if (expression.isEmpty()) {
return currentTotal;
}
Token token = expression.remove();
switch (token.token) {
case (ProjectConstants.SIZE):
if(currentOperation==null) {
... |
52c7e110-d005-4e10-8724-d227779013a8 | 9 | public boolean canIgo(int d){
/*** If valid direction */
if(d>3) return false;
/*** Than we check for map collision */
if(d == CONST.NORTH && !world.isSolid( (int)p.x, (int)p.y-1))
return true;
if(d == CONST.EAST && !world.isSolid( (int)p.x+1, (int)p.y))
return true;
if(d == CONST.SOUTH && !world.isS... |
cdb430f4-282f-4d01-a13c-1978accad4db | 7 | public static int getMinElement(int l, int r) {
if (l > r)
return array[0];
if (l == r) {
return array[l];
}
int mid = (l + r) / 2;
if (mid < r && array[mid + 1] < array[mid]) {
return array[mid + 1];
}
if (mid > l && array[mid] < array[mid - 1]) {
return array[mid];
}
if (array[mid] > ... |
71c273a7-4af9-4239-9944-94ec274385f1 | 5 | public void move(){
super.move();
if(this.clock%10==0){
if(this.clock%50 == 0){
this.angle = Math.PI*3/2;
}
PlayerShip p = game.getPlayer();
double dFromPlayer = Math.sqrt(Math.pow(p.x-x, 2)+Math.pow(p.y-y, 2));
if(dFromPlayer < 128){
this.angle = Math.PI*3/2;
this.velocity... |
c94c2d6c-87f9-4b77-aacf-1666edf3b3c8 | 0 | public static void print(Object obj) {
System.out.println(obj);
} |
b431db10-1b4a-45e3-943f-3d08a9850182 | 9 | private boolean[] getMovementArray(Translation trasl) {
boolean[] out = { false, false, false, false };
switch (trasl) {
case EAST:
out[0] = true;
break;
case NORTH:
out[2] = true;
break;
case NORTH_EAST:
out[2] = true;
out[0] = true;
break;
case NORTH_WEST:
out[2] = true;
out[1]... |
7816025e-6727-44e6-9e75-77fb8a6d0793 | 2 | public void setCarte(final int[][] carte)
{
for (int i = 0; i < carte.length; i++) {
for (int j = 0; j < carte[i].length; j++) {
this.carte[i][j] = carte[i][j];
}
}
} |
2f1b15fc-8a80-42d4-ab3e-ac7dfb3a7cbd | 2 | @Override
public void valueChanged(ListSelectionEvent e) {
if (e.getSource() == orderList) {
// check if order list is empty
if (orderList.getSelectedIndex() > -1) {
// separate the text in the selected list item
String[] values = orderList.getSelectedValue().split("\\t");
// JOptionPane.showMessag... |
fc18afd0-d0d8-45a1-b3b6-8147844f7140 | 3 | public synchronized String getPlayerChoice(QuizServer quizAccess){
List<Integer> quizIdList = new ArrayList<Integer>();
String playerChoice="";
try{
System.out.println("");
System.out.println("*****Player Client Main Menu*******");
System.out.println("********Please Select One*********");
System.ou... |
11a7a800-7efc-4e85-a5c7-2a6d879f0c33 | 2 | public void setTipoIndice(Tipo tipoIndice) throws SemanticError {
if(tipoIndice != Tipo.INTEIRO && tipoIndice != Tipo.CARACTERE)
throw new SemanticError("O tipo do índice deve ser Inteiro ou Caracter");
this.tipoIndice = tipoIndice;
} |
3cfa3aeb-61cd-4c1d-880e-8b5abe0601e3 | 0 | public int getAge() {
return age;
} |
31e68007-b6f8-40ac-9239-bfd081df807f | 8 | @Override
public String getColumnName(int col) {
switch (col) {
case COLUMN_SELECTED:
return "Selected";
case COLUMN_NAME:
return "Name";
case COLUMN_VERSION:
return "Version";
case COLUMN_SIZE:
r... |
dcc71965-c981-45ca-acfa-32f29c0a7317 | 0 | public void createNewCustomer(Customer customer) {
this.em.persist(customer);
} |
ac5180c3-70f9-4361-982c-b9de2e4cae2f | 4 | @Override
public void run() {
//hack to make server multithreaded
if(server==null) {
try {
server = new ServerSocket(6015);
} catch (IOException e) {
e.printStackTrace();
}
while(true) {
try {
//accept connection and create new player
Socket newSocket = server.accept();
newSo... |
274c8cd6-c58f-4d5e-8e1d-57c942ac2564 | 4 | 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... |
f2036a54-5027-4f43-a36a-3e6f127c70d7 | 4 | public void attacking() {
if (getDistanceToTarget() > SEEKING_TO_ATTACKING_DISTANCE) {
setState(STATE_SEEKING, "distance to " + target + " is outside attacking distance while attacking");
return;
}
if (isGunLoaded())
attackTarget();
if (!isReadyToFire()) {
setState(STATE_RETREATING, "gun is jammed o... |
892c98e6-1999-4e07-856e-2d7302931899 | 4 | public void TestAlterExistingAF()
{
// file has 7 columns, 2 of which have autofilters set
book = new WorkBookHandle( wd + "testAutoFilter-test1.xls" );
try
{
sheet = book.getWorkSheet( 0 );
AutoFilterHandle[] afs = sheet.getAutoFilterHandles(); // get handle to existing AutoFilters
// initial asse... |
4b4be966-3761-4f05-be0a-ce9905f0f972 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((rogueLimb!=null)
&&(affected instanceof MOB))
{
if(rogueLimb.location()!=((MOB)affected).location())
{
((MOB)affected).location().bringMobHere(rogueLimb,false);
rogueLimb.setVictim((MOB)affected);
}
if((rogueLimb.amFollowing()... |
ba0a90b3-21b3-4dad-800a-ad4ff25e5573 | 2 | public static Memory getMemoryFromId(int id) {
for (Memory m : memoryOptions) {
if (m.getSettingsId() == id) {
return m;
}
}
return DEFAULT_MEM;
} |
631faf2a-6804-431e-9d5b-ec5aab3dd0f2 | 8 | public void updateTrees(double dT){
for(int i = 0; i < trees.size(); i++){
trees.get(i).getCell().adjustSaturation(-0.005f); // Trees absorb some of the water in the ground just by existing
int closeNeighborsCount = 0;
for(int j = 0; j < trees.size(); j++){
if... |
c420163b-948e-48ee-ae8d-3b001b4cccf4 | 7 | public boolean nextSymbol(int in)
{
if(in == '\n')
{
this.nextLine();
return false;
}
else
{
this.column++;
}
this.nowC = (char) in;
// This is useful for 'pre'-block parsing. (NYI!)
if(!this.pre)
{
if(this.nowC == '\t')
{
this.nowC = ' ';
}
... |
12f6daa7-2e33-4133-bc28-228febc38920 | 7 | @Override
public String toString()
{
boolean set = false;
StringBuilder sb = new StringBuilder();
int baseRow = -1;
sb.append("<table");
if ( this.depth > 0 )
{
String localId = RandomId.getId( 32 );
sb.append(" id=\"");
sb.appe... |
f2dce1a8-e72f-4654-ab85-eedd123c05f6 | 8 | public final static String cleanBit(String s)
{
if(s.isEmpty())
return s;
if((s.charAt(0)==' ')||(s.charAt(s.length()-1)==' '))
s=s.trim();
if(s.length()>=2)
{
if(s.charAt(0)=='\'')
{
if(s.charAt(s.length()-1)=='\'')
return s.substring(1,s.length()-1).replace('\'','`');
return s.substr... |
d6fea90c-4ed3-4022-a805-1c693c59d19d | 1 | private RouterPacket CreatePacket()
{
//holds the packet created
RouterPacket pck = null;
//create byte buffer with data
byte[] buf = CreateData();
try
{
//make the packet
pck = new RouterPacket(buf,buf.length,InetAddress.getB... |
190a1f96-c6e8-4b03-b876-eeeff4fe3109 | 3 | private double evaluate(Dataset dataset, Filetype filetype) throws IOException {
int total_labels = 0;
int correct_labels = 0;
BufferedReader data = new BufferedReader(new FileReader(DATA_DIRECTORY_PATH + dataset.NAME + "." + filetype.FLAG));
BufferedReader prediction = new BufferedReader(
... |
05a9ef83-1fc7-4ee9-a32e-47b335662d58 | 3 | @Override
public User getUser(int id) throws SQLException {
User searchedUser = null;
Session session=null;
try{
session=HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
searchedUser = (User)session.get(User.class, id);
session.getTransaction().commit();
}catch(Except... |
4f127874-2f8e-4eaf-8c1f-c3164e4a54df | 7 | public int excluir() {
int linhasAfetadas = 0;
StringBuilder builder = new StringBuilder();
// todos os atributos
String[] atributosNome = getNomeDosAtributosDaSubClasse();
Object[] atributosValor = getValorDosAtributosDaSubClasse();
// atributos PRIMARY KEYS NAO NULOS
List<String> atributosNome_PK_NotN... |
2a14628b-873d-4779-93df-bb163e2448e8 | 0 | public Fraktion getFraktion() {
return this.fraktion;
} |
bfd3c8b5-c3bd-4258-81c5-8559909cd157 | 7 | public synchronized void relayToOthers(RMIMessageWithSource msg)
throws RemoteException {
// TracerInfo.newInfo("relayToOthers", this);
// TracerInfo.newInfo("From: " + msg.getSource(), this);
if(!msg.getType().equals("point"))
aListener.appendMsg("relayToOthers" + " From: " + msg.getSource() + " " + msg.getT... |
79f69756-de2a-4d09-9ca8-a165d385c189 | 7 | public boolean spewPRGBankDIFF(PrintStream outStream, int offset, byte inputData[], byte inputData2[], Component parentComponent){
if(inputData.length != INES_ROM_INFO.PRG_BANK_SIZE || inputData2.length != inputData.length ){
System.err.println("Only able to disassemble individual PRG banks ");
... |
61ae0e46-14cb-42ad-b257-cb6c981e5145 | 0 | public static File getLastFileOpened() {
return lastFile;
} |
63772d01-be1c-4d57-9b12-d9d179403df7 | 8 | protected void handleConsumerFoundResponse(long threadId, Address address) {
final Runnable runnable = _awaitingConsumer.poll();
// This is a representation of the server side owner running our task.
Owner owner;
if (runnable == null) {
owner = new Owner(address, threadId);
... |
9d90f59d-74f9-4d8b-a04a-77cb7195d49b | 6 | public void deplacement() {
assert (inited);
if (pointd == taille - 1) {
// si on a atteint la fin de la trajectoire
if (onReverse) {
reverse = true;
initialise(pointd, (pointd - 1) % taille);
// on rebrousse chemin
}
} else if (pointd == 0) {
if (onReverse) {
reverse = false;
init... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.