method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4ab568e2-08d2-43e2-b6e0-ed3d1bdec95e | 7 | public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if (l1 == null)
return l2;
if (l2 == null)
return l1;
ListNode head, last, p1, p2;
p1 = l1;
p2 = l2;
if (p1.val < p2.val) {
head = p1;
p1 = p1.next;
} else {
head = p2;
p2 = p2.next;
}
last = head;
while (p1 != null && p2 !=... |
5a967968-8619-4ba8-aa46-5d2626ec3b6f | 7 | @Override
public int compareTo(Object o) {
if(compareType == 0) {
String name1 = this.name;
String name2 = ((Term) o).name;
int size = name1.length();
if (name1.length() > name2.length())
size = name2.length();
for (int i = 0; i... |
6fb6e532-7d2c-44de-8612-ceade2df92ee | 0 | public Grid(int width, int height, int intelligentX, int intelligentY,
int targetX, int targetY) {
super();
this.width = width;
this.height = height;
this.intelligentX = intelligentX;
this.intelligentY = intelligentY;
this.targetX = targetX;
this.targetY = targetY;
currentCells = new boolean[width *... |
1ad7adc6-84c0-4a0e-8c64-5b5160d50e1a | 4 | private MoveResult checkresign(HantoPieceType pieceType, HantoCoordinate from,
HantoCoordinate to) {
MoveResult result = MoveResult.OK;
if(pieceType == null && from == null && to == null) {
if(turn.equals(HantoPlayerColor.BLUE)) {
result = MoveResult.RED_WINS;
}
else {
result = MoveResult.BLU... |
e21a685b-dbe1-49f6-a893-8bd9b2ca8e9e | 4 | public static int triangleBmin(int x[][]) {
int min = x[0][0];
for (int i = 0; i < x.length; i++) {
System.out.print("\n");
for (int j = 0; j < x[i].length; j++) {
if (i >= j) {
System.out.print(x[i][j] + " ");
if (min > x[i][j]) {
min = x[i][j];
}
}
}
}
System.out.println(... |
93b1e22c-89a1-4e1d-b650-d940dbd508da | 4 | public static BigInteger determinant(Matrix matrix) throws NoSquareException {
if (!matrix.isSquare())
throw new NoSquareException("matrix need to be square.");
if (matrix.size() == 1){
return matrix.getValueAt(0, 0);
}
if (matrix.size()==2) {
return ... |
0ad29986-6479-4da1-8c88-0be82a473768 | 1 | public void drawSettingsMenu() {
if (drawingSettingsMenu)
setMenu.drawWindow();
} |
8beaab24-cc7d-41a6-acb1-f00884e1000a | 2 | public void load(int ID) {
if(Consumable.loadConsumable(ID) != null) {
Consumable consumable = Consumable.loadConsumable(ID);
textPane.setText(consumable.getFlavorText());
for(int x = 0; x<consumable.getEffectsTotal(); x++) {
listModel.addElement(consumable.getStat(x) + ";" + consumable.getEffect(x) + ";... |
10d56ded-f0ee-4e95-b351-2722aa50b78b | 4 | void readGenomeConfig(String genVer, Properties properties) {
String genomePropsFileName = dataDir + "/" + genVer + "/snpEff.config";
try {
// Read properties file "data_dir/genomeVersion/snpEff.conf"
// If the file exists, read all properties and add them to the main 'properties'
Properties genomeProps =... |
8d17fd88-003c-4c66-960c-6266ee3cb4df | 7 | public String readWord()
{
StringBuffer buffer = new StringBuffer(128);
char ch = ' ';
int count = 0;
String s = null;
try
{
while (ready() && Character.isWhitespace(ch))
ch = (char)myInFile.read();
while (ready() && !Character.isWhitespace(ch))
{
count++;
... |
c147d745-dccc-4266-b9f3-19c88904fa88 | 2 | public ArrayList<Upgrade> getUpgradesByType(UpgradeType type){
ArrayList<Upgrade> matching = new ArrayList<Upgrade>();
for(Upgrade u : allUpgrades){
if(u.getType() == type){
matching.add(u);
}
}
return matching;
} |
44def04b-16ab-483f-ab89-761ccce8c299 | 7 | private int parseAndSaveToAlbum(Map root, Album album, boolean firstElementCount) {
int count = 0;
ArrayList<Object> photosMapsTmp = (ArrayList<Object>) root.get(RESPONSE);
if (firstElementCount) {
count = ((Double) photosMapsTmp.get(0)).intValue();
photosMapsTmp.remove(0... |
9f0cceba-1051-4a53-a44f-0e0b721cfe96 | 7 | private void sortFields()
{
// Method Instances
DiagramFieldPanel fieldPanel;
if(isSort())
{
for(int i = 0; i < fieldsPanel.getComponentCount()-1; i++)
{
String master = ((DiagramFieldPanel) fieldsPanel.getComponent(i)).getName();
... |
a7f630bf-8235-4718-9f6c-6947bcf35e56 | 6 | public static OS getPlatform() {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("win"))
return OS.windows;
if (osName.contains("mac"))
return OS.macos;
if (osName.contains("solaris"))
return OS.solaris;
if (osName.contains("sunos"))
return OS.solaris;
if (osNa... |
41002b8f-8f9d-41f8-9a86-d30971486049 | 1 | private static Status StatusObject(ResultSet rs) {
Status newStatus = null;
try {
newStatus = new Status(rs.getInt(rs.getMetaData().getColumnName(1)),
rs.getString(rs.getMetaData().getColumnName(2)));
} catch (SQLException e) {
E... |
2ba8774c-fe56-4147-ae67-6fccfbeeee7c | 2 | private static Float getFloat() {
Boolean flag;
float numFloat = 0;
do {
Scanner scanner = new Scanner(System.in);
try {
numFloat = scanner.nextFloat();
flag = true;
} catch (Exception e) {
flag = false;
System.out.println("Input type mismach!");
System.out.print("Please input in Floa... |
632830ce-7bd8-4885-a96c-8f45b3295a61 | 7 | @Override
public void changeCatalogUsage(Physical P, boolean toCataloged)
{
synchronized(getSync(P).intern())
{
if((P!=null)
&&(P.basePhyStats()!=null)
&&(!P.amDestroyed()))
{
if(toCataloged)
{
changeCatalogFlag(P,true);
final CataData data=getCatalogData(P);
if(data!=null)
... |
dc1e4adb-bc6c-41aa-a3fd-2e61e2793f1b | 0 | public void addButton(Container c, String title, ActionListener listener)
{
JButton button = new JButton(title);
c.add(button);
button.addActionListener(listener);
} |
11467614-a53e-43c7-94b2-7bc167ad1004 | 3 | @Override
public void sell(Command cmd)
{
cmd.execute();
if(Storage.getInstance().getRevenue() < 10000.0)
{
restaurant.setState(restaurant.getBadstate());
}else if(Storage.getInstance().getRevenue() >= 10000.0 && Storage.getInstance().getRevenue() < 20000.0)
{
restaurant.setState(restaurant.getNormal... |
8af0537d-1118-4f62-9d11-39a2da560c58 | 6 | public void moveFileFromJar(String jarFileName, String targetLocation, Boolean overwrite)
{
try
{
File targetFile = new File(targetLocation);
if(overwrite || targetFile.exists() == false || targetFile.length() == 0)
{
InputStream inFile = getClass().getClassLoader().getResourceAsStream(j... |
96bd4c76-69a2-4c86-b668-2103eb7c4dbf | 8 | public static void handle(String[] tokens, Client client) {
if(tokens.length != 3) {
return;
}
Channel channel = Server.get().getChannel(tokens[1]);
if(channel == null || !channel.getClients().contains(client)) {
return;
}
if(client.isAway()) {
client.setAway(false);
}
if(!client.isModera... |
70139552-6b21-4e13-b485-4631b36008c0 | 1 | static public void zoomIn()
{
if(zoom<17)
{
zoom++;
zoomIndex++;
}
} |
947fdbb6-dbba-4696-aa36-e8466b1b23f0 | 1 | public void visitRetStmt(final RetStmt stmt) {
if (CodeGenerator.DEBUG) {
System.out.println("code for " + stmt);
}
genPostponed(stmt);
final Subroutine sub = stmt.sub();
Assert.isTrue(sub.returnAddress() != null);
method.addInstruction(Opcode.opcx_ret, sub.returnAddress());
} |
b6c296f4-b5c2-4f1e-9bb2-39e823b0ed5e | 9 | private void paint(Display display, GC gc) {
Color white = colors.getWhite();
Color black = colors.getBlack();
Color grey30 = colors.getGrey30();
Color grey50 = colors.getGrey50();
Color grey80 = colors.getGrey80();
Color grey120 = colors.getGrey120();
// Calculate left margin to center the keyboard.
i... |
d81ee718-0bdf-422e-97cb-4472e897bf7e | 2 | public void simulate() {
long _time = 1000000L;
if (this._labyrinthType.equals("g")) { // This behavior is applied for
// graph based labyrinths.
// Load the labyrinth from the .xml file
this._labyrinthFactory.setFilename(this._filename);
de.unihannover.sim.labysim.model.graph.Labyrinth ... |
848e27c0-5a9f-456e-8eb2-5dd97936980f | 9 | private final void method645(r_Sub2 var_r_Sub2, boolean bool) {
anInt5601++;
if (anInt5665 > aGLToolkit5692.anIntArray6747.length) {
aGLToolkit5692.anIntArray6749 = new int[anInt5665];
aGLToolkit5692.anIntArray6747 = new int[anInt5665];
}
int[] is = aGLToolkit5692.anIntArray6747;
int[] is_108_ = aGLTool... |
9af0bf64-6860-4d62-8df6-f2487f9da17c | 8 | static int process(String line) {
if(line == null || line.trim().length() == 0)
return 0;
int[] inp = giveArray(line.trim().split(" "));
int n = inp[0], b = inp[1], h = inp[2], w = inp[3];
int[][] havail = new int[h][];
int[] hcost = new int[h];
for(int i = 0; i < h; i++) {
hcost[i] = Integer.parse... |
d2dd09cd-09cf-4eb8-9d16-e92b1d96368d | 8 | @SuppressWarnings({ "resource" })
public ConnectionTable(String filePath) throws Exception
{
BufferedReader bufferedReader = null;
try
{
bufferedReader = new BufferedReader(new FileReader(filePath));
String currentLine = bufferedReader.readLine();
while(currentLine != null)
{
if(!currentLine.is... |
92f5ba49-b666-461b-a2e8-b9bf52e53716 | 8 | public void keyPressed(KeyEvent e) {
char c = e.getKeyChar();
int t = Integer.parseInt(editor.getText());
if (Character.isLetter(c)) {
error();
editor.setText("" + t);
} else {
if (e.getKeyCode() == KeyEvent.VK_UP && e.isControlDown()) {
if (t < maxim - 4) {
editor.setText("" + (t + 4));
... |
52faa820-9c25-49f5-a04f-3b39d69cfe91 | 1 | public void passWeekAll() {
System.out.println("WEEK "+week+"!");
this.earnBonus();
for (int i=0; i<6; i++)
{
employees[i].workWeek();
System.out.println(employees[i]);
}
week+=1;
} |
35ccbc94-e693-4a37-9bc4-61c27fb4ec5b | 9 | public Outcome getOutcome(Choice c) {
switch (this) {
case ROCK:
return c.equals(ROCK) ? Outcome.TIE
: c.equals(PAPER) ? Outcome.LOSS : Outcome.WIN;
case PAPER:
return c.equals(PAPER) ? Outcome.TIE
: c.equals(SCISSORS) ? Outcome.LOSS : Outcome.WIN;
case SCISSORS:
return c.equals(SCISSORS) ? O... |
0e12902a-f806-40bb-b8f5-0d2b3f77f263 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
73af6826-8b63-463e-b594-1fa4d3ae12c0 | 0 | public void setYAxisDeadZone(float zone) {
setDeadZone(yaxis,zone);
} |
2d927f21-7966-42fb-881c-b685c2eb3ba0 | 3 | public BCAlgorithm(String name) {
super();
algName = name;
if (algName.equalsIgnoreCase("SkipJack")) {
keyLength = 8;
} else if (algName.equalsIgnoreCase("TwoFish")) {
keyLength = 16;
} else if (algName.equalsIgnoreCase("Salsa20")) {
keyLength = 16;
}
} |
7d92af99-4e7a-4d2c-bcac-14e2785d228d | 3 | public static int getTotalEnergy() {
if (Debug.active) {
int total = energy;
for (ArrayList<Organism> orgs : organisms) {
for (Organism org: orgs) {
total += org.life.get();
}
}
return total;
}
return 0;
} |
2dc451ea-9cdc-47ea-a06e-3d0d436cd15f | 1 | ObjectiveFunction getOF() {
if (of == null) {
throw new IllegalArgumentException("No Objective function method defined.");
}
return of;
} |
e5443eb9-aa94-4aff-8fdc-e754f104785e | 4 | public boolean isVictory(final HantoPlayerColor color){
boolean isVictory = false;
HantoCell butterflyCell = null;
int gridSize = occupiedCells.size();
for(int i = 0; i < gridSize - 1; i++){
HantoPiece curPiece = occupiedCells.get(i).getPiece();
if (curPiece.getType() == HantoPieceType.BUTTERFLY && cu... |
078f8866-bd10-460d-8e1a-82c4c350f7d3 | 5 | protected static Ptg calcAsc( Ptg[] operands )
{
if( (operands == null) || (operands[0] == null) )
{
return new PtgErr( PtgErr.ERROR_VALUE );
}
// determine if Excel's language is set up for DBCS; if not, returns normal string
WorkBook bk = operands[0].getParentRec().getWorkBook();
if( bk.defaultLanguag... |
91ca4e05-6d01-4126-9530-17d81e88a98e | 4 | public String getCurrentAnimationState(){
switch (currentAnimationState) {
case 1:
return "idle";
case 2:
return "walk";
case 3:
return "jump";
case 4:
return "fall";
default:
return "NOT DEFINED YET";
}
} |
60c69c88-ffad-4898-965b-e9f1d43f0bce | 9 | protected void doRetrieveMatchingFiles(String fullPattern, File dir, Set<File> result) throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("Searching directory [" + dir.getAbsolutePath() +
"] for files matching pattern [" + fullPattern + "]");
}
File[] dirContents = dir.listFiles();
if (dir... |
694d0f9d-17c0-40b0-b99a-d28db4395d89 | 9 | private static LinkedList<ElementSuffixe> trad49(TreeNode tree){
// tree symbol is <element suffixe>
int r = tree.getRule() ;
switch (r)
{
case 0 : // <element suffixe> --> <element access> <element suffixe>
{
ElementSuffixe x0 = trad52(tree.getChild(0)) ;
... |
5071def1-5065-45c0-b05e-f9ec569f3079 | 9 | public void render(Image image, Parameters params) {
int width = image.getWidth(null);
int height = image.getHeight(null);
if (width == -1 || height == -1) {
// Image is not ready yet.
throw new IllegalArgumentException("image not loaded");
}
Graphics g = ... |
9483cf56-35ee-426c-aa2f-4bf39bfb7e12 | 3 | public boolean add(String word, int edit_distance) {
// records the previous node
Predecessor prev = this;
// stores current node
TopNode node = front;
while( node != null) {
if (edit_distance < node.getDistance()){
prev = node;
node = node.getNext();
} else {
... |
f0a7e224-4ecf-493b-ba8e-6f0e5189d3ee | 1 | public List<QuadTree> getLeftNeighbors()
{
QuadTree sibling = this.getLeftSibling();
if ( sibling == null ) return new ArrayList<QuadTree>();
return sibling.getRightChildren();
} |
ab522fc2-2093-46ea-82b5-72201947b7a7 | 0 | public boolean isEmpty(){
return (top == -1);
} |
50689a5c-c2d5-49aa-a366-b5d82eb5d1ea | 5 | void headerOnMouseMove (Event event) {
if (resizeColumn == null) {
/* not currently resizing a column */
for (int i = 0; i < columns.length; i++) {
CTableColumn column = columns [i];
int x = column.getX () + column.width;
if (Math.abs (x - event.x) <= TOLLERANCE_COLUMNRESIZE) {
if (column.resizable) ... |
a41df28f-835b-46c1-a626-1df2f4865406 | 4 | public boolean inBounds(int x, int y)
{
if(0 <= x && 20 >= x && 0 <= y && 20 >= y)
return true;
return false;
} |
37b9eb14-6c1a-446c-8b8f-bafcc27e0ee4 | 1 | public void showScores(SnakeServerMessage SSM) {
for (int i = 0 ; i < SSM.Players.length; i++){
playerScores[i].setVisible(true);
playerScores[i].setEditable(false);
}
} |
2d5fe6b9-5248-4013-a2f5-c856f8b4bd11 | 6 | @Override
public void run() {
PlainSentence ps = null;
try {
while (true) {
ps = in.take();
if ((ps = plainTextProcessor.doProcess(ps)) != null) {
out.add(ps);
}
while (plainTextProcessor.hasRemainingData()) {
if ((ps = plainTextProcessor.doProcess(null)) != null) {
... |
f2846494-76bf-490b-a4a7-a987fe4a91a1 | 8 | public static void quickSorting(int array[], int left, int right) {
if (left < right) {
int i = left, j = right, x = array[left];
while (i < j) {
while (i < j && array[j] >= x) { j--; }
if (i < j) { array[i++] = array[j]; }
while (i < j && array[i] < x) { i++; }
if (i < j) { array[j--] = array[i... |
7f66844c-ad7e-4d14-87ec-dc0620c13a8f | 7 | String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... |
9a00f3f1-66b2-4715-960c-301f7ddac956 | 2 | public void loadFiles() throws IOException {
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
DirFile node = new DirFile(i, j);
DataBaseFile file = new DataBaseFile(getFullName(node), node.nDir, node.nFile, this, provider);
files[node.getI... |
c3610f06-9fc2-4c48-b432-46238b3c53c2 | 2 | public gameState state() {
if (_gameModel.isGameOver()) {
return gameState.GAME_OVER;
} else if (_gameModel.isEndGame()) {
return gameState.END_GAME;
} else {
return gameState.GAME_CONTINUED;
}
} |
9b2eff4b-4dae-4326-9de9-8ad8857f9ff7 | 8 | int doIO(ByteBuffer buf, int ops) throws IOException {
/*
* For now only one thread is allowed. If user want to read or write
* from multiple threads, multiple streams could be created. In that
* case multiple threads work as well as underlying channel supports it.
*/
if (!buf.hasRemaining()) {
thro... |
893df27f-ca24-40ea-9ed7-3d5173128a0b | 8 | public static boolean resolveOneSlotReferenceP(Proposition proposition, KeyValueList variabletypestable) {
{ Stella_Object firstargument = (proposition.arguments.theArray)[0];
Stella_Object predicate = null;
{ Surrogate testValue000 = Stella_Object.safePrimaryType(firstargument);
if (Surrogate... |
a64ba6e6-7e68-445d-a604-eedee0dcf26a | 0 | public int getDepth() {
return depth;
} |
2ebbcdab-2fe1-4354-80eb-bee0a8780ba2 | 6 | public void drawItems() {
itemList.removeAll();
OrderedItem orders[] = commande.getOrders();
for (int i = 0;i<orders.length;i++) {
GridBagConstraints constraintLeft = new GridBagConstraints(),constraintRight = new GridBagConstraints();
constraintLeft.gridx = 0;
constraintLeft.gridy = GridBagConstraints.R... |
d290080e-788f-495d-b2ac-26cc440552c4 | 0 | public TaskRunner(TaskSupplier<T> taskSupplier, TaskExecutor<T> taskExecutor) {
this.taskSupplier = taskSupplier;
this.taskExecutor = taskExecutor;
} |
1238dd42-7207-49bd-ae64-1596c9ab70d2 | 3 | private void parseStartLevel(Node node) throws TemplateException {
try {
XPath xPath = XPathFactory.newInstance().newXPath();
NodeList nodeList = (NodeList) xPath.evaluate("element/interleave/ref", node, XPathConstants.NODESET);
for (int i = 0, len = nodeList.getLength(); i <... |
bb59003e-84a4-4b71-9c23-a43b1ae03a0f | 3 | public static void main(String[] args )
{
TextNavigator tn = new TextNavigator();
tn.text = "forbidden treasures. The common folk of the neigh-\n" +
"borhood, peons of the estancias, vaqueros of the sea-\n" +
"board plains, tame Indians coming miles to market\n" +
"with a bun... |
928198d4-6afa-4e7d-8e1e-4593399a7ae8 | 4 | private JSONObject readObject() throws JSONException {
JSONObject jsonobject = new JSONObject();
while (true) {
if (probe) {
log("\n");
}
String name = readName();
jsonobject.put(name, !bit() ? readString() : readValue());
if (!... |
9805cd54-2947-4b7e-821c-2fff5e32e2e8 | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
3ba9856f-fbdf-4008-94cb-770bad6acdc3 | 1 | private String _toString(String delim)
{
String ret = Integer.toString(this.getId()) + delim + this.getDate() + delim;
// inefficient but perhaps acceptable here
for(Contact contact : this.getContacts())
{
ret += delim + contact.getId();
}
return ret;
} |
b40fdcdc-c300-4876-92a5-e8c8d3e43d13 | 4 | void scoreMatrix() {
score = new int[a.length + 1][b.length + 1];
// Initialize
for (int i = 0; i <= a.length; i++)
setScore(i, 0, deletion * i);
for (int j = 0; j <= b.length; j++)
setScore(0, j, deletion * j);
// Calculate
bestScore = Integer.MIN_VALUE;
for (int i = 1; i <= a.length; i++)
fo... |
8d416a09-83b2-42b6-8e7e-8501177f291a | 6 | public MusicObject getSongByPath(String folder, String fileName) {
try {
if (connection == null) {
connection = getConnection();
}
if (getSongByNameStmt == null) {
getSongByNameStmt = connection.prepareStatement("select "+getColumnNames("music")+" from org.music music where folder_hash = ? and file... |
e7dd87aa-98cb-4efc-89e5-1cef9f9e8ed3 | 2 | @Override
public void compute(Vertex<Text, Text, NullWritable> vertex, Iterable<Text> messages) throws IOException {
if (getSuperstep() == MAX_SIZE.get(getConf())) {
vertex.voteToHalt();
return;
}
if (getSuperstep() == 0) {
doFirstStep(vertex);
} ... |
a694894c-7e72-4872-88bb-bb9abe64af8d | 5 | public static Resource getLatest(RepositoryConnection con, RepositoryResult<Statement> statementIterator, URI timeProperty) throws RepositoryException {
Resource latestResource = null;
SimpleDateFormat sdf = D2S_Utils.getSimpleDateFormat();
while (statementIterator.hasNext()) {
Statement s = statementI... |
8c9ddf03-bead-4fbb-86ab-39436cb33625 | 9 | private void songsnewfromRTFdir() {
// jetzt Dateiauswahl anzeigen:
JFileChooser pChooser = new JFileChooser();
pChooser.setDialogTitle(Messages.getString("GUI.15")); //$NON-NLS-1$
org.zephyrsoft.util.CustomFileFilter filter = new org.zephyrsoft.util.CustomFileFilter("", new String[] {".rtf"}); //$NON-NLS-1$... |
07876170-3583-4474-877c-48ba0efbfbc7 | 4 | public HTMLInput getInputByName(String regex) {
Pattern patt = Pattern.compile(regex);
for (HTMLInput i : inputs) {
final String linksName = i.getName();
if (linksName == null)
continue;
if (regex.equals(linksName) ||
(patt.matcher(linksName).find())) {
return i;
}
}
return null;
} |
59acfe75-a845-404d-9d7c-31af28092a0c | 7 | private void checkReturnType(Method method) throws DaoGenerateException {
Class<?> returnType = method.getReturnType();
isReturnId = (method.getAnnotation(ReturnId.class) != null);
if (isReturnId) {
if (ClassHelper.isTypePrimitive(returnType)) {
returnType = ClassHelper.primitiveToWrapper(returnType);
... |
46814436-61ae-4438-a487-3abbf12a4d2f | 0 | public void beginScope() {
marks = new Binder(null, top, marks);
top = null;
} |
fd3d37c8-5e69-4cdd-9b5b-f7ccfa2a29d1 | 7 | public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
... |
6f294d33-e72d-421d-a9be-61f3d356372f | 3 | public boolean equals(Object o)
{
if (o == null)
return false;
if (o == this)
return true;
else
{
Position temp = (Position) o;
return ((this.getX() == temp.getX()) && (this.getY() == temp.getY()));
}
} |
f7937cf6-2696-494c-bc05-804d18edb42c | 9 | private int getDownElementIndex(int n) {
if (n >= 80 && n < getMaxElementIndex())
return n;
if (n >= 39 && n < 81)
return n + 32;
if (n >= 12 && n < 39)
return n + 18;
if (n >= 1 && n < 12)
return n + 8;
if (n == 0)
return n + 2;
return n;
} |
e2b9127e-6309-4510-a361-b4233beafc0a | 1 | public ByteVector putInt(final int i) {
int length = this.length;
if (length + 4 > data.length) {
enlarge(4);
}
byte[] data = this.data;
data[length++] = (byte) (i >>> 24);
data[length++] = (byte) (i >>> 16);
data[length++] = (byte) (i >>> 8);
... |
b02ada47-b85b-4ce4-80c3-4b2886366895 | 6 | @EventHandler
public void WolfWaterBreathing(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWolfConfig().getDouble("Wolf.WaterB... |
b41a8ac8-0fef-49c6-b9c5-d0ba31dcc292 | 3 | public void addConstant(String con, Object value){
if(value instanceof Integer) intConstantMap.put(con,(Integer)value);
else if(value instanceof Float) floatConstantMap.put(con,(Float)value);
else if(value instanceof Short) shortConstantMap.put(con,(Short)value);
} |
fae74a66-1ae6-4de9-b9b5-57d36e1d6b1e | 1 | public static void main(String[] args) {
MyLogger myLogger1 = MyLogger.getMyLogger();
MyLogger myLogger2 = MyLogger.getMyLogger();
MyLogger myLogger3 = MyLogger.getMyLogger();
MyLogger myLogger4 = MyLogger.getMyLogger();
MyLogger myLogger5 = MyLogger.getMyLogger();
myLogger1.info("Leaning Singlton design... |
58a52bdd-eb07-4971-a5f0-3770b9fe3b48 | 8 | public ArrayList selectSingleList(String query) throws SQLException
{
ArrayList resultList = new ArrayList();
Connection connection = null;
Statement statement = null;
ResultSet result = null;
String value = "";
try
{
Class.forName(driver);
connection = DriverManager.getConnection(url, username, ... |
8bcd4e0e-2d06-4083-bf4a-63dba8f188ba | 4 | @Override
public boolean accept(File f) {
return f.isDirectory()
|| f.getName().toLowerCase().endsWith(".jpg")
|| f.getName().toLowerCase().endsWith(".gif")
|| f.getName().toLowerCase().endsWith(".bmp")
|| f.getName().toLowerCase().endsWith(".png");
} |
780ef282-d22f-48c5-bb4b-16a4f1945ad7 | 1 | public int getij(int i,int j){
assert (i<n) && (j<m);
return A[i][j];
} |
44147cf5-8121-4a45-b717-bf07fd624454 | 9 | private String buildheader(int codeIn, int fileextIn) {
int code = codeIn;
int fileext = fileextIn;
String header = "";
if (code == 200) {
header = "HTTP/1.1 200 OK";
}
if (code == 404) {
header = "HTTP/1.1 404 Not Found";
}
hea... |
2e1d9bdc-b088-4bce-a18b-5ddad1a85b7a | 1 | private void endArguments() {
if (argumentStack % 2 != 0) {
buf.append('>');
}
argumentStack /= 2;
} |
8ff5f86a-9c56-4420-9d5c-c28bb72246d9 | 0 | public void die(){
} |
0db8be80-512c-4838-a4a9-3ebfb2c8bf33 | 8 | public static String getCardString(Card card) {
String string = "";
switch (card.value) {
case (0) : string += 'A'; break;
case (10) : string += 'J'; break;
case (11) : string += 'Q'; break;
case (12) : string += 'K'; break;
default : string +... |
c4eefb7f-4a03-4f5a-932f-d211cdb143ce | 0 | public GraphRect(String tid, int twhichOne, int x, int y, int w, int h) {
super(x,y,w,h);
whichOne=twhichOne;
id=tid;
} |
60295427-53fb-489f-94e9-f44a77437fb3 | 2 | private void setObject() {
if (this.isString || this.isArray) {
throw new RuntimeException(JSON__STATUS__ERROR);
}
this.isObject = true;
} |
ae5c9994-11ce-48c0-8b21-9f32e3cc853f | 8 | @Override
public boolean canBeLearnedBy(MOB teacherM, MOB studentM)
{
if(!super.canBeLearnedBy(teacherM,studentM))
return false;
if(studentM==null)
return true;
final CharClass C=studentM.charStats().getCurrentClass();
if(CMLib.ableMapper().getQualifyingLevel(C.ID(), false, ID())>=0)
return true;
f... |
9d46f059-7aa6-4a28-af32-f521c3697002 | 6 | public static void saveToPng(Maze m, Path to, boolean withShortestPath)
throws IOException {
Logger logger = Logger.getLogger("fr.upem.algoproject");
int width = m.getWidth();
int bi_w = Math.max(100, width);
int bi_h = Math.max(100, m.getHeight());
BufferedImage bi = new BufferedImage(bi_w, bi_h,
Buff... |
0a31caff-c8ca-4757-8395-f43745e66b93 | 4 | @Override
public boolean checkVersion(Player player, ReplicatedPermissionsContainer data)
{
if (data.modName.equals("all")) return true;
for (ReplicatedPermissionsMappingProvider provider : this.mappingProviders)
{
if (!provider.checkVersion(this.parent, player, data) && !player.hasPermission(ReplicatedPe... |
5ec72269-5859-4257-af95-18da797df45e | 2 | private boolean validTarget(Sprite s){
boolean returnVal = false;
if(validTargetDistance(s) && validTargetNotParent(s)) returnVal = true;
return returnVal;
} |
713bcd1a-3a8c-46ea-a12b-0f78c99c9e17 | 6 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int[] MN = readInts(line);
m = new char[MN[0]][MN[... |
e40caf28-73ec-4c65-b44d-87039c206ea6 | 0 | @Basic
@Column(name = "CTR_FORMA_PAGO")
public String getCtrFormaPago() {
return ctrFormaPago;
} |
2974a2a5-8676-4891-9e7c-8909a45e2279 | 4 | public static int canCompleteCircuit(int[] gas, int[] cost) {
assert gas.length == cost.length;
int len = gas.length;
for (int i = 0; i < len; i++) {
int tank = 0;
int start = i;
boolean done = true;
int step = start;
for (int j = 0; j < len; j++) {
tank = tank + g... |
269d15a1-bc6f-4dae-adfe-a609753cea24 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
152a17af-08b2-4675-9e0f-756b4b9535f3 | 0 | public static void main(String[] args) {
new House();
} |
34f86f88-981c-4c2b-b703-51c81cafb5ad | 3 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("sellhead")) {
if (sender instanceof Player) {
Player player = (Player) sender;
ItemStack item = player.getItemInHand();
if (item.getType() == Material.SKULL_ITEM) {
... |
2f5514d6-470a-4c30-9e03-4b9f58d4a5bb | 2 | private boolean jj_3R_81() {
if (jj_scan_token(END)) return true;
if (jj_scan_token(CLASS)) return true;
return false;
} |
11f25985-90e2-4f37-991e-b6f28644dac6 | 3 | private void byWidth(BinaryTree[] mas, int counter, int counterMas) {
System.out.print(mas[counter].getValue() + " ");
if (mas[counter].left != null) {
counterMas++;
mas[counterMas] = mas[counter].left;
}
if (mas[counter].right != null) {
counterMas++;
mas[counterMas] = mas[counter].right;
}
cou... |
40ceb4ff-b702-4a0b-8d45-8a3f3477947c | 5 | public Person getPrevPerson(final Person person) {
if (person != null) {
logger.debug("(getPrevPerson) Looking for Person with ID < " + person.getId());
for (int i = personStorage.entrySet().size() - 1; i >= 0; i--) {
@SuppressWarnings("unchecked")
final Map.Entry<Long, Person> map = (Entry<Long, Perso... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.