method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
29df6648-7ec6-4f5a-8f41-2ae3aa1e542b | 8 | private void populateTab_fleets(StarSystem system) {
// own fleets
for (Fleet f : system.getFleets()) {
if (f.getUser().equals(Client.getInstance().getLocalUser())) {
BottomMenuToolbarIcon fleetButton = new BottomMenuFleetIcon(f, false);
registerAction(fleetBu... |
c7b70565-7f7f-471b-847e-5b6429cfb4c0 | 9 | @Override
public boolean doAction(String choice) {
switch (choice) {
case "M": // move to new location
this.displayMap();
LocationView locationView = new LocationView();
locationView.display();
break;
... |
22055d4d-8955-4a44-8d26-bbdc3d1ed4ef | 1 | @Test
public void runTestObjectSensitivity2() throws IOException {
InfoflowResults res = analyzeAPKFile("FieldAndObjectSensitivity_ObjectSensitivity2.apk");
if (res != null)
Assert.assertEquals(0, res.size());
} |
f05f2a87-d68a-488c-8f9f-4da6133c93bf | 3 | protected void wolfKill() {
Vector<Integer> targets = wolfVictim2.getTarget();
if (targets.size() == 0) {
bot.sendMessage(gameChan, getFromFile("NO-KILL", NARRATION));
return;
}
int target;
if (targets.size() == 1) {
target = targets.get(0);
} else {
target = targets.get((int) Math.random() * ta... |
43e58ade-e35e-456e-9ca0-214d84d4a157 | 0 | @Override
public WebDriver getWebDriver()
{
System.setProperty("webdriver.ie.driver","src/test/resources/IEDriverServer");
return new InternetExplorerDriver();
} |
acf4718d-67ac-4381-a71d-ea7fb6e9b311 | 7 | private void buildSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
List<ProgramElementDoc> members = new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
configuration));
if (members.size() > 0) {
... |
8b6f2376-e1c9-414e-b1a6-5e822a185b91 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
8e66f66c-bcbd-4012-a09f-ee27cca48717 | 7 | private boolean validar(String hora) {
boolean res = true;
int h = 0;
int m = 0;
if (!"".equals(hora)) {
String[] temp = hora.split(":");
if (temp.length < 2) {
res = false;
}
try {
h = Integer.parseInt(temp[... |
32958bdc-b67a-4f2f-b01e-92783489e527 | 7 | public ProblemInstance readInstance(File instanceFile) {
if(instanceFile == null){
throw new IllegalArgumentException("Parameter instanceFile null");
}
long adInventorySize = 0;
boolean adOptionParseError = false;
ArrayList<Item> items = new ArrayList();
Fi... |
fa4e2991-76fd-4758-810a-a849d600bf6e | 1 | public void setUserAgent(String agentString) {
if (agentString == null) {
this.getHttpClient().getParams().removeParameter(AllClientPNames.USER_AGENT);
} else {
this.getHttpClient().getParams()
.setParameter(AllClientPNames.USER_AGENT, agentString);
}
... |
23b9273f-b685-4f7f-9548-20c7ce19b51b | 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... |
a591104f-976d-4109-9ff1-205d1fd29419 | 8 | public ListNode deleteDuplicates(ListNode head) {
if (head == null)
return null;
ListNode newHead = null, cur = null;
Integer pre = null;
int count = 0;
while (head != null) {
if (pre == null) {
pre = head.val;
count++;
} else {
... |
03a5fc9b-4cf2-4237-99fa-5f85ee181675 | 8 | private PropertiesCollection parseProperties(XmlPullParser parser) throws Exception {
PropertiesCollection collection = new PropertiesCollection();
PropertiesCollection.Property property = collection.new Property();
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == Xm... |
32bfb239-08ba-4867-9464-09b74faa7d1c | 8 | public void move_all(Draw panel, Ponto p1, Ponto p2, Color bg_color){
circulos_desenhados_aux.clear();
circulos_desenhados_aux.addAll(ctrCirculo.circulos_desenhados);
for (Circulo c : circulos_desenhados_aux) {
figura_selecionada = c;
ctrCirculo.circulos_desenhados.remove(c);
mover_figura_selecionada(... |
6dd2b2a6-65ee-40d7-ad65-88cd6010b54a | 4 | @EventHandler
public void onZombieSpawnEvent(CreatureSpawnEvent e){
r = new Random();
Entity entity = e.getEntity();
if("ZOMBIE".equals(entity.getType().toString())){
Zombie barbarianZombie = (Zombie) e.getEntity();
Zombie goldenZombie = (Zombie) e.getEntity();
... |
8850e095-a52a-413b-a1a3-b59fe646a19c | 4 | private void reconnect() {
shutdownSocket();
if (mServer != null) {
mServer.shutdown();
mServer = null;
}
while (true) {
try {
mServer = new Server(mSocketAddress);
mServer.setDaemon(true);
mServer.start();
} catch (Exception exception) {
// Someone else is already the server, just ... |
f24d5c0c-43c1-4e5a-9af6-177e1b1be57a | 2 | public static retim.Calculator unchecked_narrow(final org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
try
{
return (retim.Calculator)obj;
}
catch (ClassCastException c)
{
retim._CalculatorStub stub;
stub = new retim._CalculatorStub();
stub._set_delegate(((org.omg.CORBA.portable.... |
8fa741e5-5272-4111-a6ed-d965240aa0b3 | 3 | void stop() throws SQLException, ClassNotFoundException {
Activity activity;
// Pause() will we executed for the case "stop" is pressed being in "play" status.
pause();
if (startTime > 0 && totalTime >= TimeBO.MINIMUM_TIME_DURATION) {
try {
activity = timerPanel.getSelectedActivity();
Connection c... |
e4c20cee-22ca-4adf-b16d-130cc7a4edbb | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
solve();
while ((line = in.readLine()) != null && line.length() != 0) {
char[] w = line.trim().toCharArray();
b... |
13f5d8a1-1b49-4f09-a4f9-ab09f2d167bf | 9 | public void loadGeneIds(String geneIdsFile) {
//---
// Load Gene IDs data
//---
if (verbose) Timer.showStdErr("Loading Gene IDs from " + geneIdsFile);
GeneIds geneIds = new GeneIds(geneIdsFile);
// Assign to geneIDs
Pattern patternEnsg = Pattern.compile("ENSG[0-9]*");
Pattern patternEnst = Pattern.comp... |
b6375dda-387d-4a81-bbf3-ead9717d5085 | 0 | public A1JPanel() {
setBackground(BACKGROUND_COLOUR);
loadAllCardImagesAndSetUpCardDimensions();
addKeyListener(this);
addMouseListener(this);
reset();
} |
565f9773-565b-4600-95b5-fa959b136884 | 6 | public void paintAux(Graphics g) {
//se despliegan el score en la esquina superior izq
g.setColor(Color.RED);
g.drawString("Score: " + iScore, 20, 35);
if (entBarra != null && entBloque != null && entProyectil != null && encBloques.size() > 0) {
//Dibuja la imagen de la b... |
c52b53e8-dbb5-4ed1-83dc-15d9fa867ac4 | 0 | public static void main(String[] args) {
Callee1 callee1 = new Callee1();
Callee2 callee2 = new Callee2();
MyIncrement.f(callee2);
Caller caller1 = new Caller(callee1);
Caller caller2 = new Caller(callee2.getCallbackReference());
caller1.go();
caller1.go();
... |
4bf736ce-92d4-4379-b34b-bb4320078c2c | 2 | @Override
public int decidePlay(int turn, int drawn, boolean fromDiscard) {
//Compute the best position for the newly drawn card (if not cached)
if (!fromDiscard || cache_turn != turn)
cache_pos = maxSequence(rack, game.rack_size, drawn, false);
return cache_pos;
} |
1fec781c-be79-48cf-8120-baf9e2d6c71c | 3 | private void checkForPeakZ(double z) {
if (isUpPeakZ) {
if (z < lastZ) {
peakZ = lastZ;
isUpPeakZ = false;
}
} else {
if (z > lastZ) {
peakZ = lastZ;
isUpPeakZ = true;
}
}
lastZ = z;
} |
9fdd794d-2176-4c01-930a-79f186ed4a6a | 2 | public void updateHeightmap(BufferedImage hmap) {
for (int i = 0; i < hmap.getWidth(); i++) {
for (int j = 0; j < hmap.getHeight(); j++) {
float color = new Color(hmap.getRGB(j, i)).getRed();
color /= 255f;
color -= 0.5f;
color *= 16;
terrain.setHeight(j, i, color);
}
}
} |
d3d9ca2d-490b-41f2-aaaa-0204fd727b62 | 8 | private int readFrameType(final Object[] frame, final int index, int v,
final char[] buf, final Label[] labels) {
int type = b[v++] & 0xFF;
switch (type) {
case 0:
frame[index] = Opcodes.TOP;
break;
case 1:
frame[index] = Opcodes.INTEGER;
break;
case 2:
frame[index] = Opcodes.FLOAT;
break... |
60e4be30-bc4b-4e82-ab02-e4b0751b6a14 | 2 | public void setData1i(Complex[] data, int power) {
this.power = power;
count = 1<<power;
x = new Complex[count];
fd1i = new Complex[count];
for(int i=0;i<count;i++){
x[i] = new Complex();
fd1i[i] = new Complex();
}
for(int i=0;i<count;i++){
x[i] = data[i];
}
} |
b4dfea4c-f352-4fc2-8aa9-9aaadd7c53aa | 7 | public void update() {
if(!this.changed) return;
LinkedList<String> lines = new LinkedList<String>();
for(String key: this.pushedIndexes.keySet()) {
if(this.Indexes.containsKey(key)) {
if(!this.Indexes.get(key).toString().equals(this.pushedIndexes.get(key).toString(... |
ef60a260-a965-49d3-87ce-b37488efc1fc | 3 | public void setEnemy(int id){
switch (id){
case 1:{
this.sprite = DisplayActions.getImage("EShip1");
this.id = 1;
this.health = 3;
this.value = 1;
this.moveSpeedX = 1;
this.moveSpeedY = 0;
... |
b2c91306-d2a2-4b3f-9fd2-edfe0f79f32a | 2 | private void jButtonSignActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSignActionPerformed
this.jTabbedPane.setSelectedComponent(this.jPanelTabQueue);
for (int i = 0; i < this.model.getRowCount(); i++) {
if (this.model.isSelected(i)) {
SignatureFi... |
520127c6-df11-42df-b179-2f2da7b46af2 | 1 | public static String getArrayType(String elementType) {
if (elementType.charAt(0) == '[')
return "[" + elementType;
else
return "[L" + elementType.replace('.', '/') + ";";
} |
82a47f23-2644-42bb-8098-75f449f6aa5f | 4 | public static void run(RomInfo romL, RomInfo romR, DualGbSegment segment) {
Gb.loadGambatte(2);
// load roms
Gameboy gbL = new Gameboy(romL, 0, true);
Gameboy gbR = new Gameboy(romR, 1, true);
DualGbHelper.initDualGb(gbL, gbR);
// init inital state
StateBuffer initalBufferL = new StateBuf... |
e261b111-e11b-464d-91d4-cd51d0b6e3b6 | 0 | public LanguageId(String id, String name) {
this.id = id;
this.name = name;
} |
2ca66fec-fc5c-41be-8b70-952896c8108a | 2 | public static String getWobID(int x, int y, int z) {
try {
if ( wobjects[x][y][z] != null )
return wobjects[x][y][z].getWobID();
} catch (Exception e) {
System.out.println("BoxLoc.getWobID(): " + e);
return "OutofBound";
}
return "Vacant";
} |
d6fd3c38-7ced-48c9-b8a3-c2dc04eb7840 | 5 | public void setTile(Tile tile, int x, int y) {
if (tile != null) {
if (x >= 0 && y >= 0 && x < getWidth() && y < getHeight()) {
tiles[x][y] = tile;
}
}
} |
5d27a243-34c6-4eef-b8fb-c612e9214978 | 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... |
c33d8e15-3d9d-4518-bef9-01c0f3930e9e | 6 | private static String findDigits(String str)
{
String answer = "NONE";
boolean hasFound = false;
for(int i = 0; i < str.length(); i++)
{
if((str.charAt(i) >= 'a' && str.charAt(i) <= 'j'))
{
if(!hasFound)
{
answer = "";
hasFound = true;
}
answer += str.charAt(i) - 'a';
}
el... |
f710fcf0-f7d8-475a-bc28-97164a3ddb56 | 1 | public boolean isCarrying() {
if (rend != null) {
return (rend.hasImage("arm/carrying") == true);
} else return false;
} |
a324d583-2fb7-4a4d-9fe8-eef42b45ea22 | 6 | @Override
public void write(Session session, Packet p) {
try {
if (p.isRaw()) {
/*
* If the packet is raw, send its payload.
*/
session.getSocketChannel().write(ByteBuffer.wrap(p.getData()));
} else {
/*
* If not, get the out ISAAC cipher.
*/
// ISAACCipher outCipher = ((Pla... |
562e9b61-1e77-4dcf-a361-6064a3f5130f | 0 | public void setxStream(XStream xStream) {
this.xStream = xStream;
} |
3b238c26-7e53-4258-918b-a72a5f5c85d2 | 8 | private boolean isCollide(Entity one, Entity two)
{
if(!(one instanceof Boss) && !(two instanceof Boss))
{
if (Math.abs(one.getX() - two.getX()) >= 50 || Math.abs(one.getY() - two.getY()) >= 50) return false;
}
ArrayList<Pair> onePairs = one.getEdges();
ArrayList<Pair> twoPairs = two.getEdges();
for... |
e5cfc22f-bf72-4da5-8665-eab2d89aa470 | 6 | private void init()
{
for (int i = 0; i < NUM_ROWS; i++) // Loop through rows
for (int j = 0; j < NUM_COLUMNS; j++) // Loop through columns
gameBoard[i][j] = EMPTY;
// Left edge
for(int i = 0; i < NUM_ROWS; i++)
gameBoard[i][0] = BORDER;
// Right edge
for(int i = 0; i < NUM_ROWS; i++)
game... |
edd3e13f-98d0-48ce-b95d-e30183ea9f78 | 8 | public void getUnion(Node list1, Node list2) {
if (list1 == null && list2 == null) {
return;
}
System.out.println("List 1:");
print(list1);
System.out.println("List 2: ");
print(list2);
Node newList = new Node();
while (list1 != null && list2 != null) {
if (list1.getData() < list2.getData()) ... |
04baff37-9a2c-4b19-98e2-e42fd36f3c73 | 7 | public Armor makeArmor(Armors armorName) {
Armor armor = new Armor("Cloth", "Works great for peansantry. Not much else though, but hey, at least it's something right?", new Damage(6));
switch(armorName) {
case CLOTH:
armor = new Armor("Cloth", "Works great for peansantry. Not much else though, but hey, at l... |
57c1e163-16ae-4865-a0bd-931dafa884c4 | 1 | public void remover(long pesquisaId) throws Exception
{
String sql = "DELETE FROM Pesquisapalavras_chave WHERE id1 = ?";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
stmt.setLong(1, pesquisaId);
stmt.execute();
}
catch (SQLException e)
{
throw e;
... |
e1c5acff-fd30-444c-9aa0-78d93592aa5c | 1 | public void setDescription(String description) {
if (description == null) {
throw new IllegalArgumentException("Description shouldn't be NULL.");
}
this.description = description;
} |
b55a550d-86d5-457c-8092-914315638898 | 0 | @Override
public String getDesc() {
return "Sacrifice";
} |
645d1e24-a13b-40ea-a692-2477409b4328 | 5 | @RequestMapping(value = "deleteTask")
public @ResponseBody
String deleteTask(@RequestParam Integer id, WebRequest webRequest) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication.isAuthenticated() && (authentication.getPrincipal() instanceo... |
d8a67f02-9e4a-468a-8066-b6b95b02516d | 0 | public double getT(double x) {
return Math.acos((x - a) / r);
} |
22477306-fed3-4403-81a2-8e33346332c8 | 7 | private boolean[] getIgnoreQueryInfo(File file, int maxQueryNumber) {
System.out.println("Reading query ignore file: " + file);
boolean[] ignoreQueries = new boolean[maxQueryNumber];
for (int i = 0; i < maxQueryNumber; i++)
ignoreQueries[i] = false;
try {
BufferedReader qmReader = new BufferedReader(new... |
0d8869e2-4300-475f-9dae-0a9309dc9445 | 2 | private void parseNumber() throws IOException {
int c = in.peek();
while (Character.isDigit(c) || c == '_') {
out.append((char) in.read());
c = in.peek();
}
} |
d382f8bc-33d3-41f2-a2fc-3e458e0fd45e | 4 | protected String getPresentationText(TreeRow row, Font font, int width, boolean forHeightOnly) {
String text = getText(row);
if (mWrappingMode == WrappingMode.WRAPPED) {
return TextDrawing.wrapToPixelWidth(font, text, width);
}
if (mWrappingMode == WrappingMode.SINGLE_LINE) {
int cut = text.indexOf('\n');... |
a6930c20-e32a-4706-8758-11eb8893bab1 | 3 | public void preencherTabela() throws Exception
{
ArrayList<String> colunas = new ArrayList<String>();
colunas.add("id");
colunas.add("nome");
Object linhas[][] = new Object[list.size()][];
int i = 0;
for (InstituicaoCooperadora instituicaocooperadora : list)
{
linhas[i] = formatoTabela(instituicaocoop... |
f1ebe1ae-8e2c-4a80-8330-ce3ca9fc9ce1 | 5 | public Path getImgPath_StandardBtn(Imagetype type) {
Path ret = null;
switch (type) {
case KEYFOCUS:
ret = this.imgStdBtn_KFoc;
break;
case MOUSEFOCUS:
ret = this.imgStdBtn_MFoc;
break;
case MOUSEFOCUS... |
9c42fe1c-f8b7-486c-a474-b57f9bbd171e | 7 | public Color findColour(Cell cell1){
String cell = cell1.toString();
if(Character.isDigit(cell.charAt(0))){
return new Color(122, 66, 182);
} else {
switch(cell){
case ".":
return new Color(194, 129, 43);
case "#":
return new Color(126, 126, 126);
case "R":
return new Color(150, 52,... |
28d08c88-fa7e-4597-8626-789c4968cec6 | 1 | private boolean jj_3R_44() {
if (jj_scan_token(SEMICOLON)) return true;
return false;
} |
26b33875-40b5-4fc5-b27e-3837235746c0 | 2 | public final void registerFactory(Class<?> clazz, IAssetFactory<?> factory) {
factoryList.put(clazz, factory);
} |
3cff9977-a2d1-40dd-980c-26662f423c66 | 8 | protected double distance(Instance first, Instance second) {
double distance = 0;
int firstI, secondI;
for (int p1 = 0, p2 = 0;
p1 < first.numValues() || p2 < second.numValues();) {
if (p1 >= first.numValues()) {
firstI = m_instances.numAttributes();
} else {
firstI = first.index(p1);
... |
9eb249d5-29b6-418a-b0c5-ebe18009c73b | 1 | @Override
public List<Integer> save(List<Hotel> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException {
try {
return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (Hotel bean) -> {
Object[] objects = new Object[5];
objects[0] ... |
1b77bd5a-8d75-4b15-999f-0b932985815f | 7 | public static void main(String args[]) throws Exception {
int serverPort = 0;
boolean passes = true;
isClosed = false;
int connects = 0;
int rejections = 0;
players = new LinkedList<TictactoThreadedServer>();
rejects = new LinkedList<TictactoThreadedServer>();
TTTModelBoard sharedBoard = new TTTModelBoa... |
b5446fca-7c51-4dea-976f-3511c8a51f50 | 0 | void setStopped(boolean value) {
final ReentrantLock l = lock;
l.lock();
try {
stopped = value;
}
finally {
l.unlock();
}
} |
c894e53c-5415-42f7-8fda-9247cfa16be0 | 8 | private void setupMenuBar() {
final Component comp = this;
final NESModelListener listener = this;
bg = new ButtonGroup();
JMenuBar menuBar = new JMenuBar();
getContentPane().add(menuBar, BorderLayout.NORTH);
JMenu fileMenu = GUIUtilities.createMenu(menuBar, "File", 'F')... |
3195bc41-6a57-42aa-80d2-76ad8a0ecc06 | 7 | public static Stella_Object instantiateExternalBindings(Stella_Object self) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_NAMED_DESCRIPTION)) {
{ NamedDescription self000 = ((NamedDescription)(self));
}
}
... |
d74a28ca-7d5a-4d6d-a72a-f3f43df3bf6f | 3 | public Turma pesquisaTurma(String codDisciplina, int numTurma)
throws DisciplinaInexistenteException, TurmaInexistenteException {
Turma turmaPesquisada = null;
Disciplina d = this.pesquisaDisciplina(codDisciplina);
for (Turma t : d.getTurmas()) {
if (t.getNumero() == numTurma) {
turmaPesquisada = t;
... |
61cfb4c7-5858-435b-b3d1-c9e8bbfe220e | 8 | public void resolvePrefixes(LinkedList<Prefix> pre){
//Resolve prefix in graph name
if (name.contains(":")){
//Replace prefix
for (Prefix p:pre){
if (name.startsWith(p.getPrefix())){
name="<"+p.getIriContent()+name.substring(p.getPrefix().length())+">";
break;
}
}
}
//Resolve prefixes... |
f0a88d67-35b7-4646-a646-d8f997fd10ea | 2 | private boolean isNewLine( Token token ) {
if ( token == null ) {
return true;
}
else if ( token.isNewLine() ) {
return true;
}
return false;
} |
1f2f5bd6-0969-42a1-8d4d-d084b49c7b21 | 3 | public boolean validateChecksum(Object d, short checksum) {
short newChecksum = 0;
String data = d.toString();
byte[] dataBytes = data.getBytes();
for (int i = 0; i < dataBytes.length; i++) {
newChecksum += (short) dataBytes[i];
}
while ( newChecksum / 0xff != 0) {
newChecksum = (short) (newChecksu... |
ad593a23-9026-4780-80ae-8e9c7624d0e0 | 4 | public void getNewAbility() {
// TODO Auto-generated method stub
if(this.getLevel() == 2)
{
//power cleave
//deals bonus damage based on user's attack
addAbility(new PowerCleave());
}
if(this.getLevel() == 4)
{
//dexterous swing
//deals bonus damage based on user's dex
addAbility(new DexAt... |
c7c8a142-9c52-445a-a310-92c08ff9bbb2 | 0 | public ArrayList<DrawableItem> getDrawable() {
return ditems;
} |
57ba8d9f-3cac-44e3-bc3b-535e85c94e2e | 4 | private ArrayList<String> getEvents()
{
ArrayList<String> ret = new ArrayList<String>();
String line = null;
for(;;) {
try {
if(!serverr.ready())
break;
line = serverr.readLine();
} catch(IOException e) {
e.printStackTrace();
break;
}
if(line == null)
continue;
System.err.println(line... |
3cfc353c-33ac-4d1c-8b36-b57583f10dc6 | 1 | private String calc(String input) {
//Person 5 put your implementation here
String res = "";
if(input.length()>2) {
res = input.substring(2, input.length()) + input.substring(0,2);
} else {
res = input;
}
return res;
} |
ea0dacc0-8254-4713-bfcc-dd404475d77f | 0 | public int getId() {
return id;
} |
ba212bf8-e628-407b-94a0-e10d6bd552bf | 0 | public Actionneur(int date1, int id1, int taille1) {
super(date1, id1, taille1);
} |
4e43c2dc-1592-4654-9207-0d9e29347cb3 | 4 | private ArrayList<AbstractComponent> getSentenceList(
AbstractComponent component) throws BookException {
ArrayList<AbstractComponent> list = new ArrayList<AbstractComponent>();
if (component.getType() == EComponentType.SENTENCE) {
list.add(component);
} else if (component.getType() != EComponentType.LISTIN... |
86ffd8af-a807-44f3-a8bb-c3217721bd9c | 8 | public static boolean isBlockSeparator(String s) {
if (s.startsWith("--") && s.endsWith("--")) {
return true;
}
if (s.startsWith("==") && s.endsWith("==")) {
return true;
}
if (s.startsWith("..") && s.endsWith("..")) {
return true;
}
if (s.startsWith("__") && s.endsWith("__")) {
return true;
... |
3503d06c-8ae7-4cf5-a36b-4cac1e89ea42 | 1 | public static void main(String[] args){
Fenetre._fenster = new Fenetre();
if (Fenetre._fenster != null) {
Fenetre._working = true;
Fenetre._fenster.startThreads();
}
} |
b4a7f319-2489-42c1-99f4-4a59f1ebab2f | 0 | public double getRadius() {
return radius;
} |
47ce6cc4-e88a-46e7-935f-65702220be31 | 9 | static public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
int advance = 0;
ListNode h1 = l1;
ListNode h2 = l2;
Queue<Integer> queue = new LinkedList<Integer>();
while(h1!=null || h2!=null) {
int value1 = (h1==null) ? 0 : h1.val;
int value2 = (h2==null) ? 0 : h2.val;
int sum = value1 + value2... |
65c2f971-4b3f-4c96-b146-e9039ce9fd12 | 5 | private void calcState() {
//calculate state
if (state == State.END) {
return;
}
if (!patternCheckBound() || !matchStrCheckBound()) {
state = State.END;
} else if (patternChar() == MATCH_ALL) {
if (!patternNextCheckBound()) {
s... |
38c3905a-dbd7-4ae5-a3ee-955148e000ad | 0 | public VueAbstrait getVue(){
return vue;
} |
569c2bf1-29ec-4835-afed-b71f3aa7a965 | 3 | @Test
public void poppingReturnsSmallestElements()
{
for (int i = 0; i < 1000; i++)
heap.insert((int)(Math.random() * 10000));
int old = -1;
boolean test = true;
while (!heap.isEmpty())
{
int i = heap.pop();
if (i < old) test = false;... |
758af994-8b9f-4ee3-86a4-355c9c6b1016 | 0 | @Test
public void testKitSize(){
int size = 5;
calc = new DataCalc(inData, numberOfPoints);
calc.createDataSet(0);
outData = calc.getStructureIn();
Assert.assertTrue(outData.kitSize() == size);
} |
1a153093-5a64-4d49-b1c0-46836947375d | 8 | public void changeRule(String parameters){
//Parse Input
String[] parameterSplit = parameters.split(" ", 2);
String fileName = parameterSplit[0];
String rules = parameterSplit[1];
rules = rules.substring(1, rules.length()-1);
String ruleSplit[] = rules.split("\\|");
... |
c316af9e-0abb-43a2-ad32-c76d7ecac881 | 3 | public static BSPlayer getSimilarPlayer( String player ) {
if ( onlinePlayers.containsKey( player ) ) {
return onlinePlayers.get( player );
}
for ( String p : onlinePlayers.keySet() ) {
if ( p.toLowerCase().contains( player.toLowerCase() ) ) {
return onlin... |
b2516a77-126f-4ee7-a6ea-3e77bbaeed7a | 4 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
for (int i = 0; i < 3; i++) {
g2d.drawRect(i * fieldWidth, 0, fieldWidth, fieldHeight);
}
g2d.drawString("Оригинал", field... |
b030efc8-cee1-41bf-af8b-640c39cebbd4 | 5 | public int collision(Personnage p) {
for (Teleporteur t : liste) {
if (p.getX() < t.getX1() && p.getX1() > t.getX() && p.getY() < t.getY1() && p.getY1() > t.getY()) {
p.setX(t.getxDest());
p.setY(t.getyDest());
return t.getIdMapDest();
}
... |
c9adf135-4afb-47f5-9f1a-6b9e4c3ffa3a | 9 | public static void main(String[] args) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int c=1;
for(String ln;!(ln=in.readLine().trim()).equals("STOP");c++){
if(c>1)System.out.println();
char[] st=ln.toCharArray();
System.out.println("Dataset #"+c+": The initial... |
27d47698-1f22-4b0c-bdfc-0496e511b64c | 2 | void add(int value) {
IntQueue.Entry entry = new Entry(value);
if (tail != null)
tail.next = entry;
tail = entry;
if (head == null)
head = entry;
} |
8be2b67f-50af-4e34-abf5-aad62344d9fa | 1 | @Override
public LocalDate deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException
{
String text = jsonParser.getText();
try
{
return localDateFormatter.parseLocalDate(text);
}
catch (Throwa... |
c65b011b-62b0-4916-b3f6-358fa033349b | 5 | public static void addAccount(Messagable ui,String name, String password, String address){
boolean accountCreated = true;
if(name.isEmpty()){
accountCreated = false;
ui.sendMessage("ERROR: Enter a name.");
}
if(password.isEmpty()){
accountCreated = false;
ui.sendMessage("ERROR: Enter a password.");
... |
9bf39a60-8c1c-4936-994c-57c084732e79 | 5 | @Override
public List<Book> searchBook(String term) {
term = ".*" + term + ".*";
List<Book> match = new ArrayList<Book>();
for (Book book : getBooks()) {
if (book.getAuthor().matches(term) || book.getIsbn().matches(term)
|| new String(book.getPrice() + "").matches(term)
|| book.getTitle().matches(te... |
692b90f4-0741-45e8-81de-7cddbf1a58d8 | 3 | @Test
public void testCreateArray() {
System.out.println("createArray");
CosineInterpolator cosInterp = new CosineInterpolator();
LinearInterpolator linInterp = new LinearInterpolator();
for (int i = 0; i < 100; i++) {
int size = 500;
double p = Math.random() ... |
b8d4e367-c68f-43fb-8e00-44f5d8d96b6b | 4 | private void sampleFreqUpdate(Status status) {
long duration = TwitterCrawler.Timer.duration();
long temp = duration/Settings.sample;
int index = (int) temp;
int maxIndex = (int) (Settings.timer/Settings.sample+1);
if(index<maxIndex){
//System.out.println(duration+"ms@"+index);
HashtagEntity[] tags =... |
480e82be-abc1-4387-85c5-ba0395204a78 | 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 Address)) {
return false;
}
Address other = (Address) object;
if ((this.idAddress == null && other.idAddress !=... |
97af6ca3-92e0-443a-bb0c-a3f49ac05a7e | 1 | private static String getStringFromDocument(Document doc) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
... |
5e394f9d-c717-4669-b315-152bf01b2ef8 | 9 | @Override
public boolean execute(CommandSender sender, String[] args) {
if(!(sender instanceof Player)) {
return true;
}
String groupName = args[0];
Group group = groupManager.getGroupByName(groupName);
if(group == null) {
sender.sendMessage("Group doesn't exist");
return true;
}
boolean i... |
af350bee-1758-4bf9-a065-05428f492e92 | 7 | public Background(StreamLoader streamLoader, String s, int i)
{
Stream stream = new Stream(streamLoader.getDataForName(s + ".dat"));
Stream stream_1 = new Stream(streamLoader.getDataForName("index.dat"));
stream_1.currentOffset = stream.readUnsignedWord();
anInt1456 = stream_1.readUnsignedWord();
anInt1457 =... |
b7ce9cf7-7637-4c8b-aa6d-c87e7c1e6afa | 5 | @Test
public void httpCount() {
Path path = Paths.get("D:\\\\Download\\SecureCRT\\logs\\clientad.yy.com.log.16.gz");
File file = path.toFile();
String dateStr = "26/Apr/2015:14";
String line = null;
int length = "[26/Apr/2015:14:".length();
int count = 0;
try (FileInputStream fis = new FileInputStr... |
90daa90a-d253-4ac5-b225-a17cd67050ef | 8 | void setPendingViewOffset(int xofs,int yofs) {
if (!pf_wrapx) {
if (xofs < 0) xofs=0;
if (xofs > tilex*(nrtilesx-viewnrtilesx))
xofs = tilex*(nrtilesx-viewnrtilesx);
}
if (!pf_wrapy) {
if (yofs < 0) yofs=0;
if (yofs > tiley*(nrtilesy-viewnrtilesy))
yofs = tiley*(nrtilesy-viewnrtilesy);
}
p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.