method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7899e52f-895b-47fd-a498-a3a1b97ec112 | 4 | public void setProperty(Object value, String str) {
if(value instanceof String) {
if(str.equals(IP_STR)) {
setIp((String) value);
} else if(str.equals(NAME_STR)) {
setName((String) value);
} else if(str.equals(DESC_STR)) {
setDescription((String) value);
}
}
} |
a74562a3-90fe-440b-9d53-53811c509120 | 2 | @Override
public String toString() {
Node<T> currNode = head.getNext();
String info = null;
if (head == null) {
return " ";
} else {
info = head.getData().toString();
}
while (currNode != null) {
info = info + "\n" + currNode.getData().toString();
currNode = currNode.getNext();
}
return inf... |
18598434-11f2-4633-b82b-a4a228e9c64b | 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 Applicant)) {
return false;
}
Applicant other = (Applicant) object;
if ((this.idapplicant == null && other.idap... |
23d4d1a5-330e-497f-8e9a-46c06be0b64c | 0 | public void setEmployee_id(String employee_id) {
this.employee_id = "thisishardcoded";
setDirty();
} |
6b4bb45d-27d8-4484-b2dd-0fc5efde64f8 | 5 | static long visit(int A[], int n, int verbose, long count){
// If verbose mode = 3, print all the possible combinations
if (verbose == 3) {
for(int i = 1; i <= n; i++) {
if (A[i] != 0) System.out.print(i + " "); // print the chosen elements from 1...n
}
System.out.println();
}
// If v... |
3739b0e5-d67f-4ed5-88cd-af0b3f963342 | 1 | @Override
public void render(Graphics g, Visibility visibility, float x, float y, float scale) {
if(visibility == Visibility.VISIBLE)
PillarEntity.PILLAR_IMAGE.draw(x - 11.5f * scale, y - 22 * scale, 23 * scale, 32 * scale);
} |
66c1c11b-650e-448e-8790-e49889365655 | 4 | @Override
public Connection openConnection() {
File file = new File(dbLocation);
if (!(file.exists())) {
try {
file.createNewFile();
} catch (IOException e) {
plugin.getLogger().log(Level.SEVERE, "Unable to create database!");
}
... |
73348c6c-b5d8-41e4-9400-5cca50ffd33f | 8 | public static void main(String[] args) throws Throwable {
ArrayList<Long> array = new ArrayList<Long>();
array.add(1l);
array.add(1l);
int i = 2 ;
long res;
do {
res = array.get(i-1)*i;
array.add(res);
i++;
}while(res <= 6227020800l);
BufferedReader in = new BufferedReader(new InputStreamRe... |
6f76acd0-2d60-4a7f-8e4c-f4538f9a6faf | 5 | @Test
public void testAsteroidYAndVelocityYRandomness() {
ArrayList<Asteroid> ast = new ArrayList<Asteroid>();
for (int i = 0; i < 20; i++) {
p.spawnAsteroids();
}
for (Asteroid a : p.getAsteroids()) {
if (a.getVelY() > 0) {
ast.add(a);
... |
5df77a05-cddf-40b7-b3bf-669d9e802fc7 | 8 | public void update(){
int xa =0, ya=0;
if(anim<8000){
anim++;
}else anim =0;
if(input.up)ya--;
if(input.down)ya++;
if(input.left)xa--;
if(input.right)xa++;
if(xa !=0 || ya !=0){
lastTime = System.currentTimeMillis();
move(xa,ya);
walking = true;
} else {
now = System.curr... |
4fe4134c-9852-47e0-915b-c8a82eab3195 | 6 | private BoardNode[] findWordFrom(BoardNode start, String word){
//dfs like search to find a word from the start point
StackADT<BoardNode> searchStack=new ArrayStack<BoardNode>();
int depth=1;
boolean found=false;
BoardNode current=start;
BoardNode next;
//push the startpoint on the stack
searchStack.pu... |
33b629ae-e685-4bfb-8c80-66920ed938e2 | 8 | public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int msj_p, msj_c, num, num2, tmp1, tmp2, tmp3, tmp4, aux;
boolean continua;
do{
continua = false;
System.out.println("Ingrese el numero entero cifrado de 4 digitos: ");
msj_c = entrada.nextInt();
if(msj_c > 9999)
... |
5c47a82b-3c73-4700-ac1e-de17a07f9a72 | 3 | private static ThreadTimingContext getThreadTimingContext(String threadName, String timingContext) {
for (ThreadTimingContext context : points.keySet()) {
if (context.getThreadName().equals(threadName)
&& (context.getTimingContext().equals(timingContext)))
return... |
94c5f2ad-7830-4347-842d-421760b594b7 | 2 | private void showMessage(String typeMessage, String text, String title){
if(typeMessage.equals("error")){
JOptionPane.showMessageDialog(this, text, title,JOptionPane.ERROR_MESSAGE);
}
if(typeMessage.equals("info")){
JOptionPane.showMessageDialog(this, text, title,JOptionP... |
cae2bf7a-9139-4010-9af2-9cd9333f1c68 | 0 | public void setFesTerminal(String fesTerminal) {
this.fesTerminal = fesTerminal;
} |
8fd5a69c-7f66-475d-bd56-65c9f38ea828 | 3 | @POST()
@Path("add")
@Consumes("application/json")
@Produces("application/json")
@SportService(ServiceType.MLB)
public Player addPlayer(Player p)
{
UserTransaction utx = null;
p.setId(0);
try
{
System.out.... |
b07fd4c7-16fd-4da0-9435-77b76279f909 | 0 | public void setRoomNumber(int roomNumber) {
this.roomNumber = roomNumber;
} |
44d2e02b-680f-462a-a33c-26bde3d742ba | 6 | private void sendGamePackage() {
String version = isaacPackage.getVersion();
String seed = isaacPackage.getSeed();
String stage = isaacPackage.getStage();
String rooms = isaacPackage.getRooms();
String items = isaacPackage.getItems();
String curse = isaacPackage.getCurse();
String playerName = isaacPacka... |
22cc2bb6-0cc4-4c55-995d-cc58c3587e00 | 3 | protected String removeQuotesInsideTags(String html) {
//remove quotes from tag attributes
if(removeQuotes) {
Matcher matcher = tagQuotePattern.matcher(html);
StringBuffer sb = new StringBuffer();
while(matcher.find()) {
//if quoted attribute is followed by "/" add extra space
if(matcher.group(3).t... |
89a1096c-a30f-4939-90f3-c33c37a9c82d | 4 | public void fireItemEvent(final ItemEvent EVENT) {
fireEvent(EVENT);
final EventType TYPE = EVENT.getEventType();
final EventHandler<ItemEvent> HANDLER;
if (ItemEvent.ITEM_CLICKED == TYPE) {
HANDLER = getOnItemClicked();
} else if (ItemEvent.ITEM_SELECTED == TYPE) {
... |
713ed852-6eb5-4a6e-8979-353ff565be44 | 4 | private boolean inBounds(int x1, int y1, int x2, int y2, int x, int y) {
if (x >= x1 && x <= x2 && y >= y1 && y <= y2) {
return true;
}
return false;
} |
a2f4bc63-6f20-42da-8bd0-402cddd07c1c | 3 | public void run() {
while (s >= 0) {
ultimaEscritura(nombre);
if (s == 0)
{
cont--;
System.out.println(nombre + " - " + s + " - ultima escritura "
+ IDanterior);
System.out.println("ultima escritura " + nombre + " - " + cont
+ " Threads activos");
}
else {
System.o... |
23b7d9c1-f4a3-4adb-bfea-ddf4c9791201 | 3 | public int calcFatorInc(Personagem personagem){
int valor = 0;
switch (personagem.getClasse()){
case 1:
valor = (int) (personagem.getQuantidadeVida() * 0.1);
break;
case 2:
valor = (int) (personagem.getQuantidadeVida() * 0.4);
... |
fb7d8d2a-56c2-487a-88b8-f1489afb0b9d | 6 | public String[] obtenerRespuestasCorrectas(int tamaño){
String csvFile = "dataset/diabetes_prueba_resultados.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
String respuestas [] = new String [tamaño];
int contador = 0;
try {
br = new BufferedReader(new FileReader(csvFile))... |
579fc89d-3149-4cb1-98bc-e5526fcd612b | 8 | public Ball(Point BallPosition) {
this.ballPosition = BallPosition;
int randomNumber = (int) Math.round(Math.random() * 10);
switch (randomNumber) {
case 1:
this.color = Color.YELLOW;
break;
case 2:
this.color = Color.BLUE;... |
ea85f523-9bd0-48ba-9b05-083628fa0133 | 8 | public void setTransport(AIUnit transport) {
if (this.transport == transport) return;
AIUnit oldTransport = this.transport;
this.transport = transport;
if (oldTransport != null) {
// Remove from old carrier:
if (oldTransport.getMission() != null && oldTransport.g... |
53e175b8-d898-4fd5-a2ba-b3fa12e185c3 | 3 | public String read() {
//TODO For Debugging right now
this.i++;
switch( this.i ) {
case 0:
return "<LOGIN>`mjchao`12345`";
case 1:
return "<CREATE_ROOM>`Mickey's Room`1`60`10`4`false";
case 2:
return "<JOIN_ROOM>`0";
default:
return "ignore";
}
} |
e2f8d8de-609e-44ae-9170-8d11ffe9840c | 2 | private static void generateFile(String fileName) throws FileNotFoundException, IOException {
FileOutputStream fileOutputStream = new FileOutputStream(fileName);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, Charset.forName("UTF8"));
BufferedWriter bufferWriter... |
c110d882-9559-4f50-889f-a8adcb6a0e34 | 4 | public static VorbisPacket create(OggPacket packet) {
// Special header types detection
if (isVorbisSpecial(packet)) {
byte type = packet.getData()[0];
switch(type) {
case TYPE_INFO:
return new VorbisInfo(packet);
case TYPE_COMMENTS:
... |
2172b78e-f223-4789-addf-7e6eecf96c02 | 9 | public Object get(Object target) {
if (staticBase != null)
target = staticBase;
if (type == int.class)
return unsafe.getInt(target, offset);
else if (type == long.class)
return unsafe.getLong(target, offset);
else if (type == short.class)
return unsafe.getShort(target, offset);
else if (type == b... |
2799514c-810b-4ed2-8c83-06eeb2cdb618 | 1 | static private float[] create_t_43()
{
float[] t43 = new float[8192];
final double d43 = (4.0/3.0);
for (int i=0; i<8192; i++)
{
t43[i] = (float)Math.pow(i, d43);
}
return t43;
} |
79a2a9f8-7d77-4c43-a962-30d5032272b8 | 8 | void generateRandomNet(BayesNet bayesNet, Instances instances) {
int nNodes = instances.numAttributes();
// clear network
for (int iNode = 0; iNode < nNodes; iNode++) {
ParentSet parentSet = bayesNet.getParentSet(iNode);
while (parentSet.getNrOfParents() > 0) {
parentSet.deleteLastParent(instances);
... |
b62ea192-1ed6-4b5b-b277-91940257eeeb | 2 | public static void showAccountList(){
String lines = "-All accounts in the system: ";
//Money totalMoney = new Money();
int sizeOfList = accounts.size();
for(int index = 0; index < sizeOfList; index++){
if(index%3 == 0){
lines += "\n" + accounts.get(index);
}
else{
lines += "\t" + accounts.get(... |
a67262fa-a8c3-4e0f-a049-30ebea599bf6 | 0 | public void stop()
{
numSteps = 0;
threadRun = false;
infinite = false;
} |
6a3cce12-9452-4643-abb8-a317cf09d6ef | 3 | public static void writeToFile(File file, RunData runData)
{
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
XMLOutputFactory xmlOutFact = XMLOutputFactory.newInstance();
XMLStreamWriter writer = xmlOutFact.createXMLStreamWriter(fos);
writer.writeStart... |
2940d08a-482f-4698-af60-09da068d3ab8 | 5 | @Override
public mxICell insertEdge(mxICell edge, boolean isOutgoing)
{
if (edge != null)
{
edge.removeFromTerminal(isOutgoing);
edge.setTerminal(this, isOutgoing);
if (edges == null || edge.getTerminal(!isOutgoing) != this
|| !edges.contains(edge))
{
if (edges == null)
{
edges = ne... |
920584a0-e276-419a-b7d9-cb5aa973d4d9 | 2 | public LocalizationClient(String ip, int port) throws IOException, ConnectException {
try {
clientSocket = new SocketManager(ip, port);
clientSocket.setSoTimeout(5000);
} catch (ConnectException e) {
throw new ConnectException();
}catch (IOException e) {
throw new IOException();
}
} |
c5f467be-629a-47d6-af49-59d7670f8a9e | 7 | protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String outputJson = "";
PrintWriter out = response.getWriter();
try {
String method = request.getParameter("method").toLowerCase(
Locale.ENGLISH);
... |
e2b7b3e5-62ef-49c7-85d3-1589c0092e6b | 2 | public final void modifySanity(int toMod)
{
sanity+=toMod;
if(sanity > 100)
{
sanity = 100;
}
else if(sanity < 0)
{
sanity = 0; //oh shiet
}
} |
965ea39c-19bc-4465-afcf-4c99477fd27f | 5 | @Override
public RedBlackTree.Node<T> insert(T value) {
RedBlackTree.Node<T> result = super.insert(value);
if (result != null) {
Node<T> linkedNode = (Node<T>) result;
Node<T> pred = (Node<T>) super.getPredecessor(result);
linkedNode.setPredecessor(pred);
if (pred != null) {
p... |
6a48b539-4657-4ca6-8587-2b477d4390d9 | 7 | private void setStyle(MindMapNode node) {
// precondition: all children are contained in nodeIconSets
// gather all icons of my children and of me here:
TreeSet iconSet = new TreeSet();
for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
MindMapNode child = (MindMapN... |
ac381e57-a468-4243-9372-5245caa1e93b | 4 | public static CommandMessage getCommandMessage(Command command,
int sequenceNumber, String serialNumber) {
switch (command.getCommandType()) {
case SHELL_COMMAND: {
return new ControlRunShellCommandMessage(sequenceNumber,
serialNumber, command.getSubType(), command.getParams());
}
case FILE_HANDLING... |
c9740b60-7945-4f6f-88d9-7f6ab9a318bd | 0 | @Override
public void run() {
timer.scheduleAtFixedRate(new Timing(this), 1000, 100);
} |
678a9f14-8a31-4f64-904e-1d75159bdc8e | 1 | public static void main(String[] args) {
//Init connection count
for(int i =0; i< 100; i++){
(new Thread(new TestClass())).start();
}
} |
fa99e437-203f-4c03-8a3c-77f3d733c353 | 0 | public static void printMethod(Method m)
{
String name = m.getName();
System.out.print(Modifier.toString(m.getModifiers()));
System.out.print(" ");
printTypes(m.getTypeParameters(), "<", ", ", "> ", true);
printType(m.getGenericReturnType(), false);
System.out.print(" ");
S... |
b1be2721-7a3f-4d86-804a-e6c746a682bd | 3 | private void countVectorsModulo() {
for (wordsDocument doc : webDocs) {
doc.powVectors = new double[dictionarySize];
for (int i = 0; i < doc.powVectors.length; i++)
doc.powVectors[i] = Math.pow(doc.vectors[i], 2);
double allNumbers = 0;
for (int i = 0; i < doc.powVectors.length; i++)... |
05c3240d-3f69-4f84-8a7f-a76f1a42e928 | 5 | void onFocusIn () {
hasFocus = true;
if (itemsCount == 0) {
redraw ();
return;
}
if ((getStyle () & (SWT.HIDE_SELECTION | SWT.MULTI)) == (SWT.HIDE_SELECTION | SWT.MULTI)) {
for (int i = 0; i < selectedItems.length; i++) {
redrawItem (selectedItems [i].index, true);
}
}
if (focusItem != null) {
redraw... |
faced7fd-2f62-420f-9f05-74084d08af46 | 0 | public void setNameLangKey(String nameLangKey) {
this.nameLangKey = nameLangKey;
} |
08375c76-9343-4733-964b-8249351e7961 | 5 | private void cmdTURN(final ArrayList<String> args) {
if (status == INGAME) {
if (args.size() == 1) {
if (!game.getTurnSet()) {
if (game.getPlayerCount() != 2) {
game.setTurn(game.getPlayer(args.get(0)).getColor());
} else {
game.setTurn(game.getPlayer(args.get(0)).getColor() / 2);
}
... |
62c49615-56f0-4bbe-a726-21351e0cc0b2 | 2 | private int Number(Point point, Point point2, Point[] points) {
int count =0;
for(int i=0; i<points.length ;i++){
if((point2.x- point.x)*(points[i].y-point.y) ==
(points[i].x- point.x)*(point2.y-point.y)){
count++;
}
}
return count;
... |
da51ed6a-23f5-4fa3-8ecb-17bd3e8b8492 | 4 | protected int getVerticesIndexFor( Vertex<T> v ) {
if ( v == null ) {
throw new IllegalArgumentException( "null vertex" );
}
for ( int i = 0; i < vertices.length; i++ ) {
if ( vertices[i] != null && vertices[i].equals( v ) ) {
return i;
}
}
return -1;
} |
048c0d20-7300-44cb-ab8a-284cb0254b31 | 2 | public static void startTag(StringWriter xml, String tag,
Hashtable attributes)
{
xml.write("<" + tag);
if (attributes != null)
{
Enumeration keys = attributes.keys();
while (keys.hasMoreElements())
{
String key = keys.nextElement().toString();
String value = (String) attributes.get(key);
... |
ace150a3-ccef-4d57-a7ab-f89891a1863c | 4 | int getB(String s1, String s2) {
int b = 0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (i == j) {
continue;
}
if (s1.charAt(i) == s2.charAt(j)) {
b++;
}
}
... |
110edef4-16a9-4f55-933d-24903f45ad93 | 0 | @Test
public void testParseUserAgentString() {
testAgents(ie55clients, Browser.IE5_5);
testAgents(ie6clients, Browser.IE6);
testAgents(ie7clients, Browser.IE7);
testAgents(ie8clients, Browser.IE8);
testAgents(ie9clients, Browser.IE9);
testAgents(ie10clients, Browser.IE10);
testAgents(ie11clients, Browser... |
f0b33dd5-8d63-494c-8b7a-7a952c63c670 | 9 | public void craftRunes(int altarID) {
int runeID = 0;
for (int i = 0; i < this.altarID.length; i++) {
if (altarID == this.altarID[i]) {
runeID = runes[i];
}
}
for (int i = 0; i < craftLevelReq.length; i++) {
if (runeID == runes[i]) {
... |
ab90a351-b2fa-4e3d-aa81-c38b35f01fd0 | 0 | @Override public boolean equals(Object obj){
return (expression == ((Expression)obj).expression);
} |
f9aa2386-ff60-41bd-ae4c-133d13cb8792 | 0 | public String execute(String[] args){
return runList.remove(Long.parseLong(args[0])).toString() + "\n---removed from queue.";
} |
102a96b2-1cad-43ef-8224-763ed6de6b6d | 1 | * @throws IOException if a communications error occurs
* @throws UnknownHostException if the Cyc server cannot be found
* @throws CycApiException if the Cyc server returns an error
*/
public void unassertMtContentsWithoutTranscript(CycObject mt)
throws UnknownHostException, IOException,
C... |
9d998a0e-1234-4db7-a905-21626e157565 | 5 | @Override
public int compareTo(Point p) {
if (y == p.y) {
return x < p.x ? -1 : x == p.x ? 0 : 1;
}
return y < p.y ? -1 : y == p.y ? 0 : 1;
} |
db69909d-17b7-49cc-97de-f5161f9b5eb9 | 5 | public void setXYwrap(boolean xwr, boolean ywr){xwrap = xwr; ywrap = ywr;
int xpol; if(xwr){xpol = 1;}else{xpol = 0;}
int ypol; if(ywr){ypol = 1;}else{ypol = 0;}
borpol[2] = xpol; borpol[6] = xpol;
borpol[0] = ypol; borpol[4] = ypol;
if(xwr && ywr){borpol[1] = 1; borpol[3] = 1; borpol[5] = 1; ... |
7dfe7d16-a39a-45ec-bcc4-04dd22b1d680 | 8 | @Override
protected void setProperty(ConfigCommand cmd) {
int argc = cmd.argc ;
Object[] argv = cmd.argv ;
if (argc < 4) {
syntaxError("Wrong number of arguments to " + cmd.commandName) ;
}
if (! isName(argv[2])) {
syntaxError("The second argument to " + cmd.commandName +
" must be a property n... |
33aa158e-a96f-4bd7-905b-877f39af697a | 3 | public void loadTypes() {
this.types = new HashMap<String, Type>();
Integer i = 0;
if(plugin.configData.config.isConfigurationSection("types")) {
Set<String> types = plugin.configData.config.getConfigurationSection("types").getKeys(false);
if(!types.isEmpty()) {
for(String name : types) {
loa... |
7f072b89-77a3-43d8-9089-8d24083bce70 | 5 | public void update(GameContainer gc, int delta) throws SlickException {
quadtree.clear();
for (Shape shape : collisionObjects)
quadtree.insert(shape);
player.update(gc, delta);
viewport.update(player);
List<Shape> collidableShapes = Lists.newArrayList();
for (int i = 0; i < collisionObjects.size(); i++... |
4aa8be88-d3b8-41e7-be4b-153a68622a8d | 6 | public ArrayList<String> getPositionOfPosDestSquares(Piece piece, int x, int y, Piece[][] board, boolean owner){
ArrayList<String> moves = new ArrayList<String>();
if(piece instanceof Pawn){
Pawn pawn = (Pawn) piece;
moves = pawn.getPossibleMoveDestinations(x, y, board, owner);
moves.addAll(pawn.getPoss... |
b96d02eb-5c3d-406b-804c-b18bee691f18 | 8 | @Override
public void executeMsg(Environmental myHost, CMMsg msg)
{
super.executeMsg(myHost, msg);
if(msg.amITarget(this))
{
switch(msg.targetMinor())
{
case CMMsg.TYP_ACTIVATE:
{
final LanguageLibrary lang=CMLib.lang();
final String[] parts=msg.targetMessage().split(" ");
final TechComm... |
f59ad0ed-8d31-49a1-94b9-84351051bb3a | 7 | public int addTableSwitch(int low, int high)
{
if (DEBUGCODE) {
System.out.println("Add "+bytecodeStr(ByteCode.TABLESWITCH)
+" "+low+" "+high);
}
if (low > high)
throw new IllegalArgumentException("Bad bounds: "+low+' '+ high);
... |
23d0b0dd-bc7f-4221-8148-e955f2a79941 | 6 | public IAIGraph createGraph() {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(this.src));
// Files are not encoded so you have to do it manually
String line1 = UTF8EncodedString(br.readLine());
this.direction = getDirection(line1);
initGraph();
String line = UTF8Encoded... |
854d4b92-154a-4d76-b83f-868f4663c357 | 0 | @Override
public void doNewGame()
{
SettingsDialog.getInstance().showDialog();
} |
57c918f1-536d-4dba-8f84-9110b7f695eb | 7 | protected Component findComponentAt(Container container, int x, int y) {
Rectangle bounds = new Rectangle();
int count = container.getComponentCount();
//ShapePainterStrategy shapePainterStrategy = getShapePainter(container, null);
for(int i = 0; i < count; i++) {
Component child = container.getComponent(i... |
f8491a80-127f-4912-99d1-11515f2bd4e1 | 5 | public static String base64encode(byte[] buf) {
int size = buf.length;
char[] ar = new char[((size + 2) / 3) * 4];
int a = 0;
int i = 0;
while (i < size) {
byte b0 = buf[i++];
byte b1 = (i < size) ? buf[i++] : 0;
byte b2 = (i < size) ? buf[i++]... |
f34f04fc-5bda-421b-92d8-f0de508dc71c | 1 | private int endY( Side side ){
if( side == Side.NORTH ){
return boundaries.y;
}
else{
return boundaries.y + boundaries.height;
}
} |
dbb2400b-86c8-469e-9a1c-873bb01b5c3b | 9 | public double[] convolve_rows_gauss(double[] image, double[] mask)
{
long j, r, c, l;
double sum;
double [] h;
int n;
h = new double[(int) (width*height)];
n=(int) ((mask.length-1)*0.5);
/* Inner region */
for (r=n; r<height-n; r++) {
for (c=0; c<width; c++) {
l ... |
9604af7f-236d-4f07-9d72-ad7e268738e3 | 3 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnExcluir) {
do_btnExcluir_actionPerformed(e);
}
if (e.getSource() == btnEntrar) {
do_btnEntrar_actionPerformed(e);
}
if (e.getSource() == btnNovo) {
do_btnNovo_actionPerformed(e);
}
} |
5a8862f5-1ef0-4633-adf4-f55059f8c160 | 3 | @EventHandler
public void onSignChange(final SignChangeEvent event)
{
if (event.getLine(0) != null)
{
if ("<-pCops->".equals(event.getLine(0)) && !event.getPlayer().hasPermission("pcops.signpost"))
{
event.getBlock().breakNaturally();
}
}
} |
facbaee6-4c72-4524-b9a4-ab35c00012a9 | 3 | public String Tclient(int num) throws SocketException, IOException, InterruptedException{
TelnetService TC=TNH.get(num);
TNH.get(num).mynum=num;
String rtn=TC.getTelnetSessionAsString(Integer.toString(num));
if (rtn.equals("reload")){return rtn;}
TC.readit(" ","Room error");
dw.append("Server "+num+": ");
... |
738621e9-8be4-4a07-b000-02847874ad31 | 7 | boolean handleMousePressed(int x, int y) {
if (selectedComponent instanceof LineComponent) {
LineComponent lc = (LineComponent) selectedComponent;
int i = lc.nearEndPoint(x, y);
lc.setSelectedEndPoint(i);
lc.storeCurrentState();
return i > 0;
} else if (selectedComponent instanceof RectangleComponent... |
54180040-3ad3-42f5-a22a-8e311d85897b | 6 | int syncHeader(byte syncmode) throws IOException {
if((bytesread = source.read(syncbuf,0,3))!= 3)
return -1;
// return 0;
headerstring = syncbuf[0] << 16 & 0xff0000 | syncbuf[1] << 8 & 0xff00 | syncbuf[2] << 0 & 0xff;
if(first_call){
id_v2 [0] = ... |
c712d118-912c-4bdd-b940-2fa7fd22e142 | 8 | final boolean method321(int i, int i_14_, int i_15_, int i_16_) {
anInt411++;
if (anInt418 > i_16_ || (anInt419 ^ 0xffffffff) > (i_16_ ^ 0xffffffff))
return false;
if ((i_15_ ^ 0xffffffff) > (anInt416 ^ 0xffffffff) || i_15_ > anInt406)
return false;
if (i_14_ < anInt412 || (i_14_ ^ 0xffffffff) < (anInt404... |
8bc0c42a-42d2-461e-980f-facd57d495b0 | 5 | private static Move ForwardRightCaptureForBlack(int r, int c, Board board){
Move forwardRightCapture = null;
if(r>=2 && c>=2 && (
board.cell[r-1][c-1].equals(CellEntry.white)
|| board.cell[r-1][c-1].equals(CellEntry.whiteKing)
)
... |
36bab742-0817-4666-8a90-e63abac726e2 | 1 | protected void updateBlackHole() {
blackHole.extendDuration(1);
if (blackHole.isExpired()) {
isBlackHole = false;
blackHole.reset();
}
} |
c6f5e112-f10d-4b34-b231-ad95c86a5f47 | 6 | public void goalKick( ArrayList<Player> players, Player p){
if (((Player)p).isGoalie()){
try{
p.setBall(ball);
int num = GameEngine.rgen.nextInt(11);
if(players.get(num) != p){
p.pass(players.get(num));
} else {
if(num < 10){
num ++;
} else {
num--;
}
p.pass(p... |
97ebd3b3-66a1-4b91-bafc-f71100680ff8 | 9 | protected int computeScore () throws IncompatibleScoringSchemeException
{
int[] array;
int rows = seq1.length()+1, cols = seq2.length()+1;
int r, c, tmp, ins, del, sub, max_score;
// keep track of the maximum score
max_score = 0;
if (rows <= cols)
{
// goes columnwise
array = new int [rows];
... |
e46a0c12-b777-4f20-8018-b94322553921 | 1 | public static void captureScreenshot() {
Calendar cal = new GregorianCalendar();
int month = cal.get(Calendar.MONTH); //4
int year = cal.get(Calendar.YEAR); //2013
int sec =cal.get(Calendar.SECOND);
int min =cal.get(Calendar.MINUTE);
int date = cal.get(Calendar.DATE);
int day =cal.... |
01c44f52-76d4-43d1-9609-cd2a0c83dfa3 | 0 | @Override
public void mouseClicked(MouseEvent paramMouseEvent) {/**/} |
78cf1ef2-2c58-4f2c-8f87-5ed1653f371d | 0 | @Override
public SkillsMain[] getSkillNames() {
return Constants.assassinSkillSkills;
} |
03b8c691-3c63-439f-974e-bef3a8ea9cbf | 8 | public void writeTable(Map table, boolean reversed) {
if (!isReachable() && (Main.stripping & Main.STRIP_UNREACH) != 0)
return;
if (getAlias().length() != 0) {
String name = getName();
Identifier outer = getParent();
while (outer != null && outer.getAlias().length() == 0) {
if (outer.getName().leng... |
5036de6a-3124-466b-b172-fb6ee4a2fcb7 | 3 | public static void main(String args[]){
AudioInputStream ain;
try {
ain = AudioSystem.getAudioInputStream(new File("C:\\Users\\Andy2\\javawork\\workspace\\Learning Java\\src\\empous\\resources\\audio\\sample.wav"));
DataLine.Info info =
new DataLine.Info(Clip.class,ain.get... |
7416487b-b193-49b2-a7cd-0c8382558343 | 9 | protected void updateEntityActionState()
{
++this.entityAge;
this.despawnEntity();
this.moveStrafing = 0.0F;
this.moveForward = 0.0F;
float var1 = 8.0F;
if (this.rand.nextFloat() < 0.02F)
{
EntityPlayer var2 = this.worldObj.getClosestPlayerToEntit... |
46bbdd87-1f1f-46bd-bdd6-884e63482f71 | 6 | private void loadWords() throws IOException {
File f = new File(wordsPath);
FileInputStream fis = new FileInputStream(f);
InputStreamReader in = new InputStreamReader(fis, "utf-8");
BufferedReader br = new BufferedReader(in);
String l = null;
int wordCount = 0;
while ((l = br.readLine()) != null) {
// ... |
3bffc005-67c8-4283-a5b0-747f6000f80a | 6 | static void process() {
int i, j;
// we initialize every element in P with -1
for (i = 0; i < nodes; i++)
for (j = 0; 1 << j < nodes; j++) {
P[i][j] = -1;
D[i][j] = 0;
}
// the first ancestor of every node i is T[i]
for (i = 0; i < nodes; i++) {
P[i][0] = T[i];
D[i][0] = W[i];
}
// bot... |
03356a5b-1e21-46fa-a3db-fb2fcdcc3a94 | 4 | private boolean checkPlaceFiel() {
if (currentStadiumIndex < 0) {
ModalDialog.showEror(frame, "Выберите стадион!");
return false;
}
if (sectorField.getText().trim().isEmpty() || placeField.getText().trim().isEmpty()) {
ModalDialog.showEror(frame, "Сектор и м... |
6f88d445-2704-40ee-bb5f-cdf5e46e05c0 | 5 | private void vistDFS(XmlNode node)
{
node.level = node.getLevel();
node.path = node.getPath();
if (node.nodetype == XmlNodeType.NODE)
{
if (node.getAttribute("type").equals(XmlScript.NODE_TYPE_NET))
this.addNet(node);
else if (node.getAttribute("type").equals(XmlScript.NODE_TYPE_ROUTER))
this.... |
e8d982ba-fd9e-4e61-bcf7-b3c54c45b4b3 | 1 | public boolean addChild(Row row) {
if (canHaveChildren()) {
row.removeFromParent();
mChildren.add(row);
row.mParent = this;
return true;
}
return false;
} |
81bcadd5-64a0-4583-84f4-e564db4e9b1a | 5 | @Override
public Integer getIdFromDataBase() throws SQLException{
Connection connection = ua.edu.odeku.pet.database.ConnectionDataBase.getConnection();
Statement statement = connection.createStatement();
if(nameDepartment == null || nameDepartment.isEmpty()){
return null;
... |
3c5666e3-0fb3-483f-8e70-f5c7d0b5fbd9 | 3 | private static String convertToSaveableString(String string[][]){
String temp="";
for (int a=0; a < string.length; a++ ){
for (int b=0; b < 2; b++ ){
if (b==0){
temp += string[a][b]+DATA_DIVIDER1;
} else {
temp += string[a][b]+DATA_DIVIDER2;
}
}
}
return temp;
} |
c2fa2ac0-e997-4f9c-b2d2-a481be60621a | 7 | public int read(int address) {
if (this.cache.contains(address)) {
return this.cache.read(address);
} else {
for (int i = 0; i < this.history.length; i++) {
if (this.history[i] == address) {
// conflict miss
int mode = Integer.valueOf(this.cache.getMode(), 2);
if (mode < 8)
mode += 4;... |
2f3af38c-4185-4d63-9661-66fad74a4063 | 5 | boolean writeBytes(Frame frame) {
synchronized (this) {
if (m_handshaked == false ||
m_destroying == true) {
return false;
}
}
int n = -1;
ByteBuffer data = frame.getData();
int size = data.capacity();
int offset =... |
6412ad3d-a798-4956-81a3-694dd79fbe35 | 9 | private boolean evaluateAddClause(String str) {
Matcher matcher = ATOM.matcher(str);
if (matcher.find()) {
str = str.substring(matcher.end()).trim();
Point3f p = new Point3f();
String s1 = null;
int space = str.indexOf(" ");
if (space < 0) {
s1 = str.substring(0).trim();
p.x = (float) (Math.r... |
203116a5-72ee-41ab-b6f4-83e532a4c30b | 3 | private void cifrarBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cifrarBActionPerformed
String log = "";
String c;
String m = plaintextTF.getText();
System.out.println("m: "+m);
log += "\n Message to cipher: "+m;
ArrayList<Integer> c_ascii = new Arra... |
d3c04902-e75f-48dc-a611-cf689a44851b | 1 | private StdFileDialog(String... extension) {
for (String one : extension) {
mFileNameMatchers.add(createExtensionMatcher(one));
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.