method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1edd2384-2602-44c2-a414-f4de2e8e69e8 | 3 | public void walkLeft() {
face = 3;
if (!(x == 0) && !walkblockactive)
if (!Collision.check(new Position(x, y), face)) {
x -= walkspeed;
setWalkBlock(walkblocktick);
}
} |
bf30089c-3e8a-4684-b200-2950f372a925 | 3 | public Intersection findIntersect(Ray r) {
double d = r.getDirection().dot(normal);
if (d == 0) {
return null;
}
double t = (point.dot(normal) - normal.dot(r.getOrigin())) / d;
if (t > getTol()) {
Vector i = r.position(t);
Vector n = d > 0 ? normal.negate() : normal;
return new Intersection(t, r, ... |
14792e04-7eea-4587-bd2b-cb82c6dd7cd6 | 2 | private final void push(JSONObject jo) throws JSONException {
if (this.top >= maxdepth) {
throw new JSONException("Nesting too deep.");
}
this.stack[this.top] = jo;
this.mode = jo == null ? 'a' : 'k';
this.top += 1;
} |
842aac1e-d6f5-4f62-8308-f81fddaa86fc | 0 | public void clearAttempts()
{
myAttempts.clear();
} |
ec4895dd-4672-4aa1-aa01-2311a8b01e91 | 4 | private Method getDeclaredMethod(Class<?> cl, String methodName,
Class<?>... parameterTypes) throws NoSuchMethodException
{
do {
try {
return cl.getDeclaredMethod(methodName, parameterTypes);
}
catch (NoSuchMethodExcept... |
7c3c831f-d7cc-444e-b47a-3893b954757e | 1 | public Field(char file, char rank) {
this.file = file;
this.rank = rank;
this.backgroundColor = (this.file + this.rank)%2 == 0 ? this.BACKGROUND_DARK : this.BACKGROUND_LIGHT;
this.setDefaultBackgroundColor();
this.setLayout(new GridBagLayout());
} |
6afbd330-7fcf-4b4c-859b-4a2f33ac73c0 | 9 | /* */ protected InputStream getJarInputStream(String paramString, final URLConnection paramURLConnection)
/* */ throws Exception
/* */ {
/* 534 */ final InputStream[] arrayOfInputStream = new InputStream[1];
/* */
/* 538 */ for (int i = 0; (i < 3) && (arrayOfInputStream[0] == null); i++... |
68c0b821-5473-4ae9-bd67-283d3ff3f338 | 0 | Queen(int t, boolean w, int x, int y){
super(t,w,x,y);
dist = 7;
int[][] ex = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, 1}, {-1, 1}, {-1, -1}, {1, -1}};
moves = ex;
} |
121e2a72-8a57-4a77-a3f0-bcb53f82e92c | 9 | int insertKeyRehash(byte val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... |
df241438-2fa2-406b-a6d4-7d95746aef42 | 9 | public List<Cell> expandCell(Cell cell) {
if (cell.isDestination()) {
// the destination is reached,
return Collections.emptyList();
}
final int x = cell.getX(), y = cell.getY();
final List<Cell> nextCells = new LinkedList<Cell>();
// UP
final int up = y - 1;
if (y > 0 && maze[up][x] != OBSTACLE) ... |
28f88528-432c-4b33-8f4a-4afc219ae9e5 | 7 | @Test
public void builderTestAlternating() {
for(int len = 0; len < 10_000; len++) {
final ObjectArrayBuilder<Integer> builder = new ObjectArrayBuilder<>();
final int mid = len / 2;
if(len % 2 == 0) {
for(int i = 0; i < len; i++) {
if(i % 2 == 0) builder.prepend(mid - 1 - i / ... |
60c5a40a-3517-4587-8221-76ad5f767a18 | 0 | public Point2D getBottomRight() {
return new Point2D(width, height);
} |
c4971848-fee6-46a7-af8d-a9c206c1e5f9 | 5 | public boolean AnySecondaryMet() {
return (TimeMet() && TimeSecondary) || (PointsMet() && PtsSecondary)
|| (EnemiesMet() && EnemySecondary);
} |
6c3c6d0d-9ab1-47b5-90fd-3c5302e627f1 | 9 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ComplexDecisionAction other = (ComplexDecisionAction) obj;
if (decisions == null) {
if (other.decisions != null)
return false;
} else if (decisions... |
394824b8-b533-4bcf-8b5d-b32d4da16f42 | 2 | public void setFunction(int newFunction){
if(newFunction >= 0 && newFunction < 16) function = newFunction;
else ;//put error here
} |
d682f086-b6c9-4990-a6db-7dd02f2a4353 | 2 | public LinkedList<Long> loadAllScores() {
ResultSet rs;
LinkedList<Long> result = new LinkedList<>();
try (Statement s = openStatement();) {
rs = s.executeQuery("SELECT time FROM scores");
result = new LinkedList<>();
while (rs.next()) {
result.add(rs.getLong("time"));
}
} catch (SQ... |
e944e231-dd2d-4d35-b363-35872ea6b351 | 2 | private void loadProgramm() {
ArrayList<Integer> asmProg = parser.getAsmProg();
if(asmProg.size() >= SPEICHERGROESSE) {
PIC_Logger.logger.fine("Speicher zu klein!!");
System.exit(-1);
}
for(int i = 0; i < asmProg.size(); i++) {
speicherZellen[i].setWert(asmProg.get(i));
}
} |
7009fbe6-060a-42e4-bd7e-f5001f9db48f | 9 | public synchronized void run(){
try {
Map listConsolidado=new HashMap();
int num=0;
//System.out.println("numero ingresado:"+numeroSolicitud);
//Long numSol=numeroSolicitud;
Coneccion con=new Coneccion();
Class.forName(con.getDriver());
Connection ch=DriverManager.get... |
67dc251d-a330-4249-8fa2-ecd74c1e9ae9 | 9 | public static int[] shouldBuildAnyBuilding() {
int mineralsRequired = 0;
int gasRequired = 0;
int buildingsToBuildTypesNumber = 0;
if (TerranCommandCenter.shouldBuild()) {
mineralsRequired += 400;
buildingsToBuildTypesNumber++;
return new int[] { mineralsRequired + 8, gasRequired, buildingsToBuildTypes... |
f5ee18e5-c79a-4114-8db4-a85dbd598c41 | 1 | public void addDestination(ISO3Country destination) {
if (this.destination == null) {
this.destination = new ArrayList<ISO3Country>();
this.destination.add(destination);
} else {
this.destination.add(destination);
}
} |
27a6c2f8-17bd-41a7-b90e-bcddcc5895e0 | 9 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long begin = System.currentTimeMillis();
int[] sushu = new int[n + 1];
for (int i = 0; i < sushu.length; i++) {
sushu[i] = i;
}
sushu[1] = 0;
for (int i = 2; ... |
9ca9c6a9-7f28-41c6-a4b7-99e531fb6473 | 8 | private void generateVariations (RefineableRule R)
{
for(Dimension d : R.getCondition().values())
{
for(Value v : d.values())
{
RefineableRule r = new RefineableRule (new GeneralizedConditionChunk(R.getCondition().clone()),R.getAction());
if(v.isFullyActivated())
{
r.getCondition().get(d.get... |
a9e07fff-67db-45c7-96ee-2f94e327a801 | 0 | @Test
public void test_xml2json() {
String xml = "<Response type=\"string\"><CustID>1300000428</CustID><CompID>1100000324</CompID><Items><Item><Sku_ProductNo>sku_0004</Sku_ProductNo><Wms_Code>1700386977</Wms_Code><Sku_Response>T</Sku_Response><Sku_Reason></Sku_Reason></Item><Item><Sku_ProductNo>0005</Sku_ProductNo><... |
35e035ee-e45b-40c9-9d48-d625f5b97c73 | 9 | public CController(JFrame frame) {
this.frame = frame;
//let's create the mine sweepers
for (int i = 0; i < CParams.iNumSweepers; i++) {
sweeperPositions.add(new CMinesweeper(i == 0));
}
//initialize mines in random positions within the application window
for (int i=0; i < CParams.iNumMines; i++) {
... |
ed94b77a-0e42-47cd-a356-0ad02c0208a6 | 0 | public String toString() {
return "Message["+source+"->"+dest+" seqNum:"+seqNum+" duplicate:"+duplicate+" kind:"+kind+" data:"+data+"]";
} |
6a3d2459-5051-4801-8902-70cbd5f4982a | 7 | BackgammonPanel() {
game = new BackgammonGame();
currState = game.getInitialState();
setLayout(new BorderLayout());
setBackground(Color.BLUE);
//add top toolbar
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
... |
7eb19d0d-652a-45c4-a9da-72327a973370 | 1 | public MUsuarios(Usuarios u) {
setModal(true);
initComponents();
if(!(u == null)){
edtCodigo.setEnabled(false);
edtCodigo.setText(u.getCodigo());
edtNombre.setText(u.getNombre());
edtDNI.setText(u.getDNI());
btnSwitch.setText("Actualiza... |
35575f09-9eee-4b24-836c-770405c1747f | 5 | public static void findText(JTextComponent section, String input) {
// Removes the previous highlights if there were any.
section.getHighlighter().removeAllHighlights();
if (input.length() <= 0) {
return;
}
/*
* Gets the text from the chosen editorpane and searches after the input
* from the beginn... |
ea7f3431-f0b7-4b2f-8646-8292ff890d5e | 7 | static void sort(int[] array, int start, int end) {
System.out.println(">>>>>>>>>>>> " + start + " >>>>>> " + end
+ " >>>>>>>>>>>>>>>>>>>>");
for (int i = 0, count = array.length; i < count; i++) {
System.out.print(array[i] + ", ");
}
System.out.println();
assert start <= end;
int oStart = start;
... |
94bfd3f0-bd52-4171-850a-d294e599c092 | 7 | private void fetchValue() {
// Do we determine a simple key?
SimpleKey key = this.possibleSimpleKeys.remove(this.flowLevel);
if (key != null) {
// Add KEY.
this.tokens.add(key.getTokenNumber() - this.tokensTaken, new KeyToken(key.getMark(),
key.getMark... |
89946c85-add4-4e14-bef1-796499dc7df2 | 6 | public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java TokenScanner <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
TokenScanner scanner = null;
try {
scanner = new TokenScanner( new java.io.FileReader(argv[i]) ... |
97068fe5-21ae-472e-abff-205d40aa8d64 | 3 | private int get_new_reconnect_ivl ()
{
// The new interval is the current interval + random value.
int this_interval = current_reconnect_ivl +
(Utils.generate_random () % options.reconnect_ivl);
// Only change the current reconnect interval if the maximum reconnect
//... |
4359d288-4bac-43ea-9f61-f6b5acb8f72f | 0 | public int getDEF() {
return def;
} |
8f51f377-8f8e-430e-90f0-443c4b1134be | 6 | public int validateCredentials(String user, String pass){
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_UR... |
5a9cbde6-a858-413c-b834-48924b94762d | 5 | public void verifyDeadEnd() {
int deadCount = 0;
if(this.checkerObject.getUp()==0) {
deadCount++;
}
if(this.checkerObject.getLeft()==0) {
deadCount++;
}
if(this.checkerObject.getDown()==0) {
deadCount++;
}
if(this.checkerObject.getRight()==0) {
deadCount++;
}
if(deadCount==3) {
backT... |
41ff1263-5467-405e-b37e-c5b192ddfff1 | 8 | public String toString(){
StringBuffer sb = new StringBuffer();
switch(type){
case TYPE_VALUE:
sb.append("VALUE(").append(value).append(")");
break;
case TYPE_LEFT_BRACE:
sb.append("LEFT BRACE({)");
break;
case TYPE_RIGHT_BRACE:
sb.append("RIGHT BRACE(})");
break;
case TYPE_LEFT_SQUARE:
... |
c96061f1-9096-42c5-9c91-69c600102cf6 | 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... |
c37692e5-a80a-4fd4-9635-cf588d059b0f | 8 | public synchronized void shutdown() throws SyslogRuntimeException {
if (this.socket == null) {
return;
}
if (this.syslogConfig.isThreaded()) {
this.shutdown = true;
final long timeStart = System.currentTimeMillis();
boolean done = false;
while(!done) {
if (this.socket == null || this.socket.... |
1cd23641-9fbd-48fd-99ba-4d38ac057231 | 1 | void setEntity(String eName, int eClass, String pubid, String sysid,
String value, String nName)
{
Object entity[];
if (entityInfo.get(eName) == null) {
entity = new Object[5];
entity[0] = new Integer(eClass);
entity[1] = pubid;
entity[2]... |
77b70214-52b6-4c16-b7e2-abbef5c5d273 | 3 | @Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
try {
JavaFileObject classFile = fileManager.getJavaFileForInput(StandardLocation.CLASS_OUTPUT, name, Kind.CLASS);
if (classFile != null) {
byte[] classData = readClassData(classFile);... |
b9d92d38-6a32-49f0-accd-6b3203c9f3cb | 3 | protected ConfigurationSerializable deserializeViaCtor(Constructor<? extends ConfigurationSerializable> ctor, Map<String, Object> args) {
try {
return ctor.newInstance(args);
} catch (Throwable ex) {
Logger.getLogger(ConfigurationSerialization.class.getName()).log(
... |
0b23ea62-7807-41ad-801a-97e0e58a3d65 | 1 | public void test_printParseLongName() {
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd HH:mm ").appendTimeZoneName();
DateTimeFormatter f = bld.toFormatter().withLocale(Locale.ENGLISH);
assertEquals(true, f.isPrinter());
asse... |
323e220a-3858-4028-b96d-42d33548cb10 | 7 | private void pollEvents()
{
while(Keyboard.next())
{
char c = Keyboard.getEventCharacter();
int k = Keyboard.getEventKey();
boolean b = Keyboard.getEventKeyState();
if(k == Keyboard.KEY_F10 && b)
mainFrame.setAlwaysOnTop(!mainFrame.isAl... |
0abbc98f-0c5b-4691-8002-afffb88a4ebe | 9 | @POST
@Consumes("text/plain")
public Response forwardRequestService(final String httpMessage) {
try {
// If the caller don't knows the token access is not allowed
if (!httpMessage.contains(SecretToken.TOKEN_VALUE)) {
return Response.status(Status.UNAUTHORIZED).build();
}
// Everything except GET &... |
0b6db5b1-54fd-466f-98c4-9b60f2d7a2ae | 8 | protected void suspect(List<Address> suspects) {
if(suspects == null || suspects.isEmpty())
return;
num_suspect_events+=suspects.size();
final List<Address> eligible_mbrs=new ArrayList<>();
synchronized(this) {
for(Address suspect: suspects) {
su... |
5ac423f2-5ed2-4d66-9cb5-6db8c59797ea | 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... |
317933b9-638c-4ce4-a456-43605230c751 | 4 | public static ArrayList<String> readDomains(String filename){
ArrayList<String> list = new ArrayList<String>();
try {
BufferedReader reader = new BufferedReader(new FileReader(new File(filename)));
while(true){
String mail = reader.readLine();
if(m... |
6b801353-6dec-4a0c-9dc7-0373c2a8b2f3 | 1 | public JSONObject toJson() {
JSONObject jo = new JSONObject();
try
{
jo.put("id", getId());
jo.put("username", username);
jo.put("isAdmin", this.isAdmin);
jo.put("email", this.email);
jo.put("fullName", this.fullName);
return jo;
} catch (JSONException e)
{
e.printStackTrace();
... |
2502d470-16cf-49da-9b7a-4ccbafec8c1c | 4 | private List<String> splitList(List<String> inGdbList) {
//separa de la lista @inGdbList las pistas del calendario que se
//obtienen de @temporadas, regresa una lista con los archvos.gdb del
//calendario.
List<String> innerScenes = temporadas.getFullTrackList();
List<String> inn... |
7fe43ae8-c8f7-4f8c-9244-70e5768391f4 | 1 | public void dumpStackLocalInfo() {
for (Iterator iter = bytecode.getInstructions().iterator(); iter
.hasNext();) {
Instruction instr = (Instruction) iter.next();
System.err.println("" + instr.getTmpInfo());
System.err.println(instr.getDescription());
}
} |
96578cb5-13a9-4227-a3aa-7b3c60265fe5 | 1 | @AfterClass
public static void cleanUp() {
// deleting testing file
File myFile = new File(filePath);
if (myFile.exists()) {
myFile.delete();
}
} |
51ec36da-72a2-4037-a40f-575d39a69263 | 0 | public String getMimeType() {
return mimeType;
} |
afd2cef2-0e6a-4104-93ff-c20257dd5c36 | 6 | public static void method460(byte abyte0[], int j) {
if (abyte0 == null) {
Class21 class21 = aClass21Array1661[j] = new Class21();
class21.anInt369 = 0;
class21.anInt370 = 0;
class21.anInt371 = 0;
return;
}
Stream stream = new Stream(abyte0);
stream.currentOffset = abyte0.length - 18;
Class21 c... |
046ece80-f559-442d-bb34-f8a786cf5e7b | 2 | public static void serializeString(ByteBuf bb, String value) {
if (value != null) {
for (char c : value.toCharArray()) {
bb.writeByte(c);
}
}
bb.writeByte(SEPARATOR);
} |
f31a9d9f-c31a-4ca3-bc7f-0c1005e7ff58 | 4 | public static void sort(Tuple[] arr) {
int R = 256;
int[] count = new int[R + 1];
Tuple[] aux = new Tuple[arr.length];
//Compute frequency counts
for (Tuple t : arr) {
count[t.value] += 1;
}
//Transform counts to indices
for (int i = 1; i < co... |
35af237d-9ced-415b-a929-c2cfa5ec1144 | 3 | private static byte[][] InvShiftRows(byte[][] state) {
byte[] t = new byte[4];
for (int r = 1; r < 4; r++) {
for (int c = 0; c < Nb; c++)
t[(c + r)%Nb] = state[r][c];
for (int c = 0; c < Nb; c++)
state[r][c] = t[c];
}
return state;
} |
563f8e46-348f-4108-a7e8-d9e10ef6ff8a | 9 | private void setFlag(final CommandSender sender, final String[] args) throws CommandException {
if (args.length < 2) {
throw new CommandException(Translations.get(Message.error_input_world_name));
}
if (args.length < 4) {
throw new CommandException(Translations.get(Messa... |
1ffc984a-e2ee-4fa3-b7b1-6f40f32d2617 | 7 | public void appUI()
{
// Set a bit of text:
JLabel instruction = new JLabel(" Demo plots: ");
instruction.setFont(new Font("Serif", Font.BOLD, 13));
instruction.setAlignmentX(0.5f);
add(instruction);
// plot button
JButton plot = new JButton("Plot");
plo... |
8bb3e899-2bac-4c4b-8c71-318154e827c0 | 7 | public void setCanBeSeen(int posX, int posY)
{
if(posX >= 0 && posY >= 0 && posX < viewWidth && posY < viewHeight) {
final int layers = player.gameMap.getLayerCount();
for(int i=0; i<layers; i++) {
final int code =
pla... |
a70cf4a6-b230-4d28-bcd3-b6b8ee8f12ee | 6 | public void mouseEntered(MouseEvent e) {
for(int i = 0; i < BOARD_WIDTH; i++){
for(int j = 0; j < BOARD_HEIGHT; j++){
if(e.getSource() == m_board[i][j]){
if(m_game.getPlayerTurn() % 2 == 0){
if(m_playerOne.getColour().equals(
Piece.TicTacToePieceColour.CROSS)){
m_board[i][j].setIcon(m... |
2323f7df-8046-49bf-a398-e058f5b81008 | 6 | private boolean isSurroundingCellsOccupied(final HantoCell butterfly){
boolean allOccupied = true;
final HantoCell neCell = new HantoCell(butterfly.getX() + 1, butterfly.getY());
if (!isCellOccupied(neCell)){
allOccupied = false;
}
final HantoCell seCell = new HantoCell(butterfly.getX() + 1, butterfly.g... |
5018d80a-5abf-4833-8e83-87af69a41d5a | 2 | public void showItem(final Integer i) {
lastShownItem = i;
Item retrieved = currentAuctions.get(i);
ItemPanel panel = new ItemPanel(retrieved);
panel.addItemPanelListener(new ItemPanelListener() {
@Override
public void bidSubmitted(BidEvent e) {
BidRequest rq = new BidRequest();
rq.setSenderId(use... |
333d8c0b-3fed-4843-80f0-c22088005664 | 6 | public boolean compEnchant(Map<Enchantment, Integer> enchantments, Player play, String sAction, ArrayList<PaymentCache> aPayer) {
HashMap<String, ArrayList<EnchantTypeAdv>> hType = _jobsdata.getEnchantHash();
if (hType.isEmpty())
return false;
for(Map.Entry<String, ArrayList... |
261f28b8-9cf4-42f9-93bd-c4af8020c21c | 1 | public List<User> getAllUsers() {
List<User> users = null;
try {
beginTransaction();
users = session.createCriteria(User.class).list();
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSession();
}
return users;
} |
fc60f3e8-354d-4922-8a9f-e94652dec42e | 0 | public void keyTyped(KeyEvent e) {} |
694c9768-88eb-490e-8227-d7ec78bbeb53 | 7 | @Override
public void keyTyped(KeyEvent e) {
boolean pause;
switch (e.getKeyChar()) {
// Joueur
case 'q':
plateau.deplacementGauche();
break;
case 's':
plateau.modifierVitesse(4.0f*plateau.getVitesseBase... |
a0eb7eae-b157-4260-8770-1fd6b9468431 | 1 | protected APacket() {
//TODO: Add a history for the server the packet has been past over for preventing loop's
try {
getClass().getConstructor();
} catch(NoSuchMethodException e) {
e.printStackTrace();
log.fine("Missing default constructor in Packet class:"+getClass().getName());
throw new RuntimeExce... |
5673dd5f-e2aa-4b85-a7a1-e713ce9b59a5 | 1 | public int bowlScore(int[] bowl)
{
int score = 0;
for (int i = 0; i < bowl.length; i++)
{
score += pref[i] * bowl[i];
}
return score;
} |
b2cd7d9c-0d9e-476e-abca-aae1eee976b2 | 9 | private void addVisitsRecord(HttpServletRequest request, HttpServletResponse response, DatabaseConnection dbcon, Login credentials)
throws ServletException, IOException {
Visit v = null;
try
{
//the set ID part might be pretty messed up....
... |
91980e10-6ea1-436f-b64a-a1d6362a0deb | 0 | public void removeResult(int index) {
results.remove(index);
} |
56e2ffdf-cb7b-43b6-9cb4-0b6167d6ccae | 6 | private static String generateHtml(List<String> storesBySizeList , Set<QueryResult> results) {
StringBuilder sbuff = new StringBuilder() ;
sbuff.append("<h4>Queries per second</h4>\n\n") ;
if ( labels.size() > 0 ) {
sbuff.append("<blockquote>") ;
... |
23c52590-a768-49f6-9122-31ad68565226 | 1 | public void makeNameUnique() {
LocalInfo li = getLocalInfo();
String name = li.getName();
if (!li.isUnique) {
li.name = name + "_" + serialnr++ + "_";
li.isUnique = true;
}
} |
42851e75-0d6f-47b3-a30c-d271f59218ff | 0 | @Override
public ArrayList<Excel> getColoredExes() {
return coloredEx;
} |
eaab79a5-a785-46fa-8362-e21c3cc5d7b5 | 1 | public void test_DateTime_withHourZero_Turk() {
DateTime dt = new DateTime(2007, 4, 1, 8, 0, 0, 0, MOCK_TURK);
assertEquals("2007-04-01T08:00:00.000-04:00", dt.toString());
try {
dt.withHourOfDay(0);
fail();
} catch (IllegalFieldValueException ex) {
//... |
d6cdaeea-7a27-46a2-86c3-53b5d6bdab49 | 7 | private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
zzEndRead += zzFinalHighSurrogate;
zzFinalHighSurrogate = 0;
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartR... |
69a301d7-0c36-4d06-8d10-05eed53eab28 | 3 | @Override
public void setData(Object o) {
if(o instanceof Animation)
{
textField.text = ((Animation)o).getPath();
} else if(o instanceof String)
if(R2DFileUtility.R2DExists((String)o))
{
textField.text = (String)o;
textField.text = textField.text.replace('\\', '/');
}
} |
76dc5dce-02d1-4965-aba3-abc7008750cd | 3 | public boolean insertChild(int index, Row row) {
if (canHaveChildren()) {
int max;
row.removeFromParent();
if (index < 0) {
index = 0;
}
max = mChildren.size();
if (index > max) {
index = max;
}
mChildren.add(index, row);
row.mParent = this;
return true;
}
return false;
} |
9939a467-1605-4d1a-aae9-c96cb0798450 | 1 | public void testConstructor_invalidObject() throws Throwable {
try {
new MutableDateTime(new Object());
fail();
} catch (IllegalArgumentException ex) {}
} |
4f34f9c0-24fd-4af0-b011-15736c4d1208 | 4 | private void updateConfig(ButtonEvent event) {
for (OptionsField field : gui.getOptionsMenu().getOptionFields())
switch (field.getOption()) {
case HOSTNAME:
setHostname(field.submit());
break;
case PORT:
setPort(field.submit());
break;
case NICKNAME:
setNick(field.submit());
break;... |
a33afaa9-a0fd-4d87-b439-c53fd1a7e3f4 | 2 | @Override
public void startDocument() throws SAXException {
try {
response = clazz.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
} |
d0eb2987-4e13-4245-bca8-a5a243263afb | 4 | public void modifyBook(Book book) {
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
dbC... |
fda00114-00be-4dda-8feb-2518017dbb81 | 3 | public void draw(Graphics g){
for (int i=0;i<eHandler.length;i++) {
Entity e = eHandler[i];
if (e != null) {
g.drawImage(e.getSprite(), e.getX(), e.getY(), null);
if (debug) {
g.setColor(Color.green);
e.drawHitBox(g... |
39652809-7b78-4a92-a38c-d2b51c5236b1 | 1 | public long elapsed()
{
if(this.Run)
{
return System.currentTimeMillis() - this.StartTimeStamp;
}
else
{
return this.StopTimeStamp - this.StartTimeStamp;
}
} |
a706b332-3046-42bc-b1b1-ec7ba22a97ee | 8 | public boolean readRequest(Socket clientSock) {
StringBuffer contents = new StringBuffer();
try {
InputStream input = clientSock.getInputStream();
contents = readMessage(input);
if (contents == null) {
return false;
}
setCon... |
8aa2d4af-91d6-40bb-bc5d-b292305e2302 | 0 | @Override
public void deleteAttribute(int row, AttributeTableModel model) {
Node node = doc.tree.getEditingNode();
String key = (String) model.keys.get(row);
Object oldValue = node.getAttribute(key);
boolean oldReadOnly = node.isReadOnly(key);
node.removeAttribute(key);
model.keys.remove(row);
m... |
327d8025-ebf2-4457-9ebf-5b95df76aa20 | 7 | public void visitSourceFile(SourceFile node)
throws ACCError
{
emitter.emitPreamble(node);
emitter.emitSeparatorComment();
emitter.emitComment("Assembly file generated by");
emitter.emitComment("the AppleCore Compiler, v1.0");
emitter.emitSeparatorComment();
if (!node.includeMode) {
emitter.emitInclude... |
c0046631-80c7-412d-aa81-154e373e7a49 | 6 | private boolean equal(Gate g, GateTypes current) {
if (g.isXOR() && current == GateTypes.XOR) {
return true;
} else if (g.isAND() && current == GateTypes.AND) {
return true;
} else if (g.isINV() && current == GateTypes.INV) {
return true;
} else return false;
} |
ccc7443d-9ddd-4d3d-87a8-afbdf5f98608 | 3 | public void setExpLogica(PExpLogica node)
{
if(this._expLogica_ != null)
{
this._expLogica_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.par... |
24a68b3d-5da9-4126-a506-8a0b9a2f7161 | 7 | protected static void loadFolderInfo(String folderInfo, List<Path> localFolders) {
// load the local folders list
if (folderInfo.contains(File.pathSeparator)) {
// it's definitely a list
String[] paths = folderInfo.split(File.pathSeparator);
addLocalFolders( localFold... |
d47ddc41-fdd0-4a98-b01a-ef508bb377a5 | 6 | public void giveBack() {
Random random = new Random();
for (Loan l : this.getStockController().getStock().getLoans()) {
if (CalendarController.calendarToString(l.getEnd()).equals(
CalendarController
.calendarToString(new GregorianCalendar())... |
e9645a5a-9574-4627-bc86-51c564ec2f49 | 0 | @SuppressWarnings("unchecked")
public static <T> T newInstance(Object obj, Interceptor interceptor) {
return (T) java.lang.reflect.Proxy.newProxyInstance(
obj.getClass().getClassLoader(),
obj.getClass().getInterfaces(),
new ObjectProxy(obj, interceptor));
... |
8762504a-cc16-436a-a50d-1e0e980d20b5 | 9 | HashMap calculateMatchedList(ArrayList<ArrayList<String>> ActivityPeakUsers) {
HashMap matchedUserMap = new HashMap<String, ArrayList>();
ArrayList<String> matchedUser = new ArrayList<String>();
for (int a = 0; a < ActivityPeakUsers.size(); a++) {
ArrayList userA = new ArrayList();
ArrayList userB = new Ar... |
514554cc-f269-46b2-9edb-0b1ac938152b | 6 | public static Object findFirst(Object obj, String name) {
if(!(obj instanceof JsonObject)) {
return null;
}
JsonObject jo = (JsonObject)obj;
try {
if(jo.has(name)) {
return jo.get(name);
}
Iterator<Entry<String, JsonElement>> it = jo.entrySet().iterator();
while (it.hasNext()) {... |
9b0d553b-9e35-4d28-be67-90f548a27be1 | 3 | private static Transducer instantiate(Object object) {
if (object instanceof Class) {
try {
return (Transducer) ((Class) object).newInstance();
} catch (Throwable e) {
throw new IllegalArgumentException("Could not instantiate "
+ object + "!");
}
} else if (object instanceof Transducer) {
... |
0a0e1dc3-24b9-4199-a939-f70190dbfdb5 | 8 | @Override
public boolean onCommand(CommandSender sender, ItemStackRef itemStackRef, Command command, String label, String[] args) {
// Check the player is holding the item
ItemStack held = itemStackRef.get();
if (held == null || held.getTypeId() == 0) {
sender.sendMessage(plugin.... |
3c0e9c4f-5d82-4d9f-9f34-558e86317223 | 6 | public boolean applies()
{
if (os == null) return true;
if (os.name != null && os.name != OS.getCurrentPlatform()) return false;
if (os.version != null)
{
try
{
if (!Pattern.compile(os.version).matcher(OS.VERSION).matches())
{
... |
a85526df-f10c-44fa-9995-4eb7198b37d6 | 8 | void fillEllipse(int color, int xc, int yc, int a, int b){
/* e(x,y) = b^2*x^2 + a^2*y^2 - a^2*b^2 */
int x = 0;
int y = b;
int width = 1;
long a2 = (long)a*a;
long b2 = (long)b*b;
long crit1 = -(a2/4 + a%2 + b2);
long crit2 = -(b2/4 + b%2 + a2);
l... |
04089015-9d46-4290-9937-04f8f425e722 | 1 | protected static TinyBundle createTestBundle(String name, String version, String descriptors) throws FileNotFoundException, MalformedURLException {
TinyBundle bundle = TinyBundles.newBundle();
for (URL url : getBlueprintDescriptors(descriptors)) {
LOG.info("Using Blueprint XML file: " + url.... |
fb2e726d-b692-444f-88ec-88f4916f7fe2 | 1 | public void exportAsTXT() throws IOException{
out.write("[!] BACKUPED "+sms.size()+ " SMS.");
out.newLine();
for (SMS s : sms) {
out.append("From: "+s.getAddress() + " at: "+DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(s.getDate())+ " with text: "+s.getText());
out.newLine();
... |
6182a89b-9fff-42e5-9415-21fd692f23fd | 8 | public static String createJSON(OdeAccess[] graphs) {
StringBuffer sb = new StringBuffer(graphs.length * 512);
sb.append("[");
boolean first = true;
int x0 = 0;
int y0 = 0;
int mw = 0;
int mh = 0;
for (OdeAccess graph : graphs) {
int mX = 0;
int mY = 0;
for (Visode v : graph.getVisodes())... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.