method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
090df1df-00dd-4dfe-8a10-2393b9d24b3a | 5 | public static void init() {
energy = 100000000;
a = new ArrayList<>();
rOrgs = new ArrayList<>();
bOrgs = new ArrayList<>();
gOrgs = new ArrayList<>();
yOrgs = new ArrayList<>();
oOrgs = new ArrayList<>();
organisms.add(gOrgs);
organisms.add(bOrgs);
organisms.add(rOrgs);
... |
fef72220-c6a7-437a-a2cb-a11b83c8ddb3 | 0 | public String getSPId(String account){
return this.spidHash.get(account);
} |
34e0a626-0e4c-4927-acd1-da72bc86033e | 7 | private boolean hostMatch(Main plugin, String host, ListenerInfo info) {
int split = host.lastIndexOf(':');
if (split == -1) {
plugin.getLogger().log(Level.WARNING, "Badly formatted host:port pair: {0}", host);
}
InetSocketAddress addr = info.getHost();
String hostPar... |
45b39ddc-15c9-48da-a2ae-6034c613a3c1 | 5 | public Adventurer fight(List<Adventurer> listOfAdventurers) throws IOException {
Adventurer winner = null;
for (Adventurer adv : listOfAdventurers) {
adv.fullRestore();
adv.useWeapon("fist");
}
System.out.println("Let the battle begin!!!!!!!!");
while (... |
a39d9390-e706-4734-b4b0-6ea50ee2b3a5 | 7 | @Override
public boolean postExperience(MOB mob,MOB victim,String homage,int amount,boolean quiet)
{
if((mob==null)
||(CMSecurity.isDisabled(CMSecurity.DisFlag.EXPERIENCE))
||mob.charStats().getCurrentClass().expless()
||mob.charStats().getMyRace().expless())
return false;
final CMMsg msg=CMClass.getMsg(... |
b65357bb-5dde-4b79-80d2-bb6fed0527ba | 3 | static public void write(String path, byte[] fileBytes)
{
FileOutputStream stream = null;
try {
stream = new FileOutputStream(path);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
stream.write(fileBytes);
} catch (IOException e) {
// TO... |
12646d4c-30a0-4298-b9f2-94569a46c978 | 4 | public void resolution() {
//temperature
double T = plat.getScore2();
//iterations a chaque pas de temperature
int Nt = 10;
//coef pour le recalcul de la temperature
double coef=0.6;
//generation d'un second plateau (pour comparaison)
Plateau plateau2;
while(plat.getScore2()!=... |
9487d350-c00e-431a-a8b2-83a65038a4fa | 3 | public void setFunction(int f_index) {
switch (f_index) {
case 0:
f = new Function("sin(x)") {
@Override
public double evaluate(double x) {
return Math.sin(x);
}
};
break;
case 1:
f = new Function("exp(x)") {
@Override
public double evaluate(double x) {
return Math.exp(... |
c7465fee-a970-418e-bf66-d6b99553e38a | 1 | public Object trap(Object[] args, int identifier) throws Throwable {
Metaobject mobj;
mobj = _metaobject;
if (mobj == null)
return ClassMetaobject.invoke(this, identifier, args);
else
return mobj.trapMethodcall(identifier, args);
} |
cd6369f0-da48-44ad-b651-49528f7ef327 | 9 | private void CrossoverEmTodos() {
listaQueSeraRetornada = new ArrayList();
int tamanhoAtualDaListaMinhaGeracao = listaQueRecebePopulacaoDeMinhaGeracao.size() / 2;
if (listaQueRecebePopulacaoDeMinhaGeracao.size() / 2 % 2 == 1)
listaQueRecebePopulacaoDeMinhaGeracao.re... |
508c656e-80b9-4a04-852b-60f132e03cef | 1 | public static final int getSimpleWidth(Font font, String text) {
TIntIntHashMap map = getWidthMap(font);
int total = 0;
int count = text.length();
for (int i = 0; i < count; i++) {
total += getCharWidth(font, text.charAt(i), map);
}
return total;
} |
b943765a-c11e-4019-999f-d61d231c30f3 | 9 | public void dumpToFile() throws IOException{
if(outputPath == null){
Logger.log("No output path provided to Context");
}
if(splits==null){
PrintWriter writer = new PrintWriter(outputPath);
for(KeyValuePair kvp:list)
writer.println(kvp.key + ":" + kvp.value);
writer.close();
}
else{
Logger.... |
2cf6fa68-ea8d-4ba3-9aff-a30d250e2b95 | 9 | @SuppressWarnings("unchecked")
public static <K,V> InverseHashView<K, V> inverseHashView(JdbmBase<K,V> base, String recordName){
SecondaryKeyExtractor<Integer,K,V> hashExtractor = new SecondaryKeyExtractor<Integer, K, V>() {
long hashEqualsIdentityCounter=0;
public Integer extractSecondaryKey(K key, V value... |
447e1c9f-91b1-4f02-b1e5-51b046a52bd5 | 0 | public StudentDialog(Frame owner) {
super(owner);
this.setModalityType(ModalityType.DOCUMENT_MODAL);
// òֹ
GridBagLayout layout = new GridBagLayout();
GridBagConstraints c1 = new GridBagConstraints();
GridBagConstraints c2;
this.setLayout(layout);
c1.gridx = GridBagConstraints.RELATIVE;
c1.gridy = G... |
eeccf989-147e-4de3-aa3b-78ca88b2fe71 | 3 | void createExampleWidgets () {
/* Compute the widget style */
int style = getDefaultStyle();
if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL;
if (verticalButton.getSelection ()) style |= SWT.V_SCROLL;
if (smoothButton.getSelection ()) style |= SWT.SMOOTH;
/* Create the example widgets */
... |
612a519f-18c6-434d-bb16-f91933d7d446 | 3 | public static boolean isLeftLinearProductionWithVariable(
Production production) {
if (!isRestrictedOnLHS(production))
return false;
String rhs = production.getRHS();
/**
* if only one variable on rhs and it is first char on rhs.
*/
String[] variables = production.getVariablesOnRHS();
if (variable... |
332d6501-c71b-4dfd-9150-273ab9a834ee | 7 | public static String load(Component parent) {
if (FileDialogs.hasFileAccess()) {
URL url = ClassLoader.getSystemResource("circuits");
String urlName = url.getFile().substring(1);
if (FileDialogs.fc == null) {
FileDialogs.fc = new JFileChooser(urlName);
}
FileDialogs.fc.setFileFilter(new TextFilter... |
6c33da39-9407-4c1e-b70f-c2cca1bb95ab | 0 | @Override public void finishPopulate()
{
} |
59a2260c-dcba-4b58-ba3b-9642ce735440 | 5 | public static Logger newLogger(int dstType, String... dstName) {
switch (dstType) {
case CONSOLE:
return new Console(dstName.length == 0 ? null : dstName[0]);
case FILE:
return new File(dstName.length == 0 ? null : dstName[0]);
case NULLDEVICE:
return new NullDevice(null);
default:
return null;
... |
722f8d6e-e2fb-4a20-af69-b5ef5a8e0b10 | 7 | void display(ArrayList<Node> nodes, int view,boolean showDisappeared,boolean highlight){
//Safety check
if (this.node1>=nodes.size() || this.node2>=nodes.size()) return;
Node n1 = nodes.get(this.node1);
Node n2 = nodes.get(this.node2);
if (showDisappeared){
drawEdge(... |
a716f7a4-608c-469b-8f5e-fee9cd396b8b | 2 | @Override
public Value get(Key key)
{
for (int i = hash(key); keys[i] != null; i = (i + 1) % M)
if (key.equals(keys[i]))
return vals[i];
return null;
} |
3a968082-c703-4503-ab3c-0aa352f40d3f | 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... |
1747e62b-b9f6-4075-80df-b13a6fd577d3 | 6 | public void getKnownArchives() {
if (archive == null) {
return;
}
int total = archive.getFileCount() - 1;
for (int index = 0; index < archive.getFileCount() - 1; index++) {
try {
BufferedReader in = new BufferedReader(new FileReader("medianames.txt"));
knownArchives = new LinkedHashSet<String>();
... |
5483ac6d-84ed-4596-8766-db4228ca1203 | 5 | private static void skipWhitespace() {
char ch=lookChar();
while (ch != EOF && Character.isWhitespace(ch)) {
readChar();
if (ch == '\n' && readingStandardInput && writingStandardOutput) {
out.print("? ");
out.flush();
}
ch = lookChar();
}
... |
42a14df7-043a-466d-ae9d-7d2b16f15ff8 | 3 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this);
if ((clipboardContent != null)
&& (clipboardContent.isDataFlavorSupported(DataFlavor.stri... |
eb1c0a89-17d3-4b1b-9445-ac2f07db7a40 | 9 | @Override
public boolean canMove(Entity e, int x,int y) {
if(engine.getWorld() != null&&engine.getWorld().getEntityArray()!=null)
{
for(Entity l:engine.getWorld().getEntityArray())
{
if(l == null)
continue;
if(l == e)
continue;
if(!l.... |
83497f49-cfa0-4534-9571-ea46337b1e37 | 0 | public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(STATE_COLOR[state]);
g.fillRect(0, 0, getWidth(), getHeight());
g.translate(PADDING, PADDING);
icon.paintConfiguration(this, (Graphics2D) g, getWidth() - PADDING * 2,
getHeight() - PADDING * 2);
g.translate(-PADDING, -PADDING)... |
7646586f-6207-4707-a0a8-d768163abe0b | 2 | @Override
public boolean activate() {
if(Tabs.getCurrent() != Tabs.INVENTORY && hasSpinTicket()) {
return false;
}
return hasSpinTicket();
} |
4b206ea5-f845-4289-aaaf-af439ef336e6 | 1 | synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (pgrid.service.corba.repair.RepairHandleHelper.id (), "RepairHandle");
}
return __typeCode;
} |
04921fbd-1b60-4e10-9d70-9df48ad85a98 | 2 | public int romanToInt(String s) {
int size = s.length() - 1;
int result = 0;
int previous = numbers.get(s.charAt(size));
result = result + previous;
size --;
while(size > -1){
int current = numbers.get(s.charAt(size));
if(current ... |
9b7f457f-d617-45ef-912c-6b90b3323a32 | 4 | private void addChangeColors() {
Container container = new Container();
GridLayout layout = new GridLayout(4, 3);
container.setLayout(layout);
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 2;
constraints.gridheight = 1;
JLabel colorLabel = ne... |
a0d64369-8654-40be-8688-cadec7b7ebec | 9 | private Collection<TileType> getApplicableTileTypes(int _x, int _y) {
TileType northNeighbour = null;
if (_y - 1 >= 0)
northNeighbour = ModelManager.this.tileIdToTileTypeMap.get(ModelManager.this.tiles[_x][_y - 1]);
TileType southNeighbour = null;
if (_y +... |
93469cc3-325c-4d1e-9056-e87682a9efe7 | 3 | public void reset() {
numBloques = 30; //crear bloques de metanfetaminas
bloqX = 70;
bloqY = 110;
for (int i = 0; i < 10; i++) {
((Meth) list.get(i)).setPosX((bloqX));
((Meth) list.get(i)).setPosY((bloqY));
bloqX += 65;
}
bloqX... |
0f3ac84f-29ad-4efa-9d25-78f998eaa6bd | 7 | private static void loadItemTypes(String fn) {
String line;
String parts[];
String damages[];
try {
InputStream in = Weapon.class.getResourceAsStream(GameController.CONFIG_DIR + fn);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
... |
38eabe79-da22-49e5-a97b-9be837f47273 | 6 | public void LoadParentDirectory(String folder, String suffix) {
if(folder==null||folder.isEmpty())
return;
int current = m_corpus.getSize();
File dir = new File(folder);
for(File f: dir.listFiles()){
if(f.isFile() && f.getName().endsWith(suffix)){
loadParentDoc(f.getAbsolutePath());
// loadAPPPa... |
6c5e247c-5603-496c-9bcb-df668ed9d652 | 8 | public void loadRasPiPlugins() {
File RasPiPluginDir = new File("plugins");
if (!RasPiPluginDir.exists()) {
RasPiPluginDir.mkdirs();
return;
}
for (File file : RasPiPluginDir.listFiles()) {
if (!file.isDirectory() && !file.getName().startsWith(".")) {
try {
loadRasPiPlugin(file);
} cat... |
14a3a485-4623-4f50-b0ed-acff8eff32b3 | 3 | public static boolean isExecutable(String tcid, Xls_Reader excel){
for(int rowNum=2; rowNum<=excel.getRowCount("test_suite"); rowNum++){
if(excel.getCellData("test_suite","TCID", rowNum).equals(tcid)){
if(excel.getCellData("test_suite","Runmode", rowNum).equalsIgnoreCase("Y")){
return true;
}... |
85025a5e-391e-4375-86bd-79fb8bd351b9 | 0 | public void disable() {
} |
53332f9b-96d1-4c6c-9d63-3eb1e22841b8 | 5 | public static void main(String[] args) {
final MainWindow mainWindow = new MainWindow();
SwingUtilities.invokeLater(new Runnable(){
public void run(){
try {
System.out.println(System.getProperty("os.name"));
if(System.getProperty("os.name").contains("Linux")) {
UIManager.setLookAndFeel("javax... |
13109397-1afa-41b5-80ab-e13ac02b158c | 8 | protected boolean collision(int xa, int ya) {
boolean solid = false;
if (getDir() == 0) {
if (level.getTile((int) (x + xa) / 16, (int) (y + ya) / 16).solid())
solid = true;
}
if (getDir() == 1) {
if (level.getTile(((int) (x + xa) / 16) + 1, (int) (y + ya) / 16).solid())
solid = true;
}
if (get... |
082ce747-9e9a-43a9-9d5a-b7d2e48a16cf | 3 | public void saveRolloverData() {
if (rolloverData == null || rolloverDataFile == null) {
return;
}
try {
rolloverData.save(rolloverDataFile);
} catch (IOException ex) {
severe("Could not save config to " + rolloverDataFile);
}
} |
38b7cc2c-2c4d-4af7-ab63-9e20d130f46c | 4 | protected void printSectionFor(Target t, Node n) {
if (n == null) {
n = root ;
}
if (n.section.depth == 0) {
if (n.includes(t)) {
I.say(" "+key+" FOUND SECTION MATCHES FOR "+t) ;
I.say(" SECTION AT "+n.section.area) ;
}
}
else for (Object k : n) printSectionFor(... |
07aa2dbc-8407-42ca-bff6-f54c2c11018c | 5 | public void count() throws IOException{
TextFile tf = new TextFile("/Users/dashazhernakova/Documents/UMCG/hapmapData/tophat/1382_1_1/6.pairToBed_out.bed", false);
tf.open();
String[] fields;
Map<String,ArrayList<String>> read_map = new HashMap<String, ArrayList<String>>();
//firs... |
3f02ccf9-ffd9-4c87-9bdc-5cd7840fc8fb | 1 | public String toString() {
return getClass().getSimpleName() +
(name == null ? "" : " " + name);
} |
98dd8b1c-26d6-4d00-bd4c-d3127fe59c3e | 0 | public char getLetter() {
return letter;
} |
a1bd7d0a-8933-44c5-9271-11088d579954 | 2 | public void clickSaveButton() {
if (!getFieldsChanged())
return;
try {
savePerson();
P p = loadedPerson; // this wont cause exception
tableModel.setRowSelect(p);
} catch (InvalidFieldException ex) {
setExceptionError(ex);
return;
}
} |
6203277a-5caf-4c76-a32e-60de9f040a4d | 2 | public FrameLinkFinder(final String content) {
if (content == null || "".equals(content.trim())) {
throw new IllegalArgumentException("content cannot be null");
}
this.content = content;
} |
ff4a91a8-9314-41a0-89db-aab3f9991211 | 0 | public static void main(String[] args) {
String input;
Scanner scan = new Scanner(System.in);
System.out.println("Print the word");
input = scan.nextLine();
countVowel(input);
} |
644ffe7f-36f2-4672-9015-8df66ff8b784 | 3 | public double pdfLog(double p, int k, int n) {
if ((k < 0) || (k > n)) return 0;
if (k == n) return k * Math.log(p);
return sumLog(n) - (sumLog(k) + sumLog(n - k)) + k * Math.log(p) + (n - k) * Math.log(1 - p);
} |
252a2306-2a48-4eb2-9a61-23bebccc69dd | 8 | private boolean isTransportImplementingService(Class<?> transportClass, Class<?> service) {
for (Type genericInterface : transportClass.getGenericInterfaces()) {
// Transport has to be declared as parametrised type
if (genericInterface instanceof ParameterizedType) {
ParameterizedType parameterizedType = (P... |
b97a8ce6-234d-4739-bd0c-171ab62ec8bb | 9 | public static void main(String[] args) throws IOException
{
//Make an ArrayList of all departments in the university
ArrayList<Department> allDepartments= new ArrayList<Department>();
//Make a computer science department and add it to the university departments
Department csDepartment = new Department("Compute... |
375dbd37-4368-4b64-b75f-5780d7ad1e7b | 5 | @Override
public boolean autentica(String login, String senha) {
boolean valida = false;
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(VALIDALOGIN);... |
00a1b4b0-66da-4226-8ce5-09fc59d30ed3 | 1 | public Texture2D(TextureFormat _format, String _file) {
super();
isBound = false;
prevTexture = -1;
widthRatio = 0.0f;
heightRatio = 0.0f;
if(!LoadImage(_format, _file)) {
//TODO: Default to error texture
}
} |
7a2d4835-f0b4-438b-b27b-c0535abbf5c6 | 6 | @EventHandler(priority = EventPriority.HIGHEST)
public void onVehicleDestroy(VehicleDestroyEvent event){
if (event.isCancelled()) return;
String worldName = event.getAttacker().getWorld().getName();
if (worldName == null){
return;
}
String worldN = plugin.getIfMainWorld(worldName);
if (worldN != null){
... |
61bee5d1-1054-4b00-ad7c-688fd076b9ea | 2 | public String toString(){
StringBuffer buffer = new StringBuffer("[Record ");
for(Property<?> property : properties){
buffer.append(""+property);
}
buffer.append("]");
return buffer.toString();
} |
b98a1009-07dc-49bc-8a5e-854f5eca4519 | 7 | @EventHandler
protected void onPlayerDeath(EntityDeathEvent event) {
LivingEntity entity = event.getEntity();
if (entity instanceof Player) {
Player player = (Player) entity;
ScavDuelsPlayer dPlayer2 = ScavDuels.scavDuelsPlayer.get(player.getName());
if (dPlayer2 ... |
faded799-9210-4ae9-b189-62a2a802c32c | 4 | public void readFromUser(BinarySearchTree<String, String,String> tree, int size) {
Scanner inn = new Scanner(System.in);
String compare ="N";
String comText= null;
String name = null;
String roll = null;
String address = null;
do {
System.out.println("\n\nEnter the fullName... |
0b8da57a-b911-42fd-97b9-a87148bdddcb | 9 | public boolean checkBlockInitializer(InvokeOperator invoke) {
if (!invoke.isThis() || invoke.getFreeOperandCount() != 0)
return false;
MethodAnalyzer methodAna = invoke.getMethodAnalyzer();
if (methodAna == null)
return false;
FlowBlock flow = methodAna.getMethodHeader();
MethodType methodType = methodA... |
418dbf17-8aca-478c-9cc5-0daf5b10dd53 | 1 | @Override
public Integer getIntProp(String key, Integer value){
Integer result = value;
String propValue = getProperty(key);
if (null != propValue){
result = new Integer(propValue);
}
return result;
} |
7171a278-c32b-4573-b097-4b4c24b6ed63 | 9 | private Item createItem() throws InstantiationException,
IllegalAccessException, ClassNotFoundException {
Element itemDesc = dom.getDocumentElement();
item = (Item) Class.forName(
Item.class.getPackage().getName() + '.'
+ itemDesc.getAttribute("type")... |
e3d2a5aa-414e-45d7-b5ea-8450322f6290 | 0 | public void setCalle(String calle) {
Address.setCalle(calle);
} |
2a9f2e06-12c0-4c68-8f4d-7444762f4a31 | 6 | private Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
e56bfadf-3553-4b52-b41a-5c40f4da6e16 | 1 | public File getFileList() throws IOException, Exception{
sendDataToClient("$ADCGET file files.xml 0 -1|");
String response = getClientData();
int filesize = Integer.parseInt(response.split(" ")[4]);
//getting the file
String fileString = "... |
5542a02b-c944-4709-82e5-8bac42cc35e6 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
be2d5829-a5b3-4fb2-a640-d99a23396a77 | 1 | public static List<Piece> getPiecesFromString(String in)
throws IllegalArgumentException{
List<Piece> out = new ArrayList<>();
Piece readPiece;
for(int i=0; i < in.length(); i++){
readPiece = getPieceFromChar(in.charAt(i));
out.add(readPiece);
}
... |
42c69860-e569-4cb4-8fa2-8fc837010129 | 7 | private void orderEpisodes(FSList fslist) {
int basecounter = 1;
List<FsNode> nodes = fslist.getNodes();
for(Iterator<FsNode> iter = nodes.iterator() ; iter.hasNext(); ) {
// get the next node
FsNode n = (FsNode)iter.next();
int value = basecounter++;
int evalue = -1;
int svalue = -1;
try {
... |
9781cb8d-c1d3-4cc6-a76f-b0b145d970e2 | 0 | @Override
public void windowDeactivated(WindowEvent e)
{
} |
d2b6859a-7596-4432-9678-59f0c9f5bdf3 | 0 | @Override
public void init(List<String> argumentList) {
label = argumentList.get(0);
} |
303c4d62-caa1-4481-8768-651ce6e9d48c | 4 | public static byte[] getBytes(Serializable data) {
ObjectOutput out = null;
byte[] res = null;
if (data instanceof String) {
return ((String) data).getBytes();
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
out = new ObjectOutputS... |
432d78ea-8e40-4480-ae6d-0c12699d75cc | 5 | @Test
public void blackBoxTestQuadTree() {
/* BLACK BOX QUADTREE TEST.
*
* We want to create a QuadTree with the following parameters:
* Length: 400.
* Number of QuadTrees: 16 (4x4).
* Number of Points in each: 1 (but + 499 in the four corners).
* Tota... |
4654dc5e-1228-438b-a95b-d71180a7fb05 | 4 | static void printPlayers() {
GuiPlayersOnline.playersCountTitle.setText("Liczba graczy online: "
+ nickCounter);
for (int i = 0; i < nickCounter; i++) {
if (players[i] != null) {
if (showNumbers)
GuiPlayersOnline.playersList.append((i + 1) + ": ");
GuiPlayersOnline.playersList.append(players[i]... |
dc3a0702-b312-4a27-9965-729e49f95254 | 1 | public E fourth() {
if (size() < 4) {
throw new RuntimeException("Fourth element not available");
}
return this.get(3);
} |
692f5f81-593f-43b6-a753-6be233c41b61 | 9 | public void keyReleased(KeyEvent tecla) {
int codigo = tecla.getKeyCode();
Point d = new Point(super.deslocamento);
if (codigo == KeyEvent.VK_UP || codigo == KeyEvent.VK_W) {
super.deslocamento.y = -0;
}
if (codigo == KeyEvent.VK_DOWN || codigo == KeyEvent.VK_S) {
... |
97407cb0-fa02-4609-8d21-76a44eab3f50 | 3 | private ArrayList<String> splitToChunks(String txt) {
String[] words = txt.split(" ");
ArrayList<String> chunks = new ArrayList<String>();
String toAdd = "";
for (String word : words) {
if ((toAdd + word).length() > MAX_TXT_LENGTH && !toAdd.isEmpty()) {
chu... |
e10e932b-eea8-42b5-a580-c63b47467a30 | 3 | private void fireAt(ScannedRobotEvent event) {
if (event.getName().equals(Observer.TARGET)) {
// paint target with a red circle
Point2D.Double location = MathUtils.getLocation(robot, event.getBearingRadians(), event.getDistance());
Util.paintCircle(robot, location.getX(), lo... |
7b5f94c2-a0fd-41e0-b3a5-810f12537029 | 5 | public void run() {
long time = System.currentTimeMillis();
while(true) {
try{
Thread.sleep(20);
} catch (Exception e) {}
long current = System.currentTimeMillis();
ball.advance(current - time);
if (ball.collision()) {
if (checkVictory()) {
view.updateGameStatus(1);
br... |
5471de14-ea73-4b28-afeb-5a60bf7a9fe7 | 8 | public void simplifyNumericFunction(String[] sets0, String[] sets1,
int nbrVar, String varOrder) {
boolean table[] = new boolean[(int) Math.pow(2, nbrVar)];
if (sets1 == null && sets0 == null)
JOptionPane.showMessageDialog(null,
Tools.getLocalizedString("ERROR_NUMFORM"),
Tools.getLocalizedString("E... |
64a784e0-6843-4437-9aae-e56a60bac135 | 7 | public void update() {
updateProjectiles();
if (reloadCycle < 1) {
reloadCycle += reloadSpeed;
}
if (target == null) {
if (!findTarget()) {
angle += da;
angle %= 2 * Math.PI;
}
} else {
double targetA... |
42485bd7-53bd-4da2-8253-efa820ac5fed | 5 | private FileInfo[] getInfoFile() {
FileInputStream fileStream;
try {
fileStream = new FileInputStream(".transfertron5000.ser");
} catch (FileNotFoundException e) {
fileStream = null;
e.printStackTrace();
}
ObjectInputStream os;... |
fa456473-e5df-4f07-8ffe-9b02014add84 | 7 | private synchronized void bootServices() {
//Check to see if we already started
if(sessionBooted_flag) return;
logger.log(Level.INFO, "BOOTING Services");
sessionBooted_flag = true;
//Boot the services listed in boot_services.xml
try {
URL url = nu... |
dad42469-3cb8-4d7d-b03d-0afc6185bc01 | 9 | private Main() {
super("Snake");
/* Create game */
Skin skin = new PlainSkin();
GameConfiguration config = new GameConfiguration();
game = new GameController(config, skin, MapLoader.plain((short)30));
game.addActionListener(this);
component = new Map.Component(game.getBuffer());
/* Create panel */
J... |
21827059-00a7-4980-8aca-49fa8a34219b | 3 | public Set<Bill> removeBillByDate(Set<Bill> b, Calendar c) {
Iterator<Bill> bIt = b.iterator();
Set<Bill> bills = b;
while (bIt.hasNext()) {
Bill bAux = bIt.next();
if ((bAux.getDate().get(Calendar.MONTH) == c.get(Calendar.MONTH))
&& ((bAux.getDate().get(Calendar.YEAR) == c
.get(Calendar.YEAR))... |
621eb2da-0ba0-4041-a4a0-96e475fca02f | 7 | public void run() {
while (true) {
try {
maj("B");
if (pieceCourante.isBloque()) {
if( score-niveau*500>0 && pause-100>0)
{
niveau++;
notify... |
e3b369dd-0e0f-4ddf-8931-14ca6bf9f8fb | 1 | public Steinchen getSteinOnPosition(int pos){
//LinkedList Laenge abfragen
int linkedListSize = field.get(pos).size();
if(field.get(pos) == null){
return null;
}else{
//die Position in der LinkedList zurueckgeben
return field.get(pos).get(linkedListSize-1);
}
} |
60786f5d-9707-4309-aad5-53bc186f95ce | 7 | public void paint(Graphics g, JComponent comp) {
AbstractButton btn = (AbstractButton) comp;
boolean rollover = btn.getModel().isRollover();
boolean selected = btn.getModel().isSelected();
boolean armed = btn.getModel().isArmed();
btn.setBorderPainted(selected || rollover);
if(rollover || selected) {
if(... |
e9b47e48-3287-4e84-af6f-c57fbaf0f884 | 3 | public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Role)) {
return false;
}
final Role role = (Role) o;
return !(name != null ? !name.equals(role.name) : role.name != null);
} |
13d6b408-7994-4576-b038-a6323e762c17 | 2 | public void process(){
try{
this.processHandler.process(this);// 业务处理
if(!this.responseMsgsNotCode.isEmpty()){// 不为空进行写出信息
this.coderHandler.process(this);// 协议编码处理
//this.inputMonitorWorker.registeWrite(key);
this.sendMsgs();
}
}catch(Exception e){
e.printStackTrace();
this.close();
}
... |
491e4290-4c9a-431c-870d-7a8e7ba6da44 | 8 | private static void queryDatabase(String username, String password) throws IOException
{
ArrayList<ArrayDeque<String>> resultsList = new ArrayList<ArrayDeque<String>>();
ConnectionData connectionData = new ConnectionData(hostPort, hostName, dbName, username, password);
if (readFromFile) {
... |
532941ab-875f-4f8f-9e41-7a5a5ea4aef7 | 2 | public static Date formataData(String dataString) throws Exception {
if (dataString == null || dataString.equals("")) {
return null;
}
DateFormat fmt = new SimpleDateFormat("dd/MM/yyyy");
java.sql.Date data = new java.sql.Date(fmt.parse(dataString).getTime());
retur... |
861eeff1-1d37-4b22-8048-61c68bf8db14 | 7 | public Grid(){
setIconImage(Toolkit.getDefaultToolkit().getImage(Grid.class.getResource("/img/KT_Logo.png")));
setVisible(true);
setTitle("Kings 'N' Things");
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 1280, 700);
contentPane = new JPanel(){
/**
*
... |
aa253ba4-bc54-440d-90cf-369f02293ba2 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(targ... |
b8c02871-9231-4b15-b85c-4c86f4f3a725 | 4 | public static int getDistanceCost(Location Loc1,Location Loc2) {
if(Loc1.getWorld().equals(Loc2.getWorld())) {
double distance = Loc1.distance(Loc2);
int distanceint = (int) distance;
int multivalue = config.getint("CDT.MoneyMultiplierPerblock");
int out = multivalue * distanceint;
return out;
... |
0f28b804-7d33-4f16-930e-df15af591cbc | 4 | public void onJoin(String channel, String sender, String login, String hostname) {
String join_message = DarkIRC.AppLang.getString("join_msg").replace("{~nick~}", sender).replace("{~channel~}", channel);
// System.out.println(join_message);
if (channel.equalsIgnoreCase(Da... |
bfaf3bf9-15be-4397-a68e-45f2ccf77fec | 5 | private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
// TODO add your handling code here:
String correo = tfCorreo.getText();
try {
//SE CREA OBJETO Y SE INICIAN VARIABLES INDEPENDIENTEMENTE DE SI ES NUEVO O ACTUALIZACIO... |
3c2460bf-fbf3-4234-85b7-a9ee169e80fa | 7 | public static boolean manuallyRemoveMember(String[] args, CommandSender s){
//Various checks
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin i... |
9de97ade-fc2c-4b4e-9585-9a488d947aa9 | 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... |
ef851b6c-0802-4bb3-8098-e51d48530e7c | 4 | public HierholzerImpl(AIGraph g, String start) {
this.graph = g;
this.countGraphBegin = g.getCountGraphAccesses();
if (start == null || start.length() == 0) {
start = this.graph.getVertexes().get(0);
}
this.globalStartNode = start;
this.globalUsedEdges = new ArrayList<String>();
foundCir... |
e140e051-ecb0-4a06-87d5-3b99193ee957 | 9 | @Override
public void run() {
int callID = RpcServer.getInstance().callID();
DatagramSocket rpcSocket = null;
try {
rpcSocket = new DatagramSocket();
rpcSocket.setSoTimeout(SOCKET_TIMEOUT);
} catch (SocketException e1) {
//Could not open UDP socke... |
1cc99064-5723-4d76-a8d8-b446639c8714 | 2 | private void transfererMessagesErreurDansDeclaration(Activite2012_2014 activite) {
try {
// Ajouter le(s) message(s) d'erreur à la liste de
// messages d'erreurs de la declaration.
for (int j=0; j < activite.getNombreMessagesErreur(); j++) {
declaration.ajoute... |
6e7562af-7c3e-48bc-bcc5-cfa37044ae9c | 6 | private void addPossibleHeadCandidate(TagInfo tagInfo, TagNode tagNode, CleanTimeValues cleanTimeValues) {
if (tagInfo != null && tagNode != null) {
if ( tagInfo.isHeadTag() || (tagInfo.isHeadAndBodyTag() && cleanTimeValues._headOpened && !cleanTimeValues._bodyOpened) ) {
cleanTimeValue... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.