method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b1f48b21-12af-4f01-bc8a-03d4ef7bfb31 | 8 | public Vector<Door> nearbyDoors(Game game)
{
Vector<Door> doors = new Vector<Door>();
for (Tile tile: game.getMap().getTiles())
{
// Ignore non-doors
if (!(tile instanceof Door))
continue;
Door door = (Door)tile;
// Ignore open doors
if (door.getState() == Door.OPEN)
continue;
... |
1ca681f6-cf08-4ddc-99d1-95e208cd6183 | 3 | public void mouseDragged(MouseEvent e)
{
Main.mse.setLocation(e.getX()/Main.pixelScale, e.getY()/Main.pixelScale);
if(Main.isMouseLeft) //left click
{
}
else if(Main.isMouseMiddle) //middle click
{
}
else if(Main.isMouseRight) //right click
{
}
} |
22b3e3ed-4e34-4dd6-a487-87f6ebea338d | 5 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource()==submitButton) {
if (sectionPanel.submitSection()) {//if submit succeed
JFrame rootFrame=(JFrame)scrollPane.getRootPane().getParent();
//rootFrame.dispose();
//this.dispose();... |
357a80a3-193c-4809-ac26-6d53e8d452cf | 8 | protected void paintLoweredBevel(Component c, Graphics g, int x, int y, int width, int height) {
Color oldColor = g.getColor();
int h = height;
int w = width;
g.translate(x, y);
g.setColor(getShadowInnerColor(c));
if (hidenSide != BorderLayout.WEST)
g.drawLine(0, 0, 0, h - 1);
if (hidenSide != Borde... |
4cd3b80d-a96a-48d7-a136-d0a8eaba5b86 | 2 | @Override
public PostGameCommandsResponse postGameCommands(Log commands, String cookie) {
ArrayList<Pair<String,String>> requestHeaders = new ArrayList<Pair<String,String>>();
requestHeaders.add(new Pair<String,String>(COOKIE_STR, cookie));
requestHeaders.add(new Pair<String,String>(CONTENT_TYPE_STR, APP_JSON_ST... |
10138f23-ad33-4fcf-a360-f1ae5e519225 | 7 | private static boolean modifyPatient(Patient bean, PreparedStatement stmt, String field) throws SQLException{
String sql = "UPDATE patients SET "+field+"= ? WHERE pid = ?";
stmt = conn.prepareStatement(sql);
if(field.toLowerCase().equals("primarydoc"))
stmt.setString(1, bean.getPrimaryDoc());
if(fie... |
b4cf35db-f072-4888-8736-b9ddaa99098d | 2 | @Override
public void run() {
setVisible(true);
while (true) {
long tEnd = System.currentTimeMillis();
long tDelta = tEnd - tStart;
double elapsedSeconds = tDelta / 1000.0;
if (elapsedSeconds > delay) {
tStart = System.currentTimeMillis... |
310e4577-eaf1-42e1-b76d-6eb9f97ade03 | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) { return false; }
if (getClass() != obj.getClass()) { return false; }
final Rdv other = (Rdv) obj;
if (!Objects.equals(this.dateRdv, other.dateRdv)) { return false; }
if (!Objects.equals(this.patient, other.patien... |
6a48e09d-bc29-48d3-a82e-495f25555a50 | 7 | @Override
public void delScript(ScriptingEngine S)
{
if(scripts!=null)
{
if(scripts.remove(S))
{
if(scripts.isEmpty())
scripts=new SVector<ScriptingEngine>(1);
if(((behaviors==null)||(behaviors.isEmpty()))&&((scripts==null)||(scripts.isEmpty())))
CMLib.threads().deleteTick(this,Tickable.TI... |
88d3b2d1-2af2-4b76-80d2-604ec042f2f2 | 8 | public BigInteger poisk(int m, int X, int k, int end) {
// System.out.println
if (m == end)
return BigInteger.ONE;
if (done[m][X])
return res[m][X];
BigInteger r = BigInteger.ZERO;
int w = X;
if ((X & 1) == 0 && m >= k) {
r = poisk(m + 1, X >> 1, k, end);
} else {
X = X >> 1;
for (int i = 0... |
3e3cae3f-1d44-46cb-ab1f-13779608740b | 2 | public Position getStartNode(){
Iterator<Node> _iter = this._nodes.values().iterator();
Position _result = null;
while(_iter.hasNext()){
Node _node = _iter.next();
if(_node.isStartpoint()){
_result = _node.getPosition();
break;
}
}
return _result;
} |
a2148256-6767-4563-99dd-9c769bc233d0 | 3 | @Override
public boolean onPointerMove(int mX, int mY, int mDX, int mDY) {
if(super.onPointerMove(mX, mY, mDX, mDY)) {
return true;
}
for(ShopItemButton sib : itemSlots) {
if(sib.onPointerMove(mX, mY, mDX, mDY)) {
return true;
}
}
... |
83f6a9e5-2ad6-421a-a8bf-2939234e3f77 | 6 | public static void printDiamond(int n, char c) {
for(int i = 0; i <= n/2; i++) {
for(int j = 0; j < n/2 - i; j++) {
System.out.print(" ");
}
for(int j = 0; j <= 2*i; j++) {
System.out.print(c);
}
System.out.println();
}
for(int i = n/2; i > 0; i--) {
for(int j = 0; j <= n/2 - i; j++) {
... |
223afef3-ac75-4ab9-9de7-7d3b19cd726e | 0 | private EnumValueVisitorType(String type) {
this.type = type;
} |
450020c0-2f45-465a-b448-952b945ee0df | 2 | public static void printXmlFile(String filePath) {
try {
Document doc = getDoc(filePath);
System.out.println(doc.getDocumentElement().getNodeName());
NodeList nl = doc.getDocumentElement().getChildNodes();
for (int i = 0; i < nl.getLength(); i++)
System.out.println(" -> " + nl.item(i).getNodeName());... |
521f4085-7b65-41d4-8629-1e87ea2dcbef | 7 | public int compareTo(M m) {
if (total != m.total) return total - m.total;
if (width != m.width) return width - m.width;
if (height != m.height) return height - m.height;
for (int x = 0; x < width; x++) for (int y = 0; y < height; y++)
if (item(x, y) != m.item(x, y)) return item(x, y) - m.item(x, y) > 0 ? 1 :... |
cb81c46b-7a00-45dc-af47-8802483780ba | 7 | private boolean findEventMethod(Class<?> guiType, Object source,
String command, Class<?> eventType) throws NoSuchMethodException {
Method method = null;
Class<?> type = guiType;
while (type != null && !type.equals(Object.class) && method == null) {
try {
// System.out.println(String.format("[%s] // [%s... |
5827abb0-eb1e-498b-a355-b95928b7b8c2 | 0 | public static String getPublicKey(Map<String, Object> keyMap)
throws Exception {
Key key = (Key) keyMap.get(PUBLIC_KEY);
return SecurityCoder.base64Encoder(key.getEncoded());
} |
632c6b70-8a95-4878-b86b-0a8d832a7634 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RSResource other = (RSResource) obj;
if (resource == null) {
if (other.resource != null)
return false;
} el... |
2eff742d-e789-4c83-a528-13430770f0ed | 2 | public int GetNumber() {
int num = 0;
for (int i=0; i<m_colourMap.length; i++) {
if (!(m_colourMap[i].equals(null))) {
num++;
}
}
return(num);
} |
581ecd42-9de0-4045-8f74-33152886233a | 9 | public <T> Class<? extends T> getDestinationClass(Class<?> src, Class<T> expectedDest) {
while (src != null && src != Object.class) {
if (src.getAnnotation(Builder.class) != null) {
Class<?> dest = src.getAnnotation(Builder.class).destination();
if (expectedDest.isAssignableFrom(dest)) {
retur... |
bc2de199-4c44-483b-93d4-4b151df36185 | 7 | private boolean appearsNested(RSyntaxTextArea textArea,
int line, int offs) {
final int firstLine = line; // Remember the line we start at.
while (line<textArea.getLineCount()) {
Token t = textArea.getTokenListForLine(line);
int i = 0;
// If examining the first line, start at offs.
if (lin... |
5cb5a30e-f083-4b96-a92c-251fcfaa1848 | 2 | public static TreeMap<String, Integer> getTimeZone(ArrayList<Kill> kills) {
TreeMap<String, Integer> output = new TreeMap<String, Integer>(); // the output
int hour;
for (Kill k : kills) {
hour = k.getKillTime().get(Calendar.HOUR_OF_DAY);
if(!output.containsKey(String.valueOf(hour)+"h")){
output.... |
0ee0ed3c-70da-40e5-9fb9-3260beb40504 | 3 | @Override
public Object getValueAt(int row, int col) {
OffRec off = sortedElements.get(row);
if (col == 0)
return off.getStatus();
if (col == 1)
return off.asHTML();
if (col == 2)
return off.getDuration();
return off.getId();
} |
a0121eae-b373-4c50-b081-b4b4934a8940 | 4 | public static String getHandValue_TwoCard(Hand hand) {
Collections.sort(hand.getHand());
Card first = hand.getHand().get(0);
Card second = hand.getHand().get(1);
if (first.getSuit() == second.getSuit()) {
if (first.getRank().ordinal() - 1 == second.getRank().ordinal()) {
// Straight Flush
return "3" ... |
b857bde2-1d8a-4eac-9c8e-1bdfccd5e510 | 5 | private void fontSizeTextKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_fontSizeTextKeyReleased
if (!fontSizeText.getText().equals("")) {
if (!log.checkNumbString(fontSizeText.getText())) {
return;
}
if (listOfElements != null && listOfElements.si... |
9e578c5f-d0c0-4b1f-a610-5d28260d04d2 | 4 | public static void arc(double x, double y, double r, double angle1, double angle2) {
if (r < 0) throw new RuntimeException("arc radius can't be negative");
while (angle2 < angle1) angle2 += 360;
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
doubl... |
e66fbc0f-5429-4668-9ffa-22a9d532f514 | 3 | public static int getVisits() {
Connection c = getConnection();
int size = 0;
try {
Statement s = c.createStatement();
ResultSet set = s.executeQuery("SELECT * FROM logs");
while(set.next()) {
size++;
}
} catch (SQLException... |
539ce75c-26f1-403f-9c54-8e2b165f6606 | 1 | private static String indent(int n) {
StringBuilder b = new StringBuilder ();
for(int i=0;i<n;i++) {
b.append(" ");
}
return b.toString();
} |
fe293c57-3b8d-4f9f-903a-c24255303f1e | 9 | public DataSourceImpl(List<String> data) {
final Pattern p = MyPattern.cmpile("\\{[-+#!*/]?");
for (String s : data) {
final StringTokenizer st = new StringTokenizer(s, "|}", true);
while (st.hasMoreTokens()) {
final String token = st.nextToken().trim();
if (token.equals("|")) {
continue;
}
... |
36a627e0-3f7b-4531-a59c-9720c8f3f74e | 1 | public PeopleSearchResults searchByQuery(String query) {
try {
query = URLEncoder.encode(query, "UTF-8");
} catch (Exception e) {}
String searchUrl = "people.php?q=" + query;
return new PeopleSearchResults(new Network().connect(searchUrl));
} |
e17e4d1d-0a24-4712-b6b4-89cbaf38c287 | 7 | public void next() {
boolean[][] newField = new boolean[field.length][field[0].length];
for (int y = 0; y < field.length; y++) {
for (int x = 0; x < field[0].length; x++) {
int neighborCnt = neighborCount(x, y);
if (field[y][x] && neighborCnt >= 2 && neighborCnt <= 3) {
newField... |
775a1c85-4f82-4da6-bb08-d9cefa4e693a | 8 | public static ControlKey stringToControlKey(String key)
{
switch(key)
{
case "input.up": return ControlKey.Up;
case "input.down": return ControlKey.Down;
case "input.left": return ControlKey.Left;
case "input.right": return ControlKey.Right;
... |
0c356ebe-1574-4a48-865a-a4f3a8e6f81a | 1 | public static String read()
{
try{
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("/Users/Abhi/Desktop/Database/settings" + Member_loggedin.getLogginusername().toLowerCase() + ".dat");
// Get the object of DataInputStream
DataInputStream ... |
1b6ed941-577e-4745-8f78-d192f94e2855 | 9 | public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
//init paint grid
for(int count = 0; count < xSpan; count++)
{
for(int count2 = 0; count2 < ySpan; count2++)
{
paintGrid[count][count2] = paintGrid2[count][count2] = blank;
if((count2 == 19) && (count < 3))
pai... |
b7d490d8-31dd-40df-be14-fa7d08bc9567 | 8 | public static int leastSignificantBit(final long value) {
if(value == 0L) return -1/*by contract*/;
if((value & 0xFFL) != 0) return LEAST_SIGNIFICANT_BIT[(int)( (value >>> 0) & 0xFF)] + 0;
if((value & 0xFFFFL) != 0) return LEAST_SIGNIFICANT_BIT[(int)( (value >>> 8) & 0xFF)] + 8;
if((... |
35dfd9bb-668a-4068-9f01-f85a0aa8c7c4 | 7 | public int[] hasVariables(ArrayList<Variable> vl){
int[] ret = new int[Math.max(1, this.varNum)];
// If both lists have 0 variables then we return a 1 in the first position
if(this.varNum == 0 && vl.size() == 0){
ret[0] = 1;
return ret;
}
// vl size > varList size
if(vl.size() < varList.size(... |
2d83ee69-3f34-487f-af7e-961991223a41 | 6 | public void AtulizaUsuario(Usuario user) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_UPDATE_UM_GERENTE);
comando.setString(1, user.g... |
b8534fa2-ce90-44c5-9cb9-d9099b63adc3 | 1 | public void windowClosing(WindowEvent evt) {
boolean sortir = exit();
// Bug #348263
if ( ! sortir )
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
else
System.exit(0);
} |
dc063b76-d9ad-4569-9840-331601790e0c | 5 | public OptionScanner(String[] arguments) {
// Don't construct anything, there are no arguments
if (arguments.length == 0) {
return;
}
// Construct LinkedList of options
options = new LinkedList<Option>();
// Run through all arguments
for (int i = 0; i < arguments.length; i++) {
String argument =... |
012ec287-00c9-4390-b4c7-aff2ae3618cd | 5 | @Override
public void scanForSentences(final SentenceParserCallback parser)
throws Exception {
SentenceParserImpl impl = new SentenceParserImpl() {
@Override
public boolean found(Sentence sentence) {
return parser.found(sentence);
}
};
byte[] buf = new byte[4096];
java.io.FileInputStream fis ... |
ca5d6ca2-c61c-4f51-8fc3-591c2a979064 | 4 | private void goHome_fileManagerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goHome_fileManagerButtonActionPerformed
DefaultListModel model = new DefaultListModel();
directoryLabel_fileManagerLabel.setText("/");
for (Object obj : listFiles(dir... |
e1de9dad-b36f-4155-a90d-15daf8cbdec8 | 5 | public void body() {
// get the resource characteristics object to be used
dynamics = (ResourceDynamics)super.resource_;
// Gets the information on number of PEs and rating
// of one PE assuming that the machines are homogeneous
ratingPE = dynamics.getMIPSRatingOfOnePE();
... |
f9a90749-c1b4-40ac-8379-476205500888 | 0 | public static void KingsHall() {
currentRoomName = "King's Hall";
currentRoom = 2;
RoomDescription = "You climb through the hatch and you are now in a bigger hall. There are red carpets magestically " +
"hanging from the walls, next to the enormous painting of a proud looking king. There is one door at the "... |
f9625013-81d6-4045-9549-9bf67780c93c | 8 | private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
String type = txtFieldType.getText();
lblError.setText("");
boolean dbResult = false;
int capacity = -1;
int planeNumber = -1;
String ErrorMessage = "";
t... |
e04a2866-3b0b-497e-a9e6-450b193ac719 | 1 | @Override
public void render() {
/*
ArrayList<Long> actors = Application.get().getLogic().getGame().getSelectedWeapons();
for(Long l : actors) {
GameActor actor = Application.get().getLogic().getActor(l);
if(actor != null) {
PhysicsComponent pc = (Phys... |
540e72fb-4c7a-444b-b695-0293e6c3e310 | 3 | public void set(String newDate, String id) {
List<InvestmentFund> investmentFunds = investmentFundDao.getInvestmentFundList();
if (investmentFunds != null) {
for (InvestmentFund investmentFund : investmentFunds) {
if (id.equals(investmentFund.getId())) {
investmentFund.setDate(newDate);
investmentF... |
2cdc8cc1-db3e-4046-8886-95f459aa48a7 | 8 | @Override
public void applySGR(SGR... options)
{
for(SGR sgr: options)
{
if(sgr == SGR.RESET_ALL) {
currentlyBold = false;
currentlyBlinking = false;
currentlyUnderlined = false;
currentForegroundColor = convertColorToAW... |
525bc4d8-507b-4051-90e4-7dbb6740d796 | 3 | public static String getRootClassPath() {
if (rootClassPath == null) {
try {
String path = PathKit.class.getResource("/").toURI().getPath();
return new File(path).getCanonicalPath();
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
... |
35ea4e03-c811-4f17-9178-94f2bf84d798 | 5 | public float[] getFloatsArray() {
if (this.getTypeByte() == Encoder.TAG_NULL) return null;
Decoder dec;
try {
dec = this.getContent();
} catch (ASN1DecoderFail e) {
e.printStackTrace();
return null;
}
ArrayList<String> ints = new ArrayList<String>();
for(;;){
Decoder val = dec.getFirstObject(t... |
b092ca72-c630-4ccb-9d13-ef132dafaac9 | 3 | private void register_all() {
registered.clear();
errors.clear();
for( KeyPair p : generatedKeys ) {
threadPool.submit(new RegistrationRequest(p));
}
while( registered.size() + errors.size() < generatedKeys.size() ) {
try {
Thread.sleep(5*1000);
} catch( Exception e ) {}
System.out.pr... |
50f0eec3-330b-4edb-9d0f-381734c67878 | 3 | public String[] find(String personName){
this.personName = personName;
String dataArray[] = null;
try{
@SuppressWarnings("resource")
BufferedReader csvFile = new BufferedReader(new FileReader("parserResult/parser_result.csv"));
String target;
while((target = csvFile.readLine())!= null){
dataArray = ta... |
cc0d3895-758d-4eed-8d9d-cc47e62474c7 | 4 | public CollisionInfo collideInfo(Poly poly1, Poly poly2) {
firstPoly = poly1;
secondPoly = poly2;
info.setLengthSquared(-1);
for (int j = firstPoly.getCount() - 1, i = 0; i < firstPoly.getCount(); j = i, i++) {
Vector v0 = firstPoly.getVertices()[j];
Vector v1 = firstPoly.getVertices()[i];
Vector edg... |
727fe08f-98f7-4d9a-bb34-85f4d6b4f1aa | 7 | public static Database newInstance(Class<?> clazz, Configuration config) {
try {
Constructor<?> constructor = clazz.getConstructor(Configuration.class);
return (Database) constructor.newInstance(config);
} catch (NoSuchMethodException e) {
throw new InjectorException("Could not create a new instance of cla... |
2c4247d3-a889-47a4-ac4a-bd5a0383e874 | 0 | public int getNumberVictims() {
return numberVictims;
} |
cd34cabc-0bbc-4bb4-b2a5-0cab74df87f7 | 8 | public static void mouseReleased(MouseEvent mouseEvent) {
Iterator<PComponent> it = components.iterator();
while(it.hasNext()) {
PComponent comp = it.next();
if(comp == null)
continue;
if (shouldHandleMouse) {
if (comp.shouldHandleMouse... |
2d709f34-d14c-4336-be0a-67985a8c664e | 9 | public void setAttackStyle(int style) {
int maxSize = 3;
int weaponId = player.getEquipment().getWeaponId();
String name = weaponId == -1 ? "" : ItemDefinitions
.getItemDefinitions(weaponId).getName().toLowerCase();
if (weaponId == -1 || PlayerCombat.isRanging(player) != 0
|| name.contains("whip") || na... |
6ca41135-ea3d-4593-b8fd-ebd7fbe1b0e0 | 7 | public static JPanel EditClientObjectCard (){
System.out.println("EditClientObjectCard - flag");
//System.out.println("Active Select: " + Globals.ActiveSel);
try{
Globals.ActiveCustomer = Globals.ATA.CustomerArray[Globals.ActiveClientObjID];
}
catch(ArrayIndexOutOfBoundsException e... |
3565d039-468a-48a2-85a1-4876b7662df7 | 2 | public PdbImportFileFormat() {
try {
// the ancestors are called
// in this case, that's Object()
// create a reader-writer
createReaderWriter() ;
// tell it we'll handle content and errors
ourReaderWriter.setContentHandler (this) ;
ourReaderWriter.setErrorHandler (this) ;
} ... |
43d2a516-93af-49ec-86ff-f24625d2ed86 | 5 | public String getProperty(String var) {
for (String line : this.lines) {
if (line.trim().length() == 0) {
continue;
}
if (line.charAt(0) == '#') {
continue;
}
if (line.contains("=")) {
int delimPosition ... |
0153a72a-c871-44a4-86a3-768dfd0a02f8 | 3 | private String parseDoc() throws FileNotFoundException, IOException
{
String result = "";
_logger.debug("Filetype = DOC");
POIFSFileSystem poifsFileSystem = new POIFSFileSystem(new FileInputStream(_file));
HWPFDocument hwpfDoc = new HWPFDocument(poifsFileSystem);
WordExtractor we = new WordExtractor(hwpfDoc... |
256ddd51-6574-4b83-a836-4ccc94de2001 | 7 | public void startAnimate(int facing) {
try { // Creates an offset towards the original location
// that starts counting down ( because they're already in the new location )
if ( facing == 2 ) offsetX = -10;
if ( facing == 1 ) offsetX = 10;
if ( facing == 4 ) offsetY = -10;
if ( facing == 3 ) offset... |
520eb51e-dff6-46ba-aef3-0223ed3f0c7c | 4 | public static int getJvmItem(List<JvmItem> jvmItemList, long timeStampMS) {
if (jvmItemList == null)
return -1;
int beforeIndex = 0;
int afterIndex = jvmItemList.size() - 1;
for (int i = 0; i < jvmItemList.size(); i++) {
JvmItem item = jvmItemList.get(i);
if (item.getTimeStampMS() == timeStampMS) {
... |
6b463580-f13f-4d43-8166-32867ca46a95 | 4 | public void removeTrack() {
if (parent.tracks.size() > 1) {
for (int i = 0; i < parent.tracks.size(); i++) {
if (parent.tracks.get(i).getId() == currentTrack().getId()) {
for (int j = 0; j < parent.tracks.size(); j++) {
parent.tracks.get(j).setMatch(currentTrack().getId(), 0);
}
parent.tra... |
da599c9d-cf34-48be-ac08-93fe3ece7cfa | 3 | static private float[] subArray(final float[] array, final int offs, int len)
{
if (offs+len > array.length)
{
len = array.length-offs;
}
if (len < 0)
len = 0;
float[] subarray = new float[len];
for (int i=0; i<len; i++)
{
subarray[i] = array[offs+i];
}
return subarray;
} |
ec07c65f-0db3-4ade-8147-a8fb00af8549 | 3 | public static synchronized void clearRegionFileReferences() {
Iterator var0 = regionsByFilename.values().iterator();
while(var0.hasNext()) {
Reference var1 = (Reference)var0.next();
try {
RegionFile var2 = (RegionFile)var1.get();
if(var2 != null) {
... |
7b0efc7a-aa7e-42c2-99b7-4b8293567fce | 0 | public void setNome(String nome) {
this.nome = nome;
} |
01d6b42d-349f-421c-9acf-e9a316a3c1e2 | 3 | public void preload(String root) {
File file = new File(root);
File[] files = file.listFiles();
for(File f : files) {
if(f.isDirectory()) {
preload(f.getPath());
}
else if(f.isFile()) {
getTexture(f.getPath());
}
... |
74b2f3b4-21ac-4377-a915-b7568b15ca07 | 7 | public String getDayName()
{
switch (getDayOfWeek()) {
case Calendar.MONDAY : return "Monday";
case Calendar.TUESDAY : return "Tuesday";
case Calendar.WEDNESDAY : return "Wednesday";
case Calendar.THURSDAY : return "Thursday";
case Calendar.FRIDAY : return "Friday";
ca... |
62cbd9af-480c-4090-b70f-b5ee81f1fa50 | 0 | protected Element createTransitionElement(Document document,
Transition transition) {
Element te = super.createTransitionElement(document, transition);
PDATransition t = (PDATransition) transition;
// Add the characterizing strings for this transition.
te.appendChild(createElement(document, TRANSITION_READ_N... |
1d3b30d9-5f13-43bb-a106-cfe8072d0751 | 7 | public void toggleFX(Model model, boolean on) {
if (on) {
for (MoteFX FX : statusFX) if (FX.mote.model() == model) return ;
final MoteFX FX = new MoteFX(model.makeSprite()) ;
statusFX.add(FX) ;
FX.position.setTo(position) ;
FX.position.z += high + 0.5f ;
if (statusDisplayIndex < ... |
612596a4-5d5d-4af7-88ba-5c9df1094719 | 0 | public List<Product> getAllProducts() {
return allProducts;
} |
82a12261-4864-4a0e-8d87-a2fce1de4c8b | 7 | Class269(NativeToolkit var_ha_Sub3) {
anInterface18_Impl3Array3454 = null;
((Class269) this).anInterface18_Impl3Array3459 = null;
aHa_Sub3_3457 = var_ha_Sub3;
((Class269) this).aBoolean3458
= ((NativeToolkit) aHa_Sub3_3457).aBoolean8159;
if (((Class269) this).aBoolean3458
&& !aHa_Sub3_3457.method3931(tru... |
63f0230d-90c9-4313-9238-95bf115f32b4 | 7 | private boolean IsSumOfTwoElements(int number, List<Integer> possibleNumbers) {
boolean isSumOfTwoItems = false;
for (int i = 0; i < possibleNumbers.size(); i++) {
int lower = possibleNumbers.get(i);
for (int j = possibleNumbers.size() - 1; i <= j; j--) {
int uppe... |
9f6b19fa-0834-4ae0-9100-2f3183ca4545 | 9 | @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityDamageByEntity(EntityDamageByEntityEvent e)
{
if(plugin.UNDISGUISE_ON_PVP)
{
Entity eAttacker = e.getDamager();
if(!(eAttacker instanceof Player))
{
if(... |
c342cc94-c6f7-4a72-b965-72ff116f1d67 | 0 | public Long getId() {
return id;
} |
bf71010e-910d-4ffd-9287-829fc58ae9d1 | 7 | public void test(String TestName, String filename, boolean pruning){
try {
//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
//System.out.println("Who are you? ");
//String TheGuy = buf.readLine();
String TheGuy = TestName;
// record the time
long start = System.curren... |
f8ac6d04-26ff-44ed-911c-f4bb01e58fcb | 2 | public void save(BufferedImage pImage, String pFilename)
{
try
{
// File needs to be in .png format to save properly.
if (!(pFilename.endsWith(".png")))
{
pFilename += ".png";
}
ImageIO.write(pImage, "png", new File(pFilename));
}
catch... |
9788d6e5-1113-4101-a8aa-ee43b626ad15 | 2 | public JSONArray names() {
JSONArray ja = new JSONArray();
Iterator keys = this.keys();
while (keys.hasNext()) {
ja.put(keys.next());
}
return ja.length() == 0 ? null : ja;
} |
61ede686-483d-4a63-a640-3de526c1b3cc | 0 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = result * prime + Float.floatToIntBits(x);
result = result * prime + Float.floatToIntBits(y);
return result;
} |
9b481a7a-2ee2-4434-a4d6-3dca92d81a30 | 5 | public void onLiquidCatched(Bottle.Type bottleType, int milliliters){
// if (Log.VERBOSE) Log.v(LOG_TAG, "catched bottle = " + bottleType + " mili = " + milliliters);
Ingredient<Bottle.Type> bottle = currentProgress.getIngredient(bottleType);
actionOcurred(GameActionFactory.createLiquidCatchedAction(bottleType, bo... |
b6beee2f-fd72-4742-bc31-9c2427f6b108 | 9 | public static ErrorCode parseCode(String codeIn) {
if (codeIn == null) {
return null;
}
ErrorCode errorCode = null;
String code = codeIn.toUpperCase();
Matcher m = CODE_PARSE.matcher(code);
if (m.matches()) {
final A... |
b064dbe6-b431-44d1-be6a-a637a9383fb3 | 5 | @Override
public String getObjectiveOutput(ColorList color, int level) {
String str = "";
for (int i = 0; i <= level; i++)
str = str + "\t";
if (level == 0) // is root
str = str + "attributes " + getName() + " " + getWeight() + "\n";
else
str = st... |
59ccc95f-b1f3-4d89-80f2-ed0b84458794 | 7 | private void processCliCommand(String line) {
StringTokenizer tokenizer = new StringTokenizer(line);
// Don't crash if they entered a blank line
if (! tokenizer.hasMoreTokens())
return;
String token = tokenizer.nextToken();
switch(tokenType(token)) {
ca... |
424137f1-87f9-481e-959c-b0d249e4e14a | 0 | public List<Speaker> getSpeakerList() {
return speakerList;
} |
bd425d79-5fce-4113-b1bb-a7509bca41a5 | 7 | * @param cs A <code>ChangeSet</code> to update.
*/
public void csYearlyGoodsAdjust(Random random, ChangeSet cs) {
List<GoodsType> goodsTypes = getGame().getSpecification()
.getGoodsTypeList();
Market market = getMarket();
// Pick a random type of storable goods to add/remov... |
e6edcc94-dd3f-4de0-8554-fb37c2385bbe | 6 | public void visitShiftExpr(final ShiftExpr expr) {
expr.visitChildren(this);
genPostponed(expr);
if (expr.type().isIntegral()) {
if (expr.dir() == ShiftExpr.LEFT) {
method.addInstruction(Opcode.opcx_ishl);
stackHeight -= 1;
} else if (expr.dir() == ShiftExpr.RIGHT) {
method.addInstruction(Opco... |
cda27ae4-7e80-41c3-9476-1ce2bde5a878 | 8 | public Byte getInternetDistanceBFS(int as1, int as2) {
// if Distances for AS1 are not created yet - create them
if (distances.get(as1) == null) {
distances.put(as1, new Distances());
}
if (distances.get(as1).getDistance(as2) != null) { // if distance was
// already found,
// ... |
94e7a12d-1420-4e78-ac3e-69f6b9c80638 | 2 | private boolean checkFriendship(String user, String friend){
Statement st;
ResultSet rs;
String query;
try {
st = conn.createStatement();
query="SELECT * from friends WHERE friend1='"+user+"' AND friend2='"+friend+"'";
rs = st.executeQuery(query);
if (rs.next()){
return true;
}
else{
... |
f0edee25-384e-4c73-a622-ad4658cab255 | 9 | private String[] getDifferentTokens(String n1, String n2){
List<String> holder = new ArrayList<String>();
String[] tks1 = n1.split(" ");
String[] tks2 = n2.split(" ");
if(tks1.length == 0 || tks2.length == 0) return null;
for(String tk1: tks1)
for(String tk2: tks2)
if(tk1.equals(tk2)) holder.add(tk1... |
6a019e63-ec0c-4da3-8c81-4c4fb5725085 | 8 | public void initialize(int containerIndex, DataFormatInstance dataFormatInstance, ConfigurationDir configDir, int mode) throws MaltChainedException {
this.optionContainerIndex = containerIndex;
this.mode = mode;
setConfigurationDir(configDir);
startTime = System.currentTimeMillis();
configLogger = initConfig... |
83169e77-827e-4f15-b5ec-c820bfa6a9a9 | 4 | public static void initialize(JavaPlugin par1Plugin) {
_server = par1Plugin.getServer();
cfg = new ConfigurationManager(par1Plugin);
try {
getBanManager().load(banlistFile);
} catch (IOException e) {
System.out.println(String.format("Banlist Notfound. Create %s.", banlistFile));
try {
new File(banl... |
a41905e1-199f-40d5-8092-2017fda9e98e | 6 | public static void main(String[] args) throws Exception {
SingleWriter asd = SingleWriter.getInstance("tester.txt");
/*создание графа*/
Graph wordsGraph = new Graph();
// Обработчик WordNet
WordnetHandler wordnetHandler = new WordnetHandler();
/*установка количества счит... |
bf77e3cc-af20-4ddd-a369-31603044b90b | 6 | public void testRetainAllArray() {
int element_count = 20;
int ints[] = new int[element_count];
for ( int i = 0; i < element_count; i++ ) {
ints[i] = i;
}
TIntList list = new TIntArrayList( 20 );
for ( int i = 0; i < element_count; i++ ) {
list.ad... |
2b460569-95f0-431f-b1a3-d0681c963b74 | 2 | @Override
public void downloadArtist(final String artistUrl, final String destinationFolder, final Mp3Metadata metadata) {
String artistString = null;
try {
final long artistId = getApi().resolve(artistUrl);
final HttpResponse artistResponse = getApi().get(new Request(String.format(Constants.ARTIST_TRACK_URL... |
3fd753b5-e1a9-4270-a963-6ac73b12a0fa | 4 | public NChooseR(int n) {
ncr = new BigInteger[n + 1][n + 1];
for (int i = 0; i < ncr.length; i++) {
for (int j = 0; j < ncr[i].length; j++) {
ncr[i][j] = i < j ? BigInteger.ZERO : j == 0 ? BigInteger.ONE : ncr[i - 1][j - 1].add(ncr[i - 1][j]);
}
}
} |
a3e556e6-5c1a-4ea2-9189-df2e7ebea791 | 0 | public float getK() {
return k;
} |
f240c6d8-861a-4a52-a3c8-e647d002b57b | 1 | public void avanza() {
if (mov) {
double time = (double)(System.currentTimeMillis() - startTime)/1000;
setDoublePosX(x + vx * time);
setDoublePosY(y - (vy*time - 0.5*aceleracion*time*time));
}
} |
06273340-d169-41db-99e1-9351e40a6b88 | 3 | private void booleanStart() {
while (pos < numRead) {
if (isDelimiter(buf[pos])) {
break;
}
pos++;
}
if (pos < numRead) {
stack.push(Boolean.valueOf(new String(buf, startTokenPos, pos - startTokenPos)));
}
parseNextS... |
6f63d056-b45b-4402-9767-8995d9311043 | 1 | public void write3bytes(long n) throws IOException {
long b0 = n & 0xff;
long b1 = (n & 0xff00) >> 8;
long b2 = (n & 0xff0000) >> 16;
if (le) {
write(b0); write(b1); write(b2);
} else {
write(b2); write(b1); write(b0);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.