method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
95636f83-e6b8-4882-b5ff-12611ee4a364 | 9 | public boolean hides(Element hiderEl, Element hideeEl) {
Symbol hider = cast(Symbol.class, hiderEl);
Symbol hidee = cast(Symbol.class, hideeEl);
// Fields only hide fields; methods only methods; types only types.
// Names must match. Nothing hides itself (just try it).
if (hide... |
b5d9c0b0-3dd0-44e0-a682-88b95c7ac157 | 6 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
return true;
}
Player player = (Player)sender;
if (args.length <= 1) {
sender.sendMessage(ChatColor.RED + "You haven't supplied enough arguments.");
return fal... |
4a819215-346f-49d7-93f7-bbd85bdc51bf | 0 | public String getAmount(){ return amountInt; } |
cf69b1d6-1163-414b-b1db-7f8fbe9932b6 | 2 | private void adjustToLink() {
String tooltip;
Color color;
if (mLink != null) {
tooltip = (String) mLink.getClientProperty(ERROR_MESSAGE_KEY);
if (tooltip == null) {
tooltip = mLink.getToolTipText();
color = mColor;
} else {
color = Color.RED;
}
} else {
tooltip = null;
color = mC... |
d3b17a96-e580-4e11-8a02-fe685f2102f5 | 8 | public String toJSONString( HashMap<String,String> options )
{
boolean set = false;
StringBuilder sb = new StringBuilder();
int baseRow = -1;
sb.append("{");
// put table contents here
if ( this.depth > 0 )
{
String localId = RandomId.getId( 32 );
... |
be77ac22-c1ec-4282-b136-caa7468bf76f | 8 | public static /*@pure@*/ int[] stableSort(double[] array) {
int[] index = new int[array.length];
int[] newIndex = new int[array.length];
int[] helpIndex;
int numEqual;
array = (double[]) array.clone();
for (int i = 0; i < index.length; i++) {
index[i] = i;
... |
18393b3c-97d1-419d-b28e-222cd5f913af | 2 | public int ExecuteUpdate(String query) {
Statement st;
if (!IsConnected) { return -1; }
try {
st = Conn.createStatement();
plugin.Debug("SQL Update: " + query);
return st.executeUpdate(query);
} catch (SQLException e) {
plugin.Warn("Query execution failed!");
plugin.Log("SQL: " + query);
... |
32268e61-3706-4172-aa78-ed61cf66994d | 4 | public static void main(String[] args) {
Vector<Metier> liMetier = new Vector<Metier>();
liMetier.add(new Metier(3, "bucheron", 1200));
liMetier.add(new Metier(4, "fermier", 1000));
liMetier.add(new Metier(2, "saltimbanque", 1700));
liMetier.add(new Metier(0, "roi", 5000));
Vector<Humain> population = new ... |
b23a3e13-b058-449d-aa23-899cb35d33cd | 7 | static void linkPartitions(List<Node> positiveNodes,
List<Node> negativeNodes,
int[] positiveIndices,
int[] negativeIndices,
Graph result) {
int k = 0;
for (int i : positiveIndice... |
ec8de6a7-2abe-4988-97e4-ab91bf386109 | 2 | public void testToStandardHours_years() {
Period test = Period.years(1);
try {
test.toStandardHours();
fail();
} catch (UnsupportedOperationException ex) {}
test = Period.years(-1);
try {
test.toStandardHours();
fail();
... |
ec07e400-562d-4266-b053-906dc0dc6cc0 | 0 | public void initComponents() {
/* Instanciation du panel global */
panelGlobal = new JPanel();
setContentPane(panelGlobal);
/* Instanciation des panels */
panelTags = new VueTag();
panelSeries = new VueSeries();
panelCommandes = new VueCommandes();
panelLecture = new VueLecture();
panelListe = new Vue... |
9403eb72-e05e-4f5d-b324-d98f2d753129 | 6 | private static boolean checkCompatibility(HTMLElement html, Browsers b) {
if (html.getClass().isAnnotationPresent(NotSupportedInBrowsers.class)) {
NotSupportedInBrowsers not = html.getClass().getAnnotation(
NotSupportedInBrowsers.class);
Browsers[] browsers = not.browsers();
for (Browsers browser : brow... |
42e0350f-8337-47b6-8689-b1eb3b7aba31 | 5 | public static void main(String[] args)
{
// Make File Handle
File file = new File("parser-test.txt");
// If the test-file does not exist, create it.
if(!file.exists())
{
try
{
// Create the file...
file.createNewFile();
// Then fill it with basic test-data...
PrintStream out = n... |
0e9ac272-7592-4df8-9385-218019af8d7e | 8 | String LetterChanges(String str) {
int charnum;
char charact;
char[] charArray = str.toCharArray();
for (int i = 0; i < charArray.length; i++) {
charnum = (int) charArray[i];
if (charnum >= 65 && charnum <= 91 || charnum >= 97 && charnum <= 122) {
charnum += 1;
}
if (charnum == 91) {
char... |
855bff97-a86e-4364-bdf6-fe87dba86879 | 8 | public int clean() {
int cleaned = 0;
Set<UUID> _saves = PluginVars.npc_decks.keySet();
List<UUID> _nonsaves = PluginVars.npc_nonduelists;
List<UUID> saves = new ArrayList<UUID>();
for(UUID uuid : _saves) {
saves.add(uuid);
}
for(UUID uuid : _nonsaves) {
saves.add(uuid);
}
List<World> worlds ... |
a20e83d4-1fe8-4d93-8e01-7e6f4378fe13 | 1 | @Override
public void readFromSave(DataTag data) {
super.readFromSave(data);
DataList list = data.readList("items");
for(int i = 0; i < list.data().size(); i++){
DataTag tag = list.readArray(i);
int slot = tag.readInt("slot");
ItemStack stack = ItemStack.createFromSave(tag);
setStackInSlot(slot, sta... |
81a2bbdd-41bb-4145-9d01-3f1c0148cb7a | 7 | public static String substituteXMLContent( String xml, String xpath, Hashtable values, boolean keepCDATA) throws Exception {
XPathFactory factory = XPathFactory.newInstance();
XPath xPath = factory.newXPath();
xPath.setNamespaceContext(CommonNamespaceContext.getInstance());
DocumentBuil... |
24f4de4d-40cd-4112-bdb7-0cda6763372c | 2 | public OrderType getOrderType() {
for(OrderType o : OrderType.values())
{
if(o.getValue() == orderType)
return o;
}
return null;
} |
e06e1f29-2b68-4640-8a2a-4c8efd79d21c | 5 | @Override
public User findByLogin(String login) {
User user = null;
try {
connection = getConnection();
ptmt = connection.prepareStatement(QUERY_SELECT + " WHERE login =?;");
ptmt.setString(1, login);
resultSet = ptmt.executeQuery();
result... |
78d18d3e-3234-48b4-a3e2-dc854407dfc7 | 3 | public JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
put(key, value);
}
return this;
} |
1cd0d862-683d-45cd-ac16-deee0e17689b | 3 | private void setShapeInMatrix() {
for (int r = 0; r < shape.getHeight(); r++) {
for (int c = 0; c < shape.getWidth(); c++) {
if (shape.checkSlot(r, c)) {
setSlot(r + currentY, c + currentX, shape.getType());
}
}
}
} |
f81c62d3-8e89-4276-b46a-44506c4753bc | 2 | public PageId newPage(Page firstpage, int pages) throws
BufferPoolExceededException,
HashOperationException,
ReplacerException,
HashEntryNotFoundException,
InvalidFrameNumberException,
PagePinnedException,
PageUnpinnedException,
PageNotReadException,
BufMgrException,
DiskMgr... |
5fc804ee-ed4d-409e-a813-6bc0cc7bae64 | 6 | public static void read() throws Exception
{
FileReader file = new FileReader(ActionHandler.importConfigSelectedFile.toString());
BufferedReader reader = new BufferedReader(file);
String line = reader.readLine();
boolean foundBlock = false;
boolean endBlock = false;
while (line != null)
{
String... |
e74f1e50-b81a-4d68-b9a6-6b4b03cff8e3 | 4 | public static PolynomialComplex getCPolynomial(){
while(true){
Scanner input = new Scanner(System.in);
String inputString = input.nextLine();
if (inputString.length()==0){
continue;
}
StringTokenizer st=new StringTokenizer(inputString);
ArrayList<Complex>coefficients=new ArrayList<Complex>();
... |
41f7484e-2920-40e1-977e-9252cbd79277 | 1 | public void updateParticipantsPanel () {
Integer c[] = MainWindow.tripDB.getParticipantsCount (targetDay.getTime());
Integer t = 0;
for (int i = 0; i < 5; i++) {
t += c[i];
tfWW[i].setText(((Integer)c[i]).toString());
}
tfTotal.setText(t.toString());
} |
8524fb82-fa6f-4a13-aca8-d719d25e1ecc | 9 | public int bonusScore(Frame[] frame, int frameNumber) throws Exception {
int bonusScore = 0;
int firstBonusPoint;
int secondBonusPoint;
if (frameNumber == LAST_FRAME_NUM)
return 0;
if (frame[frameNumber].isStrike()) {
if (frame[frameNumber+1] == null)
throw new Exception("#");
firstBonu... |
272c7a9d-32fe-453b-a38d-206ce5d11ceb | 9 | public String move(Direction d) throws
OutOfBoardException {
String message = "";
int newx = x;
int newy = y;
switch(d) {
case Up:
newy++ ;
break;
case Down:
newy-- ;
break;
case Left:
newx-- ;... |
c2360a5e-3cab-445e-8f97-b304191c071d | 7 | *
* @throws ConfigurationChangeException Falls der Default nicht gesetzt werden konnte.
*/
private void setDefault(SystemObject systemObject, String aDefault) throws ConfigurationChangeException {
if("_Undefiniert_".equals(aDefault)) throw new IllegalArgumentException("Der Default-Wert '_Undefiniert_' ist nicht ... |
1fc1ab19-7674-4bc2-aaca-fedecf7abdf1 | 6 | public static Set<Class> getClassesInPackage(String packageName) {
Set<Class> classes = new HashSet<Class>();
String packageNameSlashed = "/" + packageName.replace(".", "/");
// Get a File object for the package
URL directoryURL = Thread.currentThread().getContextClassLoader()
.getResource(packageNameSlashed);
i... |
42d62b7f-bf93-40c8-9a8c-30d52c6c68fc | 0 | public boolean accept(File file) {
String filename = file.getName();
return filename.endsWith(".txt");
} |
689ec251-3e84-455f-8e65-5d57639e9294 | 8 | public boolean equals( Object other ) {
if ( ! ( other instanceof TObjectByteMap ) ) {
return false;
}
TObjectByteMap that = ( TObjectByteMap ) other;
if ( that.size() != this.size() ) {
return false;
}
try {
TObjectByteIterator iter = ... |
916088d5-ae4e-4ccd-b66c-4b1ab5e9813c | 6 | public void run() {
while (!isInterrupted()) {
try {
Task t = null;
Result r = null;
Type ty = Type.PROCESS;
while (t == null) {
if (ty == Type.PROCESS) ty = whatShouldIRequest();
t = host.getTask(me, ty);
try { Thread.sleep(50); } catch (InterruptedException e) {}
}
... |
08ef9508-4479-4a43-95ea-846363199141 | 3 | protected void processGISResourceARList(Sim_event ev)
{
if (ev == null || ev.get_data() == null) {
return;
}
Integer id = (Integer) ev.get_data();
int tag = AbstractGIS.GIS_INQUIRY_RESOURCE_AR_RESULT;
boolean result = sendListToSender(id.intValue(), tag, arList... |
5e5326e3-502d-4429-91cc-7c477a069df9 | 1 | public boolean isPickUpAble() {
return !isActive() && !this.isExploded();
} |
dcbb6806-7d96-49a1-ba42-dcecdf87491e | 3 | private int largeurMax() {
int toRet = 0;
if(t1.getLargeur()> toRet) toRet = t1.getLargeur();
if(t2.getLargeur()> toRet) toRet = t2.getLargeur();
if(t3.getLargeur()> toRet) toRet = t3.getLargeur();
return toRet;
} |
e5db2c5d-bc21-494b-8515-c95a35e6a99e | 9 | public static void main(String args[]){
System.out.println( "-------------------------" );
System.out.println( "Test Case 1:" );
HopscotchHashTable<Integer> hash = new HopscotchHashTable<Integer>(9);
System.out.println( "Create a empty hashtable with table size: " + hash.getTableSize());
System.out.println... |
565a0fab-1203-483b-be0a-9ebbec5d671c | 4 | boolean upgradeWeapon(String weapon){
Debug.debug(username + " upgrading his " + weapon);
if(primaryWeapon.equals(weapon)){
Debug.stub("upgrading primary weapon (" + weapon + ")");
boolean success = subtractResourcesForWeaponUpgrade(weapon, primaryWeaponLevel);
if(success){
primaryWeaponLevel++;
De... |
fe150b20-8512-4daf-a885-ad55975a053e | 4 | public void actionPerformed (ActionEvent event) { // like simulate method of Assignment 1,
double nextStop=t+refreshPeriod; // the arguments are attributes here.
for (; t<nextStop; t+=delta_t){
for (PhysicsElement e: elements){
if (e instanceof Simulateable) {
... |
fdec8b3f-3611-4d1a-907a-49cc19ab4557 | 1 | public int getImm() {
if(immediate)
return Integer.parseInt(inst[3]);
return 0;
} |
e6bb6186-5942-4bbf-9e0d-dd99f27657b2 | 5 | public void addToList(ArrayList<String> conceptRoleCollection, String shape, Object parent, mxGraph graph, int startPos,
ArrayList<Constructs> collections, int index, int shape1, int shape2) {
int ant = 0;
int newPos = 0;
String conceptRole = "";
String conname = collections.get(index).getConstructName();
... |
67d9c618-ab7a-4b1e-83c6-16cac7caf330 | 0 | @Override
public String toString()
{
return String.format( "classNameMatches(%s)", this.pattern.toString() );
} |
3a3e19c7-e85f-4608-8cea-51502024498a | 2 | public static int clampInt(int value, int min, int max)
{
return (value < min) ? min : (value > max) ? max : value;
} |
11436f6c-42af-4200-b832-b90e1d20d222 | 0 | public IncreaseThread(SampleCalc sample)
{
this.SampleCalc = sample;
} |
ade18dc1-bdd3-424b-8087-3f280fe74f81 | 9 | private void search() {
if (isSearching) {
return;
}
isSearching = true;
new Thread(new Runnable() {
@Override
public void run() {
model.setComStatus(SafeModel.COM_STATUS_SEARCHING);
ArrayList<String> ports = model.getPorts();
String lastComPort = model.getLastSerialPort();
if (lastCo... |
bde9591c-d117-4e45-902a-0f8339f08cbd | 5 | public void tick() {
walkblock();
if (!getWalkBlock()) {
switch (iRandom.nextInt(4)) {
case 0:
aiUp();
break;
case 1:
aiRight();
break;
case 2:
aiDown();
break;
case 3:
aiLeft();
break;
}
}
setTexture(iTexture.ID_MOUSE_0 + face);
} |
16647896-f870-4f24-8ef9-4baaf3e21fd7 | 9 | @FXML protected void BackButton(ActionEvent event){
switch(operationMode){
case LauncherSelect:
listIndex--;
if(listIndex <= 0)
listIndex=launchers.size()-1;
lbLine2.setText(launchers.get(listIndex));
listIndex=0;
break;
case CitySelect:
listIndex++;
if(listIndex >= 0)
listIndex=citys... |
416b7ea6-1580-4666-b3e2-b7f6774b52e3 | 0 | public FileProtocol getDefault() {
return defaultProtocol;
} |
e0f6b803-ce9f-4672-8b6d-1813be9b67fc | 6 | public SongPlayer(int difficulty, ArrayList scores,String songName)
{
this.songName=songName;
this.scores=scores;
songCanPlay=true;
SongLibrary lib=new SongLibrary(difficulty);
setBackground(Color.WHITE);
if(songName.equals("SomeoneLikeYou"))
{
currentSong=lib.getSLO();
msbp=214*(3-difficulty);
... |
e9671494-1d3d-4e9f-9c51-00f10f538eee | 6 | @Override
public MenuItem getAllMenuItem() {
Menu root = getRoot();
MenuItem itemRoot = new MenuItem(root);
if (!root.getMenuChildren().isEmpty()) {
itemRoot.setChildren(new ArrayList<MenuItem>());
for (Menu m1 : root.getMenuChildren()) {
MenuItem mi1... |
539a9251-5a01-4e7c-ae9e-7c540021eeca | 6 | private void readStats(String path, DataModel dataModel) {
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new File(path));
// normalize text representation
doc.g... |
bd51044b-37df-4323-866a-df9a3bb49592 | 4 | @Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.translate(-getX(), -getY());
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setStroke(new BasicStroke(5));
g2d.setColor(Color.black);
if (path_ != null) {
g2d.dra... |
76b42b82-b4d2-4fd9-9964-159364244d52 | 2 | private synchronized int re_count_users(int numberOfUsers, int servers) {
if ((numberOfUsers > 1 & servers > 0) && numberOfUsers % servers != 0) {
int usersPerEngine = numberOfUsers / servers;
usersPerEngine++;
return usersPerEngine * servers;
} else {
re... |
1b02c5d9-fd0e-4772-a1e9-f9c5b88c749c | 4 | public void aktivoi(ArrayList<Pelaaja> pelaajat, int vuoro) {
for (String elementti : elementit) {
for (Pelaaja pelaaja : pelaajat) {
if (pelaaja.getRobotti().getRuutu().getRuudussa()!=null) {
if (pelaaja.getRobotti().getRuutu().getRuudussa().tyyppi().matches(... |
9a4fe2b6-43f9-4505-b50d-54de8c7bcf6a | 7 | public static String writeBill(Object[][] tableData) {
try {
DocumentBuilderFactory dBfactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder dBuilder;
dBuilder = dBfactory.newDocumentBuilder();
Document doc = dBuilder.newDocument();
Element rootElement = doc.createElement("Bill");
... |
4b304d51-d342-4a3f-9cf8-c763f785cd02 | 6 | private Card[] getAllCards()
{
ArrayList<Card> cards = new ArrayList<>();
for (Card card : this.communityCards) {
if (card != null) {
cards.add(card);
}
}
for (PlayerProfile profile : th... |
be027c1f-5b15-445d-8e5d-7401daf8d9c5 | 3 | @Test
public void lineOneTomorrowMoltkeExpl() {
LinkedList<String> meals = new LinkedList<String>();
LinkedList<String> price = new LinkedList<String>();
Canteen curCanteen = new Canteen(new CanteenData(CanteenNames.MOLTKE, 1));// 1 for "tomorrow"
for (MealData m : curCanteen.getCanteenData().getLines().get(0)... |
10f3b433-0450-4966-8467-a45511d2ede4 | 7 | public void computeErrors(MyGraph reference, PrintWriter writer){
int misplacements=0;
int wrongoriented=0;
for(MyEdge e : this.edges){
MyNode a = reference.nodeFromId(e.getSource().getId());
MyNode b = reference.nodeFromId(e.getTarget().getId());
MyEdge edge = reference.getEdgeByST(a, b);
if(ed... |
3db61aa8-ead2-4e38-bd2b-b43717443f8d | 4 | private boolean isOnScreen(int x, int y) {
if (x >= 0 && x < this.width && y >= 0 && y < height)
return true;
else return false;
} |
cfe447d6-59f9-482a-8921-a7ee088e8d3e | 4 | public Boolean initialize() {
File dbFolder = new File(dbLocation);
if (dbName.contains("/") || dbName.contains("\\") || dbName.endsWith(".db")) { this.writeError("The database name can not contain: /, \\, or .db", true); return false; }
if (!dbFolder.exists()) {
dbFolder.mkdir();
}
File SQLFile = new F... |
0164d0b6-0adc-423a-a822-407d45639e68 | 2 | public void todaysDealsTest(DriverGenerator dg){
// boiler plate
WebDriver wd = dg.generate();
LoggedOutPage pph = new LoggedOutPage(wd);
// setup
boolean madeItToPage = pph.goToURL(AMAZON_HOME_PAGE);
boolean foundAndClickedOnElement = pph.clickOnVisibleElement(TODAYS_DEALS_LINK);
// assertions
if (made... |
2ad6f6d2-49b6-45bd-be64-d0094419514b | 3 | public boolean exist2(char[][] board, String word) {
m = board.length;
n = board[0].length;
visited = new boolean[m][n];
for(int i = 0; i < m; ++i){
for(int j = 0; j < n; ++j){
if(exist2Rec(board, word, 0, i, j))
return true;
}
... |
a2e82588-cf03-4579-8caf-08a8c6e4b91e | 4 | public int readThrough() throws IOException {
//FILL IN HERE--no for or while loops
int letter,last_letter;
letter = consume();
last_letter = letter;
if(letter != -1){
String tempChar = ""+ (char)last_letter;
last_letter = readThrough();
if(... |
aad2f21a-419e-47c6-9467-12db2c095606 | 7 | public PNGDecoderHelper(InputStream input) throws IOException {
this.input = input;
this.crc = new CRC32();
this.buffer = new byte[4096];
readFully(buffer, 0, SIGNATURE.length);
if (!checkSignature(buffer)) {
throw new IOException("Not a valid PNG file");
}
... |
08e2c017-5926-44f4-a4c9-931c5b4a3b68 | 1 | public static ResponseQuestion getQuestionByQuestionID(int questionID) {
try {
String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, questionID);
ResultSet rs = stmt.executeQuery();
rs.n... |
1eacd0ad-bd0f-4c5c-9947-8ea0ce02b2ee | 0 | public int run()
{
qSortTreePart(aInt, 0, aInt.length-1);
return 0;
} |
86298f19-d114-4d37-af37-24da07f588d0 | 1 | public void visitLdcInsn(final Object cst) {
checkStartCode();
checkEndCode();
if (!(cst instanceof Type)) {
checkConstant(cst);
}
mv.visitLdcInsn(cst);
} |
40b3b5fe-00e0-4d59-8533-56bb40162bb6 | 5 | @Override
public boolean onCommand(CommandSender cs, Command cmnd, String string, String[] args) {
String name = cs.getName().toLowerCase();
if (args.length > 0) {
if (args[0].equalsIgnoreCase("info")) {
this.plugin.alleBenutzer.get(name).sendInfo(cs);
ret... |
033e5d8c-a003-428e-bcad-1ecbd1fda089 | 8 | private String ValueVariable()
{
String value ="";
Random m_RandValue = new Random();
int rand = m_RandValue.nextInt(DepthValue);
if(typeTrace.equals("Numbers"))
{
value = String.valueOf(rand);
}
else if(typeTrace.equals("Letters"))
{
if(rand >= 25)
{
while(rand >=25)
... |
42842b6b-4dcb-4633-b5ee-9936e99078cc | 7 | public static Digraph rootedOutDAG(int V, int E) {
if (E > (long) V*(V-1) / 2) throw new IllegalArgumentException("Too many edges");
if (E < V-1) throw new IllegalArgumentException("Too few edges");
Digraph G = new Digraph(V);
SET<Edge> set = new SET<Edge>();
// f... |
8c7a458c-2b21-4892-a122-ec9b279c1958 | 7 | public String displayMoves(){
System.out.println("Select piece to move: ");
Scanner scan = new Scanner(System.in);
StringBuilder boardManip = new StringBuilder();
ArrayList list = new ArrayList();
for(Entry<Point, Piece> p : o.getBoard().entrySet()){
if(p.getValue().getColor() == o.isWhitesTurn() && ... |
c36bd5c7-0993-4c8a-87fa-04f16476557d | 2 | private static void chainloader(Loader nl) {
synchronized (Resource.class) {
if (loader == null) {
loader = nl;
} else {
Loader l;
for (l = loader; l.next != null; l = l.next)
;
l.chain(nl);
}
}
} |
1281e321-9783-4119-b3f4-1f90e6dbd306 | 8 | public void keyPressed(KeyEvent e)
{
//System.err.println (e.getKeyCode() + ">");
//Up
if(e.getKeyCode() == 87 || e.getKeyCode() == 38)
myInfo.setControls(0,true);
//Left
if(e.getKeyCode() == 65 || e.getKeyCode() == 37)
myInfo.setControls(1,true);
//Down
if(e.getKeyCode() == 83 || e.getKeyCo... |
103cacd2-3de1-4f16-ad10-133b8643ea41 | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 70
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 70
... |
30ae497a-c35b-4139-b71c-245ae86c8eba | 4 | public void toThreeD(){
double[] hold0 = (double[])this.point.clone();
double[] hold1 = new double[3];
if(this.nDimensions>3){
System.out.println("Method toThreeD: Dimensions are greater than three so instance cannot be convertd to a three D Point");
}
else{
... |
25e069a8-5576-479c-8f4b-3d8d9b1f6186 | 4 | public void format(final String s, int n)
{
String text = s;
while (text.length()>0)
{
String rest = text;
int i = text.indexOf('\n');
if (i>=0)
{
rest = text.substring(0,i).trim();
text = text.substring(i+1,text.length());
}
else... |
8ab49c79-8d1c-4fa5-94fe-38e87e0b28a4 | 5 | private void plotImageBackground( Graphics2D g )
{
// Draw general background color
g.setColor( graphDef.getBackColor() );
g.fillRect(0, 0, imgWidth, imgHeight );
// Draw a background image, if background image fails, just continue
try {
File bgImage = graphDef.getBackground();
if ( bgImage != null )... |
6c410ccf-cd26-4f3e-b838-bcb4fb99d0f2 | 5 | public void handleCollision(GameEntity a, GameEntity b) {
if (a == null || b == null) {
return;
}
// make a few variables to make equations easier to read
Vector2 aPos = a.getPosition();
Vector2 bPos = b.getPosition();
Vector2 aV = a.getVelocity();
... |
0d2842df-9c1a-4a95-8a7b-1f3b2d2653fd | 7 | private void countrySaveBTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_countrySaveBTActionPerformed
String landcode = landcodeTextField.getText();
Integer region = -1;
String countryname = null;
boolean dbResult = false;
lblError.setText("");
String Erro... |
000a04b1-04d0-4f09-8fb3-524fbf406b3e | 5 | @Override
public void valueChanged( ListSelectionEvent event )
{
// On vérifie que la sélection a bien été effectuée sur le tableau
if ( event.getSource() == ptsTable.getSelectionModel() && event.getFirstIndex() >= 0 )
{
// On détermine la première ligne sélectionnée
... |
5365f899-d65c-407b-8c3c-0ad083e8512f | 7 | private void sendUpdates() {
LinkedList<UpdatePlayer> updates = new LinkedList<UpdatePlayer>();
LinkedList<AnimatePlayer> anims = new LinkedList<AnimatePlayer>();
for (HostedConnection each : getClients()) {
if ((each == null) || (!each.attributeNames().contains(AttributeKey.PLAYER))... |
0dc04cd1-ba4a-4b11-8b91-fab9f5f35050 | 7 | public int convert_msgtobin(String msg)
{
int m = msg.length();
if (m < 14)
{
return -1; // Too short for a valid CAN msg
}
if (m > 30)
{
return -2; // Longer than the longest CAN msg
}
if ((m & 0x1) != 0)
{
... |
6b4a6fb0-dfae-43e3-8e15-56cd51fcbbd3 | 3 | @Override
public HandshakeState acceptHandshakeAsClient( ClientHandshake request, ServerHandshake response ) throws InvalidHandshakeException {
if( !request.hasFieldValue( "Sec-WebSocket-Key" ) || !response.hasFieldValue( "Sec-WebSocket-Accept" ) )
return HandshakeState.NOT_MATCHED;
String seckey_answere = res... |
5a7f60b8-2425-42ce-a139-b8e99c68a1aa | 9 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
//由context parameter取得JDBC需要的資訊
ServletContext sc = this.getServletConfig().getServletContext()... |
2d43f8f6-582e-4053-9d1d-7e66d323e767 | 9 | @SuppressWarnings("unchecked")
public static void load(String path) throws FroshProjectException {
// Create a Properties object
//
configurationData = new Properties();
// Load the file from the path specified as argument
//
try {
configurationData.loadF... |
3c616735-99e6-43d3-8bdd-42177e64f16b | 9 | public ArrayList<Integer> findSubstring2(String S, String[] L) {
ArrayList<Integer> result = new ArrayList<Integer>();
HashMap<String, Integer> needFind = new HashMap<String, Integer>();
HashMap<String, Integer> hasFound = new HashMap<String, Integer>();
int m=S.length(), n = L.length, len = L[0].length... |
5801e2a9-d70d-45cc-852e-4cec570fc2cf | 3 | public void writeNew(ArrayList<TeamObject> team) {
// before we open the file check to see if it already exists
boolean alreadyExists = new File(path).exists();
try {
// use FileWriter constructor that specifies open for appending
CsvWriter csvOutput = new CsvWriter(ne... |
fcfb17b2-e940-4f67-ba02-44ce6ed6a84e | 3 | private boolean checkEnd()
{
int size, i;
for (i=0; i<playersNo; ++i) if (players[i].isFinished() == false) {
size = players[i].getCastles().size() + players[i].getHeroes().size();
if (size == 0) {
QMessageBox.warning(WindowStack.getLastInstance(), "Przegrana", "Gracz "+players[i].getColor().name+" prze... |
f42d19eb-04ad-4377-adf1-ba75182d0552 | 7 | public static void wheel(int dir) {
for (int i = 0; i < qSlots.length; i++) {
if (qSlots[i].selected) {
if(dir == 1 && i == 0 || dir == -1 && i == qSlots.length -1){
return;
}
if (qSlots[i - dir] != null) {
qSlots[i - dir].clicked("hud");
return;
}
}
}
} |
7619bc96-4491-4597-82b0-931f0bf2ba02 | 4 | private static void compareGroups( MVD mvd1, MVD mvd2 )
throws MVDTestException
{
int numGrps1 = mvd1.numGroups();
int numGrps2 = mvd2.numGroups();
if ( numGrps1 != numGrps2 )
throw new MVDTestException(
"Number of groups in MVDs don't match" );
for ( short gId=1;gId<=numGrps1;gId++ )
{
String g... |
24249e8b-268f-4ebc-b9cc-b39e19de1910 | 6 | public static boolean checkUsername(String username) {
username = username.toLowerCase();
boolean hasallowedchars = false;
// first, check if it's empty.
if (username.trim().length() == 0) {
return false;
}
for (String e : evil)
if (username.contains(e)) return false;
for (String a : alpha)... |
ab391b5e-5f38-477c-a930-5e969beca86d | 3 | private void updateMetrics()
{
height = text.length;
if(height == 0)
height = 1;
width = 0;
for(String line: text) {
if(line.length() > width)
width = line.length();
}
} |
8d09ce2e-a7f0-40f0-b7c3-898f843c28cc | 7 | @Override
public Class<?> getColumnClass(int columnIndex) {
Class<?> clazz;
switch (columnIndex) {
case 0:
case 3:
case 4:
clazz = Integer.class;
break;
case 1:
case 2:
clazz = String.class;
... |
3c22c34c-8588-4bc4-8492-3399ceaef483 | 3 | public void checkWin() throws WhoWinException{
if (dealer.getValue()>21){
player.playerWin();
throw new WhoWinException("/photos/player_win.png");
}
if (dealer.getValue()>player.getValue()){
player.playerLose();
throw new WhoWinException("/photos/Dealer_win.png");
}
else if (dealer.getValue()<play... |
890646c0-2821-446e-ac76-9adacd4f8906 | 4 | public Codec(String extension, Class<?> iCodecClass) {
extensionRegX = "";
// Make sure an extension was specified:
if (extension != null && extension.length() > 0) {
// We are only interested in the file extension. The filename
// can begin with whatever:
extensionRegX = ".*";
String c;
fo... |
c72f363b-b298-4767-b3be-7653d5b3c1c7 | 0 | @Override
public void loadRcon() throws DataLoadFailedException {
ConfigurationSection sec = getData(specialYamlConfiguration, "rcon");
YamlPermissionRcon permBase = new YamlPermissionRcon(sec);
load(PermissionType.RCON, permBase);
} |
7a49a7bd-6ea7-4178-9798-cbdbd33ad248 | 0 | public VectorTools() {} |
f5401b31-e70e-4976-bfaa-0ca16d10557e | 6 | public void getListDetails(String id)
{
float total = 0;
float totalInterest = 0;
try
{
String tempQuery = "select membername,contribution,cash_amount,reg_amount,calamity_amount,educ_amount,emer_amount,goods_amount,mem_total from bill_dtl where billid='"+id+"'";
... |
3b2ce0fe-c859-4215-abf6-6363f00db29d | 5 | public BufferedImage convert(BufferedImage src, int[] cols) {
if (cols.length != xcolors.length) {System.out.println("# of colors doesn't match"); return src;}
int w = src.getWidth();
int h = src.getHeight();
int type = Transparency.BITMASK;
BufferedImage dst = getCompatibleImage(w,... |
21ebc9cc-dde7-4a4c-aa0d-a846071dbca9 | 4 | public BoardCell(int i, int numRows, int numCols) {
index = i;
// Initialize our links.
if((index - numCols) >= 0)
top = index - numCols;
if((index + numCols) < (numRows*numCols))
bottom = index + numCols;
if((index % numCols) > 0)
left = index - 1;
if(((index + 1) % numCols) > 0)
right = index ... |
28ab15fa-af66-4b9f-af13-996b999c269d | 3 | @Override
public void configure(TestElement element) {
super.configure(element);
BmTestManager bmTestManager = BmTestManager.getInstance();
RemoteTestRunner remoteTestRunner = (RemoteTestRunner) element;
String userKey = remoteTestRunner.getUserKey();
TestInfo testInfo = null... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.