method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
43fc8f06-2d4a-411e-8c70-5b7e0365c372 | 2 | @Override
public void salvar(Cliente cliente) {
try {
conn = ConnectionFactory.getConnection();
String sql = "INSERT INTO cliente (id, nome, cpf) "
+ "VALUES ((SELECT NVL(MAX(id),0)+1 FROM cliente), ?, ?)";
ps = conn.prepareStatement(sql); ... |
306752e0-134b-484c-82d7-79464d1b03ef | 8 | @Override
public void run() {
String recieve;
while (running) {
boolean isSended = this.clientVerbindung.send("INFO");
if (!isSended) {
this.close();
continue;
}
recieve = this.clientVerbindung.recieve();
if ... |
623efc77-3a04-4cc4-ab9b-9a4e1b5e4d63 | 9 | public Location getAdjacentLocation(int direction)
{
// reduce mod 360 and round to closest multiple of 45
int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE;
if (adjustedDirection < 0)
adjustedDirection += FULL_CIRCLE;
adjustedDirection = (adjustedDirect... |
65a1366a-421e-4d58-92f7-1f5faa5ce186 | 7 | @SuppressWarnings("unchecked")
@Override
public boolean put(final String key, final Object data, final String... indexes)
throws DataException, InvalidKeyException, DataClassException {
if (key == null) {
throw new InvalidKeyException("Null is not a valid key.");
}
... |
47fcaa58-c881-4c4c-a497-506163bd9086 | 3 | private void parseReference(Component parentNode, String sectionName, int level) throws TemplateException {
try {
// look for section
XPath xPath = XPathFactory.newInstance().newXPath();
NodeList nodeList = (NodeList) xPath.evaluate("/grammar/define[@name='" + sectionName + "']", template.getXml(), XPathCons... |
3b08e5c9-bdff-4f9f-8fce-146a4823e4d9 | 2 | public void run()
{
while (true)
{
repaint();
JokemonDriver.manageTime();
frames++;
framerateManager();
try
{
Thread.sleep(slp);
}
catch(Exception ignored){}
}
} |
217502f0-d3de-4dd5-b59b-ff4446e26ee6 | 6 | public boolean chargeForCity() {
if (! resForCity()) return false;
for (int i = 0; i < BRICK_CITY; i++) _hand.remove(Resource.Brick);
for (int i = 0; i < ORE_CITY; i++) _hand.remove(Resource.Ore);
for (int i = 0; i < SHEEP_CITY; i++) _hand.remove(Resource.Sheep);
for (int i = 0; i < TIMBER_CITY; i++) _hand.re... |
e571a928-85ff-4d1e-9bfe-bd7c1216fd17 | 4 | @Override
public String toString() {
StringBuilder albumString = new StringBuilder();
Iterator<String> it = keywords.iterator();
Iterator<String> bandIterator = bandMembers.iterator();
albumString.append("-Music Album- \n").append("band: ").append(bandName).append('\n');
... |
c832bc7d-ab92-419d-9ac0-510222aa0ce2 | 6 | public static final long mul(long x, long y) {
long moflo = (1L<<31); // multiply without overflow if operands < moflo
if (x >= 0 && x < moflo && y >= 0 && y < moflo) return (x * y) % p;
long res = 0;
while (x != 0) {
if ((x & 1) == 1) res = (res + y) % p;
... |
a11297ae-d0cf-489d-b630-0c15b25d8b34 | 8 | private static int method524(char ac[])
{
if(ac.length > 6)
return 0;
int k = 0;
for(int l = 0; l < ac.length; l++)
{
char c = ac[ac.length - l - 1];
if(c >= 'a' && c <= 'z')
k = k * 38 + ((c - 97) + 1);
else
if(c == '\'')
k = k * 38 + 27;
else
if(c >= '0' && c <= '9')
k = k * ... |
cc4e52be-e646-464a-92d3-17558e3968b4 | 8 | public static List<String> unban(String playerName) {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps;
int done = 0;
int accountid = 0;
List<String> ret = new LinkedList<String>();
try {
ps = con.prepareStatement("SELECT accountid FRO... |
4e5e9077-48e4-47fb-9d71-8e5acda3a9d1 | 2 | public static String checkLevels(double level) {
String message = "";
if (level < 0.0) {
message = " below acceptable range.";
}
if (level > 1.0) {
message = " above acceptable range.";
}
return message;
} |
97fde14d-8fc8-46a9-a569-8796d0eae095 | 6 | public XMLNode(String XMLText) {
// Figure out where the next tag begins and ends:
int lBracket = XMLText.indexOf("<");
int rBracket = XMLText.indexOf(">");
// If we reached the end of the file, we are done:
if (lBracket == -1 || rBracket == -1)
return;
// Sanity check: Is this really XML we're looking... |
bf64d61a-a5fd-47f4-b86b-ea5e1429be20 | 0 | public void onComplete(){
updateButton.setEnabled(true);
delMinecraft.setEnabled(true);
serverBox.setEnabled(true);
txtrn.setText("готово");
} |
1312b169-b9aa-4594-b44b-549c09bad543 | 1 | @Override
public InputStream openInputStream() throws IOException {
if (outputStream != null) {
return new ByteArrayInputStream(outputStream.toByteArray());
} else {
return new ByteArrayInputStream(new byte[0]);
}
} |
c3933f05-245d-4111-aa27-db5342a2c977 | 9 | private void getfields()
{
fcount = 0;
for(int k=0;;)
{
k+=32;
try { fdbf.seek(k); } catch (IOException e) {}
String fn = readChars(0,1);
if(fn.charAt(0)==0xd) break;
fn+=readChars(0,10);
field y = new field();
y.fname = fn.replace((char)0,' ').trim();
char f = readChars(0,1).charAt(0);
y.ftype =... |
5269e4eb-bf93-4f83-ae26-1024e4dfa20b | 2 | @Override
protected Integer doInBackground() throws Exception {
while(true){
jLabel1.setText(ChatBox.receiverStatus);
if (jLabel1.getText().equals("DAFUQ")) {
break;
}
}
return 666;
} |
19800750-d6cb-473b-9ade-aa92b0d793d4 | 2 | @Test
public void passed() {
for(int i=1;i<10;i++){
TestResult result = tester.test(StringGenerator.genString(i), 0,i);
if(!result.passed){
System.err.println(result.message);
}
Assert.assertTrue(result.passed);
}
} |
456b8614-ea73-478f-b9e3-90ad80f23e1e | 3 | public static Class<?> getReturnGenericType(Method method) {
Type genericType = method.getGenericReturnType();
Class<?>[] classes = getActualClass(genericType);
if (classes.length == 0) {
return null;
} else {
return classes[0];
}
} |
0a3262b6-5d33-4a64-bdc9-e48059560927 | 3 | static boolean isAllowed(final CommandSender sender, final String permission, final String targetName) {
// Always allowed for self
if (sender.getName().equalsIgnoreCase(targetName)) return true;
// Check if sender is allowed for all players
if (sender.hasPermission(permission + ".playe... |
e3257cab-82e0-4493-b0e3-7401eb3a5b35 | 0 | public void setCurconnected(int curconnected) {
this.curconnected = curconnected;
} |
98b19424-b4d1-4497-916c-04d3c6e10a36 | 7 | private void unzip(String file) {
final File fSourceZip = new File(file);
try {
final String zipPath = file.substring(0, file.length() - 4);
ZipFile zipFile = new ZipFile(fSourceZip);
Enumeration<? extends ZipEntry> e = zipFile.entries();
while (e.hasMoreElements()) {
ZipEntry entry = e.nextElement(... |
742a9cf2-ac11-4e51-bd92-c7aaef15bfa5 | 3 | protected synchronized boolean insertPacketIntoQueue(Packet pnp)
{
int srcID = pnp.getSrcID(); // source entity id
int destID = pnp.getDestID(); // destination entity id
int type = pnp.getNetServiceType(); // packet service type
Double nextTime = (Double) flowTable.get("" ... |
e6628428-4590-4573-8999-175c5a256988 | 0 | public void configure(Binder binder) {
// Singleton Implementations
binder.bind(ValidatorJNotifyListener.class).asEagerSingleton();
binder.bind(Watchers.class).asEagerSingleton();
binder.bind(JNotifier.class).asEagerSingleton();
binder.bind(XmlManager.class).asEagerSingleton();
// Interface Implementations... |
ffc2c51b-0117-4969-9dcc-7631af96bd7a | 9 | private void checkRobots(){
MyRobot tempMyRobot = null;
synchronized(robots){
for(MyRobot r:robots){
if (r.robotState == RobotState.idle && !r.broken){
tempMyRobot = r;
break;
}
}
}
if (tempMyRobot == null || (glassProcessing != 0)){
if (popUpStatus ==... |
ba44f81e-6829-45f5-9791-e558bdd68b3b | 5 | public boolean utrFromCds(boolean verbose) {
if (cdss.size() <= 0) return false; // Cannot do this if we don't have CDS information
// All exons minus all UTRs and CDS should give us the missing UTRs
Markers exons = new Markers();
Markers minus = new Markers();
// Add all exons
for (Exon e : this)
exon... |
23307b40-c941-4d2f-80d2-b22fe2532c7c | 6 | public void reserveOneWayTicket() {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
PreparedStatement ps = null;
Connection con =... |
6751a290-abfa-482d-8c5d-1be3155705f0 | 7 | public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row,
boolean hasFocus) {
Component returnValue = null;
if ((value != null) && (value instanceof DefaultMutableTreeNode)) {
Object userObject = ((DefaultMutableTreeNode... |
099ba749-51e7-4818-af5e-ded84820b8f0 | 2 | @Override
public List<String> callUserServices(String username) {
List<String> services = null;
System.out.println("[WSClient][callUserServices] Username is "+username);
try {
Service service = new Service();
Call call = (Call)service.createCall();
QName string = new QName("http://echo.demo.oracle/"... |
4f91cdc6-b899-45d9-b011-fe37667c2772 | 5 | public static void menuRemoveVisit(HousePetList hpArray)
{
int userChipID = 0;
HousePet tempHousePet = new HousePet(); /* new HP created with default chipID */
@SuppressWarnings("resource")
Scanner console = new Scanner(System.in);
boolean containsHousePet = false;
St... |
4cc8efde-6a3c-4fec-a809-fcfcc8bdb73a | 1 | public void visitLocalVariable(
final String name,
final String desc,
final String signature,
final Label start,
final Label end,
final int index)
{
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "name", "name", "", name);
... |
dcdb2dbe-2023-4b72-84ad-2e09400be545 | 5 | public static void unwrap(Message message,
CoreMessageListener coreMessageListener) {
if (!(message instanceof ObjectMessage))
return;
Object messagePayload = null;
try {
messagePayload = ((ObjectMessage) message).getObject();
} catch (JMSException e) {
e.printStackTrace();
}
if (!(messagePayl... |
b2f22bb3-139a-442a-b879-dbcf1ef99db9 | 1 | public void setPeuplesPris(List<Class<? extends Peuple>> peuplesPris) {
this.peuplesPris = peuplesPris;
} |
2c969b2e-079f-4ae6-81c5-02a757eb9792 | 0 | public GUIManager(PermWriter project) {
this.project = project;
} |
5149676b-6551-401e-b925-971ff531d7bf | 1 | public void doCSVPerformanceTest() {
try {
final String mapping = ConsoleMenu.getString("CSV File ", "SampleCSV.csv");
final boolean data = ConsoleMenu.getBoolean("Traverse the entire parsed file", true);
final boolean verbose = ConsoleMenu.getBoolean("Verbose", false);
... |
f2f8ed27-b933-4bc7-beb1-4084f2845b27 | 5 | static final void method1301(r var_r, int i, int i_0_, int i_1_,
boolean[] bools) {
if (aa_Sub1.aSArray5191 != Class332.aSArray4142) {
int i_2_
= Class348_Sub1_Sub1.aSArray8801[i].method3986(i_0_, i_1_,
(byte) -93);
for (int i_3_ = 0; i_3_ <= i; i_3_++) {
if (bools == null || bools[i_3... |
ce2c0e7d-5be1-4494-9292-505c631bb0f2 | 9 | @SuppressWarnings("unchecked")
private void listen() throws InterruptedException {
WatchKey watchKey = watcher.poll(5L, TimeUnit.SECONDS);
if (stop || watchKey == null) {
return;
}
for (WatchEvent<?> event : watchKey.pollEvents()) {
if (stop || event.kind() == OVERFLOW) {
continue;
}
... |
8b3345a1-9397-4dd6-841a-24e6a937a4ca | 1 | @Override
public Boolean getBooleanProp(String key, Boolean value){
Boolean result = value;
String propValue = getProperty(key);
if (null != propValue){
result = new Boolean(propValue);
}
return result;
} |
4863e4a8-c9de-4cd2-b9de-2db733c25792 | 9 | public static void handle ( String input, JTextPane console ) {
GUI.commandHistory.add ( input ) ;
GUI.commandHistoryLocation = GUI.commandHistory.size ( ) ;
GUI.write ( "Processing... [ "
+ console.getText ( ).replaceAll ( "\r", "" ).replaceAll ( "\n", "" )
+ " ]" ) ;
console.setText (... |
25143e4a-4ea1-45f3-b47a-330257e16a2f | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Node<?> other = (Node<?>) obj;
if (data == null) {
if (other.data != null)
return false;
} else if (!data.equals(other.data)... |
265366e2-2709-426a-af9d-a7aaee54b3cd | 5 | public CheckResultMessage check10(int day) {
int r = get(27, 5);
int c = get(28, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r + 3 + day, c, 6).add(
getValue(r + 3 + day, ... |
e73af62a-daac-4c3e-86dc-49f2615afecd | 8 | public void eliminarGrafico( Figura figura ){
if ( figura!=null ){
if ( figura instanceof ClaseGrafica ){
Figura graf ;
if ( listaFigura!=null ){
LinkedList<Figura> listaEliminar = new LinkedList<Figura>();
for (int i=0; i<lista... |
6ed3e04d-b7a2-48c1-9da3-73b4a4e355e6 | 6 | private String map(int depth50m, int depth10m, int depth1m)
throws NodeMeaningKeyErrorException {
if (depth50m < min50m || depth50m > max50m) {
throw new NodeMeaningKeyErrorException();
}
if (depth10m < min10m || depth10m > max10m) {
throw new NodeMeaningKeyEr... |
c1cd4178-e35d-4e52-a126-7967a6d90b84 | 0 | public int GetAveragePersonsWaitTime()
{
return averagePersonsWaitTime;
} |
b4d13fab-c160-4595-bd35-528455f2b69c | 2 | public synchronized boolean frameCorrection() {
// Copy frame information form CDSs to Exons (if missing)
frameFromCds();
// First exon is corrected by adding a fake 5'UTR
boolean changedFirst = frameCorrectionFirstCodingExon();
// Other exons are corrected by changing the start (or end) coordinates.
// b... |
f93d683c-cae3-4c4b-a6a6-8c80a259080b | 6 | public void add( ChunkState state )
{
if ( !containsState(state) )
{
if ( states == null )
states = new ChunkState[1];
else if ( containsState(ChunkState.none) )
{
for ( int i=0;i<states.length;i++ )
{
if ( states[i] == ChunkState.none )
{
states[i] = state;
break;
}... |
f132d6aa-a337-4b2d-91ec-93d55fa97b2c | 0 | public String getChannel(){ return Channel; } |
e63a010d-3f43-48bd-bb09-46f8b24608cc | 7 | public void processOrder(OrderTransaction orderTransaction) throws PointOfSaleSystemException {
orderTransaction.setCashier(cashier);
Transaction transaction = daoFactory.createTransaction(orderTransactionManager, inventoryDAO, creditManager, feeDAO);
try {
transaction.start();
... |
b4f6575e-2898-4500-a5e7-bee85a757298 | 6 | public int getPriority() {
switch (getOperatorIndex()) {
case 26:
case 27:
return 500;
case 28:
case 29:
case 30:
case 31:
return 550;
}
throw new RuntimeException("Illegal operator");
} |
44f0e997-0be2-4840-9e41-6e03a5088ed7 | 0 | @Override
public int getType() { return BuildingType.CITYHALL.ordinal(); } |
4cbf0925-e6cc-47cf-ac19-78238b9db74f | 2 | @Override
public boolean accept(File f) {
String extension = this.getExtension(f);
if (extension.equals("txt") || f.isDirectory()) { //Accept only txt files or directories (to allow navigation)
return true;
}
return false;
} |
58f7cab1-50af-451f-b6a2-29829b2ec6c8 | 6 | private boolean criteriaCheck3( String field, Ptg[] curRow, DB db )
{
boolean critRowMatch = false;
// for each value check all the criteria in a row
// multiple rows of criteria are combined
for( int x = 0; x < rows.length; x++ )
{
critRowMatch = true; // reset
// for each row of criteria, iterate cr... |
e53954f6-33d0-4ade-b18d-8659835cfa5d | 7 | @Override
public void restoreLimb(String gone)
{
if (affected != null)
{
if (affected instanceof MOB)
{
((MOB)affected).location().show(((MOB)affected), null, CMMsg.MSG_OK_VISUAL, L("^G<S-YOUPOSS> @x1 miraculously regrows!!^?",gone));
}
else
if ((affected instanceof DeadBody)
&& (((Item)affe... |
2d49c203-ce29-4d33-b0c8-9f8de4e8d2d2 | 0 | @Override
public PropertyFilterChain removePropertyFilterChain(String key, int index) {
return (PropertyFilterChain) filter_chains.remove(key);
} |
d78424e8-f296-4dc1-9dcc-3c246f9599a5 | 8 | private void registerUser(HttpServletRequest request, HttpServletResponse response) {
String key = request.getParameter(CommunityConstants.BASE64_PUBLIC_KEY);
String nick = request.getParameter(CommunityConstants.NICKNAME);
String remote_ip = request.getRemoteAddr();
String username = request.getRemoteUser()... |
5f3972e0-1f92-4999-8c6f-2a65524f4177 | 7 | private static boolean getDeleteDecisionFromConsole() throws CancelOperationException {
boolean validInput;
char[] result = null;
do {
validInput = true;
System.out.print("Delete the message after retrieving it [Y/N]? ");
try {
String input = in.nextLine().trim();
System... |
5f65ec55-b89e-425c-8ad7-71010513d410 | 1 | public HomePage getHomePage() {
if (homePage == null) {
homePage = new HomePage(this);
}
return homePage;
} |
31b475a2-2b42-4e1e-a4d7-aaf6f1a71fd5 | 0 | @Override
public String toString() {
return this.getID() + "";
} |
b4bf6f3d-cf9f-4c3d-854a-3f7c5be72746 | 3 | private ByteBuffer convertImageData(BufferedImage bufferedImage,
Texture texture) {
ByteBuffer imageBuffer;
WritableRaster raster;
BufferedImage texImage;
int texWidth = 2;
int texHeight = 2;
// find the closest power of 2 for the width and height
// of the produced texture
while (texWidth < buffer... |
10687173-77db-4439-b957-0f4351dd874e | 9 | private void handleQuery(int userLevel, String[] keywords) {
if (isAccountTypeOf(userLevel, ADMIN, MODERATOR, REGISTERED)) {
if (keywords.length == 2) {
String[] ipFragment = keywords[1].split(":");
if (ipFragment.length == 2) {
if (ipFragment[0].length() > 0 && ipFragment[1].length() > 0 && Functions... |
0941d43c-b3ed-40d6-b994-5734e83a4890 | 0 | private void initButtons(){
JButton buttonCancel = new JButton("Cancel");
buttonCancel.setBounds(getWidth() - 135, getHeight() - 65 ,
Main.buttonSize.width, Main.buttonSize.height);
buttonCancel.addMouseListener(new MouseAdapter() {
@Override
public void m... |
ccc56f8b-3a21-4379-b50d-b461db9280d9 | 2 | public int getStartNodeId(){
Iterator<Node> _iter = this._nodes.values().iterator();
while(_iter.hasNext()){
Node _node = _iter.next();
if(_node.isStartpoint()){
return _node.getId();
}
}
return -1;
} |
c5e52315-2cdd-424e-8e57-7054d4084a79 | 1 | public boolean _setSprite(Sprite sprite)
{
if(sprite != null)
{
this.sprite = sprite;
return true;
}
else
{
return false;
}
} |
f24fe502-ddea-4ea5-94f2-09c57bd8dfc8 | 0 | public void setG(int g) {
this.g = g;
} |
12796d49-ddfc-4acc-b8e4-6363daeffdc6 | 5 | private void searchLevelExact(ResultSet resultSet, double[] query,
Node node, double mindist, float epsError) {
// If this is a leaf node.
if (node.child1 == null && node.child2 == null) {
int index = node.cutDimension;
double dist = metric.distance(node.point, query);
resultSet.addPoint(dist, index);
... |
d732980c-1f50-4e01-adef-629dd30f2807 | 1 | public static void main(String [] args){
if (args.length!=2){
args = new String[2];
args[0] = "localhost";
args[1] = "9000";
}
String arg1 = args[1];
final String[] args2 = new String[1];
args2[0] = arg1;
final String[] args2final = args2;
final String[] argsfinal = args;
new Thread(){
publi... |
3461c4b9-8e2c-430a-a33d-b66a6bb4d95c | 3 | public void save(){
int i=0;
synchronized(options){
options.clear();
synchronized (timers){
for (Timer timer : timers){
options.setProperty("Timer"+i, String.format("%d,%d",timer.getStart(), timer.getTime()));
options.setProperty("Timer"+i+"Name", timer.getName());
i++;
}
}
t... |
c008df12-f871-41d9-949c-56e53aa34f03 | 1 | public static boolean isThis(Expression thisExpr, ClassInfo clazz) {
return ((thisExpr instanceof ThisOperator) && (((ThisOperator) thisExpr)
.getClassInfo() == clazz));
} |
81dcd36d-7e88-46a6-9283-098e3fbf4407 | 7 | @Override
public void mouseClicked(MouseEvent e) {
int mouse = e.getButton();
Rectangle rect = new Rectangle(e.getX(), e.getY(), 1, 1);
pressed = true;
if(mouse == MouseEvent.BUTTON1) {
switch(Game.state) {
case GAME:
break;
case MENU:
if(rect.intersects(Game.getInstance().getMenu().play)) ... |
e9414e41-11f6-4708-9ada-92a63486ff71 | 1 | protected void execute() {
double time = _timer.get();
if (time >= _period){
Color c = colors[_rand.nextInt(colors.length)];
Robot.ledStrip.setColor(c.getRed(),c.getBlue(),c.getGreen());
_timer.reset();
}
} |
58e6b827-eaa5-4088-a67d-ccd96da2f4c9 | 2 | private ListNode findMover( ListNode head ) {
ListNode p1 = head; // move 1 step each step
ListNode p2 = head; // move 2 steps each step
while ( p2 != null && p2.next != null ) {
p1 = p1.next;
p2 = p2.next.next;
}
// 1... |
5d67da25-827a-4c48-aa2d-ab75747f59f6 | 3 | public int getUniqueWindowID(){
int id = 0;
boolean unique = false;
while (!unique){
unique = true;
for (int x = 0; x < windowslist.size(); x++){
if (id == windowslist.get(x).getID()){
unique = false;
id++;
}
}
}
return id;
} |
557a616c-bc12-481f-9ce0-0ef58e47fb64 | 4 | public void createOpdracht() {
try {
String vraag = opdrCreatieView.getVraagT().getText();
String antwoord = opdrCreatieView.getAntwoordT().getText();
int maxAantalPogingen = Integer.valueOf((String) opdrCreatieView
.getMaxAantalPogingenC().getSelectedItem());
String antwoordHint = opdrCreatieView.ge... |
8d6338b8-9ecf-4a26-95ae-298267508957 | 6 | @EventHandler
public void ZombieHarm(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.getZombieConfig().getDouble("Zombie.Harm.Dodge... |
8abf1acb-3118-4975-bae6-4df68af027dd | 7 | AIMove onTestHockeyistFriction(AIHockeyist hockeyist) {
AIManager manager = AIManager.getInstance();
AIRectangle rink = manager.getRink();
AIPoint center = manager.getCenter();
AIMove move = new AIMove();
if (!visitedOrigin) {
double d = hockeyist.angleTo(rink.origin... |
3855d046-1e1b-4e00-9e8f-b40a85c817c7 | 4 | public static void test2(int a, int aa, int bb, String op, boolean carry) {
String op2 = "("+Integer.toHexString(aa)+" "+op+" "+Integer.toHexString(bb)+") ";
a &= 0xFF;
// if(a == 0)
// return;
if(a == aa)
return;
for(int j=0;j<A.length; j++) {
int b = A[j];
test(a+b,a,b,op2+"add",aa);
if(carry)
... |
6cfe6b3d-2fd9-4f38-80db-a97717826f40 | 9 | public final void execute() {
boolean start = false;
try {
start = valid();
} catch (Exception e) {
Logger.getLogger("CONCURRENT-VALIDATION").severe(e.getMessage());
e.printStackTrace();
} catch (ThreadDeath td) {
Logger.getLogger("CONCURRENT-VALIDATION").severe(td.getMessage());
td.printStackTra... |
14f1233f-e05b-4590-8b2d-97a9b80210bc | 4 | @Override
public StateBuffer executeInternal(StateBuffer sb, int minValue) {
sb = new UnboundedSegment(new TextSegment(Move.A,false)).execute(sb); // player mon uses attack
sb = new CheckMetricSegment(new CheckMoveDamage(isCrit, effectMiss, numEndTexts == 0, false, !player, ignoreDamage, thrashAdditionalTurns),GRE... |
3686871f-625b-4fa9-967b-e644758f5557 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(tickID==Tickable.TICKID_MOB)
{
if(nextDirection==-999)
return true;
if((theTrail==null)
||(affected == null)
||(!(affected instanceof MOB)))
return false;
final MOB mob=(MOB... |
d51f7410-99fb-4495-b4ed-c5860a4f938c | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
JsonArray other = (JsonArray) obj;
if (other.hasComments() ^ hasComments())
return false;
if (value == null) {
if (other.value != n... |
94f2ec37-20ef-4196-a149-dd9d791d1d25 | 7 | public DFSTree(Set<Node> nodeList) {
removables = new HashSet<Node>();
if (nodeList.isEmpty()) {
root = null;
return;
}
nodeMap = new HashMap<Node, DFSNode>();
int labelCount = 0;
Set<Node> visitedNodes = new HashSet<Node>();
Node n = nod... |
2152c550-6f3e-4412-92e3-eaab80a742c2 | 8 | private void seekString(StringBuilder strBuilder) {
char ch = 0;
boolean isEscape = false;
ch = jsonStr.charAt(index);
if (ch != '"') {
vali.disPass(index);
} else {
while (true) {
index++;
if (index >= length) {
... |
185db849-40b2-4c15-9c59-44671a55ce3c | 2 | public ArrayList<BESong> getAllByPlaylist(int searchWord) throws Exception {
try {
if (m_songs == null) {
m_songs = ds.getAllByPlaylist(searchWord);
}
return m_songs;
} catch (SQLException ex) {
throw new Exception("Could not find all songs... |
42d7e7ac-0946-4bca-9468-44216bc1648a | 2 | public boolean findStartPos(Level level) {
while (true) {
int x = random.nextInt(level.w);
int y = random.nextInt(level.h);
if (level.getTile(x, y) == Tile.grass) {
this.x = x * 16 + 8;
this.y = y * 16 + 8;
return true;
}
}
} |
10b0ee54-4e76-4c60-87b4-320c5f6c4617 | 8 | protected void replaceAll() {
init();
if( !replace )
return;
txt.setRedraw(false);
if( parser != null)
parser.setReparse(false);
if( wrapButton.getSelection() && replaceText.getText().contains(findText.getText()))
wrapButton.setSelection(false);
while(true){
if( !find() )
... |
fdcd609b-3ebe-4fa8-8638-d547846e5b5d | 6 | public void sendTo(CommandSender s, int page, int perPage) {
List<HelpScreenEntry> toSend = toSend(s);
int maxpage = (int) (toSend.size() / (float) perPage + 0.999);
int from = (page - 1) * perPage;
int to = from + perPage;
if (from >= toSend.size()) {
from = to = 0;
}
if (to > toSend.size()) {
t... |
43159c2f-986b-446c-8edb-c113fa65bf16 | 7 | public boolean pickAndExecuteAnAction() {
try{
for(int i =0; i < Bills.size(); i++){
//print("" + Customers.get(i).s );
if(Bills.get(i).s == OrderState.needToCompute){
Compute(Bills.get(i));
return true;
}
}
for(int i =0; i < Bills.size(); i++){
if(Bills.get(i).s == OrderState.nee... |
dae3e2b7-9c39-419e-a32b-206523fc498c | 3 | public void caretUpdate(CaretEvent e) {
ASection s;
s = aDoc.getASectionThatStartsAt(textPane.getCaretPosition());
if (textPane.getText().length()<=0)setText("Откройте сохраненный документ или вставтьте анализируемый текст в центральное окно");
else
if(s !=null){
set... |
5c786cfa-b959-4a01-af49-8dfb4183bd91 | 0 | public PageNotFoundException(Exception e, String name){
super(e, name);
} |
1f6c8fe8-b515-4340-8941-365abc49649a | 1 | public String getDiccionario(){
String dic = "";
for(int i=0; i<diccionario.size(); i++){
dic = dic + diccionario.get(i).getPalabra() + "<BR> ";
}
return dic;
} |
309f3620-d53f-4e9a-8120-185ba19bfe6e | 7 | public static StringWrapper javaTranslateTypeSpecHelper(StandardObject typeSpec, boolean functionP) {
{ Surrogate finalType = null;
String typeName = "";
{ Surrogate testValue000 = Stella_Object.safePrimaryType(typeSpec);
if (Surrogate.subtypeOfParametricTypeSpecifierP(testValue000)) {
... |
059cc48e-4856-451a-ba52-97644415ace1 | 2 | public int getHyperPeriod() {
if (workload.size() <= 0)
return 0;
int hp = workload.get(0).getPeriod();
for (int i = 1; i < workload.size(); i++) {
hp = MathUtils.lcm(hp, workload.get(i).getPeriod());
}
return hp / 2;
} |
8634569d-9c0b-411b-9d23-e491fef400f3 | 5 | @Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Node node = (Node) o;
if (id != null ? !id.equals(node.id) : node.id != null) return false;
return true;
} |
f90578c3-b91f-47ae-ae29-af2136e07e7c | 6 | public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new FileReader(new File(
ConfigReader.getKylie16SDir() + File.separator + "PCA_PIVOT_16Sfamily.txt")));
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(
ConfigReader.getKylie16SDir() +... |
5c565675-6ef3-4c9f-bae7-44b968687936 | 1 | private int root(int i) {
while (i != id[i]) {
id[i] = id[id[i]]; // to compress the path
i = id[i];
}
return i;
} |
eacf34d7-1712-418e-b308-e84935dec3b7 | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
3351bb4f-84f0-4a41-8ff3-542a940f7097 | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
511640b4-959d-48f4-afba-4bb8506d8c9d | 6 | public static Vector<Ticket> valideCaddie (Vector<Caddie> caddies) throws BDException, ParseException {
ArrayList<Vector<Place>> placesToChoice = new ArrayList<Vector<Place>>();
ArrayList<Integer> placesPrice = new ArrayList<Integer>();
Vector<Ticket> toReturn = new Vector<Ticket>();
int finalPrice = 0 ;
// ... |
d5abe9c3-e814-4495-8a9a-e1c306833445 | 2 | public boolean saveFile(ArrayList<Game> liste)
{
PrintWriter pw;
try
{
pw = new PrintWriter("words.txt");
for (int i = 0; i < liste.size(); i++)
{
pw.print(liste.get(i).toSaveString());
System.out.prin... |
e5fcf6a7-53ac-43e5-8329-6eb7a60abcbb | 7 | private int getDownPos(String text, int cpos)
{
String[] lines = text.split("\n");
int line = 0;
int tmp = cpos;
while(tmp > 0)
{
tmp -= lines[line].length() + 1;
line++;
}
line--;
int all = 0;
for(int ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.