method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9dce8cfa-38cd-4f87-b3d1-68b02128a779 | 5 | public ExtDecimal dec() {
if (type == Type.NUMBER) {
return add(new ExtDecimal(-1));
} else if (type == Type.POSITIVEZERO) {
return MINUSONE;
} else if (type == Type.NEGATIVEZERO) {
return MINUSONE;
} else if (type == Type.INFINITY) {
retur... |
f0971e17-db88-480a-ad40-89241170aa61 | 2 | public void averge(){
int grade;
int totalgrade;
int averagegrade = 0;
int counter;
counter=0;
totalgrade=0;
grade=0;
Scanner s = new Scanner(System.in);
System.out.println("Enter the grade or -1 to quit:");
grade=s.nextInt();
while(grade!=-1){
totalgrade=totalgrade+grade;
System.out.println... |
880492f6-327b-491d-8765-860c74387a02 | 1 | boolean checksum( String sentence, String checksum )
{
int cs = 0;
for( int i = 0; i < sentence.length(); i++ )
cs ^= sentence.charAt(i);
//checksums match?
return Integer.parseInt( checksum, 16 ) == cs;
} |
f4ab2a35-3ba3-4042-adb4-86a0aa05e364 | 1 | private void initPatients(int totalTime) {
int time = 0;
while (time < totalTime) {
Patient p = new Patient(this.patients.size(), time);
this.patients.add(p);
time += this.generateNextCustomerEntranceInterval();
}
} |
87d86607-78c5-4788-bf26-f71f0cca1981 | 0 | private EditorPane createEditor(final Component panel) {
final SelectionDrawer drawer = new SelectionDrawer(dfa);
EditorPane editor = new EditorPane(drawer, new ToolBox() {
public java.util.List tools(AutomatonPane view,
AutomatonDrawer drawer) {
java.util.List tools = new java.util.LinkedList();
to... |
690e581f-365b-42a9-b5c6-e3b89d5e8b76 | 8 | public void availableSlavesPolicy (int availableslaves) {
System.out.println("availableSlavesPolicy");
int pending = pendingVMs.size();
int numberofslaves = resourcePool.size();
if (availableslaves+pending < 0.3*(numberofslaves) && numberofslaves+pending < maximumslaves) {
launchVMs(1);
} else if (availabl... |
de7484dc-05bf-46ec-b9f6-7fbc8aa93887 | 9 | public static String rotateLeft(String str, int rotatePos){
if( rotatePos < 0 ){
throw new IllegalArgumentException("rotatePos < 0");
}
if( str == null ){
throw new IllegalArgumentException("Can't rotate NULL string");
}
final int strLength = str.length();
while( rotatePos > strLength ){... |
d27db53c-bbfd-409c-a03a-fc3c51bc1700 | 4 | private void loadProperties(String path) {
ResourceBundle rbHome = ResourceBundle.getBundle(path);
Enumeration<String> actionEnumHome = rbHome.getKeys();
while(actionEnumHome.hasMoreElements())
{
String command = actionEnumHome.nextElement();;
String className = rbHome.getString(command);
try {
Cla... |
bedce331-290a-472f-a7da-2037e27cff3a | 8 | private boolean move(float a_xa, float a_ya)
{
while (a_xa > 8)
{
if (!move(8, 0)) return false;
a_xa -= 8;
}
while (a_xa < -8)
{
if (!move(-8, 0)) return false;
a_xa += 8;
}
while (a_ya > 8)
{
... |
c7bc38b5-17f9-412c-9016-fef265e71489 | 4 | final public CycList xorForm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException {
CycObject sent = null;
CycObject sent2 = null;
CycList val = new CycList();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case XOR_CONSTANT:
jj_consume_token(XOR_CONSTANT);
b... |
5bffb7c2-f22a-48f4-8bfc-dbb471256bbe | 6 | public static List<Map<Integer, Double>> startLdaCreation(BookmarkReader reader, int sampleSize, boolean sorting, int numTopics, boolean userBased, boolean resBased, boolean topicCreation, boolean smoothing) {
timeString = "";
int size = reader.getBookmarks().size();
int trainSize = size - sampleSize;
Stopwa... |
37b9c439-b6ba-45ba-bc2b-d6dcc9174367 | 1 | private static void evaluateAndSavePredictions(Predictor predictor,
List<Instance> instances, String predictions_file) throws IOException {
PredictionsWriter writer = new PredictionsWriter(predictions_file);
// TODO Evaluate the model if labels are available.
AccuracyEvaluator e = new AccuracyEvaluator();
Sy... |
a67db33b-e44f-48aa-8c68-50acb17f2d31 | 8 | int serialisePair( byte[] bytes, int p, int setSize, int dataOffset,
int dataTableOffset, int parentId ) throws MVDException
{
try
{
int oldP = p;
int flag = 0;
if ( parent != null )
flag = CHILD_FLAG;
else if ( children != null )
... |
485204b8-f5ea-4aa8-a58e-9cea682340ad | 8 | public static void write(Map<?, ?> map, File file) {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(file));
for (Map.Entry<?, ?> entry : map.entrySet()) {
writer.write(entry.getKey() + "=" + entry.getValue() + System.lineSeparator());
}
} catch (IOException e) {
... |
a649b369-9884-48e9-9ea1-e56c3d834716 | 3 | @Override
public void delete(Sondage obj) {
PreparedStatement pst = null;
try {
pst = this.connect().prepareStatement("DELETE FROM Sondage where id=?;");
pst.setInt(1, obj.getId());
pst.executeUpdate();
System.out.println("suppres... |
1ccd289b-4520-4d00-881a-e5136c037bcc | 1 | private void updateWeights(){
//update the weights matrix based on the decisions made in the round
for (Decision d: myDecisions)
weights[d.getSlot()][d.getCard()]++;
} |
7ee64724-df18-4b2b-84fa-cd3a2cda9693 | 9 | public void compress(long maxDelta) {
long[] bandBoundaries = computeBandBoundaries(maxDelta);
for (int i = this.numTuples - 2; i >= 0; i--) {
if (this.summary[i].delta >= this.summary[i + 1].delta) {
int band = 0;
while (this.summary[i].delta < bandBoundaries... |
a3dd8ed4-3b99-474c-a1b5-7df8a051434f | 9 | public static void listen() {
listener = new Thread() {
@Override
public void run() {
try {
while (!isInterrupted()) {
if (rxSock == null || rxSock.isClosed()) {
rxSock = new ServerSocket(receivePort);
}
try {
waiting.add(rxSock.accept());
// Handle messag... |
29fddc3d-f9df-4f9c-9615-ed0076020a10 | 5 | public ObjectInstantiator newInstantiatorOf(Class type) {
if(!Serializable.class.isAssignableFrom(type)) {
throw new ObjenesisException(new NotSerializableException(type+" not serializable"));
}
if(JVM_NAME.startsWith(SUN)) {
if(VM_VERSION.startsWith("1.3")) {
return new ... |
6e541fb2-d92e-4400-9b94-5754e693bc53 | 4 | public ParkerPaulTime(String time) {
error = null;
String[] splitTime = time.split(":");
if (splitTime.length != 2) {
error = "Invalid or No separator entered";
return;
}
if (!applyHour(splitTime[0])) {
return;
}
if (!validate... |
0844d80c-59c3-4c08-a2a3-fe92a7a1df6e | 7 | private void extractOperator(Class<? extends IOperatorToken> operatorClass) {
Stack<Integer> positions = new Stack<Integer>();
// find operator positions
for (int i = size() - 1; i >= 0; i--) {
if (operatorClass.isInstance(get(i))) {
positions.push(i);
}
}
// offset, used when positions are updat... |
ba5c522c-beb1-4f71-a309-ab003b9100c6 | 4 | boolean valid(int x, int y) {
if (x < 0 || y < 0)
return false;
if (x >= m)
return false;
if (y >= n)
return false;
return true;
} |
75d00edc-56e2-46f8-b2fc-2dbb67968282 | 8 | private CycList queryVariablesInternal(final CycList queryVariables,
final CycObject query,
final CycObject mt,
final InferenceParameters queryProperties,
final String inferenceProblemStoreName,
final long timeoutMsecs)
throws UnknownHostException, IOException... |
814b9534-88fc-4e4a-b490-4f3f34b4cfe3 | 7 | public void showHint(LBNode n) {
if(intfHint.isVisible() || n.getHint().trim().equals("")) return;
intfHint.setTitle(n.getLabel());
hintNode=n;
hintWidth = n.getHintWidth();
if (n.getHintIsHTML()) {
tpHint.setEditorKit(new HTMLEditorKit());
... |
21713cfd-e7f2-46ad-b5a0-1c82e780eb0b | 9 | private void exportToJournal() {
// TODO save movements (and counterparties) into accounting [or with different button]
int[] rows = tabel.getSelectedRows();
if (checkAccountAndSelection(rows)) {
if (checkCounterParties(rows)) {
Object[] accountList = accounts.getBusinessObjects().toArray();
Account ba... |
bff90c87-ca84-42fb-b5a7-ea088c75d849 | 0 | public void setDate(LocalDate value) {
this._date = value;
} |
61c6c0eb-8bb9-458c-9730-4092e02dbc79 | 2 | public GameState(int[] Perm, int inNumPlayers){
NumWolves = Perm.length - 1;
NumPlayers = inNumPlayers;
PlayerRoles = new int[NumPlayers];
for(int n = 0; n < NumPlayers; n++){
PlayerRoles[n] = 1; // Initialise all players to be living innocents.
}
for(int i = 0; i < Perm.length; i++){
int n = Perm[i]... |
fb3dc1e2-2b93-404e-a53a-7379666bffd7 | 4 | public static boolean isPermitted(String user, MessageEvent event) throws IllegalAccessException, SQLException, InstantiationException {
if (CommandLinks.permitted.contains(user) || isRegular(user,event,false)) {
return true;
} else {
if (!CommandLinks.strike1.contains(user)) {
... |
d23f40fc-0cdb-44e7-9d90-6a36e2b7c86a | 0 | @Override
public void setComponent(JComponent c) {
this.component = c;
} |
a6ccdb55-5875-4f12-872f-3a1e83520f11 | 7 | public double DeltaAdd(Instance inst, double r) {
//System.out.println("DeltaAdd");
int S_new;
int W_new;
double profit;
double profit_new;
double deltaprofit;
S_new = 0;
W_new = occ.size();
if (inst instanceof SparseInstance) {
//System.out.println("DeltaAddSparceInstance");
for (int i = 0; i < inst.nu... |
ec69d929-075a-47f6-a2ae-442076b51c1b | 8 | @Override
public void actionPerformed(ActionEvent e) {
try {
if (e.getActionCommand().equals("Voeg opdracht toe aan quiz")) {
voegOpdrachtToeAanQuiz();
} else if (e.getActionCommand().equals(" Verwijder opdracht in quiz ")) {
verwijderOpdrachtInQuiz();
} else if (e.getActionCommand().equals("Alle wi... |
0ce9a8d6-1e6d-4c1b-b723-bfe44bd256d6 | 3 | public void rebuild() {
backButton = new GuiButton(this, 0, 300, 550, "gui.back");
videoButton = new GuiButton(this, 0, 100, 200, "gui.options.video");
videoVsyncButton = new GuiButton(this, 0, 100, 200, "gui.options.video.vsync." + (Client.instance.preferences.video.vsync ? "on" : "off"));
videoFullscreenButton = ... |
50d87f94-885a-42f8-8743-cfcee7b45585 | 5 | private void updateTurnOption() {
if(model.getTurnOptionState() == Model.TurnOptionState.DEACTIVATED) {
turnOption.setEnabled(false);
} else {
turnOption.setEnabled(true);
}
switch(model.getTurnOptionState()) {
case THROWDICE:
turnOptionText = "Wuerfeln";
break;
case THROWDICEAGAIN:
tur... |
6b88a59b-8900-4b20-a7b7-9a68cac1857a | 4 | public static boolean isMove(Commands one, Commands two){
boolean path = getFileName(one).equals(getFileName(two));
boolean cata = one.getCatalog() == two.getCatalog();
//Null check and makes sure that the commands are opposite
boolean comm = !(((one.getCommand() == null) || (two.getCom... |
656a14e5-c835-412a-b583-1491b0bf7fca | 7 | public void run() {
DbConnection dbConn = new DbConnection();
Connection conn = dbConn.getConnection();
try {
String statement;
while (true) {
Statement stmt = conn.createStatement();
statement = ImageStorage.statementsPoll();
try {
if (statement != null) {
stmt.execute(statement);
... |
66680f45-d8da-4089-99cc-a6b979ae60ab | 2 | protected Object computeBounds() {
Envelope bounds = null;
for (Iterator i = getChildBoundables().iterator(); i.hasNext(); ) {
Boundable childBoundable = (Boundable) i.next();
if (bounds == null) {
bounds = new Envelope((Envelope)childBoundable.getBounds());
}
else ... |
62bdbf49-36c7-4501-be74-b2e76fb886eb | 5 | public static File choose(Component comp, boolean open, String title, String dir, String name, String... extension) {
StdFileDialog filter = new StdFileDialog(extension);
FileDialog dialog;
Window window = WindowUtils.getWindowForComponent(comp);
int mode = open ? FileDialog.LOAD : FileDialog.SAVE;
if (window... |
5c89d497-ec3e-4bd2-bdfb-66eabd53c94c | 9 | public boolean equals(Object object) {
if (object instanceof ActivityNode) {
ActivityNode actNode = (ActivityNode) object;
if ((this.activity == null || actNode.getActivity() == null) &&
!(this.activity == null && actNode.getActivity() == null)) {
return false;
}
if (this.nodeNr != actNode.nodeN... |
43e1738e-f1d1-4198-bfd1-82fa530ad0a3 | 2 | public void majPlateau(Positions pos, Positions newPos)
{
if (!(newPos == null))
{
this.plateau[pos.getLigne()][pos.getColonne()] = EtatDesCases.LIBRE;
this.plateau[newPos.getLigne()][newPos.getColonne()] = EtatDesCases.OCCUPEE;
return;
}
if (this.plateau[pos.getLigne()][pos.getColonne()] == EtatDesCa... |
5d6d3733-fbd9-4f9b-a4fb-d972a049a520 | 9 | public void draw(Graphics2D g) {
for (int row = 0; row < mapHeight; row++) {
for (int column = 0; column < mapWidth; column++) {
int currentTile = map[row][column];
tilesSpec.position.x = column * tilesSpec.size;
tilesSpec.position.y = row * tilesSpec.size;
switch (currentTile) {
case 0:
g.draw... |
37a345ea-8669-4d12-8d0a-23d7b3d3d241 | 2 | public void setCommandButtonBorderthickness(int[] border) {
if ((border == null) || (border.length != 4)) {
this.buttonCom_Borderthickness = UIBorderthicknessInits.COM_BTN.getBorderthickness();
} else {
this.buttonCom_Borderthickness = border;
}
somethingChanged(... |
3d7de70c-ea58-4e7b-903a-4f49566b0b9e | 1 | public void killAll() {
for (int i = 0; i < bots.size(); i++) {
bots.get(i).close();
}
} |
bbd11ca1-dd3b-47e8-9493-f570185c6120 | 0 | public void setLastName(String lastName) {
this.lastName = lastName;
} |
b215df56-5544-458e-8905-aabefe75f600 | 0 | public Object clone() {
return new Turtle(this);
} |
0afb7d1a-6269-44c2-a826-b12be3174aec | 5 | @Override
public String getOOXML()
{
StringBuffer ooxml = new StringBuffer();
if( cxnSp != null )
{
ooxml.append( cxnSp.getOOXML() );
}
if( graphicFrame != null )
{
ooxml.append( graphicFrame.getOOXML() );
}
if( grpSp != null )
{
ooxml.append( grpSp.getOOXML() );
}
if( pic != null )
{... |
54bbffe1-97a0-4271-8e3d-f6efce720438 | 6 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (args.length != 1) {
sender.sendMessage("/delmail <ID>");
return true;
}
ResultSet rs;
java.... |
e43988e6-6e61-4491-a3ce-a0416bf2ced6 | 8 | @Override
/*public void focusGained(FocusEvent evt) {
if (evt.getSource() == dataPacketText) {
dataPacketText.setText("");
}
}
@Override
public void focusLost(FocusEvent evt) {
// do nothing
}*/
public void actionPerformed(ActionEvent evt){
if (evt.getSource() == connectBtn) {
serialPortManage... |
3e6b1d11-f3e3-43ca-93b1-c88d803ff1a9 | 8 | protected Behaviour getNextStep() {
if (stage >= STAGE_DONE) return null ;
if (type != TYPE_CONTACT && ! canTalk(other)) {
abortBehaviour() ;
return null ;
}
if (starts == actor && stage == STAGE_INIT) {
final Action greeting = new Action(
actor, other,
this, "acti... |
9c071926-b699-4182-b0e9-98839c8d4c79 | 3 | public void insert(Key v)
{
// Insert
pq[++N] = v;
int i = swim(N);
// resizing
if (N >= pq.length - 1)
pq = resize(pq, 2 * pq.length);
// Mark the min
if (minIndex == -1)
minIndex = i;
else if (v.compareTo(pq[minIndex]) < 0)
minIndex = i;
} |
856bc7dc-86d7-4387-aaae-3d582d6871bf | 6 | private boolean findEntry() {
Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(waitCursor);
boolean matchCase = searchDialog.getMatchCase();
boolean matchWord = searchDialog.getMatchWord();
String searchString = searchDialog.getSearchString();
int column = searchDialog.getSel... |
5f7343f9-c020-4097-b998-c19f491d458a | 8 | @Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MultiBelop other = (MultiBelop) o;
if (nokkelBelopMap.size()!= nokkelBelopMap.size()) {
ret... |
02896ade-7554-477b-8cfa-27b1bfe4de80 | 8 | public static void main(String[] args)
{
if (args.length != 1)
System.out.println("Please specify a Unit Test Case name");
else
{
LogQuerierTest lqTest = new LogQuerierTest();
if(args[0].compareTo("-generateLogs") == 0)
{
lqTest.genrateLogFiles();
return;
}
if((new File("unit_tests/" + ... |
527e38ff-daf3-488c-95c5-dab134432fa3 | 7 | public MemoryUsagePanel() {
super();
// initializes members
m_Memory = new Memory();
m_History = new Vector<Double>();
m_Percentages = new Vector<Double>();
m_Colors = new Hashtable<Double,Color>();
// colors and percentages
m_BackgroundColor = parseColor("BackgroundColor... |
59bd40a9-b470-467f-85a2-0f6297fc12a7 | 2 | private void hold() {
if (hold.isEnabled()) {
hold.setEnabled(false);
if (hold.getTetromino() == null) {
initializePositions();
hold.setTetromino(tetromino);
getNextTetromino();
}
else {
initializePositions();
Tetromino tmp = hold.getTetromino();
hold.setTetrom... |
7da19ccd-015a-4398-a4fe-26be7f4740c0 | 3 | public PlanSkill(JSONObject skill) throws FatalError {
super("Skill");
try {
category = skill.getString("Kategorie");
try {
count = skill.getInt("Anzahl");
} catch (JSONException e) {
}
try {
bank = skill.getBoolean("Bank");
} catch (JSONException e) {
}
} catch (JSONException e)... |
bddf6a3d-8727-42f1-8502-1fda28e5549a | 3 | public static int getFriendlySupport(Game game, Position position,
Player player) {
Iterator<Position> neighborhood = get8NeighborhoodIterator(position);
Position p;
int support = 0;
while ( neighborhood.hasNext() ) {
p = neighborhood.... |
b8b22c26-a636-4833-8dc9-580c09b5c78a | 0 | public void getFullName() {
fullName.toString();
} |
630259dc-e208-4651-b9e1-a649f9ff505e | 6 | void BaseExpr() {
printer.startProduction("BaseExpr");
switch (la.kind) {
case 9: {
Get();
printer.print(stack.size() + ": In with: " + currentType);
this.enterParenthesis(this.currentType);
Expr();
Expect(10);
this.exitParenthesis();
printer.print(stack.size() + ": Out with: " + lastType... |
37e21859-e016-408b-a9c2-21f6ef2d42fb | 0 | public RestrictedAction(String string, Icon icon) {
super(string, icon);
} |
2243fb70-14ce-49ce-aeb2-6946d22e4f17 | 6 | @Override
public boolean equals( Object obj ) {
if( obj == this ) {
return true;
}
if( obj == null || obj.getClass() != getClass() ) {
return false;
}
DefaultItemKey<?> that = (DefaultItemKey<?>) obj;
return that.id == id && that.typeName.equals( typeName );
} |
8ffa6933-aa5b-4fee-be48-5f7d4b6ce47c | 6 | @EventHandler
public void CaveSpiderSpeed(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getCaveSpiderConfig().getDouble("CaveSpid... |
3e49a0c0-a6d1-4c8e-a5a5-fba8ca6efade | 0 | public void afficherPraticien(Praticien unPraticien) { /*Lieu exercice a ajouter */
this.vue.getjTextFieldNum().setText(unPraticien.getNumero());
this.vue.getjTextFieldNom().setText(unPraticien.getNom());
this.vue.getjTextFieldPrenom().setText(unPraticien.getPrenom());
this.vue.getjTextF... |
52cb85c3-8659-4642-b747-b5c6096371f6 | 5 | /* */ public static void sendPacket(Player p, Object packet)
/* */ {
/* */ try {
/* 68 */ Object nmsPlayer = getHandle(p);
/* 69 */ Field con_field = nmsPlayer.getClass().getField("playerConnection");
/* 70 */ Object con = con_field.get(nmsPlayer);
/* 71 */ Method packet_... |
e1e309f3-e7fa-478d-bf8d-0f2af95c868d | 0 | public Path(String path)
{
this.path = path;
pathArray = trimSlashes(path).split(DELIMITER);
} |
543af59b-f98a-4504-b0a2-c8826ed20b8d | 1 | @Override
public boolean checkLife() {
if (curHP <= 0) {
return false;
} else {
return true;
}
} |
e6c7ccfb-b71b-4ae1-9f7b-8e6acda2088c | 4 | private final void promoteSuccs(Instruction from, Instruction to) {
if (succs == from)
succs = to;
else if (succs instanceof Instruction[]) {
Instruction[] ss = (Instruction[]) succs;
for (int i = 0; i < ss.length; i++)
if (ss[i] == from)
ss[i] = to;
}
} |
82fa7ae3-80e1-4879-9ade-2d5d20a2d3f1 | 5 | private void initMachine(Collection<State> states) {
if (states == null || states.size() == 0) {
throw new NullPointerException("Machine must have at least one state");
}
//put all the states into the hash map
int numStartStates = 0;
for (State state : states) {
numStartStates += state.isStart()? 1 : 0... |
bdf9501f-6dff-40e6-b31b-085880fcd427 | 8 | public void run(){
DataInputStream dIn = user.getInput();
boolean done = false;
try {
while(!done) {
byte messageType = dIn.readByte();
switch(messageType)
{
case 1: // Chat messg
Server.printMessage(user.getName() + ": " +dIn.readUTF(), user);
break;
case 2: // Command
int ... |
be39b35b-880f-4618-85f0-5a4913757d1d | 7 | private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) {
int rounds, i, j;
int cdata[] = (int[])bf_crypt_ciphertext.clone();
int clen = cdata.length;
byte ret[];
if (log_rounds < 4 || log_rounds > 31)
throw new IllegalArgumentException ("Bad number of rounds");
rounds = 1 << log_rounds;
... |
422cc483-cb21-430d-b449-8bfe6ad90ab8 | 6 | @Override
public void load() throws IOException
{
FileInputStream fileInputStream = new FileInputStream(new File(file));
XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
DateTimeFormat... |
1945a3de-c347-4a42-90b7-7e091719199f | 1 | @Override
protected void doEditing() {
if (this.col == 0) {
component.model.removeRow(this.row);
}
} |
17cda0be-5e29-485a-b560-2b07394c5e68 | 6 | public void renderGame(Game game) {
Ship ship = game.getShip();
List<Bullet> bullets = game.getBullets();
List<Asteroid> asteroids = game.getAsteroids();
List<Alien> aliens = game.getAliens();
List<Powerup> powerups = game.getPowerups();
List<Particle> particles = game.getParticles();
long points = game.g... |
36bb4797-3197-48ad-bb41-da3e9265975c | 9 | private TuplesWithNameTable updateTuplesByCond(Condition cond, ArrayList<AttrAssign> attrAssignList, ArrayList<Integer> PrimaryKeyList, TuplesWithNameTable tuples){
Hashtable<String, Integer> nameTable = tuples.getNameTable();
//Tuple list will be modified directly
ArrayList< ArrayList<Value> > tupleList = tuples... |
6a6fea35-04e1-4c9e-8836-b182005ffec4 | 6 | public static void submitStackTraces(Context context) {
Log.d(Constants.TAG, "Looking for exceptions in: " + Constants.FILES_PATH);
String[] list = searchForStackTraces();
if ((list != null) && (list.length > 0)) {
Log.d(Constants.TAG, "Found " + list.length + " stacktrace(s).");
for (int inde... |
eb4ff402-6e76-469f-ac45-025ae179c613 | 3 | public void joueurSuivant() {
setEtape(0);
/* on calcule les gains du tour et on met à jour les pts de victoire */
int argent = joueurEnCours.calcArgentTour();
Game.getInstance().showTemp(argent + " point(s) gagné(s) durant ce tour !");
joueurEnCours.addArgent(argent);
if (indexJoueurEnCours == lst... |
88691d1b-ba5e-4edd-8dd0-ee145ba16dea | 2 | public static ComplexPoly rootsToPoly(Complex[] roots){
if(roots==null)return null;
int pdeg = roots.length;
Complex[] rootCoeff = Complex.oneDarray(2);
rootCoeff[0] = roots[0].times(Complex.minusOne());
rootCoeff[1] = Complex.plusOne();
ComplexP... |
f265bc1c-59dc-49e1-90b6-9dbd06725750 | 6 | public void updatePos() {
if(--time >= 0 && direction != -1) {
switch (direction) {
case 0: {
y--;
break;
}
case 1: {
x++;
break;
}
case 2: ... |
a49fe141-ba1d-47bf-9c9f-9e3a349d03c3 | 6 | public void populate(IChunkProvider var1, int var2, int var3) {
BlockSand.fallInstantly = true;
int var4 = var2 * 16;
int var5 = var3 * 16;
int var6;
int var7;
int var8;
int var9;
for(var6 = 0; var6 < 8; ++var6) {
var7 = var4 + this.hellRNG.nextInt(16) + 8;
... |
a9e55817-6f8f-46b1-82e7-90e8e467c69a | 3 | public Template(String directory, String filename) {
this.tpl = new YamlConfiguration();
try {
file = new File(directory, filename);
this.tpl.load(file);
upgrade(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidConfigu... |
0b0d971a-ca5a-418e-be07-84e738436719 | 2 | public void updateChampion (Champion c) {
if (champion != c) {
champion = c;
icon.setIcon (champion.getIcon());
name.setText (champion.getName());
style.setText (firstLetterUppercase (champion.getPlayStyle().toString()));
tacticBox.removeAll();
tacticBox.add (new JLabel (c.getPrimaryStrategy().getIc... |
bbbb4c0f-5ecd-40db-b862-48d9cfcaafe7 | 7 | @Override
public void enqueCommand(final List<String> commands, final int metaFlags, double actionCost)
{
if (commands == null)
return;
final CMObject O = CMLib.english().findCommand(this, commands);
if((O == null)
||((O instanceof Ability)
&&CMath.bset(metaFlags, MUDCmdProcessor.METAFLAG_ORDER)
&&CM... |
1ab21766-ad1e-4cb2-ab07-9cd140ae6bf7 | 1 | private Animation createMirrorEnemyAnim(String str) {
Animation anim = new Animation();
for(int i=1;i<=26;i++){
anim.addFrame(getMirrorImage(loadImage(str+i+".png")), 80);
}
return anim;
} |
da22b7d6-b49f-42e3-84d8-b09e87833a06 | 4 | @Override
public boolean matches(List<Character> currentMatching) {
if(currentMatching.get(0) != KeyMappingProfile.ESC_CODE)
return false;
if(currentMatching.size() == 1)
return true;
if(currentMatching.get(1).charValue() > 26)
return false;
if(cur... |
424a6640-0709-48e4-847d-30e22e69bad0 | 8 | public Model load(Path path) throws IOException {
// read file line by line
BufferedReader read = null;
Model model = null;
try {
String currentLine;
FileReader reader = new FileReader(path.toFile());
read = new BufferedReader(reader);
while ((currentLine = read.readLine()) != null) {
if (cu... |
9c85fd65-67a9-4c2e-9288-ea4b76905f17 | 2 | public boolean equals(Object ob) {
if (super.equals(ob)) {
CandyForKid other = (CandyForKid) ob;
if (color != other.color)
return false;
}
return true;
} |
55ebce9f-7688-4d7b-9041-8162706c41af | 2 | @Override
public int compareTo(AstronomicalObject o) {
return (this.mass < o.mass) ? -1 : (this.mass > o.mass) ? 1 : 0;
} |
092ac5e3-7219-4d0e-b2bb-d0324792ba05 | 8 | private Handshake validateHandshake(Socket socket, byte[] peerId)
throws IOException, ParseException {
InputStream is = socket.getInputStream();
//< obfuscated handshake extension
// Read the handshake from the wire
byte[] data = new byte[Handshake.BASE_HANDSHAKE_LENGTH + 20];
is.read(data, 0, data.length)... |
cc417261-bfea-4a28-a125-a679841a9fc3 | 6 | static String spellHundredsNumber(int num){
if(primitiveNumbers.containsKey(num)) return primitiveNumbers.get(num);
String num_str = "";
if(num/100 != 0) num_str = primitiveNumbers.get(num / 100) + " Hundred ";
num = num % 100;
if(primitiveNumbers.containsKey(num)) num_str += primitiveNumbers.get(num);
else... |
7dd7f172-343c-47bc-aa29-4090ce49d836 | 0 | public void mouseEntered(MouseEvent event) {
} |
83187f1c-12ba-4142-943f-754c605aec64 | 5 | public void play(String audioFilePath) {
File audioFile = new File(audioFilePath);
try {
AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile);
AudioFormat format = audioStream.getFormat();
DataLine.Info info = new DataLine.Info(... |
58d805a1-7dab-4be7-9c30-4e21ac9f87f0 | 8 | @Override
public void stateChanged(ChangeEvent ce) {
String classSelec = DocsPanel.CLASSES[this.panel.selector.getSelectedIndex()];
switch (classSelec) {
case DocsPanel.LIBROS: {
if (this.panel.lastRowSelecDocs[0] == -1) {
this.... |
e57048b2-2caf-4246-895b-83bf30fb09ea | 0 | public String getMatricule() {
return matricule;
} |
a7c277b4-73eb-4bd7-8c0e-7e0609a797fe | 4 | public boolean containsKey(Object k) {
PositionalVector pos;
if (k instanceof CoordinateEntry)
pos = ((CoordinateEntry) k).asPosition();
else if (k instanceof PositionalVector)
pos = (PositionalVector) k;
else return false;
for (int i = 0; i < data.length... |
ad3945aa-462d-43b9-ad58-2b3054bdc72f | 5 | public AmericanFlag(int x, int y, double scale){
this.scale = scale;
this.union = new Rectangle(x,(y+(int)(this.scale*10)),(int)(this.scale*99),(int)(this.scale*70), Color.blue);
this.stripes = new Rectangle[13];
this.wstars = new Star[9][6];
// this.wstars = new Stars[9][6];
for (int i = 0; i < 13 ; i++... |
67236800-2a32-4b79-a3a4-2d4600763f7f | 9 | void run(){
int S = 125000;
int[] a = new int[S];
int s = 0;
for(int i=0;i<S;i++){
a[i] = s;
int L = 1000*i, R = L+999;
if((L+"").length()==(R+"").length())s+=1000*(L+"").length();
else{
for(int k=L;k<=R;k++)s+=(k+"").length();
}
}
Scanner sc = new Scanner(System.in);
for(;;){
int N ... |
0434564d-2512-40af-831f-1d52403af98f | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ProdutosConsumidos other = (ProdutosConsumidos) obj;
if (this.IdProdutosConsumidos != other.IdProdutosCon... |
ee539c55-58ba-49c4-8447-df8d1e000695 | 7 | public PrivatePackDialog() {
super(LaunchFrame.getInstance(), true);
setupGui();
getRootPane().setDefaultButton(add);
add.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(DownloadUtils.staticFileExists(modpackName.getText() + ".xml") && !modpackName... |
937634ee-8f23-41d6-948b-c89cd60f4354 | 4 | static protected void FillBuff() throws java.io.IOException
{
int i;
if (maxNextCharInd == 4096)
maxNextCharInd = nextCharInd = 0;
try {
if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
4096 - maxNextCharInd)) == -1)
{
inputStream.... |
a131d078-ff35-4312-aba5-7dd1e5a4b0b2 | 3 | private Value[] fillParameters(BytecodeInfo code, Object cls,
Object[] params) {
Value[] locals = new Value[code.getMaxLocals()];
for (int i = 0; i < locals.length; i++)
locals[i] = new Value();
String myType = code.getMethodInfo().getType();
String[] myParamTypes = TypeSignature.getParameterTypes(myType... |
a73566fa-c004-45f2-9187-87c65c8635f1 | 1 | protected static void readUIFile(UIFileTextVO uiFile, Path uifilepath) {
assert (uiFile != null) && FileUtil.control(uifilepath);
uiFile.setLineList(FileUtil.readTextFile(uifilepath));
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.