method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
50281a4e-0fda-4d2b-9534-8791566a0fac | 2 | public Secretarapp() throws FileNotFoundException, IOException {
initComponents();
BufferedReader fisier = new BufferedReader(new FileReader("clase"));
ArrayList<String> vector = new ArrayList<>();
for(String line; (line = fisier.readLine())!= null;){
vector.add(l... |
e390f552-d18d-4e81-b9f0-50993ed7925f | 3 | public void addMissileToClient(String id, String dest, String damage,
String flyTime, String launcherName) {
// TODO Auto-generated method stub
for (Launcher launchers : missileLaunchers) {
if (launcherName.equalsIgnoreCase(launchers.getLauncherId())) {
Missile missile = launchers.CreatWithoutAddMissile(i... |
ade3f6c1-863c-427c-b1d0-257b3ae6b52b | 2 | public static void maintainConnection() {
// constantly tell the server you are around
new Runnable() {
public void run() {
// add the socket code to communicate with server here
Process p1 = null;
try {
p1 = java.lang.Runtime.getRuntime().exec(
"ping www.google.com");
System.out.pr... |
cfcc742d-ddb0-4af1-8391-949fcfb80d11 | 3 | public static String convertOMapToJSON(Map<?, ?> map) {
System.out.println("DEBUG: requestJsons");
ObjectMapper mapper = new ObjectMapper();
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] data;
try {
mapper.writeValue(out, map);
data = out... |
445249c9-3c71-4c70-9445-14c3b296b71d | 2 | private boolean hasTag(String version) {
for (final String string : Updater.NO_UPDATE_TAG) {
if (version.contains(string)) {
return true;
}
}
return false;
} |
934f3166-245f-408e-992d-06109e170c85 | 3 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
4eb009bb-843c-467f-a419-4d294e7c193e | 1 | private int next() throws IOException {
int c = in.read();
if (c == '\n') {
line++;
}
return c;
} |
8c7e8c9c-ea86-4924-93c8-9694104d88f3 | 9 | private ArrayList<Point> bresenham(Point p1, Point p2) {
ArrayList<Point> del = new ArrayList<>();
int x1 = p1.x;
int y1 = p1.y;
int x2 = p2.x;
int y2 = p2.y;
int dx = Math.abs(x2 - x1);
int dy = Math.abs(y2 - y1);
int sx = (x1 < x2) ? 1 : -1;
int ... |
7022d191-ba2d-411d-aad5-8dd38f894b64 | 3 | public void testReadWithSpeexAudio() throws IOException {
OggFile ogg = new OggFile(getTheoraSpeexFile());
tf = new TheoraFile(ogg);
// Check the Info
assertEquals("3.2.1", tf.getInfo().getVersion());
assertEquals(3, tf.getInfo().getMajorVersion());
assertEquals(2, tf.ge... |
c2dc35db-3f96-4ecd-ba36-70cf3f346aa9 | 0 | public final ArrayList<Entry<K, V>>[] getOff() { return off; } |
85ffd4f1-a286-40e3-8b73-90fcc1db4cfd | 4 | public static void search_query2(String[] query, String[] pages) {
int matchedCount = 0;
for (String page : pages) {
for (int i = 0, idx = 0; i < query.length; i++) {
idx = page.indexOf(query[i]);
if(idx != -1) {
if (i == query.length - ... |
3e97bf58-d770-47b9-9bf4-76831524666a | 4 | void reduce(String s, int a, int b) {
for (int i = 0; i < validSet.length; i++) {
if (!validSet[i]) {
continue;
}
if ((getA(s, answerSet[i]) != a) || (getB(s, answerSet[i]) != b)) {
validSet[i] = false;
}
}
} |
138bcf62-c824-47d6-a6b3-3565e965c64a | 1 | public static String getEndPoint(IProperty[] properties, IControllerServices controllerServices)
{
String url = getValue(controllerServices.getStringPropertyValueByName(properties, END_POINT));
if (url.substring(url.length() - 1).equals("/"))
{
return url.substring(0, url.length() - 1);
}
else
{
ret... |
66d7ed4c-33e6-4f4b-a1b9-e53877fb0f51 | 6 | public int[] getTextureContents(String par1Str)
{
TexturePackBase var2 = this.texturePack.selectedTexturePack;
int[] var3 = (int[])this.textureContentsMap.get(par1Str);
if (var3 != null)
{
return var3;
}
else
{
try
{
... |
fdc6ad2f-c504-4a3c-b11c-4074a873500c | 5 | private void insertAVL(TreeNode currentNode, TreeNode newNode) {
if (currentNode == null) {
this.root = newNode;
} else {
if (newNode.key < currentNode.key) {
if (currentNode.left == null) {
currentNode.left = newNode;
newNode.parent = currentNode;
recursiveBalance(currentNode);
} el... |
b10b4115-d906-4481-ac50-2cdd4bd930cd | 1 | public void calcStats(){
int buyquant = Integer.parseInt(buynumber.getText());
int sellquant = Integer.parseInt(sellnumber.getText());
int type_int = type.getSelectedIndex()+1;
int avail = sector.getQuantity(type_int);
if (avail+buyquant-sellquant<0){
sellquant=avail+buyquant;
final int temp = sellquan... |
12311ff0-e702-4e4c-a865-156e9fa386ef | 3 | public boolean equals(Object o) {
if(this == o) return true;
if(!(o instanceof ChatUser)) return false;
ChatUser that = (ChatUser) o;
return this.chatName.equals(that.chatName) &&
this.hostName.equals(that.hostName);
} |
61a5af5c-10f7-45a7-be71-d3dc8aca2167 | 2 | public void printEigenEnergy(int number) {
double[] ee = getEigenEnergy();
if (ee.length == 0) {
System.out.println("No eigen states found :-(");
return;
}
int count = Math.min(number, ee.length);
for (int i = 0; i < count; i++) {
System.out.pr... |
5ad4733c-9c8e-4002-8422-519da2ecfb46 | 6 | * </ul>
*/
public void setTopIndex (int index) {
checkWidget ();
if (!(0 <= index && index < itemsCount)) return;
int visibleItemCount = (clientArea.height - getHeaderHeight ()) / itemHeight;
if (itemsCount <= visibleItemCount) return;
index = Math.min (index, itemsCount - visibleItemCount);
if (index == topInde... |
a03f91f0-4bb4-41c5-a815-1eaf37bb73d3 | 2 | private boolean parseBoundaries(Element exit)
{
NodeList tiles = exit.getElementsByTagName(XmlTag.TILE.toString());
int x1, y1;
String dir1;
for(int tile_num = 0; tile_num < tiles.getLength(); tile_num++)
{
//get tile1
Element tile1 = (Element) tiles.item(tile_num);
x1 = Integer.parseInt(tile1.getAt... |
95e636a5-7079-4b7c-86ff-9e6bf25a13df | 2 | private JSONObject getJson(String endpoint, Map<String, String> params) {
try {
String responseString = sendRequest(endpoint, params);
JSONObject jsonObject = (JSONObject) parser.parse(responseString);
JSONObject bossResponse = (JSONObject) jsonObject.get("bossresponse");
String responseCode = (St... |
a4849d5d-88af-45f3-9439-cabf2cf912b0 | 6 | @Override public String nextName() throws IOException {
expect(JsonToken.NAME);
Iterator<?> i = (Iterator<?>) peekStack();
Map.Entry<?, ?> entry = (Map.Entry<?, ?>) i.next();
stack.add(entry.getValue());
return (String) entry.getKey();
} |
6e5c318a-d42f-49a6-99b6-ff1ca0cd94cc | 1 | public void setStartDateTime(Calendar calendar) {
if (calendar == null) {
throw new IllegalArgumentException("StartDateTime shouldn't be NULL.");
}
this.startDateTime = calendar;
} |
2ba167b6-6afd-47a8-bfa2-a4443cca3e45 | 3 | @Override
public void activateFrame(JInternalFrame f) {
if (activationBlock) {return;}
//System.out.println("activateFrame " + f.getTitle());
super.activateFrame(f);
if (f instanceof Document) {
Outliner.documents.setMostRecentDocumentTouched((Document) f);
}
// Move the internalframe back s... |
fad461fc-8b47-4c81-b71d-5acaaf03f681 | 1 | public boolean isVisible() {
if(frame == null) buildGUI();
return frame.isVisible();
} |
da803642-b1bd-4530-bad6-e6d5f70ccf6a | 1 | public IntBuffer playSound(String sound, float x, float y, float volume, boolean loop) {
IntBuffer source = addSource();
IntBuffer buf = Application.get().getResourceManager().getAudioManager().getSound(sound);
float X = x / (Display.getWidth() * 3);
float Y = y / (Display.getHe... |
a4c0924a-9a9c-4fe2-badb-17d540661e7f | 8 | static final boolean method2308(byte i, int i_8_) {
if (i != 26)
anIntArray4822 = null;
anInt4810++;
if (i_8_ != 15 && i_8_ != 2 && i_8_ != 30 && (i_8_ ^ 0xffffffff) != -50
&& (i_8_ ^ 0xffffffff) != -52 && (i_8_ ^ 0xffffffff) != -51
&& (i_8_ ^ 0xffffffff) != -7)
return false;
return true;
} |
9d2f2f97-c243-480e-8a13-5f488e8f4a74 | 1 | public void reVisualize() {
setSize(900, 700);
this.addWindowListener(this);
this.addMouseListener(this);
this.addMouseMotionListener(this);
this.addComponentListener(new ComponentListener() {
public void componentResized(ComponentEvent evt) {
frameW = evt.getComponent().getWidth();
frameH = evt.... |
454b4994-7bf9-4909-9044-75f622418d4e | 2 | public Set executeUpdate(Connection con, String sql, List predicates,
String errorMessage)
{
PreparedStatement ps = null;
Set rows = new HashSet();
try
{
ps = con.prepareStatement(sql);
for (int i = 0; i < predicates.size(); i++)
{
int index = i + 1;
ps.setObject(index, predicates.get(i))... |
62a7e600-1e08-4227-ab90-ea25f459f248 | 8 | public String toString() {
String ret = null;
if (classifierMatches != null) {
ret = "mul:";
for (Classifier c : classifierMatches) {
ret += "[" + c + "]";
}
} else if (numberMatch != null) {
ret = "num:" + numberMatch;
} else if (intervalMatch != null) {
ret = "int:" + intervalMatch;
} els... |
f1cecd59-7dcd-40c6-97f5-0b575e56b4bb | 4 | public State run(final String program, final State s) {
operations = compile(program);
if (s instanceof StatusState) {
StatusState statusState = (StatusState) s;
for (Operations operation : operations) {
operation.execute(statusState);
if ((status... |
e73bcb31-7508-43c4-8601-a1d434818016 | 2 | public void playLand(){
for(int i = 0; i < p1.getHand().size(); i++){
if(this.p1.getHand().get(i).type.equals("land")){
//System.out.println("Playing " + this.p1.getHand().get(i).cardName);
this.p1.addLand(p1.getHand().remove(i));
break;
}
}
} |
113cbd47-99ab-4308-a4a5-3ce4d61c0acc | 6 | public static int[] split(String m) {
int count = 0;
for (int s = 0; s < m.length(); s++) {
if (m.charAt(s) == ':') {
count++;
}
}
String[] ms = new String[count];
int y = 0;
int x = 0;
while (m.length() > 0) {
if (m.charAt(x) == ':') {
int g = m.indexOf(':');
ms[y] = m.substring(0, g... |
726d5004-ad70-46ac-b280-fb17986e2ff3 | 9 | @Override
public boolean okMessage(Environmental E, CMMsg msg)
{
if (!super.okMessage(E, msg))
return false;
if(amWearingAt(Wearable.WORN_WIELD)
&&(msg.source()==owner())
&&(msg.targetMinor()==CMMsg.TYP_WEAPONATTACK)
&&(msg.source().location()!=null)
&&((msg.tool()==null)
||(msg.tool()==this)
||(... |
5cc010d6-99bb-4cf0-9840-b0885c3b84d8 | 9 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true) {
int col = Integer.parseInt(br.readLine());
if (col == 0)
return;
char[] in = br.readLine().toCharArray();
int len = in.length;
int row = len / col;
... |
bcd28c65-09b9-4a1b-bdc1-8b76907a0f50 | 2 | public void run() {
while (true) {
try {
Thread.sleep(1000);
} catch (Exception ex) {
ex.printStackTrace();
}
CometEngine engine = CometContext.getInstance().getEngine();
// if (COM1.equals(portName)) {
// long totalMemory = Runtime.getRuntime().totalMemory();
//
// // Syst... |
35a3f9b5-4c61-49c1-b221-e8bf2415329b | 7 | public void keyReleased(KeyEvent event) {
int code = event.getKeyCode();
MainCharacter stubi = pan.getStubi();
if (code==currentKey)
currentKey = -1;
switch (code) {
case 37:
case 81:
stubi.setMove('s'); // stand
// Action end go left
break;
case 39:
case 68:
stubi.setMove('s'); // stand
... |
ddc4b3ba-4810-4834-9dfb-ce08aba6d1ed | 6 | public void lookAt(String object, ArrayList<String> inv) {
if (object.equalsIgnoreCase("floor")) {
System.out.println("It is a cold and hard stone floor.\n");
} else if (object.equalsIgnoreCase("wall") || object.equalsIgnoreCase("walls")) {
System.out.println("The walls are made ... |
036c96a6-7ee4-4728-bb05-b1e1112380e9 | 0 | public byte [] getpage()
{
return data;
} |
7a56dba3-a029-4c5e-a4cc-79f4f992b705 | 6 | public static Collection<Face> fromFile(File file, Color color) {
ArrayList<Face> faces = new ArrayList<Face>();
try {
File modelFile = file;
FileInputStream fis = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
... |
957554d4-a2a4-4a5d-a3c5-76c253525523 | 2 | public FactoryOfPlaysForPlayer(Player player){
IteratorOnPieces iteratorOnPlayer = (IteratorOnPieces) player.iterator();
while (iteratorOnPlayer.hasNext()){
iteratorOnPlayer.next();
FactoryOfPlays factory = new FactoryOfPlaysForPiece(iteratorOnPlayer.getPosition(),player.getBoard());
for (AbstractPlay play... |
9758108d-6178-4895-bc9a-f724d228644f | 7 | public void provjeriUnos() {
Console c = System.console();
if (c == null) {
System.exit(1);
}
v.ispisiUpute();
petlja = true;
while (petlja) {
input = c.readLine();
String split[] = input.split(" ");
switch (split[0]) {
... |
d4956b15-d5a2-4a0d-b6b8-067239852410 | 3 | private static byte[] readEntry(final InputStream zis, final ZipEntry ze)
throws IOException
{
long size = ze.getSize();
if (size > -1) {
byte[] buff = new byte[(int) size];
int k = 0;
int n;
while ((n = zis.read(buff, k, buff.length - k)) ... |
24755b86-9f8c-4a4e-ae32-c3c4da81874c | 4 | public void increaseKey(int i, Key key) {
if (i < 0 || i >= NMAX) throw new IndexOutOfBoundsException();
if (!contains(i)) throw new NoSuchElementException("index is not in the priority queue");
if (keys[i].compareTo(key) >= 0) throw new IllegalArgumentException("Calling increaseKey() with given... |
eafced33-2c4c-4fb1-ae42-6e3034c9fd64 | 1 | @Override
public void main() {
cleanOutput();
FlyweightFactory factory = new FlyweightFactory();
int [] characterCodes = {1,2,3};
for (int nextCode : characterCodes){
EnglishCharacter character = factory.getCharacter(nextCode);
character.printCharacter();
}
super.main("Flyweight");
} |
5a199a71-fb75-4da3-9b66-2e5126b981d9 | 2 | private void HandleLineBreaks(String strText, String tag, String openStr, String closeStr,
int startCheckPos, int endCheckPos, TreeSet<TagSpecialHandler.Pair> insertList) {
// look for any line breaks
int lbPos = 0;
strText = strText.substring(0, endCheckPos);
while ((lbPos = strText.ind... |
f3412862-01b7-46a4-a602-45bf93ff9ddb | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final MaplePartyCharacter other = (MaplePartyCharacter) o... |
439d4443-7dd1-4780-aba4-01dfe07101f0 | 6 | public void testMatrixVerySmallButUpperDiag() {
DenseMatrix64F A = new DenseMatrix64F(5,5);
for( int i = 0; i < 5; i++ ) {
int start = i < 2 ? 0 : i-1;
for( int j = start; j < 5; j++ ) {
A.set(i,j,1e-32);
}
}
for( int i = 0; i < 4; ... |
f0962c31-1a0e-446a-bb31-3134b5a74cbb | 1 | private static void arraycopy(byte[] src, byte[] dest, int size) {
for (int i = 0; i < size; i++)
dest[i] = src[i];
} |
d8303b22-4f3c-466f-9043-17f8116f4f7c | 0 | public static Role getRole(int i) {
return values()[i];
} |
5bbf26c3-c46b-4725-b93c-e9287d7be66b | 6 | private void doCommand(String cmd) {
if (cmd.startsWith("D")) {
doSleep(Integer.parseInt(cmd.substring(1)));
}else if(cmd.startsWith("W")){
doWrite(Integer.parseInt(cmd.substring(1)));
} else if (cmd.startsWith("X")) {
doShutdown();
}else if (cmd.start... |
6a303b81-a209-4aae-93db-b38f60de05ec | 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... |
5d0ff7a0-2e24-44e3-8abc-1785fdd90332 | 6 | public ResultSet preencherTabelaGerente() throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_SELECT_TODOS_GERENTE... |
9fc12201-cce3-4e93-a846-70df148d8518 | 4 | public DBUpdate(Path path) throws DBUpdateInvalidFilenameException,
DBUpdateNotAFileException, DBUpdateNotReadableException {
this.path = path;
// check permissions
File f = path.toFile();
if (!f.isFile()) {
throw new DBUpdateNotAFileException();
}
if (!f.canRead()) {
throw new DBUpdateNotReadable... |
fb769ac2-5dae-4ecc-802d-12373d7b1dd9 | 6 | public void saveXml(OutputStream outputStream) throws EnrycherException {
// create an empty XML document
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder;
try {
docBuilder = docBuilderFactory.newDocumentBuilder();
} catch (ParserConfigurationExcep... |
4f28b50b-19f7-4182-a98f-df156107473a | 2 | private List <Venda> carregaDadosDoBanco(){
this.dao = new VendaDAO();
try{
List<Venda> lista = dao.listarTodas();
// System.out.print(lista);
return lista;
}catch(ErroValidacaoException ex){
JOptionPane.showMessageDialog(rootPane, ex.getMessage());... |
9393babf-3340-41a4-948a-b0fd3b604473 | 5 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In register user handler");
String responseMessage = "";
boolean successfulRequest = false;
if (exchange.getRequestMethod().toLowerCase().equals("post")) {
BufferedReader in = new BufferedReader(new InputStrea... |
008506d9-3eeb-4d6b-bb78-a38ab65587ac | 2 | public static final long inv(long x) throws Exception {
if (x == 0) throw new Exception ("Divide by zero");
long f = p;
long g = x;
long a = 0;
long b = 1;
while (g != 0) {
long h = f % g;
long c = a - f / g * b;
f = g;
g = ... |
82b15bde-fb8a-4ad2-9d98-2b95e4de5307 | 3 | @Override
public int compareTo( RemoteMethodCall o )
{
int p0 = (remoteMethod == null ? 0 : remoteMethod.priority());
int p1 = (o.remoteMethod == null ? 0 : o.remoteMethod.priority());
int d0 = p1 - p0;
long d1 = Long.signum( timestamp - o.timestamp );
return (d0 != 0 ? ... |
bbbf65f3-34f1-47e1-8c9e-32cca1bb08b7 | 5 | public void createWhereValid(int previousHexIndex) { //first in array is West-----possibly don't need previous hexes
int[] six=six(previousHexIndex); //upside-down
boolean checkWest=getHex(six[1]).getHex(six[3])==null;
boolean checkEast=getHex(six[5]).getHex(six[3])==null;
if (checkWest && linkedHexes[six[2]]==... |
624e7545-9147-4f52-b8a7-46e7ca1eb2cb | 8 | @Override
public final void run() {
// Define inputDatagramPacket
DatagramPacket inputDatagramPacket = null;
// Define input byte buffer
final byte[] inputBuffer = new byte[Constants.SERVER_BUFFER_INPUT];
// We inform than server is ready
running = true;
fireServerConnect();
// ArtNet object
ArtNe... |
b3c0d69e-1e6b-4be0-a969-40c0c1a95898 | 5 | private <T extends ConstraintValidator> T getConstraintValidator(
Class<? extends T> constraintValidatorClass,
Map<Class<? extends T>, T> cacheMap) {
if (constraintValidatorClass == null) {
return null;
}
// annotationMirror is an constraint annotation
T validator = cacheMap.get(constraintValidatorCla... |
19728bef-0965-4c9c-b8b1-ded24faf59a3 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ProcedureCallNode other = (ProcedureCallNode) obj;
if (actualParameters == null) {
if (other.actualParameters != null)
return false;
} e... |
2b0b5e7c-8027-4bae-b22d-825106faa993 | 2 | public static String formatDouble(Double d, int decimals) {
if (d == null) {
return "N/A";
}
if (decimals == 0) {
return String.format(Locale.US, "%d", Math.round(d));
}
String format = "%." + decimals + "f";
return String.format(Locale.US, format, d);
} |
158252a1-cd1c-429b-b4f3-b0028396f79c | 8 | public Set<Map.Entry<Character,Byte>> entrySet() {
return new AbstractSet<Map.Entry<Character,Byte>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TCharByteMapDecorator.this.isEmpty();
}
... |
1f50028a-252b-4cdc-9518-a89c4542bdc7 | 2 | private void RemoveUserLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_RemoveUserLabelMouseClicked
int[] selection = jTable1.getSelectedRows();
int[] modelIndexes = new int[selection.length];
for(int i = 0; i < selection.length; i++)
{
modelIndexes[i] = j... |
d4120222-10a6-4777-bef4-e0ae3c91532b | 3 | private double testDoublyLinkedListInserts(int inserts) {
System.out.println("Testing DoublyLinkedList with " + inserts + " inserts");
long[] times = new long[20];
long startTime;
long endTime;
for (int i = 0; i < 20; i++) {
doublyLinkedList = new DoublyLinkedList()... |
0caeabd9-3c42-465b-8989-f509c47597f2 | 8 | public synchronized DataInputStream getChunkDataInputStream(int par1, int par2)
{
if (this.outOfBounds(par1, par2))
{
this.debugln("READ", par1, par2, "out of bounds");
return null;
}
else
{
try
{
int var3 = this... |
e9a9499c-178b-4bbc-be3f-6b73e4317bbb | 2 | public void mergeAllLayers(boolean createUndo) {
if (layers.size() > 1) {
if (createUndo) {
addUndo(new CPUndoMergeAllLayers());
}
fusionLayers();
layers.clear();
CPLayer layer = new CPLayer(width, height);
layer.name = getDefaultLayerName();
layer.copyDataFrom(fusion);
layers.add(layer)... |
6275231d-cfd1-43bb-9080-5835d6bc9ad3 | 9 | @Override
public void move() {
itr = (itr + 1) % 40;
updateCounter = (updateCounter + 1) % SPEED_OF_ROTATION;
if(updateCounter == 0) {
currentX = (currentX + 1) % 16;
currentY = (currentY + 1) % 2;
}
if(x < SpaceWarriorPanel.sc.getX() && y < SpaceWarriorPanel.sc.getY()) {
x = x + (SPEED);
}
if(x... |
6e347e2c-761f-4cf4-8c2c-848851f4d984 | 9 | public int computeEditDistance(String s, String t) {
//compute edit distance using standard Dynamic Programming
int dp[][] = new int[s.length() + 1][t.length() + 1];
initializeDpTable(dp,s,t);
dp[s.length()][t.length()] = 0;
for (int i = s.length(); i >= 0; --i) {
... |
e7d91817-f13f-409a-b453-624574627af9 | 6 | protected OgexTime toTime( DataStructure ds ) {
OgexTime result = new OgexTime();
String s = ds.getProperty("curve", "linear");
Curve curve = Curve.lookup(s);
result.setCurve(curve);
OgexKey[] keys;
switch( curve ) {
case Linear:
... |
05db1019-9b21-4258-8b56-068929abb247 | 5 | private void makeSideRoom(LayeredMap lmap, int x, int y)
{
// Hajo: check if there is space for a side room
boolean ok = true;
for(int j=y-7; j<y; j++) {
for(int i=x-5; i<x+2; i++) {
if(i>=0 && j>=0) {
ok &= (lmap.get(... |
29801105-3219-48fa-ba09-474ee062f5e9 | 0 | public void execute() {
this.strategy.execute();
} |
48f75ccc-8c15-49f8-8703-a1fa11f8d768 | 6 | public void tick() {
clock++;
removeLosses();
draw = (draw * 49.0 + lastTickDraw) / 50.0;
lastTickDraw = 0.0;
if (charge <= 0.0)
return;
if (clock % SEARCH_INTERVAL == 0) {
neighbors.clear();
Set<I... |
ce83ba30-2aac-4d1e-89e7-ac3cc2f6ab2c | 0 | public static int hammingDist(int color1, int color2)
{
return Integer.bitCount(color1 ^ color2);
} |
4015f85d-433a-45aa-a37f-fbd8bf8c9fe8 | 2 | public void addWay(int pos, long wayId){
if (ways.size()>pos && !ways.get(pos).contains(wayId))
ways.get(pos).add(wayId);
} |
1701ef13-4d16-47d9-a323-bd069d30bcf5 | 1 | public void connect() {
if (!running) {
this.running = true;
(new Thread(this)).start();
}
} |
629ec9d4-2c96-4d7c-a9fd-994d0ddb86d7 | 0 | public static void main(String[] args) {
Integer n1 = new Integer(47);
Integer n2 = new Integer(47);
System.out.println(n1 == n2);
System.out.println(n1 != n2);
} |
2f8a14ae-d75b-4ba2-8c7c-8a58b27f28dd | 7 | public void setItems (T[] items) {
if (items == null ) throw new IllegalArgumentException("items cannot be null.");
else if(adapter == null) throw new IllegalArgumentException("no adapter attached, use setAdapter");
this.items = items;
clear();
for (int i = 0; i < items.length; i++) {
// Le hack?
fi... |
149cda8d-10f8-4b19-8078-09af4a7bf371 | 2 | final public boolean delete() {
if(parent==null)
return false;
if(!parent.dropChild(this))
return false;
return setParent(null);
} |
f79028e0-7dfb-446e-89a7-e425ec6b6252 | 6 | @Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != getClass()) return false;
Matrix4 other = (Matrix4) obj;
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++) {
if (A[i][j] != other.A[i][j... |
62a1c84c-0267-4f24-907e-688f3a417061 | 2 | @Override
public boolean reachesDestination(Packet p) {
// TODO Auto-generated method stub
Iterator<Edge> edgeIt = p.origin.outgoingConnections.iterator();
EdgeBetHop e;
while(edgeIt.hasNext()){
e = (EdgeBetHop) edgeIt.next();
if(e.endNode.equals(p.destination)){
etxLink = e.getEtx();
}
}
d... |
8fb6ede4-66c0-4162-9572-c723e4488c1b | 9 | @Override protected boolean canFigureMove(Point x, Point Abs) {
if ((x.x != 0 || x.y != 0) && !C.isFigure(Abs) &&
(x.y == 1 || x.y == -1 || x.y == 0) &&
(x.x == 1 || x.x == -1 || x.x == 0))
return true;
return false;} |
5c712093-2433-4e11-a6ef-6cb5653994c1 | 7 | public static void getXhtml(Node node, StringBuilder sb) {
if (node.getNodeType() == Node.TEXT_NODE) {
sb.append(lt.replace(gt.replace(node.getNodeValue(), ">"), "<"));
} else if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
sb.append("<" + node.getNodeNa... |
e22d23e2-a807-4fc6-a9f4-81c6f82b150e | 0 | public World(String fileName) throws FileNotFoundException {
worldBuilder = new WorldBuilder(fileName);
} |
4c36b9d6-81b7-4335-ae38-a1cf36f1e922 | 6 | /* */ public static OS getPlatform()
/* */ {
/* 23 */ String str = System.getProperty("os.name").toLowerCase();
/* 24 */ if (str.contains("win")) return OS.WINDOWS;
/* 25 */ if (str.contains("mac")) return OS.MACOS;
/* 26 */ if (str.contains("solaris")) return OS.SOLARIS;
/* 27 */ i... |
66cdc326-4c08-4d19-89bf-5a5ba6668c10 | 3 | public static void noSpace(String string) throws JSONException {
int i, length = string.length();
if (length == 0) {
throw new JSONException("Empty string.");
}
for (i = 0; i < length; i += 1) {
if (Character.isWhitespace(string.charAt(i))) {
throw... |
225bc62a-4c85-4168-94f7-0e4159ee137b | 2 | public double f(double x) {
double resultado = 0;
for (int i = 0; i < coeficientes.size(); i++) {
double productoria = 1;
for (int j = 0; j < i; j++) {
productoria *= (x - puntos.get(j).getX());
}
resultado += coeficientes.get(i) * producto... |
12c4c2f4-b940-4926-92e1-c2b98448118b | 2 | public static void main(String[] args) {
String series = "37107287533902102798797998220837590246510135740250\n"
+ "46376937677490009712648124896970078050417018260538\n"
+ "74324986199524741059474233309513058123726617309629\n"
+ "91942213363574161572522430563301811072406154908250\n"
+ "230675882075393... |
57249c50-9479-447e-828c-c43371ffc2fe | 1 | private void compute_pcm_samples4(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[4 + ... |
2c911f11-14b3-43a4-ac50-f425e5195a9d | 6 | public CommandHandler getHandler(final String command, final String workingDir) {
if (command.matches("^cd .*")) {
return new CDHandler(command, workingDir);
} else if (command.matches("^ls.*")) {
return new LSHandler(command, workingDir);
} else if (command.matches("^pwd... |
97640504-afab-4785-b2f3-999e20324906 | 1 | public void abortCommunication(SubLWorker worker) throws java.io.IOException {
Integer id = worker.getId();
if (id.intValue() < 0) {
//@note serial communications cannot be canceled right now
return;
}
try {
String command = "(fif (" + "terminate-active-task-process" + " " + worker.get... |
a0e61d9b-7b18-4afc-925f-22bae0017bc7 | 3 | @Override
public boolean onMouseDown(int mX, int mY, int button) {
Iterator<IScreenItem> it = screenItems.iterator();
while(it.hasNext()) {
IScreenItem item = it.next();
if(item.isVisible() && item.onMouseDown(mX, mY, button)) {
return true;
... |
33e48677-dd53-4e0f-a234-44fb46960f3d | 4 | private void JBRemoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JBRemoverActionPerformed
this.zerarModelo();
int codigo;
try{
int index = JTListaPaciente.getSelectedRow();
if(index >= 0){
codigo = (int) JTListaPaciente.getVal... |
c052b5dc-b189-4b83-8c83-ebdeb451e8b2 | 3 | public LoginResult genLoad() {
try {
if (type.equals(FACEBOOK)) {
return loginViaFacebook();
} else if (type.equals(TEST)) {
return loginViaTestUsers();
} else {
throw new RuntimeException("Unknown type.");
}
} catch (Exception exception) {
LoginResult resul... |
adf18c6c-8450-4250-a7a8-f26cbfb1efbd | 0 | @Test
public void runTestIntentSink1() throws IOException {
InfoflowResults res = analyzeAPKFile("InterAppCommunication_IntentSink1.apk");
Assert.assertEquals(1, res.size());
} |
53a5a5ba-091c-4d49-8816-9bc9cc30660a | 9 | public void saveNColumnRDBMS(String db_name, String mgr_ip, String id, String yyyyMMdd, String exe_query, String fields) {
String table_name = "is_monitor_" + id + "_" + yyyyMMdd;
boolean existTable = existTable(db_name, table_name);
if(!existTable){
String query = "CREATE TABLE " + table_name + "(" +
"id ... |
33e084db-0363-4a46-87ea-546423839232 | 2 | public MainPanel(Simulation controller) {
this.scape = controller;
xSize = scape.xSize;
ySize = scape.ySize;
setLayout(new GridLayout(xSize, ySize));
addMouseListener(this);
labels = new JLabel[xSize][ySize];
for (int y = 0; y < ySize; y++) {
for (int x = 0; x < xSize; x++) {
labels[x][y] = new JLa... |
9dd7eae8-3f58-4762-869a-e47957854212 | 5 | private void jButton5ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton5ActionPerformed
{//GEN-HEADEREND:event_jButton5ActionPerformed
if (!gameover) {
if (rule.turn()) {
if (rule.check(1, 1)) {
rule.pressed(1, 1);
if ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.