method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
76b9ef7b-9e56-44ee-b39b-639f88ed33d5 | 5 | public void actionPerformed(ActionEvent e) {
if (aliens.size()==0)
{
ingame = false;
}
ArrayList ms = prometheus.getMissiles();
for (int i = 0; i < ms.size(); i++)
{
Missile m = (Missile) ms.get(i);
if (m.getIsVisible())
... |
87a143d4-76b7-4620-8c33-273588a022c7 | 3 | public boolean findAtEast(int piece, int x, int y){
if(y==7 || b.get(x,y+1)==EMPTY_PIECE) return false;
else if(b.get(x,y+1)==piece) return true;
else return findAtEast(piece,x,y+1); // there is an opponent
} // end findAtEast |
9c6c88f0-dbf7-4e63-a2cb-79947fd2bcb8 | 4 | public boolean isFuelBlock(int itemID)
{
boolean res = false;
if((fuelBlocksGroupIDlist_Wool.contains(itemID)) ||
(fuelBlocksGroupIDlist_CraftedWood.contains(itemID)) ||
(fuelBlocksGroupIDlist_Log.contains(itemID)) ||
(fuelBlocksGroupIDlist_CoalOre.contains(itemID)))
... |
cde87aed-a449-4467-adee-9614af49a663 | 3 | @Override
public Node getNodeAtIndex(int index) {
// TODO Auto-generated method stub
assert !isEmpty() && (1<=index && index<=size);
Node currentNode=firstNode;
for (int count=0;count<index;count++){
currentNode=currentNode.getNext();
}
assert currentNode!=null;
return currentNode;
} |
f393eb19-cd18-46b6-87b4-09afad048f6e | 1 | protected void shift() throws IOException {
int bit = (int)(low >>> (STATE_SIZE - 1));
output.write((byte)bit);
// Write out saved underflow bits
for (; underflow > 0; underflow--)
output.write((byte)(bit ^ 1));
} |
9bc14c54-5461-4ada-8986-d166fa3d67ae | 2 | protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String url = "/";
PurchaseViewHelper purchaseViewHelper =
ViewHelperFactory.getInstance().getPurchaseViewHelper(req);
Customer customer = (Customer) req.getSession().getAttribute("loggedInC... |
30cb6fee-cbe7-4840-902c-61ae895f5e94 | 4 | public void setPriority(byte byte0, int i, int j) {
if (clientInstance.caches[0] == null)
return;
if (versions[i][j] == 0)
return;
byte abyte0[] = clientInstance.caches[i + 1].decompress(j);
if (crcMatches(versions[i][j], crcs[i][j], abyte0))
return;
filePriorities[i][j] = byte0;
if (byte0 > highes... |
7d94d5c5-087a-4a18-96f6-99a417d5e80f | 0 | public boolean isRunning(){
return running;
} |
0c4ffc36-ee8c-4321-b365-c4a5a34d39b8 | 9 | public String[] getClaims()
{
if(claims!=null)
return claims;
String s=getParmsNoTicks();
if(s.length()==0)
{ claims=defclaims; return claims;}
final char c=';';
int x=s.indexOf(c);
if(x<0) { claims=defclaims; return claims;}
s=s.substring(x+1).trim();
x=s.indexOf(c);
if(x<0) { claims=defclaims... |
a5f01b0b-b7b7-41ae-94b5-b377a1456587 | 8 | private void choosePrefixes() {
if (options.defaultNamespace != null) {
if (defaultNamespace != null && !defaultNamespace.equals(options.defaultNamespace))
warning("default_namespace_conflict");
defaultNamespace = options.defaultNamespace;
}
else if (defaultNamespace == null)
defau... |
5150111f-bee0-4239-b435-7fa4284558b0 | 7 | @Override
protected void run()
{
Set<UUID> objectsWithComponent = objectManager.getAllObjectsWithComponent(HCKeyMotion.class);
if (objectsWithComponent.isEmpty()) {
return;
}
keyboard.update();
if (keyboard.esc) System.exit(0);
for (UUID o : objectsWithComponent) {
HCVelocity v... |
0ee17bea-6b6b-4741-848d-eeda7ccbabb0 | 2 | public boolean lootSpice() {
GroundItem spice = Util.getSpice();
if (spice != null && spice.isOnScreen()) {
Mouse.move(spice.getCentralPoint(), 30, 50);
return (spice.interact("Take", spice.getGroundItem().getName()));
} else {
Camera.setPitch(Random.nextInt(40, 90));
Camera.setAngle(Camera.getMobileA... |
4e45a4f7-e846-45d9-a636-044e4e3f2b26 | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
ac47cf51-237c-4ff7-8002-2c1639485648 | 8 | public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new FileReader(new File(
ConfigReader.getMbqcDir() + File.separator + "dropbox" + File.separator +
"raw_design_matrix.txt")));
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(
Con... |
7db50656-1682-4a49-939c-40f9fc81135c | 0 | @Override
public CarType[] getCarTypes() {
return this._carTypes;
} |
8a301648-2c71-4752-9025-72550ee61369 | 1 | public void add(InstrInfo info) {
if (info.nextTodo == null) {
/* only enqueue if not already on queue */
info.nextTodo = first;
first = info;
}
} |
0c961e71-03c3-47d1-9d3f-fb45ee4ba7a2 | 1 | public void render(Graphics g) {
if (image != null) {
int xPos = particleEmitter.mapToPanelX((int)mapX);
int yPos = particleEmitter.mapToPanelY((int)mapY);
//flip the yPos since drawing happens top down versus bottom up
yPos = particleEmitter.getPHeight() - yPos;... |
ed1b48b8-6317-4e7d-a96c-55b747d9b004 | 6 | public static String numberToString(Number number)
throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
... |
0654671a-83fb-49b7-94cf-074a8c0eb67c | 4 | public void setJSONList (JSONObject obj) {
try {
JSONArray fileList = obj.getJSONArray("files");
if (fileList.length() > 0) {
for (int i = 0; i < fileList.length(); i++) {
JSONObject single = fileLis... |
af180c20-9868-4413-a55d-129f669c8a87 | 9 | static boolean isPDConstructor(Statement stmt) {
Object target = stmt.getTarget();
String methodName = stmt.getMethodName();
Object[] args = stmt.getArguments();
String[] sig = new String[pdConstructorSignatures[0].length];
if (target == null || methodName == null || args == null... |
f7cab6e4-a968-4875-972d-39183f332e94 | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if... |
fd4589a5-ad62-4b44-b211-8b71ab686f4f | 3 | public static void clearEditable(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
JoeNodeList nodeList = tree.getSelectedNodes();
for (int i = 0, limit = nodeList.size(); i < limit; i++) {
clearEditableForSingl... |
3316a084-167a-4954-b872-c6cabc33921a | 9 | public static void main(String[] args) {
try {
if(args.length == 2){
String xpath=args[0];
String path =args[1];
FileInputStream file = new FileInputStream(new File(path));
DocumentBuilderFactory builderFactory = DocumentBuilderFact... |
e103b3f6-4376-4ddf-ac29-6350ee14b1bc | 4 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
/*Metodo que muestra los datos de los clientes almacenados al ingresar su rut, si este no está registrado,
* permite la adicion de sus datos, además muestra el valor total de la venta
*/
... |
1324906d-e059-466b-a971-d4e825b71b88 | 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... |
c0a49268-5f5d-4e5a-9b7a-29de535846b3 | 5 | private boolean testSymmetry(int ks, int bs) {
try {
IMode mode = (IMode) this.clone();
byte[] iv = new byte[cipherBlockSize]; // all zeroes
byte[] k = new byte[ks];
int i;
for (i = 0; i < ks; i++) {
k[i] = (byte) i;
}
int blockCount = 5;... |
d0b0cde3-3923-454d-8ac6-4a35cf0537e6 | 7 | public static void main(String args[])
{
final History history = new History();
if (Constants.DEBUG)
{
System.out.println("History: " + history.toString());
}
final ProbabilityGenerator probabilityGen = new ProbabilityGenerator(history);
final Random ran... |
bfc4f359-e165-443d-b105-9ee0f84ee5e4 | 2 | public Rectangle getBounds() {
if(width == 0 || height ==0) return new Rectangle(-100, -100, 1, 1);
return new Rectangle((int)drawX, (int)drawY, width, height);
} |
c4e0a2d8-d888-4946-b258-642beb2cca2e | 3 | private int jjMoveStringLiteralDfa1_2(long active0)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return 1;
}
switch(curChar)
{
case 47:
if ((active0 & 0x100L) != 0L)
return jjStopAtPos(1, 8);
break;
default :
return 2... |
c0a59bb2-2232-43bf-a9c9-abaae6775e32 | 4 | public void untapAll(int player) {
for (Object e : table.getComponents()) {
if ((e.getClass().equals(TCard.class)
|| e.getClass().equals(Token.class))
&&((TCard) e).getID().charAt(0) == 'A' + player) {
((TCard) e).untap();
}
... |
6ffcd1b1-9642-4cea-a065-c425cff94a2a | 3 | public Matrix multSlow(Matrix m) {
Matrix n = new Matrix();
for (int c = 0; c != 4; c++) {
for (int r = 0; r != 4; r++) {
float v = 0;
for (int k = 0; k != 4; k++)
v += get(k, r) * m.get(c, k);
n.set(c, r, v);
}
}
return n;
} |
f3b949be-cdec-4405-87fa-dc3e7de9c107 | 0 | public List findAll() {
//return (List) getEntityManager().createQuery("FROM " + getObjectType().getSimpleName()).setHint("org.hibernate.cacheable", true).getResultList();
return (List) getEntityManager().createQuery("FROM " + getObjectType().getSimpleName()).getResultList();
} |
f692f855-393a-4b74-b027-6c88510f6bdc | 2 | private boolean canServeUri(String uri, File homeDir) {
boolean canServeUri;
File f = new File(homeDir, uri);
canServeUri = f.exists();
if (!canServeUri) {
String mimeTypeForFile = getMimeTypeForFile(uri);
WebServerPlugin plugin = mimeTypeHandlers.get(mimeTypeForF... |
e2d1a965-87a8-48e4-a655-7f5142a7de5d | 3 | protected Value getElementValue(final Value objectArrayValue)
throws AnalyzerException {
Type arrayType = ((BasicValue) objectArrayValue).getType();
if (arrayType != null) {
if (arrayType.getSort() == Type.ARRAY) {
return newValue(Type.getType(arrayType.getDescriptor()
.substring(1)));
} else if ... |
6ec45b60-aa13-47cd-9124-2def5c6d6932 | 9 | public Pattern simplify(ExpressionVisitor visitor) throws XPathException {
// detect the simple cases: no parent or ancestor pattern, no predicates
if (parentPattern == null &&
ancestorPattern == null &&
filters == null &&
!firstElementPattern &&
... |
01a4a7b0-b4a6-4c91-917b-42d5ba977478 | 3 | public int length()
{
int total = 0;
for ( int i=0;i<rows.size();i++ )
{
Row r = rows.get( i );
for ( int j=0;j<r.cells.size();j++ )
{
FragList fl = r.cells.get( j );
for ( int k=0;k<fl.fragments.size();k++ )
... |
d18b2c19-7db4-479b-97ce-0527962b779f | 2 | @Override
public String toString () {
StringBuilder sb = new StringBuilder(TrackerResponse.class.getSimpleName());
sb.append("{");
if (failed) {
sb.append("FailureReason=\"");
sb.append(failureReason);
sb.append("\"");
} else {
sb.app... |
fff224a1-6c12-44d4-902c-fbfa9f3e3f61 | 3 | public double infoX(Integer featureId) {
double result = 0D;
for (String fValue : Feature.possibleFeatures.get(featureId).getPossibleValues()) {
double positive = 0.0;
double negative = 0.0;
for (ClassifiableObject co : partitionedObjects.get(fValue)) {
if (co.isAcceptable()) {
positive++;
} e... |
5d119b1c-05fc-4793-87b3-df00ee326a0b | 8 | public boolean uniformCostSearch(int root_id,int value){
rootNode=g.all_nodes.get(root_id);
frontier.insert(rootNode,1);
rootNode.is_discovered=true;
rootNode.totalcost=0;
while(!frontier.isEmpty()){
Node n = (Node)frontier.getItem();
if(n.node_id==value){
output.append("found it!\n");
bac... |
c33bab8d-7b17-4fc1-ab9c-c53f6a8cb9b3 | 6 | @Override
public void sendDeath(Entity source) {
final NPCCombatDefinitions defs = getCombatDefinitions();
final NPC npc = (NPC) source;
resetWalkSteps();
getCombat().removeTarget();
setNextAnimation(null);
// deathEffects(npc);
WorldTasksManager.schedule(new WorldTask() {
int loop;
@Override
p... |
75f40376-45d3-450c-a567-85ef6f0feed6 | 2 | private void processMoveResult(String result, CardMove move) {
if (result.isEmpty()) {
game.getHistory().push(move);
} else if (!result.equals("ONTO_SELF")) {
storeError(result);
}
} |
93c6b681-a2f3-4abd-a26e-40f98ddaec90 | 9 | public void viewAccepted(View v) {
member_size=v.size();
if(mainFrame != null)
setTitle();
members.clear();
members.addAll(v.getMembers());
if(v instanceof MergeView) {
System.out.println("** " + v);
// This is an example of a simple merge fu... |
e03d39f2-b504-4ec6-a314-c163ada0502f | 8 | private Quest getQuest(String named)
{
if((defaultQuestName.length()>0)&&(named.equals("*")||named.equalsIgnoreCase(defaultQuestName)))
return defaultQuest();
Quest Q=null;
for(int i=0;i<CMLib.quests().numQuests();i++)
{
try
{
Q = CMLib.quests().fetchQuest(i);
}
catch (final Exception e)
... |
53f3ab18-ad66-4483-b588-8a4efc31d7f0 | 7 | private Face getTurn(Face direction){
int leftAmount = 0;
switch (playerDirection){
case NORTHERN:
//no need compute anything else here
return direction;
case WESTERN:
leftAmount = 1;
break;
case SOUTHERN:
leftAmount = 2;
break;
case EASTERN:
leftAmount = 3;
default:
break;
}
... |
f59b9401-949c-4a9f-a804-9f55d459fdd5 | 4 | public void calculateGPA(Scanner a_scan)
{
System.out.println("Please Select Method to Choose Student(1 or 2): "+"\n1)Search student by Name,\n2)Search Student by techID)");
Student s1;
switch (getMenuChoiceNameOrId(a_scan))
{
case 1:
{
s1 = findStudent(inputStudentName(a_scan));
if (s1 == ... |
d9f6ff3e-8306-47e1-8197-0a09b812830d | 8 | public void update1(float time){//@override Entity
Vector2 tempForce;
LinkedList<MyPoint> temp = new LinkedList<MyPoint>();
for (Link l : neighbors){
tempForce = Vector2.vecSubt(l.other.getPos(), this.pos);
if (tempForce.length() > l.len * breakLength){
temp.add(l.other);
}
}
for (MyPoint p : tem... |
162aa43f-400c-484c-82be-977bb4630722 | 4 | public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
thr... |
ddc126e0-4d8b-4c49-a595-781c6c36f755 | 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 Policeofficer)) {
return false;
}
Policeofficer other = (Policeofficer) object;
if ((this.policeOfficerID == nu... |
384a5489-b6ba-41a2-ac44-197ced5a3d2a | 9 | private void writeSubStreamsInfo(
List<Folder> folders,
List<Integer> numUnpackStreamsInFolders,
List<Long> unpackSizes,
List<Boolean> digestsDefined,
List<Integer> digests) throws IOException {
writeByte((byte) Header.NID.kSubStreamsInfo);
fo... |
70d030db-6eff-43d3-9bb0-83cec778f3d1 | 9 | public static void undefineModule(Module oldmodule, Module newmodule) {
System.out.println("Redefining the module `" + oldmodule.contextName() + "'");
if (Stella.$SUBCONTEXT_REVISION_POLICY$ == Stella.KWD_DESTROY) {
oldmodule.destroyContext();
return;
}
else if (Stella.$SUBCONTEXT_REVISION_P... |
9e14088a-7543-4ddc-9935-1db22527949f | 5 | public String diff_prettyHtml(LinkedList<Diff> diffs) {
StringBuilder html = new StringBuilder();
int i = 0;
for (Diff aDiff : diffs) {
String text = aDiff.text.replace("&", "&").replace("<", "<")
.replace(">", ">").replace("\n", "¶<br>");
switch (aDiff.operation) {
... |
ff09ff26-9345-44e9-b9e3-5dacb31684ac | 6 | public Card(int theValue, int theSuit) {
if(theSuit != SPADES && theSuit != HEARTS && theSuit != DIAMONDS &&
theSuit != CLUBS )
throw new IllegalArgumentException("Illegal playing card suit");
if(theValue <1 || theValue >13)
throw new IllegalArgumentException("I... |
7081232b-1275-438b-9c73-4b6a6811562e | 0 | public DocumentRepositoryEvent(Document doc) {
setDocument(doc);
} |
c35a1485-4bd3-467b-8c32-405c9ed45248 | 7 | @SuppressWarnings("resource")
public Class<?>[] getClassesFromThisJar(Object object)
{
final List<Class<?>> classes = new ArrayList<Class<?>>();
ClassLoader classLoader = null;
URI uri = null;
try
{
uri = object.getClass().getProtectionDomain().getCodeSource()... |
bb4a6d11-5b35-4a7f-853a-e14493c199d0 | 2 | @Override
public boolean equals(Object object) {
if (this == object)
return true;
if (!(object instanceof AlgoChecksumType))
return false;
AlgoChecksumType other = (AlgoChecksumType)object;
return this.name.equalsIgnoreCase(other.toString());
} |
25e191f1-59eb-43e5-a64c-6c401f94e868 | 4 | public static void main(String[] args)
{
HashMap<Integer,GameData> g=new HashMap<Integer,GameData>();
Vector<Integer> index=new Vector<Integer>();
CalculatingConsole c = new CalculatingConsole();
HashMap<String,PlayerData> p =new HashMap<String,PlayerData>();
for(File f: new File("./").listFiles())
{
S... |
09891752-0d1d-49db-bafb-3adfbe438f39 | 6 | public Point makeAIMove(OthelloBoard board) {
/** < store the maximum number of the pieces that are flipped */
int m_MaximumFlips = 0;
/** < store all the computer hard move point with the maximum piece flip number */
ArrayList<Point> m_BestFlips = new ArrayList<Point>();
... |
9c07b29a-0f41-43ab-a4a3-ce249e034e56 | 2 | private void addProgram(String text, int type){
int shader = glCreateShader(type);
if (shader == 0){
System.err.println("Shader creation failed, could not find valid memory location when adding shader");
System.exit(1);
}
glShaderSource(shader,text);
gl... |
92981011-ade5-40cf-bc2a-21af5b75f3af | 4 | public static BufferedImage stamp(BufferedImage input) {
int stamp[][] = new int[][]{
{0, 1, 0},
{-1, 0, 1},
{0, -1, 0}
};
BufferedImage result = new BufferedImage(input.getWidth(), input.getHeight(), input.getType());
for (int i = 0; i... |
47013475-6049-4998-af55-1eeb5092e612 | 1 | public void setTileAt(int tx, int ty, Tile ti) {
if (bounds.contains(tx, ty)) {
map[ty - bounds.y][tx - bounds.x] = ti;
}
} |
c1178f94-bc01-479d-b73f-c4b30945942b | 1 | private double RD2lng(double x2, double y2) {
// TODO Auto-generated method stub
double a=0;
double dX=1E-5*(x2-X0);
double dY=1E-5*(y2-Y0);
for(int i = 1; 13 > i; i++)
a+=lngpqK[i].K*Math.pow(dX,lngpqK[i].p)*Math.pow(dY,lngpqK[i].q);
return lng0 + a / 3600;
} |
ababad4e-cdb5-44cc-9a18-9b4dd0b7028d | 0 | public static void main(String[] args) {
List<Integer> numberList = new ArrayList<Integer>();
numberList.add(5);
numberList.add(6);
numberList.add(7);
//sum of all numbers
// sumWithCondition(numbers, n -> true);
//sum of all even numbers
sumWithCondition(number... |
23919420-d7eb-4eea-a3a5-f7f2294e78e5 | 1 | public static void spawnFoodFight (Location loc, int amount) {
int i = 0;
while (i < amount) {
Skeleton FoodFight = (Skeleton) loc.getWorld().spawnEntity(loc,
EntityType.SKELETON);
LeatherArmorMeta meta;
LeatherArmorMeta legMeta;
ItemSt... |
fc368695-d58f-4f87-b25e-065efe4d5fc9 | 3 | private EnumMap<JobType, Long> totalTimesForJobs(){
EnumMap<JobType, Long> out = new EnumMap<JobType, Long>(JobType.class);
out.put(JobType.COMBINE, 0l);
out.put(JobType.COMPRESS, 0l);
out.put(JobType.DOWNLOAD, 0l);
out.put(JobType.FORWARD, 0l);
out.put(JobType.UNKNOWN, 0l);
out.put(JobType.WAITING, 0l);
... |
6c99379e-040d-4f3f-9d12-7b4d36b577c0 | 9 | public synchronized void save() {
if (image == null) return;
if (fc == null) {
String[] paths = {
System.getProperty("user.home") + File.separator + "Pictures",
System.getProperty("user.home") + File.separator + "My Pictures",
System.getProperty("user.home") + File.separator + "Documents" + Fil... |
87ac99c5-81df-4960-b02b-64d544624140 | 3 | public static int loadGame(){
// Get user input
Object[] options = {"1", "2", "3"};
int slot = JOptionPane.showOptionDialog(null, "Select your save slot", "Save Slot", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
slot++;
// Find appropriate save directory for OS
S... |
1dd22dbc-4d3b-494d-af61-f23fc4de3d6b | 1 | public Block domParent(final Block block) {
if (domEdgeModCount != edgeModCount) {
computeDominators();
}
return block.domParent();
} |
db1f9622-7b27-4b90-b840-9eccb6c259bf | 1 | public void emptyField(){
for(int i = 0; i < fieldSize; i++) {
araseLine(i);
}
} |
060cbd24-1da6-446e-bf4d-6d4af2b1cf0c | 4 | @Override
boolean isColliding(int p_X, int p_Y){
//Do something
if(p_X > (posX-10) && p_X < (posX+width+10))
{
if(p_Y > (posY-10) && p_Y < (posY+height+10))
{
return true;
}
}
return false;
} |
583df319-18d8-410a-a0fe-fc25723c268a | 0 | public boolean contains(Component component) {
return tabbed.indexOfComponent(component) != -1;
} |
b23d2226-ce35-4553-a01a-f225cae67fbc | 9 | private static List<Integer> parseRange(String range, int max) {
List<Integer> idx = new ArrayList<Integer>();
String[] n = range.split(",");
for (String s : n) {
String[] d = s.split("-");
int mi = Integer.parseInt(d[0]);
if (mi < 0 || mi >= max) {
... |
389750dd-d792-4fd5-a90a-8b411467812b | 2 | public int getBeingByPosition(double x, double y){
for (int i = 0; i < beings.size(); i++){
if ( sqrt( (x - beings.get(i).getX())*(x - beings.get(i).getX()) + (y - beings.get(i).getY())*(y - beings.get(i).getY())) < RADIUS_TOUCH_DETECT ){
return i;
}
}
re... |
58eb7825-f415-4061-96fc-6dd3a3b7631c | 6 | public String isOne(String[] words) {
if(words.length<=1)
return "Yes";
for(int i=0;i<words.length;i++){
for(int j=0;j<words.length;j++){
if (words[j].startsWith(words[i]) && !words[j].equals(words[i])) treeMap.put(words[i], i);
}
if(treeMa... |
62e08ed1-9b39-4138-af08-5cfbb8f7ca06 | 5 | static final void method887(Widget class46, int i, int i_5_, int i_6_) {
if (i_6_ == 2147483647) {
anInt1589++;
if (Class289.aClass46_3701 == null && !Class5_Sub1.aBoolean8335
&& (class46 != null
&& (ToolkitException.method141(class46, (byte) -79)
!= null))) {
Class289.aClass46_3701 = class46;
... |
b254ef5b-3507-400a-b20e-ee43a0e82af7 | 9 | private boolean flipHorizontal(long binPosition, boolean goesRight){
boolean hasFlippableDisk = false;
long searchPosition = binPosition;
if(goesRight && (binPosition & 0x0101010101010101l) == 0)
searchPosition = binPosition >> 1;
else if( !goesRight && (binPosition & 0x808... |
8a7e7445-e841-4d4c-a965-1c8ea33dbdaa | 2 | boolean isValidReportDirectory(File dir) {
File jsonFile = new File(dir, "jscoverage.json");
File srcDir = new File(dir, Main.reportSrcSubDir);
return isValidDirectory(dir) && isValidFile(jsonFile) && isValidDirectory(srcDir);
} |
afa3054a-c4d9-41c3-bf48-a37ea4bc16fb | 5 | private void writeHql(ArrayList<String> colName, ArrayList<String> colType, ArrayList<String> colRemark, String tabComments) {
StringBuffer content=new StringBuffer();
content.append("USE "+data_db_name.toUpperCase()+";\n");
content.append("DROP TABLE "+tn.toUpperCase()+";\n");
content.a... |
185fee07-9bd2-4a72-91bb-02d3fe02f521 | 2 | public ArrayList<ArrayList<Integer>> permute(int[] num) {
LinkedList<TailStack<Integer>> mappers = search(num.length);
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
for (TailStack<Integer> mapper : mappers){
ArrayList<Integer> tmp = new ArrayList<Integer... |
d4bcf338-652d-47b0-b623-d8528bc4df63 | 0 | public void setLSmsOverTime(int second){
this.pconnect.setLSmsOverTime(second);
} |
9885031b-0138-41b5-b85e-981b160d9900 | 0 | public String getRawMessage(){ return RawMessage; } |
b469ef9e-4fe6-41c5-bcfd-c01aaec464bc | 9 | private void reDraw()
{
hitCount = 0;
p.removeAll();
for(int i = 0; i < nums.length; i++)
{
for(int j = 0; j < nums[0].length; j++ )
{
if( nums[i][j] == 0)
p.add( dots[i][j] == 0 ? (new JLabel (groun... |
04248a13-d1ef-4086-879a-d708753881e1 | 1 | public void setCapacidade(int capacidade) {
this.capacidade = (capacidade >= 0) ? capacidade : 0;
} |
649aceb8-2c6b-4fb0-8f0f-c8663af59aa9 | 2 | @Override
public void registerDirty(IDomainObject domainObject) {
assert domainObject.getId() != null : "id not null";
assert !removedObjects.contains(domainObject) : "object not removed";
if (!dirtyObjects.contains(domainObject) && !newObjects.contains(domainObject)) {
dirtyObjects.add(domainObject... |
95be17f7-05d8-4b24-a300-c543a46ed4d8 | 6 | @Override
public void characters(char[] ch, int start, int length) throws SAXException {
try {
int end = start + length;
while ((start < end) && (ch[start] <= ' ')) {
start++;
}
while ((start < end) && (ch[end - 1] <... |
27a44c63-845c-4383-8855-6a74cf067336 | 0 | public ProjectWizardView() {
setSize(500, 500);
setVisible(true);
} |
ce0cc626-4f85-4c3d-b255-f79b5779a4f1 | 3 | public void crossFold10(String fileLoc){
Instances data = null;
BufferedReader reader = null;
System.out.println("---------------Running Crossfold10 Testing Using Random Forrest On Data---------------");
// Need to build data to fit into evaluation
try {
//Read in data from the .arff file
reader =... |
d0aa4b74-00ac-4ed1-a558-d840147c5b3b | 9 | public View render(View convertView, final Context context, FeedView feedView) {
// Set up the view holder
if(convertView == null) {
convertView = super.render(convertView, context, feedView);
holder = new ViewHolder();
holder.achievementIconView = (Image... |
00716bbd-21d1-4435-8fce-41512e13c451 | 4 | @Override
public String toString() {
StringBuilder theString = new StringBuilder();
theString.append("[");
for (int i = 0; i < this.length; i++) {
theString.append("[");
for (int j = 0; j < this.width; j++) {
theString.append(this.cells[i][j].toBit());
if (j < this.width - 1)
theString.append(... |
d9af1e50-db61-4a6e-8ab5-17331db772e7 | 2 | public boolean Salvar(Estoque obj , int idPessoa){
try{
boolean retorno= false;
if(obj.getId() == 0){
PreparedStatement comando = conexao
.getConexao().prepareStatement("INSERT INTO estoques (id,quantidade) VALUES (?,?)");
comando.s... |
0c7c20fe-80d5-4f15-aacd-077d69c72721 | 6 | public boolean checkPassword(String pass){
boolean band = true;
int i=0;
for(int x=0;x<4;x++){
if(pass.charAt(x)<48 || pass.charAt(x)>57)
return false;
}
while(band == true && i <= numClientes){
if(pass.equals(clientes[i].getPassword()))
band = false;
else
i++;
}
return band;
} |
e810f0f0-f74a-410c-beff-505aefb214c0 | 2 | private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
String[] options = {"Minimize", "Cancel", "Exit"};
int rsp = JOptionPane.showOptionDialog(null, "Are u making the right decision?", "Message", 0,
JOptionPane.QUESTION_MESSAGE, null, optio... |
8974529c-e0a6-40da-8b92-743f2f4d06a6 | 9 | private void checkFirstOrder(){
SVA_Sketch sketch = sketchQueue[(tail-1) % MAX_QUEUE_SIZE];
Timestamp currentTime = sketch.time;
System.out.println("Checking..." + currentTime);
{
double s = sketch.s.zeroOrder.getValue(currentTime, 0);
for(int h = 0; h < H; h ++){
double C = 0;
for(int i = 0; i < ... |
20a66bbb-b7a3-439a-92c8-d789189ecfbc | 3 | public void showPanTip()
{
String tipText = null;
Point upperLeft = new Point(0, 0);
JViewport vp = getEnclosingViewport();
if (!isPannableUnbounded() && vp != null)
upperLeft = vp.getViewPosition();
Location loc = locationForPoint(upperLeft);
if (loc != n... |
38e755c3-c532-45df-a020-eeeb1b76a7cc | 8 | public int countCoins(String state) {
int coins = state.length();
if ((coins == 0) || (coins == 1)) {
return 0;
}
char[] coinsArray = state.toCharArray();
if (coinsArray[0] != coinsArray[1]) {
return 2;
}
int count = 0;
if (coinsArray[0] != coinsArray[1]) {
count = 2;
}
for (int i = 1;... |
5d73901b-4ab2-47f8-8e7b-774126ba322d | 2 | public void draw(Graphics2D g2d) {
if (x != -1 && y != -1) {
g2d.drawImage(img_cannon, x, y, null);
missile.draw(g2d);
}
} |
95290ef4-f745-4998-bcb3-1bf7523c4093 | 3 | @Override
public void onPlayerJoin(PlayerJoinEvent event) {
tellUpdate = this.config.yml.getBoolean("Update.Notifications", true);
Player player = event.getPlayer();
if ((!player.isOp() && !player.hasPermission("bcs.admin")) || !tellUpdate) {
return;
}
this.plugin... |
4c1393b3-0e7d-42b0-8a6b-812ea9aa84c1 | 0 | public String getId() {
return delegate.getId();
} |
c2709ace-aa3b-4023-88b7-11be31335850 | 6 | public JSONObject getAnswersTag(int USER_ID,int QUESTION_ID)
{
try {
Class.forName(JDBC_DRIVER);
conn=DriverManager.getConnection(DB_URL,USER,PASS);
stmt=conn.createStatement();
json=new JSONObject();
String SQL="Select * from ANSWERS where QUESTION_ID="+QUESTION_ID;
... |
0f06efc6-63f0-4b98-a205-b4539ffac5ca | 5 | @Override
public void map(LongWritable key, Text value,
OutputCollector<Text, IntWritable> output, Reporter reporter)
throws IOException {
// TODO Auto-generated method stub
boolean start = false;
String line = value.toString();
Pattern title_pattern = Pattern.compile("<title>.*</title>");
Matche... |
472f741e-8046-4b55-aa49-74cf1206af18 | 1 | @SuppressWarnings("unchecked")
public static final <T> TypeHandler<T> getTypeHandler(Class<T> cls) {
TypeHandler<T> res = (TypeHandler<T>) typehandlers.get(cls);
if (res == null) {
throw new EncodingException("No handler registered for class: " + cls.toString());
}
return... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.