method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
44e03a85-6b57-4466-8677-e81a230c3f2c | 6 | private boolean updateEdgeNoTx(String edge_id, Map<String,String> params)
{
boolean isUpdated = false;
OrientGraphNoTx graph = null;
try
{
graph = factory.getNoTx();
Edge edge = graph.getEdge(edge_id);
if(edge != null)
{
... |
48a8edc1-84b1-4e25-b91d-df4460fac809 | 4 | private void initUI() {
setTitle("ButtonModel1");
JPanel panel = new JPanel();
panel.setLayout(null);
ok = new JButton("ok");
JCheckBox cb = new JCheckBox("Enabled", true);
ok.setBounds(40, 30, 80, 25);
cb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEve... |
daa95344-c301-4d0b-af17-4e2ddb5a7682 | 3 | @Override
public boolean equals(Object o) {
if (!(o instanceof MethodID)) {
return false;
}
MethodID id = (MethodID) o;
return name.equals(id.name) && owner.equals(id.owner)
&& desc.equals(id.desc);
} |
21109dc7-5461-4810-acd9-6b30ee5b6c8d | 4 | public int getGridWidth(){
boolean test = false;
if (test || m_test) {
System.out.println("Grid :: getGridWidth() BEGIN");
}
if (test || m_test) {
System.out.println("Grid :: getGridWidth() END");
}
return m_Grid.length;
} |
6e73d4ac-ae14-42e1-a911-7347ae6a3c2c | 4 | private void visitSwitchInsn(final Label dflt, final Label[] labels) {
// Label currentBlock = this.currentBlock;
if (currentBlock != null) {
if (compute == FRAMES) {
currentBlock.frame.execute(Opcodes.LOOKUPSWITCH, 0, null, null);
// adds current block successors
addSuccessor(Edge.NORMAL, dflt);
... |
08b9f501-0727-4168-bdcc-2a5de454cee3 | 0 | public void setCustomerId(Integer customerId) {
this.customerId = customerId;
} |
56b1e793-9c06-4a26-9bcb-9c4a837a04f6 | 2 | private void i_stereo_k_values(int is_pos, int io_type, int i)
{
if (is_pos == 0) {
k[0][i] = 1.0f;
k[1][i] = 1.0f;
} else if ((is_pos & 1) != 0) {
k[0][i] = io[io_type][(is_pos + 1) >>> 1];
k[1][i] = 1.0f;
} else {
k[0][i] = 1.0f;
k[1][i] = io[io_type][is_pos >>> 1];
... |
184524a6-4232-4375-be67-8f2fb8212ba2 | 0 | public void setCommandListener(CommandListener listener)
{
OSConsole.listener = listener;
} |
ca82a511-cd18-4925-9bc6-53726604b62a | 5 | SimpleNode closestTo(final SimpleNode from, final double length) {
// Check if the link lengths have already been computed, and if not compute them.
if (linkLengths.get(from.index).isEmpty()) {
final ArrayList<DistanceEntry> distances = linkLengths.get(from.index);
for (SimpleNode peer : nodes) {
if (peer... |
99c2e00d-c7c5-4204-984d-b619fa4f86ac | 6 | */
public void iniciar() {
/* 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://download.orac... |
08d26d10-b6df-4256-b72a-07064aebd004 | 9 | static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... |
0932ea72-8ac7-4e0d-8f22-5709d06a9ddc | 6 | public static int findNumPlusOnes(String content) {
if (content != null && !content.equals(""))
if (content.contains("+1 ") || content.contains("+1.")
|| content.contains("+1ing") || content.contains("+1-ed"))
return 1;
return 0;
} |
3cb8a181-ae4a-4e43-88f1-0ffce32c0bac | 7 | public void load(String libraryFileName, List<String> platforms) {
if (loaded.contains(libraryFileName)) {
return;
}
try {
Throwable loadFailure = null;
for (String platformId : platforms) {
File libFile = nativeLibraryLocator.find(new LibraryD... |
7d243176-b820-4d3f-a3b7-27938f4c2baa | 2 | private static String problemStoreStringApiValue(final List val) {
final StringBuffer buf = new StringBuffer("(");
for (Iterator i = ((List) val).iterator(); i.hasNext();) {
final Object item = i.next();
if (item instanceof String) {
buf.append(DefaultCycObject.stringApiValue(item));
}... |
5ce8a00b-e2dc-4a71-9ab1-3e41d5827515 | 5 | public List<List<Integer>> countConvolution(int[][] convolution) {
List<List<Integer>> leaderboard = new ArrayList();
for (int[] row : convolution) {
for (Integer i : row) {
List<Integer> leaderboardHelpList = new ArrayList();
if (!existsInList(i, leaderboard)... |
e3fe3dd5-6802-4f16-872e-7cf4388e03bc | 0 | public long getTasksProcessed() {
return tasksProcessed;
} |
941984cb-758b-4246-9459-e7bbe5bea1b5 | 1 | void prepareDrink(String command) {
Out.info("Preparing drink ");
for (int i = 0; i < 10; i++) {
Out.info(".");
Processing.process("Sending mail", 1000);
}
Out.newLn();
Out.info("Drink ready...");
//
transactionLog().add(decodeDrink(comman... |
fb27a583-3799-4c8b-b620-fbf3e65e0a40 | 2 | public String toString(){
StringBuilder result = new StringBuilder("{");
for(Map.Entry<Class<? extends Pet>, Integer> pair:entrySet()){
result.append(pair.getKey().getSimpleName());
result.append("=");
result.append(pair.getValue());
result.append(", ");
}
result.delete(result.length()-2, re... |
0da71efb-1d0e-4d62-8b0c-411f1afeb527 | 4 | private static Coordinate setEdgeCoord(EnumArray[][] ara, EnumArray room) {
int size = ara.length;
Random r = new Random();
int side = r.nextInt(4);
int x = 0, y = 0;
if (side == 0) {x = 0; y = r.nextInt(size-2) + 1;} //random # b/t 1 and size-2 inclusive
if (side == 1) {y = 0; x = r.nextInt(size-2) + 1;}
... |
d3e803c6-a1b8-4f86-b178-6eaf0adceb05 | 4 | private void VulnerabilityInjectionAll(Boolean AffectSQLStatic, Boolean AffectSQLDynamic) {
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
DatabaseAccess JavaDBAccess2 = null;
try {
if ((conn = this.JavaDBAccess.setConn()) != null) {
... |
b4e3511a-087d-475f-9ceb-afb3298ff344 | 5 | private void agrupar() {
Agrupamento agrupamento;
switch(agrupamentoAtual){
case TODOS:
agrupamento = criarAgrupamentoTodos();
break;
case ANO:
agrupamento = criarAgrupamentoPorAno();
break;
case PERIODIC... |
e08e3d5b-4c5e-48ef-a2ef-2228d85d6bc3 | 2 | private void simple(){
term();
while( is(TK.PLUS) || is(TK.MINUS) ) {
gcprint(tok.string);
scan();
term();
}
} |
57f6bf7e-7d4b-4cf2-88c9-86f6309c5920 | 5 | @Override
public Event findEventByEventIdAndUserId(int eventId, int userId) {
Event event = null;
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_SELEC... |
4c41ef2e-0cd1-4d14-8e48-e9fa698a29dd | 7 | private void decodeBase64To(int width, int height, int[][] gidArray) {
byte[] decodedRaw = DatatypeConverter.parseBase64Binary(getData());
if (compression == null) {
// Do nothing.
} else if ("gzip".equals(compression)) {
try {
ByteArrayInputStream bais = ... |
ca3acb75-ded7-4e35-b908-00791e21d409 | 6 | private void sendMathPrompt(Socket client) throws IOException {
PrintWriter writer = new PrintWriter(client.getOutputStream(), true);
BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
String inputOperation = "";
String firstNumber = "";
S... |
71c85b3a-babe-4cfa-a6d8-b099af6d18e0 | 7 | protected OgexValue toValue( DataStructure ds ) {
OgexValue result = new OgexValue();
String s = ds.getProperty("curve", "linear");
Curve curve = Curve.lookup(s);
result.setCurve(curve);
OgexKey[] keys;
switch( curve ) {
case Linear:
... |
b6693655-902d-45e2-a95b-e4d75bf0575a | 1 | @Override
public void draw(int card, boolean fromDiscard){
board.playDraw(card, fromDiscard, game.deck.peek(true), current_player == 0);
try {
Thread.sleep(500);
} catch (InterruptedException ex) {}
} |
30478fcd-1c81-4ec4-96d5-a3f6d165ea33 | 2 | public Document toDOM(java.io.Serializable structure) {
Document dom = super.toDOM(structure);
TuringMachine tm = (TuringMachine) structure;
if (tm.tapes() > 1) {
Element tapesElement = createElement(dom, TURING_TAPES_NAME, null,
"" + tm.tapes());
NodeList list = dom.getDocumentElement().getChildNodes(... |
3d20633a-4666-40a6-9dfd-9189c7128638 | 5 | public static final MaplePacket getHiredMerch(final MapleCharacter chr, final HiredMerchant merch, final boolean firstTime) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION);
mplew.write(5);
mplew.write(5);
mplew.write(4);
mp... |
c3f5e708-87a7-40a2-b416-48d64deeebbb | 5 | public boolean insert(char[] key){
Node nodo = new Node(false, 26);
nodo.prefixo++;
if(this.find(key))
return false;
for(int a = 2; a < key.length; a++){
int cint = this.posInAlfa(key[a]);
if(nodo.nodos[cint] == null){
try {
nodo.nodos[cint] = new Node(false, tamAlfabeto);
} catch (... |
0a8a39ec-c302-4c57-b83c-5e757c8a7a5f | 1 | public int compareTo(final Object o) {
Item other = (Item) o;
int retVal = name.compareTo(other.name);
if (retVal == 0) {
retVal = desc.compareTo(other.desc);
}
return retVal;
} |
540fa94e-0e5a-4113-a0a9-37297be54947 | 5 | private void checkPluginVault() {
if (vault != null)
return;
Plugin vaultCheck = pm.getPlugin("Vault");
if (vaultCheck != null && vaultCheck.isEnabled()) {
vault = vaultCheck;
core.log.info(core.getNameBrackets() + "found Vault plugin.");
RegisteredServiceProvider<Permission> permissionPr... |
151ef121-14a4-44c5-8913-266e9e733449 | 3 | @Override
public void actionPerformed(ActionEvent event) {
Component comp = getFocusOwner();
if (comp instanceof JTextComponent) {
((JTextComponent) comp).copy();
} else {
Copyable copyable = getTarget(Copyable.class);
if (copyable != null && copyable.canCopySelection()) {
copyable.copySelection();
... |
81eee164-57ef-4328-a618-485ab83fbf11 | 1 | public List<CompetenceDetailType> getCompetence() {
if (competence == null) {
competence = new ArrayList<CompetenceDetailType>();
}
return this.competence;
} |
b04db8aa-37b1-455d-bc9c-0df48fff0313 | 6 | public static void load(Memory mem, Code code, File file) throws FileNotFoundException{
if(file != null) {
Scanner input = new Scanner(file);
Boolean modeCheck = true; //true for code mode, false for data mode
while(input.hasNextInt(16)){
//reads a hexadecimal number into inp
int inp = input.nextInt(... |
69641694-f5b7-438a-8d44-355e1359f420 | 1 | @Test
public void assertThatBudgetFormDataIsNotNull() {
try {
budget.buildBudget(null);
fail("BudgetFormData is null.");
} catch (Exception e) {
assertEquals("BudgetFormData is null.", e.getMessage());
}
} |
75c8ff7f-6087-48a8-a728-175f02fa6419 | 4 | protected void processLine(String line) {
String[] tokenLine = line.split("\t");
if (tokenLine.length == 3) {
String word = tokenLine[0];
String replacedValue = tokenLine[1];
String type = tokenLine[2];
String[] token = type.split(":");
if ... |
20fd8ca2-2dcc-461e-a79b-0f9312e46770 | 1 | private void resize(int capacity) {
Item[] temp = (Item[]) new Object[capacity];
for (int i = 0; i < next; i++) {
temp[i] = a[i];
}
this.a = temp;
} |
80bada56-95a3-40d4-8ef9-0d2b4e406ab3 | 5 | @Override
public void run() {
try {
System.out.println("TCP Listener started on IP: " + InetAddress.getLocalHost().getHostAddress() + " Port: " + TCP_PORT);
} catch (UnknownHostException e1) {
System.out.println("TCP Listener started on IP: UNKOWN Port: " + TCP_PORT);
}
while (true) {
try {
fin... |
29f34638-9735-4000-b6af-9e23cf5a91db | 4 | public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
super.doGet(req, res);
header("Liste des représentations");
if (!testConnection()){ footer(); return; }
String numS;
numS = req.getParameter("numS");
try {
out.println("<p><i>" + ConvertHTML.vecto... |
81b278a4-072d-40f2-8dbd-37d6c2b2118c | 4 | public void deleteUser() {
if (id != null) {
loadUser(id.toString());
PreparedStatement st = null;
String q = "UPDATE users SET active = ? where email = ?";
try {
conn = dbconn.getConnection();
conn.setAutoCommit(false);
... |
2ec99493-215e-4453-a931-3b1dc1d04ae2 | 4 | private boolean validPosition(Position position) {
if (position.getX() < 0) {
return false;
}
if (position.getX() >= xLength) {
return false;
}
if (position.getY() < 0) {
return false;
}
if (position.getY() >= yLength) {
... |
32da2e85-5ea9-4369-a6df-5788813b66f9 | 6 | private void loadConfigs() {
PoolConnection pcon = ConnectionPool.getConnection();
Statement stmt = null;
try {
Connection con = pcon.connect();
stmt = con.createStatement();
System.out.println("Loading butler");
ResultSet rs = stmt
.executeQuery("SELECT `name` FROM `accounts` ORDER BY `id` LIMI... |
999fb48f-a867-405a-abe6-3e4c924f9898 | 3 | @Override
public EntidadBancaria insert(EntidadBancaria entidad) {
PreparedStatement preparedStatement;
Connection connection = connectionFactory.getConnection();
try {
preparedStatement = connection.prepareStatement("INSERT INTO entidadbancaria(nombre, fechaCreacion, codigoEntid... |
852920e4-a2d4-48ff-b8d6-6c8b24006d83 | 5 | public int findKthLargest(int[] arr, int p, int q, int k) {
if (p == q) {
if (k == p) {
return arr[p];
} else {
return -1;
}
}
else if (p < q) {
int pivot = findPivot(arr, p, q);
if (pivot == k)
return arr[pivot];
if (pivot > k) {
return findKthLargest(arr, 0, pivot - 1, k);
... |
4bb29425-defd-46bc-9eba-ffa5ea0f0424 | 4 | public static boolean contains(Object objectToFind, Object... array) {
if (array != null && array.getClass().getComponentType().isInstance(objectToFind)) {
for (int i = 0; i < array.length; i++) {
if (objectToFind.equals(array[i])) {
return true;
}
}
}
return false;
} |
b481bff3-0a6a-4add-8134-16e218aab931 | 3 | public void send(String a){
if (a==null || a.length()==0) return;
if (ENCRYPTED) a = Encryptor.encrypt(a, 5); //encrypt it 5 times
this.out.println(a);
} |
7739dd3c-c139-43ef-b99b-61346f9435c5 | 9 | byte[] readCodewords() throws FormatException {
FormatInformation formatInfo = readFormatInformation();
Version version = readVersion();
// Get the data mask for the format used in this QR Code. This will exclude
// some bits from reading as we wind through the bit matrix.
DataMask dataMask = Data... |
661bf900-10b6-4b38-bd74-d634288b367f | 8 | final public void syntax_Analysis() throws ParseException {/*@bgen(jjtree) #ConditionalNode( false) */
SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTCONDITIONALNODE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
Expression();
jj_consume_token(0);
} catch (Throw... |
50d21d57-31c7-48df-a44f-ba02116cc517 | 6 | public static void main(String[] args)
{
final String DEFAULT_DIRECTORY = "user.dir";
CourseAssignment ca = new CourseAssignment();
String directory = System.getProperty(DEFAULT_DIRECTORY);
try
{
ca.loadCourses(new File(directory + "/input/CourseSchedule.crs"), ne... |
091677b6-b052-4c7e-b7b9-0ad5e1ed7c1e | 9 | static int OPLOpenTable() {
int s, t;
double rate;
int i, j;
double pom;
/* allocate dynamic tables */
TL_TABLE = new IntSubArray(TL_MAX * 2);
SIN_TABLE = new IntSubArray[SIN_ENT * 4];
AMS_TABLE = new IntSubArray(AMS_ENT * 2);
VIB_TABLE = new IntS... |
da47d915-c941-43eb-9bd1-c413163fae9f | 9 | public int classifyGrid(Grid grid){
GridNode[] nodes = grid.nodes;
SparseMatrix A = grid.A;
GridNode gn = null;
int numOfC = 0;
strongInfluenceCaculation(nodes, A);
while((gn = getMax(nodes)) != null){
gn.type = NodeType.C;
gn.order = numOfC++;
// if(gn.id==1)System.out.println(gn.St.keySet(... |
52765eed-2ee3-4974-b678-86c7300ace9d | 2 | public void tick()
{
tick++;
if(tick == 30) {
anim = sOffsetA;
}
else if(tick == 60) {
anim = 0;
tick = 0;
}
} |
8ae71bae-873d-4a24-93a9-ffd9c06276df | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
3fdc39c7-e22a-4c4a-8506-d4c1f85cf14e | 9 | private static void saveWorld(Cell[][] cells){
try {
File mapfile = new File("automap.txt");
BufferedWriter mapout = new BufferedWriter(new FileWriter(mapfile));
mapout.write(Integer.toString(cells[0].length));
mapout.newLine();
mapout.write(Integer.toString(cells.length));
mapout.newLine();
for ... |
ee6fcd0a-aa9b-4c75-bca3-87ee669a272f | 7 | public List getSubscriptions() {
clearResultMetaInformation();
List subscriptions = new ArrayList();
StringBuffer result = new StringBuffer();
GetMethod get = new GetMethod(apiEndpoint + DeliciousConstants.INBOX_SUBS);
get.setDoAuthentication(true);
try {
ht... |
9fbab45c-1b03-4052-8b63-b6c3abdc233e | 9 | public boolean canMove()
{
World myWorld = getWorld();
int x = getX();
int y = getY();
switch(direction) {
case SOUTH :
y++;
break;
case EAST :
x++;
break;
case NORTH :
... |
b9bbcd74-a500-4bd8-9205-31aa82986923 | 4 | public static void main(String[] args) throws IOException, SQLException {
Connection conn=DriverManager.getConnection(url,user,password);
PreparedStatement stmt = null;
Set<Book> bookSet = new TreeSet<>();
String booksCount="";
ResultSet rs=null;
float aa=10.0f... |
8e94c316-fa6a-4c71-954c-90eb7e62f264 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if((mob.numFollowers()>0)||(mob.isMonster()))
{
mob.tell(L("You cannot have any followers when casting this spell."));
return false;
}
if(!super.invoke(mob,commands,givenTarget,auto,asLeve... |
6c5268ec-9f33-48d4-81a6-46336bea1634 | 7 | private void btSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSaveActionPerformed
if (ctrlFields()) {
if (newEnregistrement) { // Si nouvel enregistrement, faire un nouvel objet.
if (type.equals(CtrlAdmin.TYPE_MEDECIN)) {
Medecin med = ne... |
3a27c5dc-ee0d-4b95-ab39-e8760f24f87c | 2 | public Currency get(String code){
for (Currency currency: instance)
if (code.equalsIgnoreCase(currency.getCode()))
return currency;
return null;
} |
9f30fae9-1468-47a4-8cd0-4975e7575466 | 4 | public Rule(String rule)
{
String[] tempTokens = rule.split(" ");
leftToken = new Token(Token.getTokenType(tempTokens[0]), tempTokens[0]);
if(tempTokens.length > 2)
{
rightTokens = new Token[tempTokens.length - 2];
for(int i = 0; i < rightTokens.length; i++)
{
rightTokens[i] = new Token(Token.g... |
7098cdd6-067e-4244-b247-a1514d11bca6 | 9 | private boolean jj_3R_81() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_8()) {
jj_scanpos = xsp;
if (jj_3R_97()) {
jj_scanpos = xsp;
if (jj_3R_98()) {
jj_scanpos = xsp;
if (jj_3_9()) {
jj_scanpos = xsp;
if (jj_3_10()) {
jj_scanpos = xsp;
if (jj_3_11()) {
jj_scanpos = x... |
ef59bd30-1237-4ce5-a729-5ab48bb4577f | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Car other = (Car) obj;
if (code == null) {
if (other.code != null)
return false;
} else if (!code.equals(other.code))
return false;
... |
070a6d8c-738d-4fb1-8b06-c2e2f6821c8a | 0 | public Cpu(boolean color, Board board) {
super(color, board);
largestCapture=0;
} |
0c072b2e-2dde-4f6f-8265-a4fdbc105ca9 | 7 | public void setGroups() {
Vector<WargusUnit> units = wp.getUnits();
for (WargusUnit u : units) {
String name = WargusStateImporter.unitTypeToString(u.getType());
boolean inGroup = false;
for (UnitGroup<Integer> unitGroup : unitGroups) {
if (unitGroup.contains(u.getUnitID()))
inGroup = true;
}
... |
3d30bc1b-7ec4-4d39-b5ca-44aa9ef56e35 | 8 | public void executeAction(ActionListener listener, Object source,
String actionCommand)
{
// create event
ActionEvent evt = new ActionEvent(source,
ActionEvent.ACTION_PERFORMED,
actionCommand);
// don't do anything if the action is a wrapper
// (like EditAction.Wrapper)
if(listener instanceof Wrappe... |
97566b1c-d639-44dc-925e-c77e1f4f2968 | 5 | public static void spikeDraw(int start, Color color1, Color color2,
double[] x, double[] y) {
int count = 0;
// if (start == 1){
// count = -1;
// }
while (count < 3) {
if (start == 0) {
StdDraw.setPenColor(color1);
StdDraw.filledPolygon(x, y);
for (int i = 0; i < x.length; i++) {
x[i] = ... |
ec48e8c4-aa1d-46d0-a95d-c7ed53dbfdc3 | 0 | public CheckResultMessage check5(int day) {
return checkReport.check5(day);
} |
4eca8fc5-e974-4d0e-8ac5-5eeadb36491e | 0 | public void sendToGrid(String stringToSend){
OSCMessage message1 = new OSCMessage("/ch/grid");
message1.addArgument(stringToSend);
send(message1);
} |
bbd41831-c20b-483f-a8b4-4f350de897d9 | 3 | public int constantTag(final int index) {
if ((0 < index) && (index < constants.size())) {
final Constant c = (Constant) constants.get(index);
if (c != null) {
return c.tag();
}
}
return Constant.UTF8;
} |
34889924-f4de-45dc-b6ae-b873a2200982 | 2 | static Method lookup(String method) {
for (Method m : Method.values()) {
if (m.toString().equalsIgnoreCase(method)) {
return m;
}
}
return null;
} |
04cb79cc-2dc6-4349-9721-6696ba31f03a | 3 | private static StringBuilder appendSignature(StringBuilder buff, Class cls) {
if (cls.isPrimitive()) {
int tid;
buff.append((tid=OP.typeID(cls))>9?'L':"ZBCSIJFDLV".charAt(tid));
} else if (cls.isArray()) {
buff.append('[');
appendSignature(buff,cls.getComponentType());
} else { // ju... |
d1e9f679-4f74-434f-bebe-b2cd6ac753a3 | 0 | public int getCategoryId() {
return categoryId;
} |
951037ec-e783-4bff-abe2-e23789995859 | 4 | public int compareTo(Time other)
{
if (equals(other))
return 0;
else {
if (hours < other.hours || (hours == other.hours && minutes < other.minutes))
return -1;
else return 1;
}
} |
2a9dde56-e227-43c8-b36d-d0efa86e1a90 | 8 | private void checkSelection(EntityManager entityManager) {
for (int x = (int) selectionStart.x; x <= (int) selectionEnd.x; x++) {
for (int y = (int) selectionStart.y; y <= (int) selectionEnd.y; y++) {
Node n = World.nodeAt(x, y);
if (n != null) {
E... |
2b154203-cf6d-421d-b401-78c4f5316ccd | 9 | private void handleAlias(Player player, String alias, String message) {
ChatPlayer cp = PlayerManager.getPlayer(player.getName(), plugin.name);
if (cp.modes.contains(ChatPlayer.Mode.LOCKED)) {
PluginUtil.send(cp.name, "You have been locked in your channel and may not change channels.");
return;
}
String ... |
ae1ba27f-7edf-4be6-a4dd-a3d655713258 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
if((thePlants==null)||(thePlants.owner()==null)||(!(thePlants.owner() instanceof Room)))
{
unInvoke();
return super.okMessage(myHost,msg);
}
final MOB mob=(MOB)affected;
... |
5c628ec1-ffb5-49e4-a9ed-4c42f18c3cfc | 7 | private DisplayMode getDisplayMode(int width, int height, int bpp, int freq) {
try {
for (DisplayMode displayMode : Display.getAvailableDisplayModes()) {
if (displayMode.getWidth() == width && displayMode.getHeight() == height && displayMode.getBitsPerPixel() == bpp &&
... |
27a3e86a-a891-44f9-bd5f-3821983a3d4c | 9 | protected int[] getAppropriateXY(Area A, String mapStyle)
{
if((mapStyle==null)
||(mapStyle.length()==0)
||(!(A instanceof GridZones)))
return null;
if(mapStyle.startsWith("G"))
{
mapStyle=mapStyle.substring(1);
final int[] xyxy=new int[6];
int x=mapStyle.indexOf('_');
int index=0;
while(x>... |
3e7cbf53-2376-4a92-a338-7217ab10cfc7 | 1 | private static void askForChoice(QuestionsInterface quesObj, Scanner scn) {
// TODO Auto-generated method stub
System.out.println("1. Sort on Rank\n2. Sort on Votes\n0 Exit");
int choice = scn.nextInt();
if(choice==0)
System.exit(0);
else
System.out.println(quesObj.changeSorting(choice));
askForCho... |
4ccf9d5c-db7e-4179-82d2-84f30080c591 | 9 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
StringTokenizer st = new StringTokenizer(br.readLine());
int[] a = new int[n];
for(int i=0; i<n; i++){
... |
51910d44-b658-48a9-97f6-109f1565f76b | 3 | Client2() throws IOException {
String s;
System.out.println(getCurrentTime() + "::" +"Starting Client ..");
clientSocket = new Socket("localhost", 38000);
serverIn=new DataInputStream(clientSocket.getInputStream());
serverOut=new DataOutputStream(clientSocket.getOutputStream());
/*--------Reading file from ... |
480e6881-72f7-457a-8b6e-ced025c76f85 | 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 Lenguaje)) {
return false;
}
Lenguaje other = (Lenguaje) object;
if ((this.lenLenguaje == null && other.lenLeng... |
455f5e0b-0a2f-4e0d-9f13-80339521b52c | 0 | public static boolean isApplicable(Object object) {
return object instanceof TuringMachine;
} |
cc842a90-f7f5-42c7-8ee1-d2292a36bbf8 | 7 | private void createDefaultLoaders() {
this.loaders.put(String.class, new AbstractLoader(this.loaders, this.resources) {
@Override
public void load(Element element, Object target, IElementParser parser) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, Insta... |
48deb7f2-8d9d-4243-ae48-791dbfa01ef9 | 7 | protected void notifyEditorListeners(final EditorEvent e) {
if (e == null)
return;
if (editorListenerList == null || editorListenerList.isEmpty())
return;
Runnable r = new Runnable() {
public void run() {
for (EditorListener el : editorListenerList) {
switch (e.getID()) {
case EditorEvent.E... |
24f705a7-ebb9-4c75-8bdd-d6a0005e8a07 | 8 | public static double[][] removeColumnFromMatrix(double[][] matrix, int columnNumber1, int columnNumber2) {
double[][] newMatrix = new double[matrix.length][matrix[0].length-1];
if(matrix != null && matrix.length > 0 && matrix[0].length > columnNumber1 && matrix[0].length > columnNumber2) {
... |
c73e3026-9cdc-4e2f-98db-fd80161c4be7 | 2 | public void PrivMsg(String destination, String message, boolean autothrow) throws Exception
{
try
{
Writer.write("PRIVMSG " + destination + " :" + message + "\r\n");
Writer.flush();
}
catch(Exception e)
{
if(autothrow) throw e;
... |
82ff071f-2c1a-41e1-b203-a0798aa153e3 | 1 | public DBRecipeRepository() throws ClassNotFoundException {
Class.forName("org.sqlite.JDBC");
connectionString = System.getProperty("omnom.db.connectionString");
if(connectionString == null){
connectionString="jdbc:sqlite:omnom.db";
}
} |
058ee597-22af-4590-8e17-fbd8129eed45 | 3 | @Override
public String toString()
{
if (factor == 0)
{
return Long.toString(base);
}
else if (factor > 0)
{
return toDecimalString();
}
else
{
// factor negative
if (base == 0)
{
return "0";
}
else
{
return Long.toString(base) + ZEROS[-factor];
}
}
} |
c4bee861-0840-46c9-9412-f7a8a5dabeaf | 9 | public void renderTile(int xp, int yp, Tile tile) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < tile.sprite.SIZE; y++) {
int ya = y + yp;
for (int x = 0; x < tile.sprite.SIZE; x++) {
int xa = x + xp;
if (xa < -tile.sprite.SIZE || xa >= width || ya < 0 || ya >= height) break;
if (xa < 0) xa... |
4d34bc43-0c51-4d5a-8be8-ac3ecb685ab7 | 2 | public static void main(String[] args)
{
try
{
BufferedReader reader = new BufferedReader(new FileReader("Input.txt"));
String line = null;
int sum = 0;
while((line = reader.readLine()) != null)
{
sum = sum + Integer.parseInt(line);
}
System.out.println(sum);
}
catch(Exception ex)
{
... |
a05970e0-0da5-4f7e-9737-c025ed7e2fec | 3 | public static void sort(int[] randomSet)
{
int i = 0;
int m = 0;
while(i < randomSet.length)
{
int j = i + 1;
m = randomSet[i];
while(j < randomSet.length)
{
if(randomSet[j] < randomSet[i])
{
m = randomSet[i];
randomSet[i] = randomSet[j];
randomSet[j] = m;
}
j++;
... |
38daf668-b99a-47a4-b975-0af662ac95ef | 8 | public void drawCards()
{
card1 = newDeck.getCard(0);
newDeck.removeCard(0);
totalVal += card1.cardValue;
maxCardsInHand+=1;
card2 = newDeck.getCard(0);
newDeck.removeCard(0);
totalVal+=card2.cardValue;
maxCardsInHand+=1;
if("Ace".equals(card1.... |
d7247b0e-fc1c-4ffb-8f9d-d7f6009c830a | 4 | public void parse() throws XMLStreamException, InterruptedException {
XMLInputFactory xif = XMLInputFactory.newFactory();
XMLEventReader xmlreader = null;
try {
xmlreader = xif.createXMLEventReader(stream);
while (xmlreader.hasNext()) {
XMLEvent event = xmlreader.peek();
if (event.isStartElement(... |
9b710260-5c0c-457a-8a8d-076031f87e1a | 0 | public void update(String userLogin, UserDTO userDTO) throws Exception {
Gson gson = new Gson();
String json = gson.toJson(userDTO);
System.out.println(json);
ClientConfig config = new DefaultClientConfig();
client = Client.create(config);
client.addFilter(new LoggingFilter());
webResource = client.resou... |
13b03b0f-8458-4ae6-a476-15de6a8dc08c | 3 | @Override public final RadialMenu build() {
Options options = properties.keySet().contains("options") ? ((ObjectProperty<Options>) properties.get("options")).get() : new Options();
List<MenuItem> items;
if (properties.keySet().contains("itemsArray")) {
items = Arrays.asList(((... |
dc332faf-3cd7-4d13-8d05-7312ed76e990 | 7 | public double getEnergyForDOF(int dof){
double E = constTerm;
for(int t=0; t<terms.length; t++){
if(dof!=-1){//if not total energy, only take terms involving this DOF
if(!termHasDOF[t][dof])
continue;
}
Co... |
69073fbe-6938-4f6d-ad19-ef48beb90158 | 0 | public ListenerManager getListenerManager() {
return listenerManager;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.