method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e5776899-59c6-404a-b01f-4af2bf0b7689 | 9 | private boolean find(final List<Pair<Integer, SimpleSequence>> nrs,
int left,
int first,
int previous,
Map<SimpleSequence, Integer> solution) {
if (left > 0) {
final int min = previous <= 0 ? 0 : prev... |
14a3acf2-3f58-4cd8-8de2-e30e31d46d8f | 1 | public static List<Point2D> parsePoints(String point2Ds) {
List<Point2D> pts = new ArrayList<Point2D>();
for(String point2D : point2Ds.split("[ \t]+")) {
pts.add(parsePoint(point2D));
}
return pts;
} |
6cd20ef6-fa22-41cb-9dbd-e01c527b9757 | 2 | public static void main(String[] args) {
// 创建一个FloatBuffer的方法
FloatBuffer floatBuffer = FloatBuffer.allocate(10);
// capacity 方法是所有Buffer的接口类Buffer的方法,获取buffer容量的意思。
System.out.println(floatBuffer.capacity());
for (int i = 0; i < floatBuffer.capacity(); i++) {
floatBuffe... |
d78fa33d-34f6-4bd4-8935-e19b8f7d4303 | 7 | private int negW(int dest) {
clearFlags(SR_X, SR_N, SR_Z, SR_V, SR_C);
int result = -dest;
if (msbSetW(result)) setFlag(SR_N);
if (isZeroW(result)) setFlag(SR_Z);
if (msbSetW(dest) && msbSetW(result)) setFlag(SR_V);
if (msbSetW(dest) || msbSetW(result)) setFlag(SR_C);
if (isCarrySet()) setEx... |
453473b0-ccdc-475d-848f-24713e752939 | 6 | private boolean saveHotkeySettings() {
boolean somethingChanged = false;
for (Component com : this.pnl.getComponents()) {
if (com instanceof HotkeySettingsPanel) {
HotkeySettingsPanel hKSP = (HotkeySettingsPanel) com;
if (hKSP.isNew()... |
5ce0de1d-18b8-48b6-9380-395d8065bd07 | 2 | public void checaColision() {
//Checa colision del principal con el fondo del JFrame
if ( (principal.getSalta()) && ( principal.getPosY() > getHeight()) ){
principal.setSalta();
principal.setVelocidad(0);
principal.setPosY(posYinicial);
}
} |
34d160c5-be7e-48d6-ae5e-8fe3e6dbfab0 | 5 | @Test
public void testPlaylistMusic() {
try {
PlaylistMusic pl = new PlaylistMusic("/home/andreluiz/a.mp3");
} catch (CannotReadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (TagExc... |
d844296d-e849-42e2-b8e3-872086fe797b | 0 | public static int getNumberOfMonsters(){
return numberOfMonsters;
} |
ff65e3e5-f7ca-4173-b965-93819a197558 | 0 | public Set<String> getEntryPointClasses() {
return this.entryPointsClasses;
} |
85d5b3a5-b9f9-4486-b94f-fd7b4ac6e3f6 | 4 | public boolean isFull() {
if(!parkIsNull() && !park.isFull()) {
return false;
}
for(ParkBoy boy : this.parkBoyList) {
if(!boy.isFull()) {
return false;
}
}
return true;
} |
47bf58ea-9ec2-4cd6-a1ae-c14cf7957de0 | 0 | @Override
public int hashCode() {
int result = length;
result = 31 * result + width;
return result;
} |
4e76456a-2664-4f79-b204-921117e60de4 | 8 | public Object[] parseSet(String sets) {
sets = sets.trim();
HashSet set = new HashSet();
boolean aa = false;
if (!sets.contains(",") && !sets.contains("[")) {
shell.evaluate("___ = " + sets.trim());
set.add(shell.get("___"));
return set.toArray();
... |
e133bbed-0367-4d10-9b90-8fc0dafc7fe7 | 3 | public boolean testHit(int x_guess, int y_guess){
for(byte i = 0; i < this.shipSize; i++){
if(this.shipCoordinates[i][0] == x_guess && this.shipCoordinates[i][1] == y_guess){
this.markHit(i);
return true;
}
}
return false;
} |
6fa64ed6-9a01-43b8-9e74-170f08530ad8 | 6 | @EventHandler(priority=EventPriority.MONITOR)
void onInventoryClick(InventoryClickEvent event) {
if (event.getInventory().getTitle().equals(name)) {
event.setCancelled(true);
int slot = event.getRawSlot();
if (slot >= 0 && slot < size && optionNames[slot] != null) {
... |
cb57e0cd-9ffc-4862-adc9-04e14f6ec4d8 | 1 | public Object getValueAt(int row, int col) {
try {
return fileResultList.get(row).getColumnData(col);
} catch (Exception e) {
e.getMessage();
return null;
}
} |
7cc96ff3-cdd5-48c3-8942-cbf508c2b2f7 | 2 | @Override
public T validate(String fieldName, T value) throws ValidationException {
if (value == null) {
return null;
}
if (!legalValues.contains(value)) {
throw new ValidationException(fieldName, value, "must be one of " + legalValues);
}
return value;
} |
453da8e6-08dc-43d0-8d76-7febe2660393 | 7 | @SuppressWarnings("unchecked")
public ArrayListTablePanel(Class objClass,
List<T> al, ArrayListTableModel lm) {
objectClass = objClass;
list = al;
model = lm;
table = new JTable(model);
setLayout(new BorderLayout());
add(new JScrollPane(table), BorderLayout.CENTER);
JPanel botPanel = new JPanel();
... |
bd5a6607-14f1-46f9-b83a-d3a4fe16d1ca | 5 | private IOAcknowledge remoteAcknowledge(IOMessage message) {
String _id = message.getId();
if (_id.equals(""))
return null;
else if (_id.endsWith("+") == false)
_id = _id + "+";
final String id = _id;
final String endPoint = message.getEndpoint();
return new IOAcknowledge() {
@Override
public vo... |
39bd6515-5533-469a-aee8-13920ec4c400 | 1 | private void declareLabel(final Label l) {
String name = (String) labelNames.get(l);
if (name == null) {
name = "l" + labelNames.size();
labelNames.put(l, name);
buf.append("Label ").append(name).append(" = new Label();\n");
}
} |
6663c659-8a33-487a-93a9-262d954d9260 | 5 | public boolean isValid(String s) {
char[] stack = new char[s.length()];
int size = 0;
for (char c : s.toCharArray()) {
if (size == 0) {
if (isStart(c)) {
stack[size] = c;
size++;
} else {
re... |
0943090d-7355-4554-972c-9341019bf346 | 4 | public static ArrayList<Student> addDelMenu(ArrayList<Student> inList) throws FileNotFoundException
{
int choice = 0;
do {
System.out.println("What would you like to do: \n 1) add a student \n 2) delete a student \n 3) return to main menu");
Scanner userinput = new Scanner(System.in);
choice = userinpu... |
f65fdd6f-e22a-48fd-957b-d2edf0e7c90c | 2 | @Override
public void getItems(Retriever retriever)
{
for (LinkedList<SupplierProduct> list : products.values())
{
for (SupplierProduct p : list)
retriever.addProduct(p);
}
products.clear();
} |
97c3ceaa-0427-4a6b-a2db-d72dd0882356 | 4 | public static Packets getPacketByID(int id){
switch(id){
case 0:
return Packets.OUTVOTE;
case 1:
return Packets.INXPAMOUNT;
case 2:
return Packets.INDONOR;
case 3:
return Packets.TEST;
default:
return Packets.UNKNOWN;
}
} |
04965e7f-2956-4cb7-bd08-33bc8e4a957f | 0 | public Object getField1() {
return field1;
} |
21e48476-6802-4b4c-94c0-1dc2364a6fa6 | 3 | static void upload(final String appKey, final Photo photo) throws UnknownHostException, IOException, UnsupportedEncodingException, MalformedURLException,
FileNotFoundException, InterruptedException {
System.out.println("=====================================> " + photo.url);
final Socket socket = new Socket("dev... |
3953f807-3294-488e-9090-73e541c0d4f5 | 4 | public void checkPlayers()
{
List<Player> deathlist = new LinkedList<Player>();
for(Player p : playerList.getList())
{
List<AbstractMatter> units = p.getUnitList().getAbstractMatterList();
List<AbstractMatter> cities = p.getCityList().getAbstractMatt... |
a605f852-825d-4450-b58e-a3f4aba498d4 | 1 | public void simplify() {
if (instr != null)
instr = instr.simplify();
super.simplify();
} |
5588f135-5737-4438-b51c-261fa96cdfe2 | 6 | public static String getNodeValue(Node domNode) {
if(domNode instanceof Comment) {
return domNode.getNodeValue();
}
if(domNode instanceof Attr) {
return ((Attr)domNode).getValue();
}
StringBuffer resultBuffer = new StringBuffer();
NodeList childNodes = domNode.getChildNodes();
... |
0917758a-6f7c-4537-818e-c843159f3892 | 0 | public CheckResultMessage checkDayofMonth5() {
return checkReport1.checkDayofMonth5();
} |
8635d2f2-f64b-44cc-96b5-255a36acb8f8 | 2 | @Override
public void mousePressed(MouseEvent event) {
Point p = event.getPoint();
for (int i = 0; i < points.length; i++) {
if (points[i].contains(p)) {
pos = i;
return;
}
}
} |
3e0d6414-536c-4a0d-9780-4e13abcf5422 | 6 | SpaceList getForkSpaces(Piece piece) {
SpaceList list = new SpaceList();
Space[] oppSpaceArray = getSpacesWithPiece(piece);
Space[][] openSetsLast = getOpenSets(lastSpaceMoved);
for (Space oppSpace : oppSpaceArray) {
if (oppSpace != lastSpaceMoved) {
Space[][] openOppSets = getOpenSets(oppSpace);
for... |
a4efdc17-1838-45bd-bf52-b41b1039cb67 | 7 | @Override
public void handlePacket(Player p, int packetSize, int packetType) {
switch (packetType) {
case 98:
case 164:
case 248:
if (packetType == 248) {
p.packetSize -= 14;
}
p.newWalkCmdSteps = (p.packetSize - 5) / 2;
if (++p.newWalkCmdSteps > p.walkingQueueSize) {
p.newWalkCmdSteps = 0;... |
54988a7b-2d5e-4537-bf09-1813a2824efc | 2 | public void fillingMatrix(double massive[])
{
int index = 0;
for(int i=0; i<columns; i++)
{
for(int j=0; j<rows; j++)
{
matrix[i][j] = massive[index];
index++;
}
}
} |
b73304c2-e6c8-4ab2-a8c5-f854a1da2ae7 | 9 | @Override
public void run() {
log.info("SubscribeThread started");
while ((!this.isInterrupted()) && (!markToBeRemoved)) {
try {
cache.drainTo(messages);
// wait for message
RoutingMessage routingMessage = messages.poll(200, TimeUnit.MILLI... |
29afb076-594c-4115-83df-279b253dac63 | 3 | private void initRouteFromGene(Gene gene){
//init to ordered route
for(int i = 0;i<route.length;i++){
route[i] = i;
}
int lastAllele = travelingSalesman.n;
//apply transpositions
for(int i = 0;i<allelesCount;i++){
//differeing strategies to deal with superfluous alleles - modulo n favours ... |
0f06a4bb-2f07-45a7-a625-92155330c0e9 | 9 | protected void shortLoop(RasterAccessor src,
RasterAccessor dst,
int filterSize) {
int dwidth = dst.getWidth();
int dheight = dst.getHeight();
int dnumBands = dst.getNumBands();
short dstDataArrays[][] = dst.getShortDataArrays... |
19ce54df-f8d6-4800-8711-56fc52f20a36 | 6 | private IndianSettlement placeIndianSettlement(Player player,
boolean capital, Position position, Map map) {
final Tile tile = map.getTile(position);
String name = (capital) ? player.getCapitalName(random)
: player.getSettlementName(random);
UnitType skill
= gener... |
8c3ae52a-f71a-4c84-a0fc-64403508a640 | 9 | protected ArrayList<ArrayList<Node>> getNextJumps(Location loc)
{
ArrayList<ArrayList<Node>> retVal = new ArrayList<ArrayList<Node>>();
ArrayList<Location> jumps = new ArrayList<Location>();
int orientation = getLoyalty() == Loyalty.RED ? 1 : -1;
for(int i = -1 ; i <= 1; i += 2)
{
Location possi... |
1c89e00a-3995-440e-8358-eb5e58f2be26 | 9 | public static boolean getPossibleBoard(int[][] current, int[][] target, Piece p, boolean overrideNext){
if(current != target){
for(int i = 0; i < target.length; i++){
System.arraycopy(current[i], 0, target[i], 0, target[i].length);
}
}
for(int i = 0; i < p.getCurrentStructure().length; i++){
if(p.get... |
0f728c93-79a1-4502-b0eb-1a53f0013938 | 3 | public void mouseDragged(MouseEvent e) {
if (dragNormal) {
mouseSelect(e);
} else if (dragPrecise) {
int diff = (e.getPoint().x - dragPreciseX) / 4;
if (diff != 0) {
setValue(value + diff);
dragPreciseX = e.getPoint().x;
}
}
} |
90026035-f651-433d-8378-6ef328aa5415 | 2 | private GameAssetManager() {
data = new HashMap<String, Map<String, String>>();
factoryList = new HashMap<Class<?>, IAssetFactory<?>>();
// Register default factories offered by the GameAssetManager
createGraphicFactories();
createSoundFactories();
createFontFactories();
} |
da8aa74d-e604-4087-9c84-c98a64ac8b80 | 3 | public static int random_deletes(CommunityDAO dao, int howmany) {
KeyRegistrationRecord [] recs = dao.getRegisteredKeys();
Collections.shuffle(Arrays.asList(recs));
int removed = 0;
for( int i=0; i<howmany && i<recs.length; i++ ) {
try {
dao.deregisterKey(recs[i].getBase64PublicKey());
removed++;... |
e863415b-8003-4be3-93a9-ad0a4b24c4cb | 2 | public static int partition(int[] array, int start, int end){
int key = array[start]; // choose the first element as the prvit
int i = end;
for(int j = end; j > start;j--){ // from the end to the first find the element biger than the privt
if(array[j] > key){
exchange(array,i,j); ... |
39b7cd11-7bcf-47e1-bb07-ed3a101c6e18 | 6 | @Override
public void actionPerformed(ActionEvent e) {
this.addObserver(searchInstance);
JButton tempButton = (JButton) e.getSource();
if(e.getActionCommand().equals("from")){
CreateGUI.returnInstance().setTextInFromTextField(tempButton.getText());
for (Entry<String, MyEdge> entry : possibleFromEdges... |
85528e40-77e5-4e1c-b812-694cc22db2bb | 6 | private static void trainTransitionParameters(String[] emissions, MarkovModel mm,
ForwardAlgorithm fa, BackwardsAlgorithm ba) throws Exception
{
int numStates = mm.getMarkovStates().length;
double[][] A = new double[numStates][numStates] ; // all zero; no pseudocounts
double logPx = fa.getLogFinalPValue()... |
df43095b-68ec-4624-8f07-1b526f87fa09 | 1 | public int doSomething(int deciSeconds) {
// reset pointer
last = null;
while (deciSeconds > MIN_SECONDS * 10) {
int sleepDeciSeconds = getDeciSeconds();
deciSeconds -= sleepDeciSeconds;
// sleep
Control.quietSleep(sleepDeciSeconds * 100);
// rufe sinnlose URL auf
Utils.getString(getUrl());... |
93284c68-db55-42e3-9397-f84604fe5af0 | 6 | public static final String getName(byte village) {
switch (village) {
case 0:
return " UNDECIDED ";
case 1:
return " LEAF ";
case 2:
return " SAND ";
case 3:
return " ROCK ";
case 4:
... |
05bc6552-836c-4897-9b8a-a728ffd1ee02 | 5 | private void handleFindValueRequest(RPCMessage received)
{
try
{
FindValueRequest reqRPC = (FindValueRequest)received.getRPC();
NodeId key = reqRPC.getLookupId();
String type = reqRPC.getType();
String ownerId = reqRPC.getOwner();
boolean recent = reqRPC.getRecent();
boolean countersOnly = reqRPC... |
f9e02c63-2521-48b2-926e-f1a3655bfc36 | 5 | public static void main(String args[]) {
Logger log = Logger.getLogger("MAIN");
Properties pt = new Properties();
pt.setProperty("connection.host", "localhost");
pt.setProperty("connection.port", "21");
pt.setProperty("user.login", "ftpuser");
pt.setProperty("user.passwo... |
16fd131c-cc1a-460f-b568-014f7cd87939 | 4 | public void align() {
if(endian==BIG_ENDIAN && bitIndex>=0) {
bitIndex=7;
byteIndex++;
}
else if(endian==LITTLE_ENDIAN && bitIndex<=7) {
bitIndex=0;
byteIndex++;
}
} |
3b95781e-0943-4d32-8d01-9cb01860251a | 0 | public static void main(String... args) {
new CLI(new MainInterface(), args);
} |
735d5c8f-790b-4cbd-9ebd-4ca2ee2422d0 | 6 | public void createCSVExport(String pName, ArrayList<String[]> tabCSV) throws IOException {
String filename = new String();
String path = new String();
filename = pName+".csv";
FileWriter writer;
String targetDirectory = "C:\\J-SimForest\\CSVSave\\";
path = targetDirectory... |
8ed992bb-2d80-493f-843b-644876b369a5 | 7 | public static void startupRead() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (Stel... |
be028c56-abb3-4796-afc3-def2c5d5b416 | 1 | public void deliverShake() {
if (this.calculateChances(5))
{
this.addEffMult(-0.1);
}
else
{
this.addEffMult(0.03);
}
} |
d009dbdb-e0d5-4b8c-87ba-f267153a02c3 | 4 | public void init(int mode, byte[] key, byte[] iv) throws Exception{
String pad="NoPadding";
byte[] tmp;
if(iv.length>ivsize){
tmp=new byte[ivsize];
System.arraycopy(iv, 0, tmp, 0, tmp.length);
iv=tmp;
}
if(key.length>bsize){
tmp=new byte[bsize];
System.arraycopy(k... |
dd31c9ba-487a-4f90-a3ba-97255f44c32e | 3 | public boolean encloses(Rectangular other)
{
return x1 <= other.x1 &&
y1 <= other.y1 &&
x2 >= other.x2 &&
y2 >= other.y2;
} |
c39f1a00-904d-4618-8b68-4d14a9dfa1fc | 4 | protected static void errorLog(String sql, SQLException e) {
if ("X0Y32".equals(e.getSQLState())) { // table already exist
LOGGER.error("Table/View already exist: SQL ===> " + sql);
LOGGER.error(e.getMessage());
} else if ("42X05".equals(e.getSQLState())) { // table does not exist
LOGGER.error("Table/View ... |
40b7da6b-7095-4916-89b7-f95ca3ed26bb | 1 | public ExchangeContext(RoutingTable localRT, boolean invited, int maxRef) {
ArgumentCheck.checkNotNull(localRT, "Null RoutingTable given.");
if (maxRef < 0) {
throw new IllegalArgumentException("Negative maxRef given");
}
maxRef_ = maxRef;
localRoutingTable_ = localR... |
32aabaaa-ffde-4c7d-9ca0-ab85adf21d02 | 3 | private synchronized void processInternalEvent()
{
// this is a constraint that prevents an infinite loop
// Compare between 2 floating point numbers. This might be incorrect
// for some hardware platform.
if ( lastUpdateTime_ == GridSim.clock() ) {
return;
}
... |
96c5dd9f-514d-4825-b7b9-9b7fd5f2d6c5 | 7 | private final void step6()
{ j = k;
if (b[k] == 'e')
{ int a = m();
if (a > 1 || a == 1 && !cvc(k-1)) k--;
}
if (b[k] == 'l' && doublec(k) && m() > 1) k--;
} |
0d83481e-288f-48b8-850e-059181c4b7b5 | 3 | public static boolean isMovePossible(int mX, int mY)
{
return !(mX < 0 || mX > 11 || mY < 0 || mY > 11);
} |
ed0f37c6-8f40-4d98-8814-0b00a62616df | 9 | public static void main(String[] args)
throws Exception
{
// preparing out- and input
PrintWriter pen = new PrintWriter(System.out, true);
java.io.BufferedReader eyes;
java.io.InputStreamReader istream;
istream = new java.io.InputStreamReader(System.in);
eyes = new java.io.BufferedReader(i... |
488c1115-426b-45d2-b4eb-39ee4a75a10d | 5 | public Node<Integer> rearrange(Node<Integer> head) {
if (head == null)
return null;
Node<Integer> fast = head;
Node<Integer> slow = head;
if (head.next == null) {
return head;
}
while (fast.next.next != null) {
slow = slow.next;
fast = fast.next.next;
}
Node<Integer> p = head;
while (slo... |
ddbc5486-54f5-4bed-837f-9f4f87253f9c | 3 | public Path getImgPath_SliderArrowUp(Imagetype type) {
Path ret = null;
switch (type) {
case DEFAULT:
ret = this.imgSliderArrowUp_Def;
break;
case FOCUS:
ret = this.imgSliderArrowUp_Foc;
break;
case PR... |
abb28c22-7471-44f2-84e2-762d6feba38c | 0 | @Test
public void vertexListAndAdjacencyListContainSameObjects() {
Vertex a = new Vertex(0);
g.addVertex(a);
assertEquals(a, g.getAdjacencyList().getNeighbours(0).min());
} |
41a4103e-3074-49d8-b8be-5a0ae4689e8d | 3 | public void render(Screen screen, int xScroll, int yScroll) {
int xOffset = xScroll >> 4;
int yOffset = yScroll >> 4;
int width = (screen.width + 15) >> 4;
int height = (screen.height + 15) >> 4;
screen.setOffsets(xOffset, yOffset);
for (int yt = yOffset; yt <= height + yOffset; yt++) {
for (int xt = x... |
d814648d-0add-4252-8574-05eca4e24f29 | 4 | public void parseFindNames(File[] files) throws IOException {
int compid = 1;
for (File file : files) {
if (file.isDirectory()) {
parseFindNames(file.listFiles());
} else {
if (file.getName().endsWith("txt")) {
logger.fine("Filename " + file.getPat... |
ca53afbf-b944-4c45-8781-bc131b09f16f | 9 | @SuppressWarnings("unchecked")
public boolean login() {
Credentials credentials = model.getCredentials();
// login via http also for GET requests
try {
boolean successful = connection.login(credentials);
if (!successful) {
logger.warn("Failed to login via HTTP.");
} else {
logger.info("Successf... |
0733a63f-0f54-4bad-963b-c4a78e8efdf0 | 9 | public static String format(String src, Serializable... data) {
if (StringUtils.isEmpty(src)) {
throw new IllegalArgumentException("要格式化的字符串不能为空!");
}
if (data == null || data.length < 1) return src;
int index = 1;//从1开始搜索
int cursor = 0;//当前游标
StringBuffer bu... |
fd0e9764-4ad8-4a66-8448-a73012b898bf | 1 | public void initialPopulation(List< List<Double>> inNodes, List<Double> outNodes) {
this.setSize(AppProperties.populationSize());
OrganismFactory fabrica = new OrganismFactory();
List<Organism> organisms = new ArrayList<Organism>();
List<Double> out = new ArrayList<Double>();
ou... |
2f10a59b-df9f-4f06-b4ed-6a086060895f | 2 | public void setTreeHeuristics (TrieNode node) throws Exception {
if (!node.isRoot()){
throw new Exception("calcHeuristic must be run on root node");
}
node.setHeuristic(0);
for (TrieNode child : node.getChildren().values()) {
calcHeuristic(child);
}
} |
aa843f04-58ea-40ce-b112-8c29043672b1 | 5 | protected void printTopKChild4StnWithHybrid(String filePrefix, int topK) {
String topKChild4StnFile = filePrefix + "topChild4Stn_hybrid.txt";
try {
PrintWriter pw = new PrintWriter(new File(topKChild4StnFile));
m_LM.generateReferenceModel();
for (_Doc d : m_trainSet) {
if (d instanceof _ParentDoc) {
... |
15b0e1cf-92d9-453a-a0e2-2570354863fb | 2 | public String getJavaDir() {
String separator = System.getProperty("file.separator");
String path = System.getProperty("java.home") + separator + "bin" + separator;
if ((getCurrentPlatform() == WINDOWS) &&
(new File(path + "javaw.exe").isFile())) {
return path + "javaw.exe";
}
return ... |
5023d567-0cfa-42eb-987d-912848e25e64 | 2 | public boolean mousedown(Coord c, int button) {
if(registerclicks) {
String action = text.actionat(c.sub(10, 10 - sb.val));
if(action!=null) {
wdgmsg("click", action, button);
}
}
return super.mousedown(c, button);
} |
52578056-aa7b-473f-81b5-2ab696c98834 | 0 | public void setPosition(Coordinate position) {
this.position = position;
} |
22e348bd-f8dc-4d4d-9e79-2d33d6a0de65 | 2 | public Session GrabSessionByUserID(int ID)
{
for(Session mSession : this.SessionList.values())
{
if (mSession.GrabHabbo().ID == ID)
{
return mSession;
}
}
return null;
} |
c8852ef9-0ea5-4b39-90cf-502c4c40d699 | 0 | public void updateEl(int n,int m,double value)
{
matrix[n][m] = value;
} |
8ddfaf99-4f98-425e-9e61-bd5bd695779c | 9 | public static Image generateChart(List<Result> results, int width, int height, int xScroll) {
Collections.sort(results);
int chartHeight = height-Y_OFFSET*2;
int chartWidth = width-X_OFFSET;
Image image = new BufferedImage(X_OFFSET+chartWidth, Y_OFFSET*2+chartHeight, BufferedImage.TYPE_INT_ARGB);
Graphics ... |
d5522009-9c98-4f9f-bc5e-d6dade17e907 | 1 | public void parseNumbers() {
for (int i = '0'; i <= '9'; i++)
ctype[i] |= CT_DIGIT;
ctype['.'] |= CT_DIGIT;
ctype['-'] |= CT_DIGIT;
} |
9a52b6fe-fc92-46e2-8473-2a61dea277a2 | 1 | public String getText() {
if (mText == null) {
mText = pop(0);
}
return mText;
} |
c1b62e9a-2510-457b-b9fe-eddff946e350 | 2 | private Directive getDirective(int column)
{
for (int i = 0; i < sortingColumns.size(); i++)
{
Directive directive = (Directive) sortingColumns.get(i);
if (directive.column == column)
{
return directive;
}
}
return EMPTY_DIRECTIVE;
} |
d101b9b1-56d9-44e3-b398-60edd69b3a0a | 0 | private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarActionPerformed
int n = Integer.parseInt(txt1.getText());
nuevo(n);
setVisible(false);
}//GEN-LAST:event_btnEditarActionPerformed |
b03fbccc-e3cb-4fe3-a29d-bce0ec197950 | 1 | public void loadContent(){
try {
door_img = ImageIO.read(this.getClass().getClassLoader().getResource("img/door.png"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
b369b09b-0265-48e1-9071-edd273338bd6 | 0 | public int getLevel() {
return level;
} |
17187ad7-53e2-49e6-aee3-7f1e5b0ac0f4 | 3 | public User getRandomUser(Game game, User exclude) {
Random generator = new Random();
Integer randomint = generator.nextInt(game.users.size());
Integer i = 0;
for(User randomuser : game.users) {
if(i == randomint) {
if(!randomuser.equals(exclude)) {
... |
e28b79fb-e455-4dc3-884b-1920dbc7e236 | 2 | private String getNodeValue(XPathFactory factory, Document doc, String xpathStr)
throws XPathExpressionException
{
XPath xpath = factory.newXPath();
XPathExpression expr = xpath.compile(xpathStr);
Object result = expr.evaluate(doc, XPathConstants.NODESET);
NodeList results = ... |
748693ac-7c60-4644-9c70-8b05b4dbccbb | 1 | public void unPause()
{
pause=false;
if(line!=null)
{
line.start(); // in case a pause was in place, else won't do anything
}
} |
98cfa80f-fe82-43b6-b87a-b9ec80c15e7c | 8 | @Override
public String execute() throws Exception {
try {
Criteria disp = myDao.getDbsession().createCriteria(Campaign.class);
disp.add(Restrictions.sqlRestriction("1=1 order by rand()"));
disp.setMaxResults(1);
cam = (Campaign) (disp.list().get(0));
... |
562777b2-9ffc-465f-88e1-a19ecaefd17e | 2 | public void reFresh() {
for (int i = 0; i < xSize; i++) {
for (int j = 0; j < ySize; j++) {
image.setRGB(i, j, colorR.getRGB());
}
}
} |
5ab2b337-4652-4e02-ad3e-4dacc39e91bb | 5 | public List<Interval> merge(List<Interval> intervals) {
List <Interval> mergedList = new ArrayList<Interval>();
if (intervals == null) return mergedList;
if (intervals.isEmpty()) return mergedList;
for (Interval interval: intervals)
{
insertInterval(interval);
}
... |
53132a41-0d43-4d4d-bad4-2f32838e6a88 | 1 | public void setActive(ArtifactType at, Artifact art)
{
if (artifacts.contains(art)) {
active.put(at, art);
}
} |
8785b000-7f9b-41eb-8ac7-f9386de46ec7 | 8 | public static String strStr(String haystack, String needle) {
if (null == haystack || null == needle) return null;
if ("".equals(needle)) return haystack;
for (int i = 0; i <= haystack.length() - needle.length(); i++) {
int t = i;
int j = 0;
for (j = 0; t < haystack.le... |
4e9add93-1e4e-4826-9d7a-478dd3936730 | 0 | protected JToolBar initInputToolbar() {
JToolBar tb = super.initInputToolbar();
tb.add(new JButton(pauseResumeAction), 1);
pauseResumeAction.setEnabled(false);
return tb;
} |
658779e2-a5fa-4e41-815f-0f32b28a7168 | 2 | float displace1(Point ul, Point ur, Point ll, Point lr, float smooth){
// gen++;
if(ll.y - ul.y <= 1) return 0;
Point lmid = midpoint(ul,ll),
rmid = midpoint(ur,lr),
tmid = midpoint(ul,ur),
bmid = midpoint(ll,lr),
center = midpoint(midpoint(ul,ur),midpoint(ll,lr));
float tlh = get(ul)... |
c5d2bdd3-9c4e-4feb-9134-91b3467a6627 | 1 | private void startCamera() throws IOException, MediaException {
if (player.getState() == Player.PREFETCHED) {
player.start();
}
} |
3db763d8-c549-4973-a1af-285d2c0963ee | 8 | static void indexDocs(IndexWriter writer, File file)
throws IOException {
// do not try to index files that cannot be read
if (file.canRead()) {
if (file.isDirectory()) {
String[] files = file.list();
// an IO error could occur
if (... |
92e9b2c3-482d-426e-89ba-50475d0ace80 | 1 | private static boolean isPlusExpr(ASTree expr) {
if (expr instanceof BinExpr) {
BinExpr bexpr = (BinExpr)expr;
int token = bexpr.getOperator();
return token == '+';
}
return false;
} |
39e9a032-1066-44ed-9bed-5aafb1b3e263 | 1 | private List<Status> searchForTweets() {
try {
Logger.log( TAG, "searching twitter ..." );
queryResult = twitter.search( twitterQuery );
} catch ( TwitterException e ) {
e.printStackTrace();
Logger.log( TAG, "search failed : " + e.getMessage() );
}... |
8d2da87b-7061-480c-bdac-c9ad001491b8 | 6 | private SpriteState generateSpriteState(int frames, int directions, List<Integer> delays) throws IOException
{
SpriteState state = new SpriteState();
state.frames = new ArrayList<SpriteFrame>();
// Extract the width of the full image(not the tiles)
int base_width = buffer.getWidth();
for(i... |
2362f9c0-b3ec-465d-be3d-b7dbbf9908f0 | 8 | public final boolean add(CMVFSFile f)
{
int x=f.path.lastIndexOf('/');
if(x==f.path.length()-1)
x=f.path.lastIndexOf('/',x-1);
CMVFSDir subDir=this;
if((x>0)&&(!f.path.substring(0,x+1).equals(path)))
subDir=fetchSubDir(f.path.substring(0,x),true);
if(subDir!=null)
synchronized(subDir)
{
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.