method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
296239dd-bacc-4df1-aff7-6a30db27a5c0 | 6 | public void loadCharacters(Element docEle){
NodeList charactersList = docEle.getElementsByTagName("Characters");
Node charactersNode = charactersList.item(0);
Element characterElement = (Element)charactersNode;
String charactersPath = characterElement.getAttribute("FolderPath");
String characterPrefix = chara... |
04c1590d-530b-4ae0-88a8-9b7c9f857702 | 3 | public void calcTangents()
{
for(int i = 0; i < indices.size(); i += 3)
{
int i0 = indices.get(i);
int i1 = indices.get(i + 1);
int i2 = indices.get(i + 2);
Vector3f edge1 = positions.get(i1).sub(positions.get(i0));
Vector3f edge2 = positi... |
8227997a-032f-4c95-b207-e011d2257631 | 4 | public void battle(Team other)
{
for (int i = 0; i < Math.max(this.team.length, other.team.length); i++)
{
if (this.team[i] != null)
{
int j = (int)Math.round(((Math.random() + i - 1) * 3));
while(j < 0 || j > team.length - 1)
{
j = (int)Math.round(((Math.random() + i - 1) * 3));
}
t... |
8899ad55-bd8c-45c9-91a2-70c2434457b0 | 6 | public String showBorad() //trying to make it look decent
{
StringBuffer s = new StringBuffer();
int j = 0;
// String white = "\u25CB", black = "\u25CF", empty = "\u2212";
String white = "W", black = "B", empty = "-";
s.append("\n");
s.append(" | | | | ... |
5fed9b8f-8789-4ee1-b41e-fcfd715dff6d | 8 | private void updatePalettes() {
if (paletteType == PPUConstants.IMAGE_PALETTE_TYPE) {
for (int i = 0; i < backgroundPalette.length; i++) {
backgroundPalette[i] = (byte) EnvironmentUtilities.getIntegerEnvSetting(IMAGE_HELPER_BG_PALETTE_INDEX + i, DEFAULT_IMAGE_HELPER_BG_PALETTE);
}
for (int i = 0; i < spr... |
bda36c0f-3f09-4aff-bf64-b5ae9b80c68f | 3 | private void disassociateAC(ComponentEntry ac) {
System.out.println("No KEEP_ALIVE received from "+ac.id+", assuming dead...");
this.accessControllers.remove(ac.id);
AccessAssociation aa = findAssociation(ac.id);
if (aa != null) {
this.accessAssociations.remove(aa);
if (!associateAccessPoint(aa.accessPoin... |
b33243af-a63b-4453-abbe-da948cad34d8 | 2 | public static final int task7(int nthPrime) {
int prime = 2;
int number = 3;
while (prime < nthPrime) {
number += 2;
if (isPrime(number)) {
prime++;
}
}
return number;
} |
357c5df2-1d05-4801-bd52-c0ea70ec13e8 | 1 | @Test
public void PelaajanAlkusijaintiKunOnKerrottu() {
ArrayList<String> rivit = new ArrayList();
rivit.add("P 20 20");
TasonLuonti tl = new TasonLuonti(rivit);
Taso ta = tl.getTaso();
assertTrue("Pelaajan alkusijainti oli väärä"
+ ta.getPelaajanAlkusijainti(... |
c290de71-a40b-4a2c-8362-dcecf5589039 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Vendor)) {
return false;
}
Vendor other = (Vendor) object;
if ((this.vendorID == null && other.vendorID != null... |
58ec8c3c-5538-42d1-8a86-a86fb856cf44 | 4 | public void reorderList(ListNode head) {
// deal with the trivial case when head is null
if ( head == null || head.next == null ) {
return;
}
// 1. find the first element that should moved forward
ListNode p = findMover(head);
Stack<ListNode> s = ... |
e082802f-00c5-4d62-b04f-fa93a3f29ef2 | 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... |
1160ae61-4df0-4c33-8e5f-54d5f8d7a284 | 7 | public ConfigurationSerializable deserialize(Map<String, Object> args) {
Preconditions.checkNotNull(args, "Args must not be null");
ConfigurationSerializable result = null;
Method method = null;
if (result == null) {
method = getMethod("deserialize", true);
if ... |
4a6ed5c1-be33-46c5-b09d-311762e32ac2 | 2 | private boolean cmdSet(CommandSender sender, String world, String[] data,
int offset, boolean oneRadius) {
int radiusX, radiusZ;
double x, z;
try {
radiusX = Integer.parseInt(data[offset]);
if (oneRadius) {
radiusZ = radiusX;
offset -= 1;
} else
radiusZ = Integer.parseInt(data[offset + 1])... |
581e7cc0-08df-4117-9294-f1777eb48916 | 2 | public static boolean validCod(String cod){
if(cod.length()<5 || cod.length()>20){
return false;
}else{
return true;
}
} |
9363bb9a-50c6-44bd-a9a6-ec8eeebe9335 | 2 | public ArrayList<Node> calculatePath(Node p_Start, Node p_Goal)
{
ArrayList<Node> nodes = new ArrayList<>();
boolean done = false;
Node temp = p_Goal;
while(!done)
{
//always add the new node at the beginning of the list
nodes.add(0,temp);
... |
cad780d3-0427-4ae9-b2ea-6165145ba42d | 5 | @Override
public Matrix add(Matrix matrix) throws IllegalArgumentException {
int rows = this.getRowsNumber();
int cols = this.getColumnsNumber();
if (matrix.getRowsNumber() != rows || matrix.getColumnsNumber() != cols) {
throw new IllegalArgumentException("Macierze o różnych rozmiarach");
}
try {
for ... |
c22ea651-582e-44fd-bfd8-33382f307a08 | 9 | public static void main(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
Option pathOpt = obuilder.withLongName("path").withRequired(true).withArgument(
... |
351f400d-922a-43b1-a3a4-6bfa4f68a744 | 0 | public GrammarTable getTable() {
return table;
} |
2d15bf2f-1033-461b-8ba9-a06d96af7785 | 5 | public void updateDecorRenderList(World world)
{
decorationsToRender.clear();
for(Decoration decoration : world.getDecorList())
{
Vector2f c = decoration.getCoords();
if((c.x >= (cLoc.x - (cameraWidth / 2) - decoration.getBB().getWidth()) || c.x <= (cLoc.x + (cameraWidth / 2) + decoration.getBB().getWidth(... |
6cbbfc89-ea8b-497b-80d6-75dbe29c838d | 7 | private static <E> void merge(E[] a, int from, int mid, int to, Comparator<? super E> comp) {
int n = to - from + 1;
Object[] values = new Object[n];
int fromValue = from;
int middleValue = mid + 1;
int index = 0;
while (fromValue <= mid && middleValue <= to) {
if (co... |
16d5e1e3-4e66-4760-9d5d-bd2e5f2d2f1d | 8 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((attributes == null) ? 0 : attributes.hashCode());
result = prime * result + (hasClosingTag ? 1231 : 1237);
result = prime * result + (hasOpeningTag ? 1231 : 123... |
9db1ae0c-c5a5-47a0-bde6-0a1f0013bd13 | 1 | @Override
public void mouseClick(int X, int Y) {
if(this.getMouseListener() != null)
{
this.getMouseListener().MouseClick(this);
}
} |
623ba671-bdee-429d-8f35-b9c8eddeb3b7 | 3 | private void deopPlayers() {
User[] users = bot.getUsers(gameChan);
for (User user : users) {
String nick = user.getNick();
if (user.isOp() && players2.isPlaying(nick)) {
bot.sendMessage("ChanServ", "deop " + gameChan + " " + nick);
}
}
} |
c2879426-3404-4b87-961e-5544c807da85 | 8 | @Override
public void applyRenewPolicy(LibraryModel model, List<LibraryView> views,
List<Copy> toRenew, String borrowerID) {
List<Copy> reservedCopies = new LinkedList<Copy>();
List<Copy> toRemove = new LinkedList<Copy>();
for (Copy copy : toRenew) {
Item item = model.findItem(copy.getRelatedItemID());
... |
ee43e071-ff99-4ef5-a65a-bde808754ab6 | 3 | @Override
public String getUserServicePrice(String seller, String serviceName) {
String priceValue = "0";
Service service = new Service();
Call call;
try {
call = (Call)service.createCall();
Object[] inParams = new Object[]{seller, serviceName};
call.setTargetEndpointAddress(new URL(SERVICES_UR... |
70148024-7ce4-4ae9-bf1d-b6713e085933 | 8 | @SuppressWarnings("unchecked")
public synchronized static <T> int indexOf(T array[], T search) {
if (array == null || array.length == 0) {
return -1;
}
if (search == null) {
for (int i = 0; i < array.length; ++i) {
if (array[i] == null) {
return i;
}
}
} else {
for (int i = 0; i < arr... |
33970ff4-644f-4fcf-9459-79c1e89cafd6 | 2 | private static void processFile(String filename, double dt) {
try {
System.err.println("Loading file " + filename + " ...");
JPLEphemeris ephemeris = new JPLEphemeris(filename);
NeptuneBarycentricElements runner = new NeptuneBarycentricElements(ephemeris, dt);
runner.run();
} catch (JPLEphemerisExceptio... |
7ecb8105-5054-496b-9d2c-8db5f75271ab | 9 | @Override
public boolean importGroup27ReadingCO(JSONObject toImport, String device_serial, String product_id) throws Exception {
String latitude = __jdbcProperties.getProperty("sql.latitude");
String longitude = __jdbcProperties.getProperty("sql.longitude");
String method = __jdbcProperties.getProperty("sql.meth... |
d92fd206-2569-44d0-a071-387bbacbf6c2 | 7 | public static void main(String[] args) {
Enumeration<CommPortIdentifier> portList;
CommPortIdentifier portId;
String messageString = "Hello, world!\n";
SerialPort serialPort = null;
OutputStream outputStream = null;
portList = getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (Com... |
3611aa1f-1873-4485-b6d4-81a93143c366 | 2 | private boolean validateCoordinate(int i){
if(i <= 0 || i> model.getField().size){
view.onError("Не верное значение, значение должно быть от 1 до " + model.getField().size + " попробуйте еще раз");
return false;
}
return true;
} |
fb0bc083-f813-48aa-b78c-94b3e0f54b4d | 4 | @Override
public void removeEdgesTo(N to) {
if(containsNode(to)) {
for(N node : nodes.keySet()) {
List<Edge<N>> edgesFrom = edgesFrom(node);
for(Edge<N> edge : edgesFrom) {
if(edge.to.equals(to)) {
nodes.get(node).remove(edge);
}
}
}
}
} |
500e032d-3660-471c-bcd3-83bc03893f47 | 0 | @Test
public void testTruncate()
{
String s = "My really long string that needs to be cut down to size.";
Assert.assertEquals(
"My really long string that needs to be cut down…",
_helper.truncate(s, 50)
);
} |
9efcc52b-a49b-4e55-b744-969785b1a6bf | 1 | @Override
public void actionPerformed(ActionEvent e) {
JButton augmenter = (JButton) e.getSource();
System.out.println("Augmenter vitesse");
new Thread(new Runnable() {
public void run() {
try { Main.service.augmenterVitesse(bus); }
catch (IOException e) { e.printStackTrace(); }
}
}).start();
... |
2eab5b12-fafd-4eb6-9cb3-7f095f267974 | 7 | @Override
public void run() {
Thread me = Thread.currentThread();
String item = (String) (cb.getSelectedItem());
int current_index = item2index(item);
while (true) {
item = (String) (cb.getItemAt(current_index));
cb.setSelectedIndex(current_index);
... |
db81106e-cf65-480b-bb3e-41f36bc5b42f | 4 | private void executeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_executeButtonActionPerformed
String input = inputTextField.getText();
if (state == 0)
{
if (input.equals("open door"))
{
feedbackLabel.setText("You open the door."... |
cdeee5f9-ac07-419f-9239-c6d20b52d190 | 4 | public void SmithWaterman()
{
int x,y;
matrix[0][0]=0;
//System.out.println(matrix.length + ":" + matrix[1].length);
for(x=1;x<matrix[0].length;x++)
{
matrix[0][x]= Math.max(matrix[0][x-1] +effort[0], 0);
}
for(y=1;y<matrix.length;y++)
{
matrix[y][0]= Math.max(matrix[y-1][0] +effort[1], 0);
}... |
f89494fe-f9b2-4e17-9419-089e5e153b0d | 8 | public String weekTo(String field)
{
String newField = " TO ";
if(field.length() == 3)
{
if(field.equals("SUN") || field.equals("MON") || field.equals("TUE")
|| field.equals("WED") || field.equals("THU") || field.equals("FRI")
... |
9d17d724-f077-4ed9-8bab-54e0f21a678b | 5 | public static int menu () {
Scanner kb = new Scanner(System.in);
int cho = 0;
do {
System.out.println ("\n\n[*] Menu:\n");
System.out.println ("1) Conta esemplari totali");
System.out.println ("2) Calcola valore totale della raccolta");
System.out.println ("3) Cerca e visualizza i... |
0912a58a-fd50-4193-a5e3-fc9bb0b46205 | 8 | public JPanel addNumberButtons(JTextField DispField){
final JTextField Field = DispField;
JPanel ButtonPanel = new JPanel();
ButtonPanel.setLayout(new GridLayout(4, 3));
ButtonPanel.setPreferredSize(new Dimension(500,320));
ButtonPanel.setMaximumSize(new Dimension(500,500));
JButton [] Num... |
3b0bd035-cb87-444e-abb8-073b241decee | 5 | private int[] parseBookingID(String bookingID)
{
int[] idArray = null;
try
{
// exit if bookingID is empty
if (bookingID == null || bookingID.length() == 0) {
return null;
}
int MAX_ATTR = 2; // 2 members: resID_reservationI... |
42fb870e-22f4-44e8-95fa-7b59124960f1 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
620afcdf-4dbc-43b4-8956-2cd9c86eff66 | 0 | protected AutomatonSimulator getSimulator(Automaton automaton) {
return SimulatorFactory.getSimulator(automaton);
} |
54514bc6-f1c7-44a9-adee-c90ee121ed4d | 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... |
74863a17-6f86-458c-8bc5-5df8aa1936ce | 7 | public List<ServerFile> getServerFiles() {
List<ServerFile> files = new ArrayList<>();
if(dontScan) {
return files;
}
ServerFile sf;
File[] dirfiles;
getServer().log("Parsing " + getDirectory().getParent() + "/" + getDirectory().getName());
dirs: for (File directory : getFiles()) {
if (!directory.is... |
a72d5212-e761-4c56-ad04-f24932746e38 | 5 | public Map<String, Mass> makeMassMap(){
Map<String, Mass> massMap = new HashMap<String, Mass>();
NodeList[] massArray = {movingMasses, fixedMasses};
for (NodeList massType: massArray){
for (int i = 0; i < massType.getLength(); i++) {
Node node = massType.item(i);
if (node.getNodeType() == Node.ELEME... |
9686d946-d7e9-4f89-9ddd-65887386c88a | 6 | public Recipe getRecipeForPallet(Pallet pallet) {
String sql =
"Select quantity, rawMaterialName, recipeName "+
"from Ingredients "+
"where Ingredients.recipeName like ? ";
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sql);
ps.setString(1, pallet.recipeName);
} catch (SQLExc... |
b6bb35eb-d26f-4025-a26f-88bcd4fb32df | 4 | public void update(long currentTime) {
if (isFinished) {
return;
}
progress = (double)(currentTime - iT)/period;
if (progress >= 1) {
if (loop) {
start(currentTime);
return;
}
progress = 1;
isFini... |
6a97ea4f-efc5-4a2d-ae3d-63b7c1612062 | 1 | @Before
public void setUp(){
for(int i = 0; i < 20; i++){
solutions.put(i,(double) i);
}
classUnderTest.setSolutionFitness(solutions);
} |
fc48df4c-e526-456a-b026-ee1ea06a2ddd | 7 | private void doSave() {
fileDialog = new JFileChooser(currentDirectory);
File selectedFile; //Initially selected file name in the dialog.
if (editFile == null)
selectedFile = new File("filename.txt");
else
selectedFile = new File(editFile.getName());
fileDialog.... |
5debba50-91fa-4ef5-bca9-56ee3ba0b17d | 6 | private void listenClient(String clientRequest) throws NullPointerException {
String[] reqSplit = clientRequest.split("-");
if (reqSplit[0].equals("LOGOUT") && reqSplit.length == 2) {
processor.getMessageQ().add(this, clientRequest);
} else if (reqSplit[0].equals("LOGIN") && reqSplit... |
698ee856-23bb-4e4b-a2a6-7a43c58980e4 | 0 | Xpp3Dom getResults() {
return getInTestLinkListener().getResults();
} |
6d6102d5-d8e6-4718-bc27-9ec46f958e1b | 2 | public RoleSchool removeRole(long id){
for(int i = 0; i < roles.size(); i++){
if(roles.get(i).getId() == id){
return roles.remove(i);
}
}
return null;
} |
0f8f16de-cd7f-49c9-b9f3-437f96c102d3 | 0 | public String getMiasto() {
return miasto;
} |
89e42ca1-096b-4654-bd3b-c3685694fe65 | 7 | public static void call(final String mapping, final String data) throws Exception {
// delimited by a comma
// text qualified by double quotes
// ignore first record
OrderBy orderby = null;
final Parser pzparser = DefaultParserFactory.getInstance().newDelimitedParser(new File(map... |
4ded5c06-bcb6-4e89-b6b3-41ab49fdd529 | 9 | public void endElement(String uri, String localName, String qName) throws SAXException {
int tag = getTagIndex(qName);
if (inOneBoxResult) {
doOneBoxResult(tag);
} else if (inOneBoxResponse) {
doOneBoxResponse(tag);
} else if (inResult) {
doResult(tag)... |
2ca3a946-988b-4a75-affb-f5987e23fd50 | 8 | public static void main(String[] args) {
// insert a bunch of strings
String[] strings = { "it", "was", "the", "best", "of", "times", "it", "was", "the", "worst" };
IndexMaxPQ<String> pq = new IndexMaxPQ<String>(strings.length);
for (int i = 0; i < strings.length; i++) {
pq.... |
1eba6fbe-42a2-4dae-a4e8-d92ee8c591e0 | 0 | private int extractSlot(byte[] schedule, int slot) {
// since 8 is divisible by bitsPerSlot, we know that
// one slot will never span more than one byte.
// relevant byte:
byte b = schedule[(slot * bitsPerSlot) / 8];
int startBit = (slot * bitsPerSlot) % 8;
b >>= startBit;
b &= (1 << bitsPerSlot) - 1;
... |
f0264a45-4a6a-4592-b747-3e5ca920b5b1 | 4 | @Override
public void keyTyped(KeyEvent e) {
if(e.getKeyChar() == this.editor.getCommandChar()) {
this.view.getCommand().setVisible(true);
this.view.getCommand().setText(this.editor.getCommandChar()+"");
this.view.getCommand().requestFocusInWindow();
}
else switch (e.getKeyChar()) {
case '\u0008':
c... |
0c754a18-eff9-488b-bad6-e70abe7cbcad | 3 | private Raum[][] erzeugeRaumArray(List<Raum> raumListe,
List<XmlRaum> raumPositionen)
{
Raum[][] result = new Raum[getMaximumX(raumListe) + 1][getMaximumY(raumListe) + 1];
for(Raum raum : raumListe)
{
for(XmlRaum xmlraum : raumPositionen)
{
if(xmlraum.getID() == raum.getId())
{
result[raum.... |
ad7125bd-dd5b-4c0c-abeb-a1edd789e71e | 4 | void run() {
if (fileToProcess != null) {
File resultFile = new File(fileToProcess);
if (!resultFile.exists() || resultFile.isDirectory()) {
LOG.error("{} is not a good result file", fileToProcess);
return;
}
try {
... |
0612acca-50d3-448d-b9a3-9ee83a2e066d | 6 | public InvertedFileIterator(int entryPar,String indexDirectory,int lexiconSizePar, InvertedFile invFile){
synchronized(this){
entry=entryPar;
lexiconSize=lexiconSizePar;
try{
File pl_f=new File(indexDirectory+"/invfile/pl_e"+entry+"_sorted.dat");
... |
3b2744c1-2aa8-446f-877a-293e8ee81aec | 3 | protected synchronized void onResized(int columns, int rows)
{
TerminalSize newSize = new TerminalSize(columns, rows);
if(lastKnownSize == null || !lastKnownSize.equals(newSize)) {
lastKnownSize = newSize;
for(ResizeListener resizeListener: resizeListeners)
r... |
5bdd42d5-653d-4ebe-bbc8-3f8a35fd7db4 | 5 | @Override
public void actionPerformed(ActionEvent e) {
visibleScreen.getFrame().getContentPane().removeAll();
boolean playerHadABang = false;
if (visibleScreen.getSetup().getRound().playerInTurnIsNextToReactToDuello()) {
playerHadABang = visibleScreen.getSetup().getRound().ge... |
bc703622-10de-4b5e-bb79-c0b783d4011a | 0 | public void ship(String dest) {
Contents c = contents();
Destination d = to(dest);
System.out.println(d.readLabel());
} |
0f6fb69d-2c36-4ef9-a211-dfef953fd06e | 2 | @Override
public void processEntity(Entity entity) {
Spatial spatial = entity.getComponent(Spatial.class);
/**
* If the previous spatial was null, this is the first time it's been
* through this PreviousSpatialSystem. We therefore create its new
* Spatial. We couldn't do this within the Spatial class bec... |
551030a8-802f-4be3-881b-bb670413a80a | 6 | @Test
public void testTasks()
{
Task heute,invalid;
try {
//anpassen an aktuellen tag!
heute=new Task(2012, 11, 16,"heute");
} catch (InvalidTaskException ex) {
fail(ex.getMessage());
}
invalid=null;
try {
invalid=... |
97876581-aa08-4b75-907f-dbcebf9630d2 | 2 | public E succ(E e) {
DoublyLinkedNode node = search(e);
if (node != null) {
if (node.getSucc() != null) {
final E returnValue = (E) node.getSucc().getKey();
return returnValue;
}
}
return null;
} |
5ea3fae7-db70-4827-8dbe-821dc83c6fab | 7 | public Class<?> getColumnClass(int columnIndex)
{
switch (columnIndex)
{
case COL_HASH:
case COL_TITLE:
case COL_LINK:
case COL_SOURCE:
return String.class;
case COL_SEED:
case COL_LEECH:
return Integer.class;
default:
return String.class;
... |
ee39f675-4619-4386-8934-3cfb96517b87 | 5 | public static boolean isAvailable(int port){
if (port < 0) {
return false;
}
ServerSocket ss = null;
DatagramSocket ds = null;
try {
ss = new ServerSocket(port);
ss.setReuseAddress(true); //ServerSocket类中,默认值为false,该方法必须在绑定端口前使用才有效
ds = new DatagramSocket(port);
ss.setReuseAddress(true);
... |
0dd5436e-2fab-477f-9e16-06644019fda0 | 6 | private boolean checkSetting() {
if (DoArea.userNameField.getText().isEmpty())
return false;
if (DoArea.passWordField.getText().isEmpty())
return false;
if (DoArea.keyPathField.getText().isEmpty())
return false;
if (DoArea.hostNameField.getText().isEmpty())
return false;
if (DoArea.portNumberField... |
c4a4e704-07a7-4990-ab41-61422af57551 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!auto)
return false;
final Physical target=givenTarget;
if(target==null)
return false;
if((target instanceof Item)&&(room==null))
return false;
if(target.fetchEffect("Sinking")==nul... |
6706e49d-994b-4dd0-b248-cface34a0093 | 3 | boolean setLcLpPb(int lc, int lp, int pb) {
if (lc > Base.kNumLitContextBitsMax || lp > 4 || pb > Base.kNumPosStatesBitsMax) {
return false;
}
m_LiteralDecoder.create(lp, lc);
int numPosStates = 1 << pb;
m_LenDecoder.create(numPosStates);
m_RepLenDecoder.creat... |
c2ae72a7-2581-476e-8249-5d8eb3d7ba4e | 7 | private void integrityCheck() {
PurchasableCircularList next = nextGroupElement;
int stations = 0;
int owned = 0;
do {
stations++;
next = next.getNextGroupElement();
} while(!next.equals(this));
next = this;
do {
if(next.getOwner() != null && next.getOwner().equals(owner)) {
owned++;
}
... |
2202d94f-4fb6-4079-8194-68fc5f7f47c4 | 1 | @Override
public boolean canImport(TransferSupport support) {
return (support.getComponent() instanceof JList) && support.isDataFlavorSupported(RiverComponent.RIVER_COMPONENT_DATA_FLAVOR);
} |
e165a251-dd1c-4087-aace-3464dc7d2701 | 8 | public List<Position> getClosestCarsInt() { //Returns closest car to intersection on each road
List<Position> closest = new ArrayList<Position>();
ListIterator<Road> roadItr = this.roads.listIterator();
Position carPos = null;
// For if we continue cars moving
while (roadItr.h... |
4f86413a-2178-4f53-8e01-d533e43f0555 | 3 | @Override
public void paint(Graphics2D g2d) {
super.paint(g2d);
if(municion <= MUNICION_PARA_RECARGAR)
g2d.drawString("Reload! ("+movimientos.getRecargar().getNombreTecla()+")", x, y+6);
if(salud<=5 && vidas>0) g2d.drawString("Reviviendo en "+salud, x, y-10); ... |
72694e1d-149c-4275-b2d6-7f3afb1d9a28 | 8 | public void deleteFile(String fileName){
// deletion flag
boolean flag = true;
// Create an instance of File representing the named file
File file0 = new File(fileName);
// Check that the file exists
if(!file0.exists()){
System.err.println("Method deleteFil... |
877ede10-ed98-4312-b6ab-70b59e4c35f4 | 7 | private void checkHit() {
int mapPosX = Main.getMapPosX();
int mapPosY = Main.getMapPosY();
int epsilon = 100; // Epsilon fuer Radius um Schwerts
LinkedList<Mob> Mobs = AssetCreator.getMobs();
for (int i = 0; i < Mobs.size(); i++) {
Mob mob = Mobs.get(i);
if(!mob.isHit() && (x+epsilon-mapPosX > mob.g... |
384dd0e4-7ee8-4a59-b4df-709b2aa93c10 | 7 | public void destroy() {
bgComboBox.destroy();
ActionListener[] al = okButton.getActionListeners();
if (al != null) {
for (ActionListener i : al)
okButton.removeActionListener(i);
}
al = cancelButton.getActionListeners();
if (al != null) {
for (ActionListener i : al)
cancelButton.removeAction... |
0b09e9ee-63cd-4e2e-ba1f-47e820929a5c | 4 | private void initCamera() {
Transform3D projectionMatrix = new Transform3D();
double nearClipping = 0.1;
double farClipping = 5.0;
double[] intrinsics = new double[9];
try
{
System.out.println(UbitrackFacade.DATAFLOW_PATH+File.separator +"CamCalib-3-3-Matrix" );
FileReader fro = new FileReader(System... |
d6879e8e-f564-4c83-89ed-b68ae14e5f15 | 7 | public void splitCodeAndComment(CodeMethod cm) {
List<String> src = new LinkedList<String>();
List<String> comment = new LinkedList<String>();
boolean comment_mode = false; // multi-line comment mode
String comment_mark = "";
StringBuilder sb = null;
for (String sen : cm.body) {
if (comment_mode) {
i... |
21d4965e-9155-47d8-8c9d-1ef6ced1e77d | 3 | @Override
public void caseAFormallist(AFormallist node)
{
inAFormallist(node);
{
List<PFormalrest> copy = new ArrayList<PFormalrest>(node.getFormalrest());
Collections.reverse(copy);
for(PFormalrest e : copy)
{
e.apply(this);
... |
041b2374-66ad-4726-b601-7d3e9277d518 | 2 | private void initiateParsing()
{
// http://tutorials.jenkov.com/java-xml/sax.html
SAXParserFactory factory = SAXParserFactory.newInstance();
File file = new File("assets/OSM_MapOfDenmark.osm");
try
{
InputStream openStreetMapData = new FileInputStream(file);
SAXParser saxParser = factory.newSAXParser()... |
8ec15ca1-a526-4e35-b1b8-3f25ce77320b | 8 | private void initializeJob() {
if (job == null) {
job = new Job("3D Molecular Simulator #" + jobIndex++) {
public void run() {
while (true) {
super.run();
while (!isStopped()) {
modelTime += getTimeStep();
advance(indexOfStep++);
execute();
}
synchronized (thi... |
d980d8c2-f4a9-41dd-acde-2cdc048032cb | 1 | public void makeBold() {
if (this.isDisposed()) {
return;
}
isBold = true;
setFont(boldFont);
} |
f7dd11d9-d9d4-4298-b4b4-b4a788f39711 | 8 | private int getDepth() {
Stack<TreeNode<E>> nodeStack = new Stack<TreeNode<E>>();
Stack<Integer> leftStack = new Stack<Integer>();
Stack<Integer> rightStack = new Stack<Integer>();
nodeStack.push(root);
leftStack.push(-1);
rightStack.push(-1);
while (true) {
TreeNode<E> t = nodeStack.peek();
int l... |
2c19966f-0e87-4f0b-9aa4-b3ade151675d | 8 | private void receiveRegularMessage(Message m) {
if(this.children.contains(m.broadcaster())) {
if (this.parent == -1) {
this.returnACK(m);
}
else {
this.rebroadcast(m);
}
}
else if (this.parent == m.broadcaster()) {
... |
7a816137-fefb-43ec-b85b-38d050c194f2 | 6 | private boolean attemptWin(Command command){
if (!command.hasNthWord(2)) {
System.out.println("Go where?");
} else if (command.getNthSegment(1).equalsIgnoreCase("Sunset")){
if(bag.contains("hull") && bag.contains("mast") && bag.contains("rudder") && bag.contains("helm")){
... |
ffc83803-7b2d-4a09-a8c9-d9c800dbc818 | 1 | public void testConstructor_RP_RI8() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Period dur = new Period(0, 0, 0, 0, 0, 0, 0, -1);
try {
new Interval(dur, dt);
fail();
} catch (IllegalArgumentException ex) {}
} |
41bcd9a7-bd02-4e6f-839a-4e304302ed7a | 3 | public void setButtonRate(JButton button) {
button.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt) {
try {
System.out.println("Rate Button for Media_Id: "
+ wbview.getSelectedId());
if (wbview.getSelectedRowCount() == 1) {
wbview.invokeRateMediaDialog(wbvi... |
0fb15a4b-2e5a-4b5f-b29a-671a5ae33f8c | 8 | public static Double complexSum ( Double value1, Double value2 ) {
if ( ( value1 >= 0.0 && value2 >= 0.0 ) || ( value1 <= 0.0 && value2 <= 0.0 ) ) {
return value1 + value2;
} else if ( ( value1 >= 0.0 && value2 <= 0.0 ) || ( value1 <= 0.0 && value2 >= 0.0 ) ) {
return value2 - va... |
39cf033f-7ab2-4f48-9af5-d1efcc76b61f | 9 | protected boolean checkCDATA(StringBuffer buf)
throws IOException
{
char ch = this.readChar();
if (ch != '[') {
this.unreadChar(ch);
this.skipSpecialTag(0);
return false;
} else if (! this.checkLiteral("CDATA[")) {
this.skipSpecialTag(1... |
a9577256-7ac4-44f0-aa4a-2dca8561361c | 7 | private void StakeholderListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_StakeholderListValueChanged
// TODO add your handling code here:
Stakeholder tempSH = new Stakeholder();
String tempName = (String) StakeholderList.getSelectedValue();
for (int i = 0; i ... |
9345770d-c2c5-4766-832b-e612a9395427 | 0 | public Tile(int x, int y, int t)
{
this.x = x;
this.y = y;
type = t;
} |
152ea80e-703b-4b51-aca9-75756fc6e594 | 5 | public void sendToNether(Player p){
if(p.hasPermission(DeityNether.OVERRIDE_PERMISSION)){
testAndPort(p, false);
}else if(p.hasPermission(DeityNether.GENERAL_PERMISSION)){
if(p.getWorld() == DeityNether.server.getWorld(DeityNether.config.getNetherWorldName())){
p.sendMessage(DeityNether.lang.formatAlready... |
dd910702-d77c-4772-97f0-2abb37cab177 | 7 | protected String[] parseRow( ) throws SQLException
{
String[] newRow = new String[ COLUMN_NAMES.length ];
String headerLine = readNextLine();
if ( headerLine == null ) { return null; }
if ( !isRecordHeader( headerLine ) )
{
throw new SQLException( "Bad... |
502f72ee-0059-4cf6-b827-d81f92ae4011 | 0 | public void setAuthor(String author) {
this.author = author;
} |
a218447e-a776-4cf8-ac7b-efe7f609966a | 5 | protected static boolean isDayLightSavings(double latitude, double longitude, int date, int dstFlag) {
boolean DSTBoolean = false;
//user says no
if(dstFlag == 1) {
DSTBoolean = false;
}
//user says yes
else if (dstFlag == 2) {
DSTBoolean = true;
}
//user does not know
else {
try {
//chec... |
b399034d-f923-4870-9499-1b6bd525659f | 4 | private String checkDetailsNode(Element element, int nodeCount, String xmlTag){
if(nodeCount == 0){
//This value is returned when detail tag is not present
return "";
}
String genre = "";
NodeList detailsNode = element.getElementsByTagName("detail");
for(int i = 0; i < detailsNode.getLength(); i++){
... |
e6491168-0f77-476e-8136-59cc70d0cee4 | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.