method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
30eb0c3f-780c-4206-8052-3f1676ad815e | 7 | @Override
public void happens() {
for (Character characterChecking : Game.getInstance().getCharacters()) {
if (characterChecking.getCurrentRoom().getFloor() == Floor_Name.BASEMENT) {
int rollResult = characterChecking.getTraitRoll(Trait.SANITY);
if (rollResult >= 1 && rollResult <= 3){
Trait chosenT... |
1093459a-b614-409f-abf5-c3eb2d38dc1c | 9 | private void updateStateEntry(List<Keyword> keywords, List<String> terms) {
//Either jumped due to RecipeName passed, or no Recipe could be found
if (keywords == null || keywords.isEmpty()) {
if (terms != null && !terms.isEmpty()) {
recipeName = terms.get(0);
getCurrentDialogState().setCurrentState(RecipeAssi... |
d32873b2-546b-4e35-afc0-460bde2d27a5 | 7 | public void join() {
if (!isOnline) {
isOnline = true;
System.out.println("Input IP-address of active node");
System.out.println("If it is the first online node input 127.0.0.1");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... |
99c2693e-489f-454f-abeb-5f54cb6b1418 | 0 | @Test
public void test() {
// 00000000 00000001 11111111
String data = "Hello World!";
// SO: junit-how-to-simulate-system-in-testing
InputStream stdin = System.in;
try {
System.setIn(new ByteArrayInputStream(data.getBytes()));
RunLength.compress();
} finally {
S... |
3c97cf48-2ee5-4d0d-8fbc-5c18c6ccfaa1 | 1 | public void testConstructor_ObjectStringEx5() throws Throwable {
try {
new LocalDateTime("10:20:30.040");
fail();
} catch (IllegalArgumentException ex) {}
} |
523f0bcc-a853-4470-8777-2bad85c254f6 | 2 | private int findRec(){
int i = TLTa_table.getSelectedRow();
int x;
for (x = 0; i>0; x++){
i = i - patient.getTreatmentRec(x).getTreatmentSize();
if (i<0)
x--;
}
return x;
} |
f87fce3c-fd8b-42e8-ac81-ff541c3b1b4d | 7 | public void fusionWithHardLightFullAlpha(CPLayer fusion, CPRect rc) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(rc);
for (int j = rect.top; j < rect.bottom; j++) {
int off = rect.left + j * width;
for (int i = rect.left; i < rect.right; i++, off++) {
int color1 = data[off];
int alpha... |
236ec7a2-b3dd-4391-b809-ab72542bccff | 2 | public GoTerm rootNode() {
if( (parents == null) || parents.isEmpty() ) return this;
return parents.iterator().next().rootNode();
} |
2a954473-a776-4582-908a-0d56ffd64688 | 0 | public void setNum(String num) {
this.num = num;
} |
0445ca0e-d5d3-4580-accc-418cfada8639 | 4 | public void run(){
while(loop());
new read("deletePlayer;"+gameTag+";",ID).start();
} |
171b4512-2bdb-43ee-9398-6f4fb8a340b2 | 7 | public double[] getBulkConcns(){
if(!this.psi0set && !this.sigmaSet)throw new IllegalArgumentException("Neither a surface potential nor a surface charge/density have been entered");
if(this.sigmaSet && !this.psi0set)this.getSurfacePotential();
if(this.psi0set && !this.sigmaSet)this.getSurfaceCha... |
81a12a75-d5ab-4933-a2b0-fd0612970d3c | 1 | @Test
public void hahmoEiPaaseVasemmallaPuolellaOlevastaEsteestaLapi() {
laitetaasPariEstetta();
for (int i = 0; i < 100; i++) {
pe.liikuVasemmalle();
}
assertTrue("Hahmo pääsi seinästä läpi vasemmalle paahtaessaan. x = "
+ pe.getX(), pe.getX() > 0);
... |
b990a8c1-03e7-4263-bd38-d478e4835800 | 5 | private int binarysearch(int[] arr,int target,int b, int e)
{
if (b >= e) return -1;
if (b == e - 1)
if (arr[b] == target) return b;
else return -1;
int mid = (b + e) /2;
if (arr[mid] == target) return mid;
if (arr[mid] > target) return binarysearch(arr, target, b, mid);
return binarysearch(arr, t... |
fb729ea8-ef88-4ebe-a3e8-c2cd7e86f831 | 6 | @Override
public String textAendern(String text) {
if (text == null) {
return "";
}
ArrayList<Integer> spaces = new ArrayList<>();
StringBuilder buffer = new StringBuilder();
//Position der Spaces in eine ArrayList schreiben
//und aus dem String entfern... |
35485bb5-cb47-4b5a-9814-58e499f6f395 | 3 | private void dropLink() throws Exception {
Session s = HibernateUtil.getSessionFactory().getCurrentSession();
try {
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
Object obj = ois.readObject();
if(obj instanceof Link) {
s.beginTransaction();
s.delete(obj);... |
c430ac6e-b925-41b1-a7c6-5471080f2c81 | 6 | public void open(final InputStream is, final OutputStream os)
throws BITalinoException {
try {
socket = new BITalinoSocket(new DataInputStream(is), os);
Thread.sleep(SLEEP);
} catch (Exception e) {
e.printStackTrace(System.err);
close();
... |
d936bb40-fae8-4e94-bfed-06b64908765c | 4 | static String stripAccess(String newClass) {
// loop until all the known access flags are stripped
boolean flag = true;
while (flag) {
flag = false;
for (int i = 0; i < accessStrings.length; i++) {
String s = accessStrings[i][0];
if (newClass.substring(0, s.le... |
cdc141d8-d432-45c6-b161-855c50050455 | 3 | public Beverage makeBeverage(String beverageType) {
Beverage beverage = null;
if (beverageType.equalsIgnoreCase("Coffee")) {
beverage = new Coffee();
} else if (beverageType.equalsIgnoreCase("Tea")) {
beverage = new Tea();
} else if (beverageType.equalsIgnoreCase("Lemonade")) {
beverage = new Lemonade(... |
eaf36422-8191-4fac-aad6-c50b956bc21b | 5 | public Complex Newt(Complex z, double i, double j, int mode) {
if (mode == 1) {
return z.sub(UnityFunction(z, i, j).div(UnityDerivative(z, i, j)));
} else if (mode == 2) {
return z.sub(Poly2Function(z, i, j).div(Poly2Derivative(z, i, j)));
} else if (mode == 3) {
return z.sub(DivZ2Function(z, i, j).div(D... |
bbd15030-3a09-4636-8e01-5661b3c21874 | 7 | private void hideFile() {
if (stegoImg == null) {
((StegoHide)getTopLevelAncestor()).showErrorMessage("Please select a cover image!");
return;
}
int seedValue;
try {
seedValue = Integer.parseInt(seed.getText());
} catch(NumberFormatException ex) {
((StegoHide)getTopLevelAncestor()).showErrorM... |
7fde17d7-05e1-4d94-b710-0250b7205e7c | 3 | public static long[] euclideEtendu(long x, long y) {
if (x <= 1 || y <= 1) throw new IllegalArgumentException();
long r, q, xTemp, yTemp,
x0 = 1, x1 = 0,
y0 = 0, y1 = 1;
while (y != 0) {
r = x % y;
q = x / y;
x = y; y = r;
... |
d4ffeb81-8420-4d82-a156-1e40c9b93c1c | 2 | public void put(String cod_competicao, String cod_jogador) {
try (Statement stm = conn.createStatement()) {
int i = stm.executeUpdate("Update Marcadores set Cod_Competicao='" + cod_competicao + "',cod_jogador='" + cod_jogador + "',Golo=to_number('0') WHERE Cod_competicao='" + cod_competicao + "'an... |
7a517bed-9c8a-4fbf-b3fa-751198784589 | 0 | @Override
public void connected(ConnectedEvent e) {
} |
dbcda247-4dde-4f3a-b249-2a26ae728525 | 5 | public boolean getStudentByUniqueId(IssueBookVO issueBookVO)
throws LibraryManagementException {
boolean returnValue = true;
ConnectionFactory connectionFactory = new ConnectionFactory();
Connection connection;
try {
connection = connectionFactory.getConnection();
} catch (LibraryManagementException e)... |
da511ace-36ea-48e7-bb7c-0f06ea162d84 | 1 | */
public String getConfig() {
StringBuilder buffer = new StringBuilder();
int count = mModel.getColumnCount();
buffer.append(OutlineModel.CONFIG_VERSION);
buffer.append('\t');
buffer.append(count);
for (int i = 0; i < count; i++) {
Column column = mModel.getColumnAtIndex(i);
buffer.append('\t');
... |
80f6273b-1fb7-4fa2-8674-49f70f2eddb9 | 2 | public int calculerGain() {
int gains = 0;
Iterator<Territoire> it = this.territoiresOccupes.iterator();
// Calcul des gains pour chaque territoire
while (it.hasNext()) {
Territoire t = it.next();
gains += 1 + this.bonusGain(t) + t.bonusGain();
if (hasPower()) {
gains += this.pouvoir.... |
9df2e409-50ee-49ee-966b-f471ef31ec00 | 5 | @Override
public void onEntityTarget(EntityTargetEvent event) {
if (event.isCancelled()) {
return;
}
if (!(event.getTarget() instanceof Player)) {
return;
}
Player player = (Player) event.getTarget();
if (player.getGameMode().equals(GameMode.CR... |
985e88f1-a027-4f1a-a540-01343e7ab788 | 1 | @Test
public void readWorks() throws IOException {
ConnectMessage msg = new ConnectMessage("test", true, 10000);
msg.setCredentials("username", "password");
msg.setWill("/will/topic", "this is will message", QoS.EXACTLY_ONCE,
true);
byte[] data = msg.toBytes();
MessageInputStream is = new MessageInputStr... |
b6a1bba9-3f31-402f-bea5-46db704f75fc | 5 | public static void read() throws Exception {
synchronized (SystemProperty.class) {
if (instance == null) {
instance = new SystemProperty();
}
}
// Map作成
if (prop != null) {
prop.clear();
prop = null;
}
prop = new HashMap<String, List<String>>();
// ドキュメントビルダーファクトリを生成
Document... |
6a3ff8ed-8e13-4fe6-9c35-e5f27d024e4e | 4 | public static void run()
{
System.out.println("--|Basic Usage|--------------------------------------------------------------");
System.out.println("Some simple uses of the hat container");
// put some data into a hat and then get a random item
String[] names = {"Alice", "Betty", "Celia", "Darcy"};
Hat<Str... |
ac4d664b-ecb0-47b0-909b-14602dbdc113 | 4 | public static Node inorderSuccessor(Node root,int val)
{
if(root!=null)
{
if(root.data==val)
{
if(root.right!=null)
{
return minValue(root.right);
}
else
{
return maxAncestor;
}
}
else if(root.data<val)
{
return inorderSuccessor(root.right, val);
}
else
{
maxA... |
6fec1554-bec2-4fb8-a4b6-527b54f85481 | 0 | @Basic
@Column(name = "SOL_FECHA_HASTA")
public Date getSolFechaHasta() {
return solFechaHasta;
} |
eeb5941b-e51a-4b71-b226-f2d23af9c2f2 | 0 | public FiilContactFormParameter(String nameF, String nameL, String address,
String phoneH, String phoneM, String phoneW, String email1,
String email2, String bday, String bmonth, String byear,
String address2) {
this.nameF = nameF;
this.nameL = nameL;
this.address = address;
this.phoneH = phoneH;
thi... |
9f628982-6fcf-4eb2-859d-2a7d3aee1c43 | 3 | private static void doHelpTest()
{
String[] args0 = { "-h" };
String[] args1 = { "-h","add"};
String[] args2 = { "-h","archive"};
String[] args3 = { "-h","compare"};
String[] args4 = { "-h","create"};
String[] args5 = { "-h","delete"};
String[] args6 = { "-h","description"};
String[] args7 = { "-h","ex... |
e7ca38c5-c504-49ef-9daa-10cace34c549 | 7 | Object invoke(Object target, Object[] args)
{
Method method = method();
try {
try {
return method.invoke(target, args);
} catch (IllegalAccessException ex) {
Method accessible = searchAccessibleMethod(method, argTypes);
if (acce... |
d385cf8b-bddc-4c54-ba33-55a98ba98d6a | 6 | public void setModelValue(Object obj) throws YException {
if (obj == null) {
this.setSelectedIndex(-1);
} else {
// searching corresponding item in list:
if (items == null) {
throw new YException("List model for YList is not set.");
} else {
for (i... |
e8dd81d6-32c1-4df7-bed5-8a94fed87c87 | 3 | public BitTorrentMessage receiveMessage () throws IOException {
try {
// Message length
inputBuffer.clear().limit(4);
while (inputBuffer.remaining() > 0) {
channel.read(inputBuffer);
}
inputBuffer.flip();
int length = inputB... |
adebd2db-7f82-4673-800d-96b63bc7cca2 | 7 | static private final int jjMoveStringLiteralDfa14_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(12, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(13, active0);
return 14;
}
switch(curChar)
... |
9655ee9c-e2d8-4d49-af73-10baade466c0 | 2 | public void sort(List <T> values) {
// Check for empty or null array
if (values ==null || values.size()==0){
return;
}
this.values = values;
number = values.size();
quicksort(0, number - 1);
} |
74c89d38-1efa-4034-b4fa-a0d6b1fecaff | 6 | private String findElement(String response, String elementTag, String elementTypeLink, String elementName) throws InvalidObjectException, ConnectorException {
Document doc = RestClient.stringToXmlDocument(response);
NodeList list = doc.getElementsByTagName(elementTag);
for(int i=0; i < list.getLength();i++){
... |
b77f0cbb-54ca-46a9-b853-98b28dbfb445 | 6 | public static boolean implementsInterfaceIncludingSuper(Class<?> implementor, Class<?> interf)
{
List<Class<?>> interfaces = getAllInterfacesIncludingSuper(implementor);
for (Class<?> intf : interfaces)
{
if (intf.equals(interf))
{
return true;
}
}
return false;
} |
203626b7-2e2a-41e3-ab01-6a7c9d3fc961 | 1 | public boolean removeByKey(String tableName, String key) throws DataBaseTableException {
Table table = tableHashMap.get(tableName);
if (table == null) {
throw new DataBaseTableException("no such table");
}
return table.remove(key);
} |
b6e87b7c-b4f0-4b4f-acd7-7480b9c4fb46 | 4 | public void start() {
server = new Server();
server.setPort(port);
server.setNoSystemExit(true);
server.setDatabasePath(0, path);
server.setDatabaseName(0, name);
server.setErrWriter(new PrintWriter(System.out));
server.setLogWriter(new PrintWriter(System.out));
server.setSilent(true);
server.setTrace... |
fbc8837c-38d2-4c1a-ba7e-d5a776f571d1 | 3 | /** @param scrollTo The row index to scroll to. */
protected void keyScroll(int scrollTo) {
Outline real = getRealOutline();
if (!keyScrollInternal(real, scrollTo)) {
for (OutlineProxy proxy : real.mProxies) {
if (keyScrollInternal(proxy, scrollTo)) {
break;
}
}
}
} |
3fb6b40b-6c6c-45ac-8024-a2fb1ac9d299 | 1 | public boolean setPituus(double pituus){
if (pituus > minPituus){
this.pituus = pituus;
paivitaMinMax();
return true;
} else {
return false;
}
} |
f07eeb3d-212c-41b7-97d8-69289486cfb7 | 2 | public String buscaLogin(String login, String pass) {
String res = "error";
Statement statement;
ResultSet resultSet;
try {
Connection con = DriverManager.getConnection(connectString, user, password);
statement = con.createStatement();
resultSet = sta... |
ecb46bb8-13a5-449d-95e0-39a2cea398ba | 8 | static void getCommand(int blocks, int bytesPerBlock, String filename) throws IOException {
BufferedReader r = new BufferedReader(new FileReader(filename));
//StringTokenizer token = new StringTokenizer(r.readLine());
FileManager file = new FileManager(blocks, bytesPerBlock);
String storageName;
int ... |
2ae7aaa6-2af2-4e23-a87e-9881942ebe0d | 2 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((nome == null) ? 0 : nome.hashCode());
result = prime * result + ((obs == null) ? 0 : obs.hashCode());
long temp;
temp = Double.doubleToLongBits(preco);
result = prime * resu... |
8ec18589-1b7b-47e5-b65b-0ed4785f1a72 | 1 | @Override
protected DataSet doParse() {
try {
lineCount = 0;
return doDelimitedFile(getDataSourceReader(), shouldCreateMDFromFile());
} catch (final IOException e) {
LOGGER.error("error accessing/creating inputstream", e);
}
return null;
} |
542f8dd5-6ff8-4108-9d27-b0526b5e8386 | 2 | public void playFirework(World world, Location loc, FireworkEffect fe) throws Exception {
// Bukkity load (CraftFirework)
Firework fw = (Firework) world.spawn(loc, Firework.class);
// the net.minecraft.server.World
Object nms_world = null;
... |
f2caa31d-b38e-4cdb-9235-394cab14aa13 | 2 | @Override
public boolean verifier() throws SemantiqueException {
//Dans le cas où il y aurait d'autres methodes verifier pouvant retourner false
/*if(value instanceof Identificateur){
if(!((Identificateur) value).verifier())
GestionnaireSemantique.getInstance().add(new Se... |
c1c337c5-3443-4e81-ae67-eea7de88a78e | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tuple tuple = (Tuple) o;
if (first != null ? !first.equals(tuple.first) : tuple.first != null) return false;
if (second != null ? !second.equal... |
db6438b3-e84c-47e6-a177-560ad0b1196b | 4 | public int numUpgrades() {
if (upgrades == null) return 0 ;
int num = 0 ;
for (int i = 0 ; i < upgrades.length ; i++) {
if (upgrades[i] == null || upgradeStates[i] != STATE_INTACT) continue ;
num++ ;
}
return num ;
} |
a2cf3bbd-e4e8-4aef-b3f6-40ee61ced9c6 | 2 | @Override
public void deleteIngredient(int index) {
for(int i = 0; i<ingredientRepository.size(); i++){
if(ingredientRepository.get(i).getIngredientId() == index){
ingredientRepository.remove(i);
return;
}
}
} |
2705d95f-17ff-4108-b9e1-9d19fabde2c8 | 5 | private Field filterFields(Field[] fields, Class type) throws /*NoSuchFieldException,*/ TooManyMatchesException
{
ArrayList<Field> list = new ArrayList<Field>();
for(Field f : fields)
{
if(!f.getType().equals(type))
{
continue;
}
... |
3a952d9a-de15-48ed-83a7-a0c0789b40a3 | 9 | public String toString() {
String result = "Runs from: " + m_RunLower + " to: " + m_RunUpper + '\n';
result += "Datasets:";
for (int i = 0; i < m_Datasets.size(); i ++) {
result += " " + m_Datasets.elementAt(i);
}
result += '\n';
result += "Custom property iterator: "
+ (m_UseProper... |
9a7aa6bd-092c-4c4e-b4db-bf18f9b3befd | 9 | private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {
if (lab_modo.getText().equals("Alta")){
if (camposCompletos()){
if (validarFechas()){
ocultar_Msj();
insertar();
... |
61294693-b91f-4c7a-b5cc-d80248096c83 | 1 | protected void extendToString(StringBuffer buffer) {
if (hasConstructor)
buffer.append("hasConstructor ");
super.extendToString(buffer);
} |
0c098a1d-764e-4c68-b3cb-607814b20a68 | 8 | private void processOffScreen(String offScreenString){
String[] gameObjects = offScreenString.split("#");
//Object data contains two fields: type, number of the object
for(int i = 1; i < gameObjects.length; i++){
ArrayList<String> objectData = processOffScreenObject(gameObjects[i]);
String type = obje... |
53b7e348-a149-4dc0-afad-2e7764f570e0 | 6 | public Cuboid expand(CuboidDirection dir, int amount) {
switch (dir) {
case North:
return new Cuboid(this.worldName, this.x1 - amount, this.y1, this.z1, this.x2, this.y2, this.z2);
case South:
return new Cuboid(this.worldNam... |
87fd11d1-4542-4d39-b221-55de4182e4a7 | 3 | @Override
public synchronized int read() throws IOException
{
if (bsize == 0) return -1;
int returnValue = buffer[offset];
if (bsize == buffer.length)
{
int read = in.read();
if (read != -1)
buffer[offset] = (byte) read;
else --bsize;
} else {
--bsize;
}
offset = (++offset) % buffer.leng... |
eaca9539-3c13-44d5-93ee-2851b8c551c2 | 3 | @Override
public void run() {
try {
report("checking cache", 1); // same as in GetPageJob before trying to read cache;
if (page.loadFromCache()) {
report("read from cache", 1); // same as in GetPageJob on successful reading cache;
//note: this iterator does not require locking because of CopyOnWriteArr... |
1d9f90d7-4c91-446a-bc22-157bc8fb4977 | 8 | public static boolean endsWithIgnoreCase(String s,String w)
{
if (w==null)
return true;
int sl=s.length();
int wl=w.length();
if (s==null || sl<wl)
return false;
for (int i=wl;i-->0;)
{
char c1=s.charAt(--... |
ebf3eda5-c51e-4aba-b92e-e55d4554204a | 8 | private boolean r_prelude() {
int among_var;
int v_1;
// repeat, line 36
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 36
... |
c1d86a2c-3ce5-425a-aec9-e4dbe7c535dc | 1 | @Execute
public void execute() {
for (int a = 0; a < 100000; a++) {
est_coeff = p1 * 1.2;
estimate = p2 + p2 + p3;
double d = Math.atan2(1.0666, 3.45);
d = Math.sin(1.0666);
}
} |
35a1ae68-be92-4a84-a0af-124b498edae5 | 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 Grupo)) {
return false;
}
Grupo other = (Grupo) object;
if ((this.codgrupo == null && other.codgrupo != null) |... |
919af563-db8b-484f-bd86-55bf1ce5ba8c | 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... |
127843d1-698c-4d18-86b7-2d53a041a732 | 3 | @Override
protected boolean perform(final CommandSender sender, final Command command, final String label, final List<String> args, final Region region) {
String owner = RegionExecutor.parse(args, 0, "<Owner>", sender);
if (owner == null) return false;
// Do not allow an owner to remove the... |
997adaa8-295e-4bfd-a0e7-bbfa0fc0e1a1 | 3 | private static void createGridResource(String name, int totalMachine,
int totalPE, double bandwidth, int[] peRating,
int policy, double cost)
{
// Here are the steps needed to create a Grid resource:
// 1. We need to create an object of Mac... |
2a215140-8c8f-45b7-bd2d-13a85c8b53a5 | 9 | private Set<VehiclePart> findConnectedFuelTanks(final VehiclePart engine) {
final Set<VehiclePart> connectedParts = new HashSet<>();
final Set<VehiclePart> scanned = new HashSet<>();
final Deque<VehiclePart> parts = new ArrayDeque<>();
parts.add(engine);
scanned.add(engine);
... |
6d0bd0ef-7b0f-4181-8621-db84aed9b601 | 6 | public static Attributed readAttrs(Reader source) throws IOException{
StreamTokenizer in = new StreamTokenizer(source);
AttributedImpl attrs = new AttributedImpl();
Attr attr = null;
in.commentChar('#');
in.ordinaryChar('/');
while(in.nextToken() != StreamTokenizer.TT_EOF){
if(in.ttype == StreamTokenizer... |
33e7c05e-04e9-4b91-8cae-eaf4bc6f4eda | 9 | public News[] LoadNews(){
News[] res = null;
try{
File xmlFile = new File(xmlFileName);
DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder xmlBulder = dFactory.newDocumentBuilder();
Document doc;
doc = xmlBulder.parse(xmlFile);
NodeList items = doc.getElementsB... |
43c63d3b-2c4b-4243-bfcb-987d3e46efd3 | 7 | public void run() {
NPC cat = spiceLooter.getCat();
if (cat.interact("Interact-with", cat.getName())) {
int time = 0;
while (!chaseVermin.validate() && time <= 3000) {
time += 50;
Time.sleep(50);
}
}
if (chaseVermin.validate() && chaseVermin.click(true)) {
int time = 0;
while (!cat.isMovi... |
11ea2cb9-ac54-426d-ae1e-efe6514454c1 | 3 | @SuppressWarnings("static-access")
private void ROUND4() {
enemises.clear();
System.out.println("Round4!!!!!!");
for (int i = 0; i < level.getWidth(); i++) {
for (int j = 0; j < level.getHeight(); j++) {
if ((level.getPixel(i, j) & 0x0000FF) == 2) {
... |
3a7672d7-657f-4bab-ada0-5d4007c612a4 | 5 | public String buscarProspectoPorTelefono(String telefono){
//##########################CARGA_BASE DE DATOS#############
tablaDeProspectos();
//##########################INGRESO_VACIO###################
if(telefono.equals("")){
telefono = "No busque nada";
... |
a2bef62f-229c-4338-acce-33934025f39d | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final JHeader other = (JHeader) obj;
if (!Objects.equals(this.IdOrder, other.IdOrder)) {
return fal... |
69a10e40-2ddc-436d-846e-5ead172a934a | 0 | public String getAmount() {
return amount;
} |
45e3a299-40e5-42cc-be36-fe9d0acadffd | 6 | private Set<String> complete(final String cmd) {
final Set<String> set = new HashSet<>();
for (final String s : commandMap.keySet()) {
if (s.startsWith(cmd)) {
set.add(s);
}
}
for (final String s : helpCommands.keySet()) {
if (s == null) {
if ("help".startsWith(cmd)) {
set.add("help");
... |
e7bbb44e-4aad-41a7-8547-1613c7504751 | 2 | public void save() throws IOException {
try {
this.mutex.acquire();
// On enregistre le fichier
FileWriter fw = new FileWriter(XML_PATH, false);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("<?xml version=\"1.0\"?>");
bw.newLine()... |
b72ae4dc-2901-4d15-ba97-eb9d9f51092e | 0 | public Flip(int random, int s1, int s2) {
this.random = random;
this.state1 = s1;
this.state2 = s2;
} |
5c924f0f-1ad0-4604-858e-050a34c59ffa | 2 | @Test
public void containsReturnsCorrectly() {
for (int i = 0; i < 5; i++) {
l.insert(v);
}
l.insert(a);
for (int i = 0; i < 5; i++) {
l.insert(v);
}
assertTrue(l.contains(a));
assertFalse(l.contains(b));
} |
0ff1ae01-8a8a-468e-86fe-f28efd312fca | 6 | @Override
public void assign(final Assignment<? extends Item> assignment) throws NullPointerException, IllegalArgumentException {
if (assignment == null) throw new NullPointerException("assignment = null");
final Item value = assignment.value();
if (value == null) throw new IllegalArgumentException("value = null... |
0b898e89-e67c-49af-9903-356047005345 | 5 | public static void showBoards(BoardGen bg)
{
n = bg.getBoardNum();
System.out.println("Board " + n + ": ");
for(int x = 1; x < b.length; x++)
{
for(int y = 1; y < b[x].length; y++)
{
System.out.print(b[x][y] + " ");
}
System.out.println();
}
System.out.println("\nBoard " + n + ": ");
... |
b0237737-f00b-4291-a6d3-84dfb716e820 | 5 | public InetAddress[] getValueAsInetAddrs() throws IllegalArgumentException {
if (!isOptionAsInetAddrs(code)) {
throw new IllegalArgumentException("DHCP option type ("+ this.code +") is not InetAddr[]");
}
if (this.value == null) {
throw new IllegalStateException("value is nu... |
9f9bb444-ba6d-4e7e-b0c7-c607f3cbfa3e | 3 | @SuppressWarnings("unchecked")
public static Map<String, Object> parseMap(String json) {
ObjectMapper mapper = new ObjectMapper();
JsonFactory factory = mapper.getFactory();
JsonParser jp = null;
Map<String, Object> result = null;
try {
jp = factory.createParser(json);
result = jp.readValueAs(HashMap.c... |
b96bec61-66f9-462e-963f-5f6b5d74e28f | 4 | public List<String> getStringListFromString(String xArg)
{
if (xArg == null || xArg.equalsIgnoreCase(""))
return null;
List<String> d = new ArrayList<String>();
char[] c = xArg.toCharArray();
int lastPos = 0;
for (int i = 0; i < c.length; i++)
{
if (c[i] == ',')
{
d.add(returnMergedChara... |
a3e81bf2-d60c-411d-be29-6f5e2d8bb450 | 5 | public String getTypeSignature() {
switch (((IntegerType) getHint()).possTypes) {
case IT_Z:
return "Z";
case IT_C:
return "C";
case IT_B:
return "B";
case IT_S:
return "S";
case IT_I:
default:
return "I";
}
} |
64e6e185-6eb7-4283-8010-c4cbdc7f5f5b | 4 | @Override
public void agisci(Parco parco) {
if (this.isMorto()) {
parco.eliminaAnimale(this);
return;
}
this.riproduci(parco);
Posizione nuovaPosizione;
Animale roditore;
roditore = trovaRoditore(parco);
if (roditore != null) {
this.incrementaCibo(1);
parco.eliminaAnimale(roditore);
nuova... |
189fcfb1-c6e2-47ac-9b76-fbf7679434a4 | 0 | public static int get() {
return value.get();
} |
b06ea22e-0c78-4b42-9363-5b48b9d87b66 | 7 | void radf2(int ido, int l1, final double cc[], double ch[],
final double wtable[], int offset)
{
int i, k, ic;
double ti2, tr2;
int iw1;
iw1 = offset;
for(k=0; k<l1; k++)
{
ch[2*k*ido]=cc[k*ido]+cc[(k+l1)*ido];
c... |
82ed37cf-add1-4462-94e7-c99213c56e95 | 8 | public void temporizador() throws SQLException {
System.out.println("1");
long start = System.currentTimeMillis();
long aux = start;
while (true) {
long end = System.currentTimeMillis();
long res = end - start;
if (aux != end) {
aux = e... |
ffec5e17-e8f4-466c-a8cf-4eff0bac28fe | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
Range<T> other = (Range<T>) obj;
if (max == null) {
if (other.max != null)
return false;
} else if (!ma... |
2107d338-8702-41a9-9136-fa33002725ce | 4 | @AfterClass
public static void afterClass() throws Exception {
File file = new File(VALID_FILE);
if (!file.delete()) {
throw new Exception("Finished testing for routing table persistency" +
"and trying to cleanup resources used, " +
"but for some r... |
c29b22d0-fc44-4601-b866-864e9a0070ec | 2 | public void addParticleSprite(String spriteName, BufferedImage spriteImage) {
if (spriteName == null || spriteImage == null) {
throw new IllegalArgumentException("Cannot add a null sprite!");
}
particleSprites.put(spriteName, spriteImage);
} |
790a5aa9-0952-477b-9161-e108b5785dbf | 5 | public static void checkCache(double[] cache, double[] read) {
boolean error = false;
if (cache.length != read.length) {
System.out.println("\tERROR: Cache array length difference : cache length = " + cache.length
+ "\t obsval length = " + read.length);
error... |
4c5a2091-68e6-425a-ad84-6be8a3e31aa9 | 9 | public Query handleInsertStatement(ZInsert s, TransactionId tId)
throws TransactionAbortedException, DbException, IOException,
simpledb.ParsingException, Zql.ParseException {
int tableId;
try {
tableId = Database.getCatalog().getTableId(s.getTable()); // will
... |
29b2de65-3d42-49c8-bfb1-609745584b4f | 2 | public boolean isConstant() {
for (int i = 0; i < subExpressions.length; i++)
if (!subExpressions[i].isConstant())
return false;
return true;
} |
89141f5b-8892-4609-a69a-82662998fdd5 | 9 | public CrossingStructure findPath(Crossing start, Crossing end, int limit) {
closedList = new ArrayList<CrossingStructure>();
openList = new ArrayList<CrossingStructure>();
CrossingStructure current = new CrossingStructure(start, null);
current.setgScore(0).sethScore( heuristic.calculat... |
cb612933-8141-494c-b424-6ba28cf6b83d | 6 | public static SwingDrawer createSwingDrawer( Drawable drawable )
{
if ( drawable instanceof Cheese )
return new SwingDrawerCheese();
else if ( drawable instanceof Door )
return new SwingDrawerDoor( (Door)drawable );
else if ( drawable instanceof Floor )
return new SwingDrawerFloor();
else if ( drawabl... |
f89958bf-161c-462f-a605-62fe4fec8963 | 5 | private void onLoad(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onLoad
toggler.setState(false);
chooser.showOpenDialog(this);
if (chooser.getSelectedFile() != null) {
try (DataInputStream dis = new DataInputStream(new FileInputStream(chooser.getSelectedFile()))) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.