method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b99fd3cc-a7e0-48c6-8948-ef298949c291 | 5 | private void createAnswerModule(String type, String goTo, int points, String date, String wrong, int timestop, Element answerElement)
{
Attr attr = doc.createAttribute("type");
attr.setValue(type);
answerElement.setAttributeNode(attr);
if((goTo!=null)&&(!goTo.equals("")))
... |
d744a7a7-31ed-4179-92d5-ad589a0e720b | 3 | @Override
protected FoodItem getFoodItem(String foodItemName) {
Sandwich beverage = null;
if (foodItemName.equalsIgnoreCase("CheeseSandwich")) {
beverage = new CheeseSandwich();
} else if (foodItemName.equalsIgnoreCase("GrilledSandwich")) {
beverage = new GrilledSandwich();
} else if (foodItemName.equals... |
46a032d1-92ca-44fa-b733-e74532272fe7 | 0 | public void AddVoice(String channel)
{
VoiceChannels.add(channel);
} |
28211ccf-6110-417e-8738-10065ecf0a22 | 8 | @Override
public void drawTile(int x, int y, BufferedImage tile, TileFlip flippstate,
float alpha) {
if (this.alpha != alpha) {
setAlpha(alpha);
}
AffineTransform xform;
int w = tile.getWidth();
int h = tile.getHeight();
switch (flippstate) {
case H:
xform = new AffineTransform(-1, 0, 0,... |
f95a1fa2-9059-499e-8c43-4510adc2e30c | 8 | private String colorToCharacter(SquareColor color) {
if (color == null) {
return " ";
}
switch (color) {
case CYAN:
return ("◘");
case RED:
return ("◙");
case BLUE:
return ("█");
case GREE... |
309f96c2-4719-43a5-9976-a903ffbd0141 | 9 | public Long[] determineRoots2(Collection<Long> factors, Long a, Long b){
Long[] roots = new Long[2];
roots[0] = 0L;
roots[1] = 0L;
Long secFactor = 0L;
boolean foundRoot = false;
for (Long factor : factors){
if (factor == 0L){
secFactor = -a;
roots[0] = factor;
roots[1] = -a;
foundRoot = ... |
8bc79c77-9c0a-482e-8a73-bb6ac60ee3eb | 7 | public void fireBefore(State state, int pc) {
String idstr = SimUtil.getIDTimeString(simulator);
LegacyState s = (LegacyState) simulator.getState();
int code = s.getDataByte((int)STATUS_ADDR.get());
String name = "UnknownException";
String ... |
2ae0257d-9736-436d-ade9-8ee98aa40b5f | 7 | private StackTraceElement getLibraryClassElement(StackTraceElement elem) {
try {
Class<?> clazz = Class.forName(elem.getClassName());
if (clazz.getAnnotation(SafeChainWrapper.class) != null) {
return new StackTraceElement(elem.getClassName(), "", elem.getClassName() + ".java", -1);
}
//elem.getMethodN... |
b1855338-a4b3-46cc-ae0a-736ebf5da9d3 | 3 | public String getFileNameGenomeFasta() {
for (String f : getFileListGenomeFasta()) {
if ((new File(f)).exists()) return f;
if ((new File(f + ".gz")).exists()) return f;
}
return null;
} |
617fa921-999e-4c5a-ac88-62670165f22e | 0 | public void setX2Coordinate(double x)
{
x2Coordinate=x;
} |
91332000-f096-4926-bd45-bad9517e93e8 | 8 | public void update(double timeDifference){
for (int i=transfer.size()-1; i>=0; i--){
Aircraft b = transfer.get(i);
b.update(timeDifference);
//handle completed transfer path
if (b.isFinished()){
Aircraft a = transferStore.remove(i);
transfer.remove(i);
if (b.getFlightPlan().getOrigin() == wLe... |
6ac17182-88a3-4e4b-986b-f5836c34ae68 | 6 | @Override
public void save(FacetList fl) {
PrintStream out;
boolean close;
if (outputDir == null) {
close = false;
out = System.out;
} else {
close = true;
try {
out = new PrintStream(outputDir.resolve(fl.getSourceShort()).toFile());
} catch (FileNotFoundException e) {
logger.error... |
67e892ae-e8bd-44ee-9e9e-cc9ace037b5a | 4 | public static void draw(World world) {
clear();
for (int x = 0; x < world.getWidth(); x++) {
for (int y = 0; y < world.getWidth(); y++) {
Square s = world.getSquare(x, y);
if (s.isObstacle()) {
// Draw obstacle
setPenColor(BLACK);
filledRectangle(x + 0.5, y + 0.5, 0.5, 0.5);
} else if ... |
3042afc8-a66c-4994-8169-0ffd9edd60ef | 6 | public String toString() {
//Place name
String output = placeName + "\n";
//Basic description
output += basicDescription;
//Items
if(!items.isEmpty()) {
output += "\nYou notice:\n";
for(Iterator<Item> iter = this.getItems().iterator(); iter.hasNext();) {
Item i = iter.next();
output += "\t" + ... |
95f54f74-ec3e-48d5-bbfa-7d4e7148fdfa | 4 | public void addCourseToStudent(Scanner a_scan) {
System.out
.println("Please Select Method to Choose Student(1 or 2): "
+ "\n1)Choose by Name,\n2)Choose by techID");
switch (getMenuChoiceNameOrId(a_scan)) {
case 1: {
Student s1 = findStudent(inputStudentName(a_scan));
if (s1 != null) {
s1.add... |
3d91ee84-bdd1-468e-bffa-bf6f3e86ca08 | 3 | public Schat zoekSchat(int teZoekenIdSchat)
{
Schat schat = null;
try (Connection conn = DriverManager.getConnection(JDBC_URL)) {
PreparedStatement queryZoekSchat = conn.prepareStatement("SELECT FROM SCHAT WHERE IDSCHAT = ?");
queryZoekSchat.setInt(1, teZoekenIdSchat);
... |
6d7bf031-c1a9-4241-bd83-52ff66f2394f | 8 | private static LinkedList<AngleInterval> flattenIntervals(Heap<AngleInterval> startAngles, StatWriter writer)
{
int opt = startAngles.size(); //Original amount of sectors is stored for stats collecting.
Queue<AngleInterval> flat = new Queue<>(); //This will be returned.
Heap<AngleInterval... |
ea52b44d-6d51-4ca5-9ea1-53e8566ba3e7 | 0 | @Override
public boolean supportsAttributes() {return false;} |
d302f8e8-be19-4a3c-98ab-6d4304293e10 | 6 | public void onLivingUpdate()
{
super.onLivingUpdate();
if (this.isWet())
{
this.attackEntityFrom(DamageSource.drown, 1);
}
int var1 = MathHelper.floor_double(this.posX);
int var2 = MathHelper.floor_double(this.posZ);
if (this.worldObj.getBiomeGe... |
23daf66d-2d93-4fba-abd0-e68298ba1955 | 0 | public void setEvent(Event event) {
this.setEvent1(event);
event.getCars().add(this);
} |
adfbb38c-2aab-4f05-af84-d2570b58a3cd | 1 | public static int [] getRandomArray(int size, int range) {
int [] list = new int[size];
Random random = new Random(System.currentTimeMillis());
for (int i = 0; i < size; ++i) {
list[i] = random.nextInt(range);
}
return list;
} |
58cdad93-09a9-4056-afe0-578c42dd2dd3 | 4 | @Override
public void updateCategory(String categoryId,
String newName) throws ProfileExceptions {
if (categoryId == null || categoryId.isEmpty())
throw new ProfileExceptions(ProfileExceptionType.EmptyString);
if (newName == null || newName.isEmpty())
throw new ProfileE... |
59f84695-52c5-4577-8aad-591a1482c045 | 4 | public BeerState getState()
{
if( local == Local.INSIDE )
{
long deltaTime = System.currentTimeMillis() - timeToFreeze;
if( deltaTime > 10000 ) // 10 seconds to get ICED
{
state = BeerState.ICED;
}
}
if( local == Local.OUTSIDE )
{
long deltaTime = System.currentTimeMillis() - ti... |
89d0cc57-b93a-4250-8fad-3e8dd7ba78a0 | 7 | public List<Entity> getSquareNeighbors(int row, int col, int dist) {
List<Entity> neighbors = new LinkedList<>();
for (int x = row - dist; x <= row + dist; x++) {
if (isInBounds(x)) {
for (int y = col - dist; y <= col + dist; y++) {
if (isInBounds(y) && t... |
7530b22c-ca8b-4f13-9454-28f9fff7bcd4 | 2 | public void updateBookByTitle(final String oldtitle, final String newTitle, final String author, final String genre,
final int quantity, final double price) {
for (Book book : bookList.getBookList()) {
if (oldtitle.equals(book.getTitle())) {
book.setTitle(newTitle);
... |
cb1ae431-f2b7-4eee-8285-a155ca975a60 | 3 | private void updateUserCount() {
int i = MH.getConnections().size();
MH.setServerStatus(i > 0 ? i == MH.getMaxConnections() ? ServerStatus.FULL : i > MH.getMaxConnections() ? ServerStatus.OVERFILLED : ServerStatus.READY : ServerStatus.EMPTY);
} |
6217a8ee-ad3c-4142-bf57-aca2ad632845 | 9 | private CompleteAreaList convertGradeTables(Elements[] gradeTables) {
// First Headers == Areas
CompleteAreaList allAreas = new CompleteAreaList();
for (Element element : gradeTables[0]){
allAreas.add(new Area(element.text()));
}
/**
* Dont show to many errors, and dont annoy user
*/
int nonC... |
ddfe08be-da19-47be-913d-1e72ef982f50 | 5 | @Override
public void recibirMensaje(Mensaje mensaje) {
if (mensaje.getRuta() != null) {
List<Long> ruta = mensaje.getRuta();
for (int i = 0; i < ruta.getLength(); i++) {
if (ruta.get(i) == this.id) {
for (int j = 0; j < connections.getLength(); j+... |
0d21cf6c-8bb3-48f6-9647-4fc8ff30ccaf | 4 | public static <RESULT, PROJECTION> Filter<? super PROJECTION> getFilter(Filter<? super PROJECTION> oldFilters,
RESULT instance,
Order<? super PROJECTION> order)
{
if(instance != null)
{
return new FilterSet<P... |
11149bd5-ba7e-44ef-8b7a-e0a203ebe59f | 9 | @Override
public void paint(Graphics window)
{
int x = 10;
if(leather != 0)
{
window.drawImage( leatherPic, 5 , x, 20 , 20 , null );
x = x + 30;
window.drawString("You have " + leather + " units", 30 , x);
}
if(cloth != 0)
{
... |
1d64b89a-5112-4fc8-9c75-babeccac5581 | 8 | final public HelpCmdCommand helpCmd() throws ParseException {
HelpCmdCommand.Type type;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case KW_CREATE:
jj_consume_token(KW_CREATE);
jj_consume_token(KW_TABLE);
type = HelpCmdCommand.Type.CREATE_TABLE;
break;
case KW... |
e38a586b-01e5-4124-b56f-b2f6da7f0d07 | 9 | public static File getConfigFile(String fileName) throws
NoConfigFileFoundException
{
for (int i = 0; i < CONFIG_LOCATIONS.length; i++)
{
String location = CONFIG_LOCATIONS[i];
if (location.startsWith("%HOME%"))
{
if (isUnix())
... |
6cb06deb-b191-4539-9986-5e6752a8f70b | 7 | public void setActions(){
PrintTag = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setJobName("Utskrift av tralleseddel");
printJob.setPrintable(new Printable() {
... |
e405d9e4-0c34-479b-aa8a-3bbb77f1ed40 | 8 | private String itemList(List<Item> itemList, Item oldItem, String oldValue)
{
final StringBuffer list=new StringBuffer("");
if(oldItem==null)
oldItem=RoomData.getItemFromCatalog(oldValue);
for (final Item I : itemList)
{
list.append("<OPTION VALUE=\""+RoomData.getItemCode(itemList, I)+"\" ");
if((oldI... |
8e8a507a-ebd0-484c-981f-5a5f2b9c36e0 | 8 | public static void playerAttack(){
mTurn.health -= attack;
TA1.append("\nYou deal "+attack+" hitpoints to the "+mTurn.finalName+".");
if(mTurn.health <= 0){
TA1.append("\nThe "+mTurn.finalName+" dies.");
if(mTurn.finalName == "Corrupted Mother Board... |
a7dd1092-15e5-4bcc-85fe-9283da7579fa | 7 | public Behaviour jobFor(Actor actor) {
if ((! structure.intact()) || (! personnel.onShift(actor))) return null ;
final Choice choice = new Choice(actor) ;
final int linkMod = (int) (5 * (1 - stocks.shortagePenalty(DATALINKS))) ;
if (actor.vocation() == Background.AUDITOR) {
final Venue t... |
64145724-7640-4666-a488-c40320e8a16e | 1 | @Override
public String toString() {
return (loc==null?"":"["+loc.toString()+"] ")+super.toString();
} |
670a6463-f5d9-4b19-b61b-b291a8e4b0c4 | 2 | public static int nextSequenceNumber(int sequenceNumber) {
if(sequenceNumber == Packet.SEQUENCE_NUMBER_NOT_APPLICABLE || sequenceNumber == Packet.MAXIMUM_SEQUENCE_NUMBER)
return Packet.MINIMUM_SEQUENCE_NUMBER;
return sequenceNumber + 1;
} |
66b61b96-14a0-421b-bba3-91bdb2588c55 | 7 | private String extractNextHead(String idRef) throws IDrefNotInSentenceException {
Node node = sentence.getNode(idRef);
String headIDref = null;
String result = "HEAD";
int readyCount = 0;
int i = 0;
while (headIDref == null && readyCount < node.getPathsFromRoot().size()) {
i++;
for (String[] path : n... |
3c12e204-0fbc-4078-9d41-a8ac03b26dbd | 7 | @SuppressWarnings("ConvertToTryWithResources")
private void connectNotchers(NetworkInterface pNetworkInterface)
{
tsLog.appendLine("Broadcasting greeting to all Notchers...");
//open socket
MulticastSocket socket = openUDPBroadcastSocket(pNetworkInterface);
if (socket == null) return;
//set u... |
c51a2541-7763-4186-ae25-b38e23cb01f6 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
399b6b3a-50de-42b3-b9b2-6bcfeb3a7e84 | 5 | private boolean learn(boolean record) throws FileNotFoundException {
File file = new File("data/" + txtFile.getText());
if (lstTypes.getSelectedIndex() < 0) {
return true;
}
if (btnLearn.getText().equals("Learn")) {
for (LinkKNN knn : knns) {
knn.l... |
7d66782e-5842-42fc-9eae-7046b99acc54 | 5 | public static XMLEvent filterAttributes(StartElement startElement,
XMLEventFactory ef, String[] attributesToKeep) {
String tagName = startElement.getName().getLocalPart();
Iterator nameSpaces = startElement.getNamespaces();
Iterator it = startElement.getAttributes();
// Arra... |
3bbcc4bc-7ce8-459f-bff2-f2174f9270a1 | 3 | private ResourceItem findResource(Resource resource) {
for (int i = 0; i < items.size(); i++) {
if (items.get(i) instanceof ResourceItem) {
ResourceItem has = (ResourceItem) items.get(i);
if (has.resource == resource) return has;
}
}
return null;
} |
d15771e0-3b45-4278-9bfe-0a2a3a4d48b1 | 8 | public void Update() {
if (state == State.Dead) {
// score--;
respawn();
}
if (health <= 0 && state != State.Dead) {
state = State.FatalCrash;
doFatalCrash();
}
else if((Sys.getTime() - brCooldown) / 1000 < 2)
{
... |
32025bcb-63f1-4968-a39b-fdc036577b5d | 0 | private EditorPane createEditor(FiniteStateAutomaton dfa) {
SelectionDrawer drawer = new SelectionDrawer(dfa);
editor = new EditorPane(drawer, new ToolBox() {
public java.util.List tools(AutomatonPane view,
AutomatonDrawer drawer) {
java.util.List tools = new java.util.LinkedList();
tools.add(new Ar... |
6e162ddf-3b11-496b-9c50-fd7b279ffe33 | 6 | public Layers(File file) {
try {
FileInputStream stream1 = new FileInputStream(file);
FileInputStream stream2 = new FileInputStream(file);
TraceReader reader = new TraceReader(stream1);
Vector<Node> list = reader.getPairs();
Node array [] = new Node [list.size()];
for(int i = 0; i < array.l... |
c37bb267-0241-435e-ae1e-acfabfb9f126 | 1 | private void swap()
{
if (this.x0 > this.x1)
{
float temp = x0;
x0 = x1;
x1 = temp;
temp = y0;
y0 = y1;
y1 = temp;
}
} |
a0dae477-f2db-416c-b50a-4743f33117d1 | 9 | public boolean process(Command command){
try{
switch(command.getCommand()){
case "/me":
if (command.parts.length > 1) {
String s_b = command.getRequest().replace("/me", Client.getUsername());
FormatColor.decodeTextPaneFormat(command.channel, command.pane.getStyledDocument(), FormatColor.enc... |
ecbf07af-ff99-4266-8864-faaee847c802 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Document document = (Document) o;
if (file != null ? !file.equals(document.file) : document.file != null) return false;
return true;
} |
6e52aa3d-0889-4faa-abf2-a0171293b112 | 8 | public void checkMouse()
{
// send cursor value to mouse variable
MouseInfo mouse = Greenfoot.getMouseInfo();
int changeX;
int mouseX;
int mouseY;
// check don't exceed left and right border of background
// don't move paddle before player shoots
if (G... |
e03677d9-a9da-4792-b81f-e446b01a4007 | 4 | @Override
public boolean isExcluded(Object obj, String attr, Object value,
boolean write)
{
return exclude.contains(attr)
|| (write && attr.equals("value") && value instanceof Node && ((Node) value)
.getNodeType() == Node.ELEMENT_NODE);
} |
62ce2d2d-97b8-4de5-b900-b13c23481748 | 9 | * @return The language parsed from the rawData or en-US (English-United States) if Google cannot determine it.
*/
private static String findLanguage(String rawData){
for(int i = 0; i+5<rawData.length(); i++){
boolean dashDetected = rawData.charAt(i+4)=='-';
if(rawData.charAt(i)==',' && rawData.charAt(i+1)==... |
3480d5e0-151f-44af-8b60-bbad8a973e49 | 0 | public int getIndex()
{
return result.Index;
} |
bee3936d-fb24-4306-b92c-bed5bd33c304 | 8 | private void stepOptions(boolean[] _Perception) {
options.clear();
if (!_Perception[0] && alreadyVisited(0)) {
options.add(0);
}
if (!_Perception[1] && alreadyVisited(1)) {
options.add(1);
}
if (!_Perception[2] && alreadyVisited(2)) {
o... |
8eb8a1e8-a409-4d17-8b34-cacefbc87a1d | 5 | @Override
public int indexOf(final Object item) {
if (item == null) {
for (int index = 0, count = this.size(); index < count; index++) {
if (this.get(index) == null) return index;
}
} else {
for (int index = 0, count = this.size(); index < count; index++) {
if (item.equals(this.get(index))... |
c2b1ecf7-70ef-42ba-8d98-b48d8a5141e6 | 6 | public Vue(){
frame = new JFrame("Traiteur");
panel = new JPanel();
image = new JLabel();
slider = new JSlider(1,31,4);
chooser = new JFileChooser();
slider.setMinorTickSpacing(1);
slider.setMajorTickSpacing(10);
slider.setPaintTicks(true);
slider.setPaintLabels(true);
panel.add(slider, BorderLayout... |
2f28a94b-5af3-495c-993c-99bc685b3c21 | 0 | public void removeSelectionListener(SelectionListener listener) {
selectionListeners.remove(listener);
} |
7f5c8a5d-f1bb-49cf-8c3e-173c50d4662b | 5 | protected final void updateComponent() {
final BufferStrategy b = that.gamePanel.getBufferStrategy();
if (b != null) {
myPen.simplePen.pen = (Graphics2D) b.getDrawGraphics();
}
if (myPen.simplePen.pen != null) {
if (first) {
try {
that.start(myPen);
} catch (final Exception e) {
... |
290dd1e2-ba20-463b-9295-2ca078e0b93a | 4 | @Override
public WebSocketResponse leaveServer(GameClient gameClient) {
//System.out.println("leave Server");
int clientId = gameClient.getIdentifyer();
PlayerLeftMessage message = gameManager.LeaveServer(clientId);
RisikoServerResponse response = new RisikoServerR... |
fece89a4-674a-4ca4-834a-95e0087168c9 | 0 | public void setDead(boolean a){
dead = a;
} |
67d40c23-4edd-4f50-8dcb-3ce6a99a06fe | 1 | private void doInsertTest() {
System.out.print("\n[Performing INSERT] ... ");
try {
Statement st = conn.createStatement();
st.executeUpdate("INSERT INTO COFFEES "
+ "VALUES ('chocolat', 5)");
} catch (SQLException ex) {
System.err.println(e... |
296c5514-e2d4-49b6-869b-6ada826d8d6c | 6 | public static void main(String args[]) {
Scanner entrada = new Scanner(System.in); // Entrada do teclado
int num1 = 0; // Inicializa variavel
int num2 = 0;
int soma = 0;
do {
System.out.println("Digite um numero diferente de 0: "); // Pedi para digita... |
02dc6671-a1fc-4172-8a00-91bc26fbf5c1 | 2 | static void injectIntoField(final Field field, final Object instance, final Object target) {
AccessController.doPrivileged((PrivilegedAction<?>) () -> {
boolean wasAccessible = field.isAccessible();
try {
field.setAccessible(true);
field.set(instance, targ... |
73ae1b3a-288c-418d-aa47-917d400713cd | 7 | public void setPagesList(List<Page> list) {
if (list == null)
return;
pagesList = list;
ImageCache.getInstance().clear();
for (Page p : pagesList)
ImageCache.getInstance().preload(p.getUrl());
index = 0;
try {
Image m = ImageCache.getInstance().get(
pagesList.get(index).getUrl());
for (Page... |
82842de6-4fdb-4bd3-a21d-425f87fc3f71 | 5 | public void setAmChoking(boolean t){
if(conState != ConnectionState.connected){
throw new RuntimeException("Can only send choke state on 'connected' connections");
}
try {
if (am_choking != t) {
if(t) {
mp.choke(sockOut);
if(peerRequests!=null)
peerRequests.clear();
} else {
mp.u... |
236ade83-c93d-4af4-9c97-bf57ae799a38 | 5 | public static void main(String[] args) {
final Point p = new Point(35,25);
JFrame frame = new JFrame("PlayGrid class test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) frame.getContentPane();
GridBagLayout gb = new GridBagLayout();
GridBagConstraints c = new GridBagCo... |
ea86cdca-9caa-4911-8d90-f1fcc9c759dd | 0 | public Kevin()
{
super("Kevin", 8000, 350, 80, 180, as);
as.setSkill(0, "TooLongDidNotRead", -100, 10, "Kevin does not read.");
as.setSkill(1, "Scorch", 250, 100, "Kevin sends a tiny stream of fire at his enemy.");
as.setSkill(2, "Pyroblast", 750, 200, "Kevin throws a huge fireball at his enemy.");
as.setSki... |
3be4a6b2-5182-41c2-866e-3f34f455cd0c | 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... |
b84ad6bd-f9e7-4d5a-8b40-762302c4a90b | 3 | public List<StudentObj> getStudentTable(PreparedStatement pre) {
List<StudentObj> items = new LinkedList<StudentObj>();
try {
ResultSet rs = pre.executeQuery();
if (rs != null) {
while (rs.next()) {
StudentObj item = new StudentObj();
... |
8bea5235-7eaa-4e81-a1c0-ae9ae3d806ab | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=mob;
if(target==null)
return false;
if(target.charStats().getBodyPart(Race.BODY_WING)<=0)
{
mob.tell(L("You can't flap without wings."));
return false;
}
final bool... |
7f2ab478-8f99-4dc7-be54-1e6ea5c3be17 | 6 | private int checkStraight(int player) {
TreeSet<Integer> set = new TreeSet<Integer>();
for (int card : players[player].cards) {
set.add(card % 13);
}
int[] hand = new int[5];
int i = 0;
for (int card : set) {
hand[i++] = card;
}
if (hand[1] == hand[0] + 1 && hand[2] == hand[1] + 1 && hand[3]... |
068ca500-e9a6-4aa4-8dc5-222821aa9e90 | 0 | public FileDataBase(){
dataBaseFiles = new ArrayList<AlgorythmFile>();
} |
8a939a13-f803-4312-b015-4579fc26312f | 5 | @Override
public void connect(Integer a, Integer b) {
int rootA = findRoot(a);
int rootB = findRoot(b);
if(rootA==rootB){
return;
}
if (sizes[rootA] == sizes[rootB] || sizes[rootA] < sizes[rootB]) {
setId(rootA,rootB);
if(sizes[rootA]==0... |
4d735eaa-42e3-4dec-b524-ac7b648d57c4 | 4 | @Override
public void actionPerformed(ActionEvent event) {
if (event.getSource() == okButton) {
// verify the data and set it to the local variable.
if (cow.getText().equals("") || row.getText().equals("")) {
shakeScreen();
return;
} else {
setCowNum(Integer.valueOf(cow.getText()));
setRowNu... |
0480ff17-8567-4dab-85be-a7a1bac9648d | 1 | private void onMoveMade(Move move) {
for (GameEventListener l : this.gameEventListeners) {
l.onMoveMade(move);
}
} |
e8a479a9-13e0-43d3-8444-6c02520db2db | 5 | private void setColumnDataType(DataColumn column, String value) {
if ("text".equals(value)) {
column.setDataType(DataColumn.DATA_TEXT);
return;
}
if ("numeric".equals(value)) {
column.setDataType(DataColumn.DATA_NUMERIC);
return;
}
if ("date".equals(value)) {
column.setDataType(DataColumn.DATA_... |
20e2e6e3-b051-48f7-a757-5c13ba6fbd59 | 5 | public void error(){
switch(i){
case 1:
JOptionPane.showMessageDialog(null, "HKID field should not be blank.","Blank Field", JOptionPane.ERROR_MESSAGE);
break;
case 2:
JOptionPane.showMessageDialog(null, "Field should not be blank.","Blank Field", JOptionPane.ERROR_MESSAGE);
break;
case 3:
JOptio... |
368cacfd-a98d-4e8b-a8a0-de7e7345dcd0 | 2 | public static void main(String[] args) throws Exception
{
MyTest test = new MyTest();
Class<MyTest> c = MyTest.class;
// Class<?> c = test.getClass();
Method method = c.getDeclaredMethod("output",new Class[] {});
if(method.isAnnotationPresent(MyAnnotation.class))
{
method.invoke(test, new Ob... |
ce2addb7-bca4-43e7-986b-2bf0c7f0c962 | 5 | @Test
public void testRollbackOrder2() throws InvalidProcessStateException, ProcessExecutionException,
ProcessRollbackException {
// some components do not require rollback (C3, C5)
// define names
String nameParent = "P";
String nameChild1 = "C1";
String nameChild2 = "C2";
String nameChild3 = "C3"... |
ba8ee038-6c4d-4a62-80e7-44d6a3b8f07d | 8 | public static final int Char2Int(char c)
{
switch (c)
{
case '+':
return 0;
case '-':
return 1;
case '*':
return 2;
case '/':
return 3;
case '(':
return 4;
case ')':
return 5;
case 'i':
return 6;
case '#':
return 7;
default:
return 0;
}
} |
537e1fdb-4db7-4394-a136-a55b81b800cd | 0 | public int specialAttack2() {
return skill2.attack(this.getAgility(), this.getLuck());
} |
60fb5153-0419-435d-85bb-e3d754650838 | 8 | private static void agregarCuenta(String user) {
System.out.println("De que tipo? FACEBOOK o TWITTER: ");
String tipo = lea.next();
for(iSocial cuenta : cuentas){
//si el usuario ya existe para el mismo tipo de cuenta
if( cuenta.getUsername().equals("user")){
... |
0d439a51-fc4e-4a09-9d8d-e1f5c8068d4a | 5 | public StringBuffer printGeneric(Class<?> cls, StringBuffer message){
TypeVariable<?>[] params = cls.getTypeParameters();
if(params.length > 0){
message.append('<');
for(int i = 0; i < params.length; i++){
message.append(params[i].getName());
if(i != params.length - 1){
message.append(", ");
... |
2eab0ee2-3b65-460d-9a10-054922907fff | 1 | public void makeDeclaration(Set done) {
block.propagateUsage();
block.makeDeclaration(done);
if (nextByAddr != null)
nextByAddr.makeDeclaration(done);
} |
285dcebf-adb9-41c4-9ad2-2ce3923857b2 | 3 | public static void calculateValues(int row, int id, int temperature)
{
// Set values received in the 2D array
valueArray[row - 1][id - 1] = temperature;
// Grab all values & calculate the average temp
for(int i = 0; i < antalVeckor; i++)
{
// Variable to hold this weeks temp. sum
int collectTemp = 0;
... |
f9b4d58a-9f0e-47d6-adb4-5f73345fe582 | 6 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String email = request.getParameter("email"),
motDePasse = request.getParameter("motdepasse");
if (email==null || email.trim().equalsIgnore... |
e284ebb4-9441-4336-9022-f1dcc43d9778 | 2 | public boolean lessThan(RouteLength other)
{
boolean result = false;
if (other.uninitialized())
{
result = true;
}
else if (!uninitialized())
{
result = length < other.length;
}
return result;
} |
2a840824-69c2-43e5-ab9b-c590a3ccbf13 | 3 | private void updateStructure() {
int i = jList.getSelectedIndex();
if(i > -1) {
String name = FW.getObjectNames().get(i);
FileWriter.Types type = FW.getObjectType(name);
if(type != null && type == FileWriter.Types.ISAVEABLE) {
displayValue = new FileWriterGUI((FileWriter) FW.get(name));
displayVa... |
c3bc111b-6621-4a9a-ab99-686762d58c57 | 2 | public static void playFirework(World world, Location loc, FireworkEffect fe, int power) throws
Exception {
// Bukkity load (CraftFirework)
Firework fw = world.spawn(loc, Firework.class);
// the net.minecraft.server.World
Object nms_world;
Object nms_firework;
... |
4fdbebaa-6eb1-4ea5-9b7d-79cac9b8d134 | 1 | public boolean containsUnit() {
if(this.abstractMatterList.has(Unit.class)){
return true;
}
return false;
} |
4e81f6df-6f79-445b-a49d-c904cc05c947 | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == nameField)
changeTitle(nameField.getText());
else if (e.getSource() == okBtn) {
ok = true;
setVisible(false);
} else if (e.getSource() == cancelBtn) {
ok = false;
setVisible(false);
}
} |
cacbedda-4192-419c-a3bb-c41220015743 | 2 | public void Initialize()
{
deltaX = (float) gridWidth / sudokuSize;
deltaY = (float) gridHeight / sudokuSize;
CellVariable.deltaX = deltaX;
CellVariable.deltaY = deltaY;
CellVariable.domainXOffset = gridXOffset;
CellVariable.domainYOffset = gridEndY + 10;
activeX = 0;
activeY = 0;
mouseOverX = -1;
... |
ba598e38-6e2a-4e76-b11e-25a51775cc55 | 2 | public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) {
if (!(sender instanceof Player)) {
Language.IN_GAME_ONLY.bad(sender);
return;
}
if (args.length != 1) {
Language.CMD_RMFRIEND_HELP.bad(sender);
retur... |
200b55df-8feb-45c4-a56b-dc623819d7cd | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Tipoencaminhamento other = (Tipoencaminhamento) obj;
if (!Objects.equals(this.idtipoEncaminhamento, other... |
ce8551c8-3d1d-47c6-8a58-a56c3eede59a | 3 | public void loadNetworkFile(String filename, EntityFactory entityFactory) {
BufferedReader bufferedReader = null;
try {
bufferedReader = new BufferedReader(new FileReader(filename));
String strLine;
while ((strLine = bufferedReader.readLine()) != null) {
... |
25c5aefd-b2ed-4514-b8a9-9aa626563cb9 | 3 | public List<AuctionItem> getItems(String player, int itemID, int damage, boolean reverseOrder) {
List<AuctionItem> auctionItems = new ArrayList<AuctionItem>();
Connection conn = getConnection();
PreparedStatement st = null;
ResultSet rs = null;
try {
String sql = "SELECT * FROM WA_Items WHERE player = ? ... |
672fd22d-8a75-44e0-855b-070b2f201c40 | 8 | @EventHandler
public static void onPlayerInteract(PlayerInteractEvent event) {
if (event.getMaterial() == Material.STRING && MeasuringTape.hasPermission(event.getPlayer(), "measuringtape.measure")) {
final Action action = event.getAction();
if (action == Action.LEFT_CLICK_BLOCK)
MeasuringTape.attach(event.... |
5990269b-b50e-426e-840e-e5931d735d57 | 9 | private void updateBetStatus(String betStatusText) {
// TODO: notify some other thread when result changes
if (betStatusText.equals("Bets are OPEN!")) {
if (!betStatus.equals(BetStatus.OPEN)) {
Server.generateMatchups();
setResult(BetStatus.OPEN);
}
} else if (betStatusText.equals("Bets are locked u... |
d42a0422-1cce-40b0-83f6-244f60dc4897 | 6 | private static final void seleccionaDriverAProvar()
{
File[] llistat_drivers = obteLlistatFitxers( carpeta_drivers );
if ( null == llistat_drivers && null == ( llistat_drivers = obteLlistatFitxers( carpeta_drivers_relativa ) ) )
{
System.out.println( "[KO]\tNo s'ha trobat cap fitxer a les rutes de drivers es... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.