method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2c5bc975-3cd0-4d76-b185-4bf5165c37c6 | 1 | public void simplify() {
if (object != null)
object = object.simplify();
super.simplify();
} |
bf184c00-2a6a-4c8b-bf95-df4566b7ee1d | 1 | @Override
public void render() {
super.render();
long bID = Application.get().getLogic().getGame().getBaseID();
GameActor b = Application.get().getLogic().getActor(bID);
if(b != null) {
PhysicsComponent bPC = (PhysicsComponent)b.getComponent("PhysicsComp... |
b3b1ebfc-101d-4982-bcb6-8e09b3e554f8 | 4 | @Override
public HandshakeBuilder postProcessHandshakeResponseAsServer( ClientHandshake request, ServerHandshakeBuilder response ) throws InvalidHandshakeException {
response.setHttpStatusMessage( "WebSocket Protocol Handshake" );
response.put( "Upgrade", "WebSocket" );
response.put( "Connection", request.getFie... |
94486f36-0eee-4913-b64e-d9a5dfd08044 | 2 | public static void main(String[] args) {
MatrixCornerProblemWithMemoize matrixCornerProblemWithMemoize = new MatrixCornerProblemWithMemoize();
matrixCornerProblemWithMemoize.initializeArray();
System.out.println(" Matrix is ******************* ");
matrixCornerProblemWithMemoize.display(... |
2a92599c-99c5-4330-8f04-78fdf5d0c708 | 8 | public boolean equals( Object other ) {
if ( ! ( other instanceof TObjectShortMap ) ) {
return false;
}
TObjectShortMap that = ( TObjectShortMap ) other;
if ( that.size() != this.size() ) {
return false;
}
try {
TObjectShortIterator ite... |
aad8661c-e2c7-4c19-bf8f-8515870be765 | 6 | public static void cppOutputCase(Cons renamed_Case) {
{ Stella_Object keyform = renamed_Case.value;
Stella_Object defaultcase = renamed_Case.rest.value;
Stella_Object conditions = renamed_Case.rest.rest.value;
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print("switch (");
S... |
c029f3e3-a6b8-4e47-8749-6bd2ccf82ca8 | 4 | public void printTable(float[][] table) throws IOException{
System.out.println("printing the resulting expression table to " + outFile);
TextFile outReads = new TextFile(outFile, true);
String curCount="", numReads="",trName="";
float reads=0;
int len;
outReads.write("p... |
bdce2e42-cf51-4933-8792-86bb9d290a65 | 1 | public Type getSubType() {
if (elementType instanceof IntegerType)
return this;
else
return tArray(elementType.getSubType());
} |
4cb9bf50-6fce-4fad-96db-f33d569e3c76 | 5 | public void close() {
if (sequencer != null) {
if (sequencer.isOpen() && sequencer.isRunning()) {
sequencer.stop();
}
sequencer.close();
sequencer = null;
}
if (synthesizer != null) {
if (synthesizer.isOpen()) {
... |
f52d656e-81c5-4031-ad3a-640172def89c | 3 | public void invokeTricks(){
// Extreme mode
int random = rd.nextInt(100);
if(!extremeMissileLock){
if(random < 40){
extremeMissileLock = true;
shoudlGenerateExtremeMissiles = true;
return;
}
}
if(random > 40){
shoudlGenerateExtremeMissiles = false;
}
} |
e822bfef-8a8f-4361-9076-33ab72ac003d | 5 | @Override
protected void onPrivateMessage(String sender, String login, String hostname, String message)
{
super.onPrivateMessage(sender, login, hostname, message);
int targettab = 0;
int i = 0;
while(true)
{
try
{
if(Main.gui.tabs.get(i).title.equalsIgnoreCase(sender) || Main.gui.tabs.get(i).title... |
ca864c61-4a50-4e3c-8aa1-2f879b158f3e | 1 | public static void mousePress() {
if(!mousePressed) {
mousePressed = true;
mouseHeld = true;
//mouseClick = new Point2D.Double(Mouse.getX(), -(Mouse.getY() - Camera.get().HEIGHT));
}
} |
2b0c1686-2a15-47fe-8cd0-70a20a336380 | 0 | private void channelListBoxActionPerformed(ActionEvent e) {
} |
24d20a67-c34c-494c-89c4-3c1dae88cafd | 8 | @Override
public void testClean() {
for (int i = 0; i < numberOfRows; i++)
for (int j = 0; j < numberOfColumns; j++)
assertEquals(null, board.get(i, j));
for (int i = 0; i < numberOfRows; i++)
for (int j = 0; j < numberOfColumns; j++)
board.set(new Square(board, i, j), i, j);
for (int i = 0; i < ... |
c2489f15-4a57-4d50-bb73-17d25c9c94ec | 0 | public void setPrice(Float price) {
this.price = price;
} |
c0d40b08-63f8-4e10-a46c-4bca04147b62 | 7 | private void removeGaps(int nodesLevel[]) {
int temp = m_nodes.size();
int temp2=graphMatrix[0].length, tempCnt=1;
for(int n=0; n<temp; n++) {
for(int i=0; i<temp2; i++) {
int len = graphMatrix.length;
if(graphMatrix[n][i]>0)
if(nodesLevel[i]>nodesLevel[n]+1) {
... |
bf3462e6-0ba2-4066-989e-adf89b9e162b | 1 | public synchronized boolean occurence() {
boolean result = false;
totalEvents++;
// figure out next slot and put it there
lastEntry = (lastEntry+1)%NUMBER_OF_OCCURRENCES_TO_BE_CONSIDERED_AS_BOT;
oldestSlot = (oldestSlot+1)%NUMBER_OF_OCCURRENCES_TO_BE_CONSIDERED_A... |
40d00291-46a1-4e7d-9087-82ed1d09d26e | 6 | private void disminuirVentaBD(itemVenta venta){
itemVenta it= venta;
int diferencia= it.getCantVenta();
ArrayList<HashMap> lista= new ArrayList<>();
try{
String sql="SELECT s.fact_ent AS num_fact, s.id_prod, p.nombre_prod, s.can_venta AS cant_venta, s.ttl_cont, s.can_venta AS... |
3e77202c-0060-4610-b2c0-9b4541567022 | 2 | private void activate() {
if (isActive())
throw new IllegalArgumentException("Lightgrenade was already active, something went wrong");
if (getGrid().getElementPosition(this) == null)
throw new IllegalArgumentException("The LightGrenade can only be activated when it's placed on the grid!");
this.active = tr... |
1ec7517e-0f8c-46dc-87bd-430827773d8b | 4 | public void run() {
println("This program finds the smallest and largest integers in a list."); //program intro
println("Enter values, one per line, using a 0 to signal the end of the list."); //prompts the user to enter values
int x = readInt("? ");
if (x == SENTINEL) {
println("The Sentinel number was... |
50377e31-1036-4e70-8548-02f7ad6f0519 | 9 | private int readMultipleBytesSingleElement(byte[] b, int off, int len) throws IOException {
int read = 0, totalRead = 0;
switch (state) {
case NEW_HEADER:
readNewHeader(); //fallthrough
case PROCESS_TAG: {
read = readHeaderBytes(currentHe... |
d861a9f0-f249-465e-af1c-bc82aa5a7652 | 4 | @Test
public void shouldParserReadAllFile() {
TSPLIBParser parser = new TSPLIBParser();
long[][] graph = null;
try {
graph = parser.loadGraphFromFile(TSPLIBParserTest.class.getResource("att48.xml").getFile());
} catch (ParserConfigurationException | SAXException | IOExcep... |
5c240e33-1371-472d-b47e-9c5797f4c2e3 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PaymentAmountKey other = (PaymentAmountKey) obj;
if (amount == null) {
if (other.amount != null)
return false;
} else if (!a... |
fbb6b9c4-758b-4887-8d49-c75cec4e3b3c | 4 | public float priorityFor(Actor actor) {
if (type == TYPE_WANDERING) {
return IDLE ;
}
//
// Favour patrols through more dangerous areas in absolute terms, but not
// in relative terms. (i.e, go where you're needed, but won't get killed.)
float absDanger = 0, relDanger = 0 ;
if (acto... |
e3d20597-ff7f-4a2e-9f90-6f2e93c7429b | 7 | public boolean saveEmployee(ArrayList<Employee> employee, Connection con) {
boolean didItWork = true;
int tal=0;
String SQLString1 = "insert into medarbejder values(?,?,?,?,?,?,?,?)";
String SQLString2 = "select medarbejderseq.nextval from dual";
String SQLString3 = "insert into... |
f10bc182-cc1f-4425-9731-0e8ef79bf042 | 6 | @Override
public void onInvalidCommand(CommandSender sender, String[] args, String command) {
tickets = plugin.getTicketHandler();
if (sender instanceof Player) {
Player p = (Player) sender;
if (p.hasPermission("modreq.tp-id")) {
if (args.length == 1) {
... |
b14f7340-84a6-4d9f-bdb7-a8836e4f0bc8 | 2 | private void installADB_uatMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_installADB_uatMenuActionPerformed
JFileChooser dirChooser = new JFileChooser();
dirChooser.setDialogTitle(parser.parse("adbInstallChooserTitle"));
dirChooser.setFileSelectionMode(JFileChooser.DIRECT... |
4f598f07-1d9f-4017-8134-7c7f13c5d37a | 2 | public URL find(String classname) {
try {
URLConnection con = openClassfile0(classname);
InputStream is = con.getInputStream();
if (is != null) {
is.close();
return con.getURL();
}
}
catch (IOException e) {}
... |
c6cc607e-fc47-43b3-a74e-eb1d9ad76f7f | 0 | public double getSimilarity() {
return similarity;
} |
eb02f022-3f94-4809-ba12-829627c8cbc3 | 6 | public static void main(String args[]) {
MatchTeamFrame frame = new MatchTeamFrame();
frame.setVisible(true);
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If N... |
11977964-1686-47f4-af97-561b7b8493a0 | 1 | public void precedent() {
String numeroString = (String) this.vue.getjTextFieldNum().getText();
indicePraticienCourant = Integer.parseInt(numeroString)-1;
if (indicePraticienCourant == 0) {
indicePraticienCourant = lesPraticiens.size()-1;
} else {
indiceP... |
0e7442c9-9e28-4c40-b622-d967da84be61 | 2 | public void renderBase(float health, float x, float y) {
if(health > 0.7) {
Renderer.get().draw(baseHealthy, x, y);
}
else if(health > 0.3) {
Renderer.get().draw(baseDamaged, x, y);
}
else {
Renderer.get().draw(baseCritical, x, y);
}
... |
94a47ac5-3183-4f8e-80a9-7b8bfb0f6b01 | 4 | private static Example parseExample(String record) {
String[] tokens = record.split(",");
double[] input = new double[10];
if(tokens[0].equals("M")) input[0] = 1.0;
if(tokens[1].equals("F")) input[1] = 1.0;
if(tokens[2].equals("I")) input[2] = 1.0;
for(int i = 1; i < tokens.length - 1; i++) {
... |
70adb1a4-aa12-4f9f-91b3-0ec5761f60ce | 0 | public void setFunAportaFondo(String funAportaFondo) {
this.funAportaFondo = funAportaFondo;
} |
e3cd6dd9-a865-44ef-83ba-83ee79aff6f6 | 9 | public void init () {
Container contentPane = getContentPane();
ballBall=getAudioClip(getCodeBase(),"ballBall.wav");
MyWorld world = new MyWorld(ballBall,true);
double plotWindowTime = 30;
MyWorldView worldView = new MyWorldView(world);
JPanel fondo = new JPanel();
world.Gr... |
24ee48e6-eb20-4091-be17-74bae6efbb7b | 4 | public static int removeDuplicates(int[] A) {
int len = A.length;
int dup = 1;
int des = 0;
for (int i = 1; i < len; i++) {
if (A[i] == A[i - 1]) {
dup = dup + 1;
} else {
if (dup > 2) {
des = des + dup - 2;
}
dup = 1;
... |
8509c11c-1d40-477d-95e7-8a48adcc416d | 3 | public boolean jsFunction_waitPopup(int timeout) {
deprecated();
int curr = 0; if(timeout == 0) timeout = 10000;
while(!JSBotUtils.havePopupMenu())
{
if(curr > timeout)
return false;
Sleep(25);
curr += 25;
}
return true;
} |
e6d6f878-4d9b-4b43-8917-2ab0563ac0e2 | 2 | public Configuracion buscar(String server){
for(int i=0;i<configuraciones.size();i++){
if(configuraciones.get(i).getServer().equals(server)){
return configuraciones.get(i);
}
}
return null;
} |
f9e61618-9d8c-40b7-a252-27145832dd03 | 6 | private void initSettingsFromString(String settings, String prefs) {
if(!settings.equals("{}")) {
/* settings could be "{'PILOT_WEIGHT':0,'SAILPLANE_WEIGHT':1}" */
settings = settings.replace("{","");
settings = settings.replace("}","");
String[] settingsArray = s... |
22f36181-a20d-41b9-83ef-730189522295 | 0 | public void setImage(File image) {
this.image = image;
} |
8bddd7c6-dfc1-49b2-9b18-7eb041daf15d | 1 | public void saveString(String[] string, File file, String path) throws Exception {
if (file.exists()) {
file.delete();
}
createNewFile(file, path);
FileOutputStream buf = new FileOutputStream(file, true);
ObjectOutputStream oos = new ObjectOutputStream(buf);
o... |
a481a380-311e-4c0e-a64a-1f37c6085881 | 6 | private void processDeleteReplica(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] obj = (Object[]) ev.get_data();
if (obj == null)
{
System.out.println(super.get_name() +
".processDeleteReplica(): no object is found");
... |
69ddcde7-e543-498d-999f-34313a477eee | 7 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
Player p = (Player) sender;
if(commandLabel.equalsIgnoreCase("cdt")) {
if(args.length == 0) {
Messenger.playermessage("Usage: /cdt <setprice>, /cdt <stats>, /cdt <price>", p);
}else if(args.length ... |
0d68c187-7576-4213-a272-f6a80b93527b | 9 | public ClassUseMapper(RootDoc root, ClassTree classtree) {
this.classtree = classtree;
// Map subclassing, subinterfacing implementing, ...
for (Iterator<ClassDoc> it = classtree.baseclasses().iterator(); it.hasNext();) {
subclasses(it.next());
}
for (Iterator<ClassD... |
90c311f2-f97a-456f-89c0-81e9e9b7d900 | 6 | public TestSuite testSuiteFromClass(Class<?> clss) throws TestSuiteCreationException {
final Method[] methods = clss.getMethods();
Method beforeSuite = null;
Method afterSuite = null;
// Search the before- and after- suite methods in the test suite class //
// O... |
2938d931-b607-4c6a-b8a0-b85021439d61 | 7 | public String serialize(final Object content) {
if (content == null) {
return EMPTY_STRING;
}
boolean addSeparator = false;
final StringBuilder stringBuilder = new StringBuilder();
final List<AnalyticsField> analyticsFields = analyticsParamResolver.getAnalyticsParamFields(content.getClass());
for (fin... |
e9d5e45f-c521-4e85-a62a-c959439dc5f2 | 6 | public void abilitySpec(String[] parts){
//get the id
int unitID = Integer.parseInt(parts[1]);
String[] split = parts[2].split(",");
Unit unit = getUnitFromID(unitID);
// System.out.println("Main : abilitySpec : unit has " + unit.abilityPoints + " abilityPoints");
if(unit==null){
... |
0eee40e4-f429-4f3d-a167-f1f20d337de7 | 7 | public void partRoom(String message, String currentname, Socket socket){
int arrsize;
int num;
String roomname;
room = message.substring(6);
if(roomlist.containsKey(room)){
roomnum = Integer.parseInt((roomlist.get(room)).toString());
//Removes the user from the channel
if((rooms.get(roomnum-1)).cont... |
6baf2d0f-a837-4116-9761-4f9210bf8748 | 8 | double distanceTo(Point a){
double newx, newy, dist;
if((this.x < 0 && a.x >= 0) || (this.x >= 0 && a.x < 0)){
newx = Math.abs(this.x) + Math.abs(a.x);
}
else{
newx = this.x - a.x;
}
if((this.y < 0 && a.y >= 0) || (this.y >= 0 && a.y < 0)){
... |
d433398b-ef71-4797-a379-fcabc9b9d590 | 0 | public void setCashCountId(int cashCountId) {
this.cashCountId = cashCountId;
} |
6403115a-5835-4c0b-b1ff-e686c243fe3f | 8 | public static boolean getSemaphoresData(String pathName) {
DocumentBuilderFactory docBuilderFactory;
DocumentBuilder docBuilder;
Document document = null;
try {
docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilder = docBuilderFactory.newDocumentBuilder();
document = docBuilder.parse(n... |
8774c071-b83d-4872-8e3a-d57482ac0ac2 | 3 | @Override
public void mouseReleased(MouseEvent e) {
// Is there a final point? At this stage, this means a rectangle is constructed.
if (finalX > 0 && finalY > 0) {
String dialogMsg = "Would you like to crop the image to the specified size?";
int doCrop = JOptionPane.showConf... |
b6d71e0c-ff66-4b51-8a09-eb3a2dbd0af3 | 5 | private final void method1927(boolean bool, ByteBuffer class348_sub49,
int i) {
anInt3257++;
if ((i ^ 0xffffffff) != -2) {
if (i == 2)
((Class254) this).anInt3256 = class348_sub49.getDword();
else if (i == 4)
((Class254) this).aBoolean3261 = false;
else if (i == 5)
((Class254) this).aString... |
f8be984c-ba77-4430-9c81-f8a3e56eb615 | 5 | static Argument[] asArgumentList(Node parent, Object obj)
{
if (obj == null)
{
return new Argument[0];
}
else if (obj.getClass().isArray())
{
Argument[] result= new Argument[Array.getLength(obj)];
for(int i = 0; i < result.length; i++)
result[i] = wrap(parent, Array.get(obj, i), false);
retur... |
9a5182c3-4e09-4e01-aaca-3c6ae9005967 | 6 | public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
ListNode p1 = headA;
ListNode p2 = headB;
while (p1 != null && p2 != null && p1 != p2) {
p1 = p1.next;
p2 = p2.next;
if (p1 == p2) {
return p1;
}
if (p1 == null) {
p1 = headB;
}
if (p2 == null) {
p2 = headA;
... |
ba48e8da-df29-4db3-9d0f-d480a9104281 | 0 | public void setLocation(int x, int y) {
this.x = x;
this.y = y;
} |
201383fe-27a4-47bf-90f4-74e98f289dd1 | 4 | public MarginField(int[] initialValue, Color bg, String fieldTitle) {
if ((initialValue != null) && (initialValue.length != 4)) {
throw new IllegalArgumentException();
}
if (bg == null) {
bg = Color.WHITE;
}
if (fieldTitle == null) {
fieldTit... |
99428fc0-14e4-43ba-bdc4-ef572c176e4a | 7 | private void processFile(File file)
{
if (lookup.containsKey(file))
{
FileDetails info = lookup.get(file);
if (info.hasExpired())
deleteList.add(info);
//else ignore
}
else
{
//apply rules
//... |
1f9b1082-0816-45da-87b3-95bbadda85eb | 2 | public static List<LigneCommandeClient> selectLigneCommandeClient() throws SQLException {
String query = null;
List<LigneCommandeClient> commandes = new ArrayList<LigneCommandeClient>();
ResultSet resultat;
try {
query = "SELECT * from LIGNE_COMMANDE_CLIENT ";
... |
e4aa78c7-2383-4809-9826-145fe039a7cb | 9 | protected int myElse(StringBuffer s, int i, int end, String[] lastFoundMacro)
{
int endifsToFind = 1;
for (; i < end; i++)
{
if (s.charAt(i) == '@')
{
final String foundMacro = parseFoundMacro(s, i, lastFoundMacro, true);
if ((foundMacro != null)
&& (foundMacro.length() > 0))
{
if (fo... |
7538def1-9c75-4650-b200-d6343240af6f | 8 | public MyJCanvas()
{
addMouseListener(new MouseAdapter()
{
public void mousePressed (MouseEvent e)
{
mouseX = e.getX();
mouseY = e.getY();
if (mouseInRange(mouseX, mouseY))
{
xPressed = ((minX)+((mouseX)*((maxX - minX)/W)));
yPressed = ((maxY)-((mouseY)*((maxY - ... |
4fec75b0-73a4-46e4-a608-5970166c8e03 | 7 | @Override
public void execute(CharSequence str) {
HasSubSection selectedItem = editor.getSelectedItem();
// if the section is not a lvl 1 section
if (selectedItem instanceof Section
&& ((Section) selectedItem).getParent() instanceof Section) {
Section section = (Section) selectedItem;
Section parent = ... |
1b0ec385-9244-4fc2-b257-0613914b2eae | 7 | private void compruebaImpactoDelLaser(Laser laserJugador){
for (int i=0;i<sprites.size();i++)
if (sprites.get(i).getClass()==UFO.class) if (((UFO)sprites.get(i)).isVisible()) {
UFO enemigo=(UFO)sprites.get(i);
if ((laserJugador.getX()>enemigo.getX() && laserJugado... |
1b46b61d-0fc3-4e90-b5f8-da119e13f6bb | 4 | public Type getCanonic() {
if (ifaces.length == 0 || (clazz == null && ifaces.length == 1))
return this;
if (clazz != null)
return Type.tClass(clazz.getName());
else
return Type.tClass(ifaces[0].getName());
} |
20857828-7c7d-4a10-af34-2041322e0d57 | 9 | @Override
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final Code ent1 = Code.of(arg.get("ENT1", 1));
final Code ent2 = Code.of(arg.get("ENT2", 1));
final IEntity cl1;
final IEntity cl2;
final IEntity normalEntity;
final String suffix = "lol" + Uni... |
f23e6b9f-c9dc-480a-bbca-cbe833d03b23 | 3 | private static void build(String ord, Node node, int len, int index) {
if (len > index) {
char c = ord.charAt(index);
HashMap<Character, Node> tempMap = node.barn;
if (! tempMap.containsKey(c))
tempMap.put(c, new Node());
if (len > index + 1)
build(ord, tempMap.get(c), len, index + 1);
}
} |
b99a5cdf-f8e7-4fee-a2a4-d7868b09cd12 | 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");
} |
f301181e-9752-4c2d-890c-221482210a7c | 7 | public PixelInfo(
final int radius, final BufferedImage image, final int x0, final int y0, final int width, final int height) {
final int[] redHistogram = new int[VALUE_LIMIT];
final int[] greenHistogram = new int[VALUE_LIMIT];
final int[] blueHistogram = new int[VALUE_LIMIT];
... |
8b26ce90-1a92-4a3f-a10e-cdee7a4c3a93 | 6 | public GameComponent newGameComponent(){
stageNumber++;
if(game!=null) {
game.dispose();
NavalManager.w1 = null;
NavalManager.w2 = null;
NavalManager.w3 = null;
}
persists = new Player(playerName);
ai = new AI();
tm = (new TurnManager(new PlayerManager(persists,ai)));
switch(stageNumber){
c... |
d123cffd-cee9-499e-87e1-2a08c99b3cab | 1 | public List<Player> playMultipleGames(Player player1, Player player2,
int count)
{
ArrayList<Player> returnList = new ArrayList<>();
for (int i = 0; i < count; ++i)
{
returnList.add(i, playGame(player1, player2));
}
printResults(player1, player2, coun... |
89c7abdf-35f4-4b6e-88cf-0f79da86783b | 5 | public void simulateOneStep()
{
step++;
// Provide space for newborn actors.
List<Actor> newActors = new ArrayList<Actor>();
// Let all actors act.
for(Iterator<Actor> it = actors.iterator(); it.hasNext();) {
Actor actor = it.next();
actor.ac... |
bb548f0e-cd18-4545-945d-3df92fbfdbce | 7 | @Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
String data;
try {
ArrayList<FilterBean> alFilter = new ArrayList<>();
if (request.getParameter("filter") != null) {
if (request.getParameter("filterop... |
01d98528-0b93-41f4-9f3a-754db620a65a | 1 | public void searchAcc() throws IOException
{
try
{
Scanner in = new Scanner(System.in);
System.out.println("What account are you looking for?(Account Number)");
int an = in.nextInt();
String path = accDir+an+".txt";
Account aA = new Account(an);
System.out.println("-------------... |
dcd6c491-cc68-4f3a-b6ed-0360d4451a3e | 8 | public void avoidObs(){
int counter=0;
boolean b= false;
while (!b) {
counter++;
getRangers ();
if(counter%150==0){
turnTo();
getRangers();
if(front>1.5){
goTo();
b=true;
}
}
Sp = 0.2;
ySp = 0;
if (front < 0.4) {... |
4911bf41-dfda-4232-bc98-43bc0bdb3912 | 3 | private void lbChatDatesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbChatDatesMouseClicked
if (evt.getClickCount() == 2) { // doubleclick
if (lbChatDates.getSelectedIndex() == -1) { // there is no selection
return;
}
String sel... |
483d1899-0e68-4a64-b639-8a947e8bdcbb | 0 | public int getCapacity( )
{
return data.length;
} |
0e271847-9ee4-4cd7-b4f6-0ad35d773720 | 2 | private void addTileToDelta(Tile tile, AtomDelta delta)
{
// Make sure the turf actually exists
if(tile != null)
{
delta.updates.add(new FullAtomUpdate(tile));
for(Atom content : tile.contents)
{
delta.updates.add(new FullAtomUpdate(content));
}
}
} |
42bb14b5-6aef-46db-ac14-9443c9973182 | 4 | public Node add(String sana) {
Node uusi = this.getChild(sana.charAt(0));
String loput = sana.substring(1);
if (uusi == null) {
uusi = new Node();
uusi.setName(sana.charAt(0));
if (lapset.isEmpty()) {
lapset.add(uusi);
} else {
... |
06411a62-a38a-47e7-a71c-abbb6722cc85 | 7 | public Square(char c) {
if(c == '#' || c == '.' || c == '$' || c == '*' || c == '@' || c == '+' || c == ' ') {
setValue(c);
} else {
throw new IllegalArgumentException("Invalid square type");
}
} |
a55cd3fb-bf88-46e6-9a9a-e1f25c1d720f | 3 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
buildConversion();
while ((line = in.readLine()) != null && line.length() != 0) {
line = line.trim();
if (Chara... |
96d4beb0-df63-4dc8-99e3-337748378988 | 6 | @EventHandler
public void GiantWaterBreathing(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.getGiantConfig().getDouble("Giant.Wat... |
58e674b8-649a-4cf8-9f80-d0ba9ade5641 | 4 | public static int findMaxDepth(int[][] maze){
int max = Integer.MIN_VALUE;
for(int i=0; i<maze.length; i++){
for(int j=0; j<maze[0].length; j++){
if(maze[i][j]<Integer.MAX_VALUE && max<maze[i][j])
max = maze[i][j];
}
}
return max;
} |
7979ff9c-ead2-4080-a2b0-60ca17f66052 | 8 | public void initConnection()
{
// We need to be able to detect if the program has been run for the first time or not
boolean firstRun = false;
try
{
// Ensure that the SQLite driver is accessible
Class.forName("org.sqlite.JDBC");
}
catch(ClassNotFoundException e)
{
Errors.fatalError("Could not ... |
2c62441f-a544-4b31-ba45-2324a8caa003 | 8 | private static String cutLine(final String string, final boolean deleteDelimiters, final String ending, final String... begining) throws Exception
{
if(!string.contains(ending))
throw new Exception();
boolean exists = false;
for(final String temp : begining)
if(string.contains(temp))
exists = true;
i... |
7436f505-1dfb-4dae-8f28-e56d17763222 | 5 | @SuppressWarnings("unchecked")
@Override
public void onEnable(){
logger = getLogger();
logger.info("Chest Screen Plugin Author: Tim Kerr (Kloudy)");
logger.info("Reading display data from file");
//read display data from file
try{
File folder = new File("plugins/DisplayData");
if(!folder.exis... |
87cb1902-55e9-4da6-aa5b-1af4fef957c9 | 8 | public static int getIntensityParamIndex(String accession) {
if (INTENSITY_SUBSAMPLE1.getAccession().equals(accession)) {
return 1;
} else if (INTENSITY_SUBSAMPLE2.getAccession().equals(accession)) {
return 2;
} else if (INTENSITY_SUBSAMPLE3.getAccession().equals(accessi... |
50db8ec1-81dc-4a2d-afb8-9a2831fff7ac | 1 | public int Largo()
{
int contador=0;
NodosListaProceso aux = PrimerNodo;
while (aux!=null) {
contador ++;
aux=aux.siguiente;
}
System.out.println("El largo de la lista es: "+ contador);
return contador;
} |
34dc01da-bccc-4a1e-a255-3c1cc53cbf77 | 8 | public ExecCommand[] PrepareText(String text)
{
ArrayList<ExecCommand> currentCommands = new ArrayList<ExecCommand>();
text = changePolishLetters(text);
String[] words = text.split(" ");
int x = 0;
int y = 0;
Boolean isArgCus = false;
... |
c859459d-7321-4f75-846c-78159f64ea83 | 0 | private String escapeXMLText(String text) {
text = StringTools.replace(text, "&", "&");
text = StringTools.replace(text, "<", "<");
text = StringTools.replace(text, "]]>", "]]>");
return text;
} |
2c9835e4-2170-416b-ad14-a88a967e9881 | 7 | public void testConstructor_int_int_int_int_int_int_int_Chronology() throws Throwable {
MutableDateTime test = new MutableDateTime(2002, 6, 9, 1, 0, 0, 0, GregorianChronology.getInstance()); // +01:00
assertEquals(GregorianChronology.getInstance(), test.getChronology());
assertEquals(TEST_TIME_... |
d98c59e5-7352-44b0-8ab2-cd01b765dccd | 4 | public static void main(String[] args){
HashMap<BigInteger, Integer> cache = new HashMap<BigInteger, Integer>(); //memoiation structure that has the key of the integer, and the value of the length it takes to get to 1 according to the sequence
cache.put(BigInteger.valueOf(1), 1);
cache.put(BigInteger.valueOf(2), ... |
4a1fdd57-ce5b-4483-b4d9-9dd46453a2f5 | 8 | public long uniquePaths(int m, int n) {
if(m<1||n<1) return 0;
if(m==1 && n==1) return 1;
long count[][] = new long[m+1][n+1];
for(int i=0;i<=m;i++) count[i][0] = 0;
for(int i=0;i<=n;i++) count[0][i] = 0;
count[0][1] = 1;
for(int i=1;i<=m;i++)
{
for(int j=1;j<=n;j++)
{
count[i][j] =count[i-... |
2f9ba460-54be-46c0-8985-d2de9f13e6ce | 5 | private void updateDescription() {
if (currentFunc == null) {
return;
}
try {
currentFunc.descDoc.clear();
int beg;
int off;
String line;
for (int i = 0; i < descArea.getLineCount(); i++) {
beg = descArea.getLineStartOffset(i);
off = descArea.getLineEndOffset(i) - beg;... |
26d65349-db98-4e3d-810e-612768e4fb16 | 0 | @Override
public void endSetup(Attributes atts) {
super.endSetup(atts);
} |
775d67d2-3a74-4607-9a6b-9e41f64ee9cc | 5 | public static boolean isEntrance(Tile t) {
for (Tile n : t.edgeAdjacent(tempT4)) {
if (n == null || ! (n.owner() instanceof Boardable)) continue ;
for (Boardable b : ((Boardable) n.owner()).canBoard(tempB4)) {
if (b == t) return true ;
}
}
return false ;
} |
3afa4717-1521-4703-8e59-cb78ae9bd8db | 6 | private int min(int i, int j) {
if (i == j && i == 0) {
return 0;
}
int del = delete(i, j);
int ins = insert(i, j);
int rep = replace(i, j);
int res;
if (del <= ins && del <= rep) {
res = del;
}
else {
if (ins <= del && ins <= rep) {
res = ins;
}
else {
res = rep;
... |
6c2cc86a-d4c0-416d-b1aa-f8e3842988b7 | 7 | public static boolean shortTermP(Stella_Object arg) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(arg);
if (Surrogate.subtypeOfP(testValue000, OntosaurusUtil.SGT_STELLA_LITERAL_WRAPPER)) {
{ LiteralWrapper arg000 = ((LiteralWrapper)(arg));
{ Surrogate testValue001 = Stella_Obj... |
e08402c3-c6db-416a-a84b-5739892c38a0 | 8 | public static void main(String[] args) {
for(String s: args) {
if(s.startsWith("-d")) diff = s.substring(2);
if(s.startsWith("-tw64")) func = new Tworojok64HashFunction();
try {
if(s.startsWith("-p")) port = Short.parseShort(s.substring(2));
} catch(NumberFormatException e) {
}
}
System.err.... |
63f9ef0e-5b0d-4fdb-a7a3-42b8e148116d | 0 | public PhonewordFinder(WordReader dictionary) {
super();
this.dictionary = dictionary;
} |
5e89fc07-4317-4079-9f86-3dee14684a69 | 4 | @Override
public void keyPressed(int key, char c) {
switch(key) {
case Input.KEY_UP:
player.startMoving(Direction.NORTH);
break;
case Input.KEY_DOWN:
player.startMoving(Direction.SOUTH);
break;
case Input.KEY_LEFT:
player.startMoving(Direction.WEST);
break;
case Input.KEY_RIGHT:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.