method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2fd966a4-a3e9-4ea9-afe7-78f31151cb9d | 5 | @Override
public void draw(Graphics g) {
if(Constants.getWidth() > viewport.getWidth()){
System.out.println("Updating viewport.");
viewport = new Rectangle(0,
0,
Constants.getWidth(),
Constants.getHeight());
}
g.setColor(Color.WHITE);
/**
* Draw the map.
*/
try{
... |
274fd6d5-f9dd-4131-9f41-d8c82624b781 | 4 | protected String GetPreferredLanguage(HttpServletRequest httpRequest, String parseLangQueryParams)
{
String preferredLang = null;
// Attempt to detect a lang parameter in the referral URL
preferredLang = InferLangFromReferralUrl(httpRequest, parseLangQueryParams);
// If the cookie failed, ... |
edc41124-9b0d-40ba-9397-b529c1ab815b | 6 | public void createGUI(Composite parent) {
GridLayout gridLayout;
GridData gridData;
/*** Create principal GUI layout elements ***/
Composite displayArea = new Composite(parent, SWT.NONE);
gridLayout = new GridLayout();
gridLayout.numColumns = 1;
displayArea.setLayout(gridLayout);
// Creating these e... |
6495cb06-3133-4229-9b97-f2e49ebb5ea8 | 4 | public void sigmoidThresholdFit(){
if(this.nAnalyteConcns<4)throw new IllegalArgumentException("Method sigmoidThresholdFit requres at least 4 data points; only " + this.nAnalyteConcns + " were supplied");
this.methodUsed = 5;
this.sampleErrorFlag = true;
this.titleOne = "Sigmoid threshol... |
4670d494-f7ed-44de-8747-ca18f16ef50b | 9 | public String formatLegal_name(String value) {
String[] delimiterlist = {" ", "-", "_", "'", "."};
String[] abbreviationlist = {"ag", "bvba", "cv", "cvba", "cvoa", "esv", "nv", "pvba", "vzw"};
boolean first = true;
boolean afterdelimiter = false;
int index = 0;
String des... |
e9f17194-565b-4668-b5ba-4798a3007844 | 0 | public BrainPanel()
{
BoxLayout mainBoxLayout = new BoxLayout(this, BoxLayout.Y_AXIS);
setLayout(mainBoxLayout);
TopPanel topPanel = new TopPanel();
add(topPanel);
final QuestionPanel questionPanel = new QuestionPanel();
TimerButtonPanel timerButtonPanel = new Time... |
40bfa282-b9dc-4044-a864-d5045eea6ded | 8 | @Override
public void paint(Graphics2D g) {
super.paint(g);
Image image = new ImageIcon("resources/sprites/player1.png").getImage();
if (getFace() == 1) {
image = new ImageIcon("resources/sprites/player1.png").getImage();
}
if (getFace() == 2) {
image = new ImageIcon("resources/sprites/player2... |
8ec96cdb-da88-4bc5-a6cb-efb9bb591f62 | 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... |
b4f88b46-52bf-4fbb-aa9b-76c387858c16 | 3 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null && line.length() != 0) {
tree = new Node();
int n = Integer.parseInt(line);... |
bfb7fe16-da9b-4a4c-b16d-06e70e9bb236 | 0 | public StaticHelloProxy(IHello hello) {
this.hello = hello;
} |
b799e313-5df4-4dd6-8a8b-bc251aca18cc | 4 | public static int closestPoint() {
Shapes.Point min = new Shapes.Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
int index = 0;
for (Shapes.Point point : points) {
if (point.getY() < min.getY()) {
min = point;
index = points.indexOf(point);
} ... |
2ac45ef0-adf4-4495-94ff-d892573cdd05 | 8 | @Override
public void receiveOrder(OrderMessage message) throws RemoteException {
LOGGER.debug(echoIndex() + "received order from " + message.getSender());
incomingMessages.put(message.getAlreadyProcessed(), message);
sendAck(message);
//valid for the exchange rounds starting from 2... |
4e7d2458-6bac-4bb3-a51d-bcfaa60b896b | 0 | public ExceptionList() {
exceptions = new ArrayList<Throwable>();
} |
7ee26ad6-bf4a-4eea-8ff5-3d95e775e91e | 3 | public static void save(Game g){
try {
Connection conn = ConnectionHandler.getConnection();
Statement stmt=conn.createStatement();
DatabaseMetaData md = conn.getMetaData();
ResultSet rs = md.getTables(null, null, "PLAYERS", null);
if(!rs.next()){
String create =
"CREATE TABLE PL... |
a3692b71-e983-4f5e-b909-0555fdc6efd7 | 4 | public static boolean DeleteSuffix(String hostname)
{
Read(hostname);
List<String> todel = new ArrayList<String>();//list to delete
for(String s : Suffixes)
{
String[] split = s.split(" ");
if(split[0].equalsIgnoreCase(hostname)){
todel.add(s);... |
8744ac61-f6e3-4203-9c13-2b1a6e022189 | 2 | @SuppressWarnings("unchecked")
public final <ValueT> ValueT valueFor(Class<? extends Property<ValueT>> propertyT)
{
Property property = this.properties.get(propertyT);
return property == null ? null : (ValueT)property.value();
} |
efec9c92-ab0f-4302-9cfe-8b8f92c05f78 | 9 | @Override
public boolean isDone(Game game)
{
boolean ended = super.isFinished(game);
if(ended)
return true;
int countAcum = 0;
if(itype1 != -1) countAcum += game.getNumSprites(itype1) - game.getNumDisabledSprites(itype1);
if(itype2 != -1) countAcum += game.... |
2bf67872-2c50-431a-bc86-7dce26969b08 | 1 | public void visit_iaload(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
181abe5b-b53c-459d-87a0-984f36b583a1 | 3 | public void report(final String reportPath) throws IOException {
//// Preconditions
if (reportPath == null)
throw new NullPointerException("reportPath must not be null");
if (reportPath.length() == 0)
throw new IllegalArgumentException("reportPath must not be an empty string");
assert mos... |
8a83c4ef-c0f8-4888-a0b7-f5b20549aed6 | 3 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
TuoteService palvelu = new TuoteService();
try {
ArrayList <Tayte> taytteet = palvelu.haeTaytteet();
System.out.println(taytteet.toString());
request.se... |
dd3c251c-9bfa-4e85-a6b0-c39d50423495 | 0 | public static void main(String[] args){
PumpingLemma r;
LanguageTester t = new LanguageTester();
String[] s;
/* r = new ABnAk();
s = new String[] {"abababaa", "ababab", "ab", "ababac", "aba", "abc", "a", "b", ""};
t.test(r, s, 1);
r = new AnBkCnk();
s = new String[] {"aabbcccc", "abbccc", "aabccc... |
2e50e389-a1ee-4f32-b081-792930d6e809 | 8 | @Override
public void applyStatus(GameObject holder) {
for(SpriteGroup sg : myPlayField.getGroups()){
for(Sprite s : sg.getSprites()){
if(Math.abs(s.getX() - holder.getX()) <= myRange && Math.abs(s.getY() - holder.getY())<= myRange) {
if(((GameObject) s).getType().equals("Enemy")){
Enemy enemy = (E... |
95996be2-a518-4356-b6d0-dc2896d56f3f | 7 | public static Class<?> getClass(Object classLoaderObj, String path) throws ClassNotFoundException {
if( THREAD ) {
ClassLoader cl = null;
if( classLoaderObj != null )
cl = classLoaderObj.getClass().getClassLoader();
if( cl == null )
return Thread.currentThread().getContextClassLoader().loadClass(path... |
934e220a-d153-429e-bae7-eb0e369dd9a6 | 9 | public boolean ResetPlayerVars() {
teleportToX = 0;
teleportToY = 0;
heightLevel = 0;
playerRights = 0;
playerIsMember = 0;
playerMessages = 0;
playerLastConnect = "";
playerLastLogin = 20050101;
playerEnergy = 0;
playerEnergyGian = 0;
playerFollowID = -1;
playerGameTime = 0;
playerGameCount =... |
5dc7d376-d241-47de-a5b9-ffb4e56fa996 | 4 | private ArrayList<Integer> processOpenings(ArrayList<Integer> openings) {
int prev = openings.get(0);
int current;
boolean check = false;
int counter=0; //tellen hoeveel openingen na elkaar komen
ArrayList<Integer> ret = new ArrayList<Integer>();
for (int i = 1; i < openings.size(); i++) {
current = open... |
76125b69-17df-4817-bb70-af0c97df0c00 | 9 | public void installAttributes(CellView view) {
super.installAttributes(view);
Map map = view.getAllAttributes();
shape = CellConstants.getVertexShape(view.getAllAttributes());
stretchImage = CellConstants.isStretchImage(map);
// Adds the inset as an empty border to the existing border.
int i = GraphConstan... |
de00b130-b04d-4aac-8501-e535a0ebde70 | 5 | public void run()
{
try {
ois = new ObjectInputStream(socket.getInputStream());
userInfo = (UserInfo)ois.readObject();
if(userInfo!=null){
System.out.println("Your name is : "+userInfo.getUserName());
writers.add(oo... |
53cd3253-483a-4c1e-865b-ebc1da017c7e | 2 | public void test_01() {
String args[] = { "-classic", "-noOut", "testHg3766Chr1", "./tests/huge_deletion_DEL.vcf" };
SnpEff cmd = new SnpEff(args);
SnpEffCmdEff cmdEff = (SnpEffCmdEff) cmd.snpEffCmd();
List<VcfEntry> vcfEntries = cmdEff.run(true);
// Make sure these are "CHROMOSOME_LARGE_DELETION" type of ... |
afe74647-33d3-4365-9fab-e71816ecc018 | 7 | public boolean addNumberToBoard () {
int row = 0, col = 0, counter = 0;
Random randomGenerator = new Random();
/* Checks board size */
if (size.equals("9x9")) {
/* uses a while loop to generate a random number and then an if statement to place a solution */
while (counter < 200) {
row =... |
324b28c4-2c8a-4f6e-ab56-d944142eeee0 | 8 | public void annotation_process(){
if(this.q!=null && this.q.size()>0){
for(int i=0; i<this.q.size(); i++){
for(int j =0; j<this.q.get(i).v.size(); j++){
this.annotation_replace(this.q.get(i).v.get(j).name);
//System.out.println("replace " + this.q.get(i).v.get(j).name + " with a_" + this.q.get(i).v.g... |
a54db0df-cd0f-48f0-ac54-c84bdc1b976d | 7 | private String[] _smsc_send_cmd(String cmd, String arg){
String[] m = {};
String ret = ",";
try {
String url = (SMSC_HTTPS ? "https" : "http") + "://smsc.ru/sys/" + cmd +".php?login=" + URLEncoder.encode(SMSC_LOGIN, SMSC_CHARSET)
+ "&psw=" + URLEncoder.encode(SMSC_PA... |
0656ed96-411e-409b-921a-8471f2267103 | 1 | public void doDelimitedWithPZMap() {
try {
final String mapping = ConsoleMenu.getString("Mapping ", DelimitedWithPZMap.getDefaultMapping());
final String data = ConsoleMenu.getString("Data ", DelimitedWithPZMap.getDefaultDataFile());
DelimitedWithPZMap.call(mapping, data);
... |
1f0aca22-2fca-4862-aa0e-3ec9efd2c81b | 9 | public void pelaajaOnKoilisessa() {
Pelaaja kiekollinen = getKiekollinen();
int pelaajiaSuunnassa = 0;
for (Pelaaja pelaaja : pelaajat) {
if (kiekollinen.getY() > pelaaja.getY() && pelaaja.getX() > kiekollinen.getX()) {
int x = pelaaja.getX() - kiekollinen.getX();
... |
f666702a-e166-43ee-8f51-66fe2767c911 | 0 | public <T> int sendData(T data, String typeURI) throws Exception {
Gson gson = new Gson();
String json = gson.toJson(data);
System.out.println(json);
prepareConnection();
webResource = client.resource(address + "adminPanel/" + typeURI);
ClientResponse response = webResource.type(MediaType.APPLICATION_JSO... |
be6ba5e5-3b85-4a81-8c6d-86b759f422e0 | 6 | public String printXMLResults(boolean all) {
StringBuffer sb = new StringBuffer(100);
double singleMultiRatio = 0.0;
sb.append("<?xml version=\"1.0\"?>");
sb.append("<bsbm>\n");
sb.append(" <querymix>\n");
sb.append(" <scalefactor>" + parameterPool.getScalefactor()
+ "</scalefactor>\n");
sb.appe... |
edb4f280-ea22-4380-b783-69cc85007be1 | 6 | public boolean interact(EntityPlayer par1EntityPlayer)
{
ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
if (var2 != null && this.isWheat(var2) && this.getGrowingAge() == 0)
{
if (!par1EntityPlayer.capabilities.isCreativeMode)
{
--var2.s... |
0f047449-dc60-48b1-983e-8a3a90661742 | 8 | String headerGetToolTip (int x) {
if (resizeColumn != null) return null;
int orderedIndex = computeColumnIntersect (x, 0);
if (orderedIndex == -1) return null;
CTableColumn[] orderedColumns = getOrderedColumns ();
CTableColumn column = orderedColumns [orderedIndex];
if (column.toolTipText == null) return null;
... |
f6cf18f7-ea16-4e1b-b5fb-c436130bc67d | 6 | public final String getSalt() throws IllegalAccessException {
StackTraceElement[] stacks = Thread.currentThread().getStackTrace();
try {
StackTraceElement e = stacks[2]; //The heartbeat class will always be the 3rd in the stacktrace if the heartbeat is being sent correctly
Class<?> class_ = Class.forName(e.ge... |
cbe31f84-f13a-4d10-a27b-1bd5779fa5e5 | 5 | public void actionPerformed(ActionEvent ev) {
Object o = ev.getSource();
String font = fontComboModel.getSelectedItem().toString();
String fontSize = sizeSpin.getValue().toString();
String printOptions = " <PRINT FONTSIZE=\"" + fontSize + "pt\" FONTFACE=\"" + font + "\"/>\n";
if (o == prevButton) {
File... |
2eb77882-5ec7-41eb-9646-fe07fc664d89 | 3 | public BufferedImage toImage(ImageBean i) {
BufferedImage image = new BufferedImage(i.getWidth(), i.getHeight(), 1);
int[] pixels = i.getPixels();
for (int x = 0; x < image.getWidth(); x++) {
for (int y = 0; y < image.getHeight(); y++) {
int rgb = pixels[(x + y * image.getWidth())];
if (rgb == 0) {
... |
a3a8b85f-92ae-40a1-a76c-1415b7741a24 | 1 | public List<Basket> getALL() {
List<Basket> baskets = null;
try {
beginTransaction();
baskets = session.createCriteria(Basket.class).list();
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSession();
}
return baskets;
} |
3c0e46bc-7153-436a-8c68-5149ff9d9839 | 6 | public void saveAs()
{
if(_isOSX || ostype == ostype.Linux || ostype == ostype.Other)
{
saveAs_OSX_Nix();
saveFile(curFile);
}
else /* Windows */
{
JFileChooser fc = new JFileChooser();
if(curFile != null)
fc.set... |
a738693b-7307-4f09-a96f-954c0b0b38b7 | 6 | public static String getCellValueAsString(XSSFCell cell) {
String strCellValue = null;
if (cell != null) {
switch (cell.getCellType()) {
case XSSFCell.CELL_TYPE_STRING:
strCellValue = cell.toString();
break;
case XSSFCell.CELL_TYPE_NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
SimpleD... |
8e24c6fd-0c98-4a89-85a8-f78eba936e2b | 3 | public boolean textAtContains(String locator, String verificationText) throws Exception {
boolean isTextMatched = false;
try {
String temp = textAt(locator).toLowerCase();
if(temp.length() < 1)
return isTextMatched;
isTextMatched = temp.contains(verifi... |
50487097-8047-480f-9a9f-df73a80670a1 | 0 | public void setCoordinates(LngLatAlt coordinates)
{
this.coordinates = coordinates;
} |
5b5ba6b6-50e1-4c82-b6b5-216ef062d058 | 1 | public String getTitle() {
if (doc.title() != null) {
return doc.title();
} else {
return "RESERVE";
}
} |
6c9f304a-aee7-4685-a8fc-be694c526ed8 | 6 | public void render(Graphics g) {
background.render(g);
for (int i = 0; i < obstacles.size(); i++) {
obstacles.get(i).render(g);
}
for (int i = 0; i < fruits.size(); i++) {
if (fruits.get(i).spawned) {
fruits.get(i).render(g);
}
}
for (int i = 0; i < snakes.size(); i++) {
if (snakes.get(i).de... |
1818fcb9-41d6-40ae-8a26-29c917360969 | 7 | private String DDCRET_String(int retcode)
{
switch ( retcode )
{
case DDC_SUCCESS: return "DDC_SUCCESS";
case DDC_FAILURE: return "DDC_FAILURE";
case DDC_OUT_OF_MEMORY: return "DDC_OUT_OF_MEMORY";
case DDC_FILE_ERROR: return "DDC_FILE_ERROR";
case DDC_INVALID_CALL:... |
0d7aab8e-9ba0-4c00-b58f-30a451cb149f | 5 | public Set<Literal> getOverlappedLiterals(Literal literal, ProvabilityLevel provability) {
Set<Literal> relatedLiterals = getRelatedLiterals(literal, provability);
if (null == relatedLiterals) return null;
Set<Literal> extractedLiterals = new TreeSet<Literal>();
Temporal literalTemporal = literal.getTemporal()... |
7c1a851f-8e99-489a-ab82-a519ef4aecd0 | 3 | public boolean hasCard(int value, int suite) {
ListIterator<Card> iterator = cardPile.listIterator();
while (iterator.hasNext()) {
if (iterator.next().value == value && iterator.next().suite == suite) {
return true;
}
}
return false;
} |
c2a62e17-2b29-466c-8624-e289d1a485c5 | 3 | public void setBlockTileEntity(int var1, int var2, int var3, TileEntity var4) {
if (!var4.isInvalid()) {
if (this.scanningTileEntities) {
var4.xCoord = var1;
var4.yCoord = var2;
var4.zCoord = var3;
this.addedTileEntityList.add(var4);
... |
e763f6fb-f0d7-430d-9f12-6547aea8a939 | 3 | public boolean commitReservation(int reservId) {
Reservation reservation = getReservation(reservId);
if(reservation == null) {
logger.info("Error commiting reservation, ID is invalid");
return false;
}
int resId = reservation.getResourceID();
try {
... |
047d3580-1de7-4149-999f-c26b287b788b | 7 | @Override
public boolean setA(DenseMatrix64F A) {
pinv.reshape(A.numCols,A.numRows,false);
if( !svd.decompose(A) )
return false;
DenseMatrix64F U_t = svd.getU(null,true);
DenseMatrix64F V = svd.getV(null,false);
double []S = svd.getSingularValues();
int ... |
b15c86f3-32df-49d4-832e-38986f4e02de | 3 | private void formUserOrderList(SessionRequestContent request) throws ServletLogicException {
Criteria criteria = new Criteria();
User user = (User) request.getSessionAttribute(JSP_USER);
if (user != null) {
criteria.addParam(DAO_USER_LOGIN, user.getLogin());
criteria.addP... |
9b7fe340-1945-4a17-a13f-6af5555d2f74 | 6 | Class14_Sub2(NativeOpenGlToolkit class377, int i, boolean bool, int[][] is) {
super(class377, 34067, Class108.aClass304_1662, Class68.aClass68_1183,
6 * (i * i), bool);
try {
((Class14) this).aClass377_5082.method3850((byte) -109, this);
if (!bool) {
for (int i_0_ = 0; i_0_ < 6; i_0_++)
OpenG... |
d9e6970b-a48f-408e-8f98-70b0a26afa52 | 1 | private void checkBossStatus() {
if(Application.get().getLogic().getActor(bossID) == null) {
// boss is dead!
dead = true;
}
} |
1b98b3d0-2872-4570-aa95-f9e4cebfbde0 | 3 | public void drawUnits(){
for ( int r = 0; r < GameConstants.WORLDSIZE; r++ ) {
for ( int c = 0; c < GameConstants.WORLDSIZE; c++ ) {
Unit u = game.getUnitAt(new Position(r,c));
if (u != null){
UnitFigure uf = new UnitFigure(u,
... |
d8582a34-ff4a-4c6a-b505-acee9f959319 | 3 | public void updateModes(String modes) {
IRCModeParser parser = new IRCModeParser(modes);
modes = ""; // reset modes, we will order them
String args = "";
char operator;
char mode;
for (int i = 1; i <= parser.getCount(); i++) {
operator = parser.getOperatorAt(i);
mode = parser.getMode... |
7e5b290a-a38b-4758-8fd2-c9e8cbcc69f5 | 2 | public void resizeMainMenu(double scaleFactorX, double scaleFactorY){
this.scaleFactorX=scaleFactorX;
this.scaleFactorY=scaleFactorY;
layers.setBounds(0, 0, (int)(scaleFactorX * (double)getWidth()), (int)(scaleFactorY * (double)getHeight()));
systemScroll.setBounds((int)(scaleFactorX * (double) 110), (int)(scal... |
378da6b0-3b35-4eea-a379-9d1e9ad2ce80 | 2 | public Bus [] getBusses ()
throws IOException
{
Bus value [] = host.getBusses ();
Bus retval [];
if (value.length == 0)
return value;
retval = new Bus [value.length];
for (int i = 0; i < retval.length; i++)
retval [i] = get (value [i]);
return retval;
} |
017faf80-b1f5-4e6c-bb95-12e98e30857f | 6 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length != 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.join + " (channel)");
return;
}
String c... |
9f3abe17-94e7-41da-b6c3-fd61c6d28a49 | 6 | public void handleIntersections() {
if (armed) {
triggered = false;
for (Tank player : level.getPlayers()) {
if (intersectsEntity(player)) {
triggered = true;
explode = true;
}
}
}
touchingGround = false;
for (FloatingPoint point : hitbox) {
if (level.getTerrain().hitTestpoint((int... |
5b6a987f-a6e9-4737-80eb-0595b4b4f810 | 0 | public static void start() {
Setup.println("Router iniciado en " + Setup.address.getHostAddress() + ":" + Setup.ROUTING_PORT);
server = new RoutingService();
new Thread(server).start();
} |
7a250c12-bc85-478e-9578-75482b72a444 | 1 | private void initTablasCoches(){
tabCch = (DefaultTableModel) tablaCoches.getModel();
coches = taller.searchCoches("");
tabCch.setNumRows(coches.size());
for(int i=0; i<coches.size(); ++i){
tablaCoches.setValueAt(coches.get(i).getMatricula(), i, 0);
... |
4f8401e2-2637-4abe-a14c-de64f8bab30a | 6 | * @return boolean
*/
public static boolean constantP(Stella_Object objectref) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(objectref);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_LITERAL_WRAPPER)) {
{ LiteralWrapper objectref000 = ((LiteralWrapper)(objectref));
... |
ff432571-a479-4d66-af2b-9fcb03c0f2b0 | 9 | public boolean similar(Object other) {
try {
if (!(other instanceof JSONObject)) {
return false;
}
Set<String> set = this.keySet();
if (!set.equals(((JSONObject)other).keySet())) {
return false;
}
Iterator<St... |
0427cd4e-8b49-48d4-a157-32c13b7c25c5 | 0 | @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Color color = (Color) value;
setText("");
setBac... |
581925f7-ce5e-464e-bbbc-8a892f262c3d | 3 | public List<User> getAllUsers(String userEmail)
{
initConnection();
List<User> userList = new ArrayList<User>();
String preparedString = null;
PreparedStatement preparedQuery = null;
try
{
//Prepare Statement - Get all users except logged-in user
preparedString = "SELECT * " +
"FROM users... |
e300b508-00e5-42bf-92a1-6d356ac7bd93 | 4 | public static ListNode deleteDuplicates(ListNode head) {
if (null == head || null == head.next) return head;
ListNode p = head.next;
ListNode q = head;
while (null != p) {
if (p.val == q.val) {
q.next = p.next;
} else {
q = q.next;
}
p = p.next;
}
return head;
} |
3cd9d8e7-11e6-47d6-8ec2-06c0d03d0cad | 9 | private Character getSquareChar(SquareType squareChar) {
//SquareType squareChar = myBoard.getSquare(row, column);
if (squareChar == null) {
return '*';
} else {
switch (squareChar) {
//I, L , J, T, O, S, Z, EMPTY, OUTSIDE;
case I:
... |
a50b4e20-364c-4b6c-a56e-8e9a8d72ded4 | 7 | @Override
public boolean equals(Object object) {
if(object == null || !(object instanceof LedShape))
return false;
LedShape shape = (LedShape) object;
if(x != shape.x || y != shape.y)
return false;
for(LedRow row1 : ledRows)
for(LedRow row2 : shape.ledRows)
if(!row1.equals(row2))
return... |
8a60d1eb-885c-4a5a-89a5-cc7eb48101b2 | 3 | public void checkParameter(String name, String email, String tel) {
ParameterUtils.checkAllEmpty(email, tel);
if (email != null) {
ParameterUtils.checkEmail(email);
}
if (tel != null) {
ParameterUtils.checkPhoneNum(tel);
}
int num = userInfoDao.getUserInfoNum(name, email, tel);
if (nu... |
f1e5b769-4b15-4dea-9d10-4da879374739 | 0 | protected void redirect(String url, HttpServletRequest request,
HttpServletResponse response)throws ServletException, IOException {
response.sendRedirect(url);
} |
79912f58-e56d-463b-82ba-1ccb0d0f7b1f | 8 | public void insert(int pos, T obj)
{
if (count == arr.length) {
// time to grow the array
if (increment == 0) throw new UnsupportedOperationException(getClass().getName()+"/"+clss.getName()+" has max capacity="+arr.length);
grow(increment);
}
if (pos == count) {
// append at tail - checking for this... |
4e5913ee-5787-41cb-bd3b-5ca043c84f8a | 7 | public Rachel(String s, TileMap tm){
super(tm);
this.tiley = tm;
width = 44;
height = 60;
cwidth = 30;
cheight = 44;
moveSpeed = 0.6;
maxSpeed = 2.0;
stopSpeed = 0.4;
facingRight = false;
facingUp = true;
facingDown = false;
health = maxHealth = 2;
ammunition = maxAmmuni... |
bfd0348f-8ac2-47f6-ba8f-d5687e98a93c | 3 | @Override
public void handleDrawing(List<Row> rows, ViewEventArgs args){
this.logicalDocument.draw(rows, args, this.index);
this.updateLogicalLocations(args);
if (this.selectionRange != null){
this.selectGlyphs(args);
}
if (this.spellCheckEnabled){
IVisitor visitor = new SpellingCheckingVisitor(this... |
d6171f3b-2351-42b2-9e6e-9b2d32dff378 | 7 | protected void L2RModelTraining() {
//select the training pairs
createTrainingCorpus();
if (m_ranker==0) {
ArrayList<Feature[]> fvs = new ArrayList<Feature[]>();
ArrayList<Integer> labels = new ArrayList<Integer>();
for(_Query q:m_queries)
q.extractPairs4RankSVM(fvs, labels);
Model rankSVM ... |
2f5f1028-1f03-4e47-ad04-5e752b5b04f5 | 6 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sIn = new Scanner(System.in);
long N = sIn.nextLong();
if (N ==0){
System.out.println(10);
return;
} else if (N < 10)
{
System.out.println(N);
return;
}
long result = 0;
long cur = N;
int power = 1;
... |
3f633485-d39e-48f3-bbfc-fd52e62d3627 | 0 | public void setSignedInfo(SignedInfoType value) {
this.signedInfo = value;
} |
33cd7d19-b5e9-4848-b9ee-3fad9e239b03 | 9 | @Override
public Integer getIdFromDataBase() throws SQLException {
if (name == null || name.isEmpty()) {
return null;
} else if (name2 == null || name2.isEmpty()){
return null;
} else if (surname == null || surname.isEmpty()){
return null;
} else i... |
63e807a6-3241-44d6-8dda-ec923a9d6d5e | 0 | public Id3v2RawFrame(Property property, PropertyTree parent) {
super(property, parent);
} |
083dcdd6-4fc7-4b66-8ce0-7bcb8befc601 | 7 | public double[] train(List<Instance> trainingInstances, List<Instance> testingInstances) {
int dimension = trainingInstances.get(0).getFeatures().length;
int trainSize= trainingInstances.size();
int testSize = testingInstances.size();
double[] weight = new double[dimension];
boolean continueLoop = true;
... |
71eda88f-806a-4200-97db-63a08b05fb55 | 5 | public static void main(String[] args) throws IOException {
/**
* The file to be read
*/
String path;
System.out.println("Please enter the path of the input file: ");
path = TextIO.getlnString();
String fileName;
System.out.println("Please enter the name of the input file: ");
fileName = TextIO.g... |
ca7e09fe-2063-48bf-b41c-e985d4922768 | 6 | public boolean[] getTipo()
{
boolean tipo[] = new boolean[6];
if(this.jCheckBox1.isSelected())
tipo[0]=true;
else
tipo[0]=false;
if(this.jCheckBox2.isSelected())
tipo[1]=true;
else
tipo[1]=false;
if(this.jCheckBox3.isSe... |
451b25e8-82bf-4f6f-8584-87a4f69ccb9a | 9 | public void initialisationPorteeCases() {
int x = this._parametre.getNbCaseX();
int y = this._parametre.getNbCaseY();
this.casesBateaux = new HashMap();
// Permet d'afficher les cases a portee de tir
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++) {
... |
7d3c37ed-8508-4777-965e-83a14181920c | 5 | public void parseMultiple(){
String[][] inputs = myModel.getInputs();
int size = 1;
if(environment.myObjects != null) size = environment.myObjects.size();
int uniqueInputs = inputs.length/size;
Grammar currentGram = grammar;
if(environment.myObjects != null) currentGram = (Grammar)environment.myObjects.get(... |
5a014d3c-a58d-405d-bc93-589b9684f1c6 | 0 | public void setNumber(Integer number) {
this.number = number;
} |
3d7ad9df-6827-4862-8ddb-34e189ea74bb | 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... |
a047a0f3-a590-4179-a414-4eb425aa81a2 | 9 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//on verifie que l'utilisateur est connecté en temps que particulier
if(request.getSession(false).getAttribute("connecte")==null
||request.getSes... |
f9e7168c-84d8-4720-ad73-f71fb6bce1ea | 8 | @SuppressWarnings("fallthrough")
private void beforeValue(boolean root) throws IOException {
switch (peek()) {
case NONEMPTY_DOCUMENT:
if (!lenient) {
throw new IllegalStateException(
"JSON must have only one top-level value.");
}
// fall-through
case EMPTY_DOCUMENT: ... |
997b40db-faa4-47a5-b7a6-e574b2b36f54 | 6 | @EventHandler
public void EnderDragonBlindness(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.getEnderDragonConfig().getDouble("En... |
100226fd-29e9-4716-8346-b01cc81bfbb4 | 8 | private void decodeMapEntry(String serviceName, OMMMapEntry mapEntry)
{
OMMFilterList serviceFilterList = (OMMFilterList)(mapEntry.getData());
for (Iterator<?> filter = serviceFilterList.iterator(); filter.hasNext();)
{
OMMFilterEntry serviceFilterEntry = (OMMFilterEntry)filter.n... |
22009cb4-90a7-46d4-98e8-91fa50b5a3f8 | 4 | @SuppressWarnings({ "deprecation", "resource" })
private static void fixSkin(GameProfile profile, String skinOwner) {
try {
URL url = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + Bukkit.getOfflinePlayer(skinOwner).getUniqueId().toString().replace("-", ""));
... |
af2e10b4-c974-48bb-a80b-8f963ba46bec | 2 | @Override
public String toString() {
if(super.toString() == "HUMAN"){
return "H ";
}else if(super.toString() == "ZOMBIE"){
return "Z ";
}else{
return ". ";
}
} |
9f9a7afe-2f8b-433d-8738-89630727c6c3 | 4 | public byte[] decompressFile(String name) {
int hash = 0;
name = name.toUpperCase();
for (int c = 0; c < name.length(); c++)
hash = (hash * 61 + name.charAt(c)) - 32;
for (int file = 0; file < fileCount; file++)
if (hashes[file] == hash) {
byte[] output = new byte[decompressedSizes[file]];
if (!d... |
a158c199-cc65-4e2b-8abe-ebf892afc1f2 | 3 | public boolean matchesAndPreservesGroupArtifactAndType(Dependency dependency) {
if (!matches(dependency)) {
return false;
}
Dependency transformed = apply(dependency);
return transformed.getGroupId().equals(dependency.getGroupId())
&& transformed.getArtifactId... |
84e90692-0268-4503-8585-d3fea2d3f834 | 9 | @Override
public boolean isDeadlyOrMaliciousEffect(final PhysicalAgent P)
{
if(P==null)
return false;
if(flaggedBehaviors(P, Behavior.FLAG_POTENTIALLYAUTODEATHING).size()>0)
return true;
if(isTrapped(P))
return true;
for(final Enumeration<Ability> a=P.effects();a.hasMoreElements();)
{
final Abil... |
339e83ba-b107-4cfc-a547-ad9200303498 | 4 | public boolean hasCycle(){
Hashtable<Vertex,Color> color=new Hashtable<Vertex,Color>();
LinkedList<Vertex> vertices=graph.getVertices();
Iterator<Vertex> i = new Iterator<Vertex>(vertices);
while(i.hasNext()){
Vertex v = i.getNext();
color.put(v, Color.WHITE);
... |
474157a8-1a38-4160-9b9a-2e0d216838ef | 8 | public ArrayList<String> restoreIpAddresses(String s) {
ArrayList<String> rst = new ArrayList<String>();
if (s == null || s.length() < 4 || s.length() > 12) return rst;
int[] buf = new int[4];
for (int i =1;i<4;i++)
{
int vl = -1;
try {
vl = Integer.valueO... |
693bafee-fe21-4f2b-9f30-778cf8923b5d | 8 | public void rescaleCenter(double minLevel, double maxLevel) {
double maxImage = -Double.MAX_VALUE;
double minImage = Double.MAX_VALUE;
double[] slice;
for(int z=0; z<nz; z++) {
slice = (double[])data[z];
for(int k=0; k<nxy; k++) {
if ((slice[k]) > maxImage)
maxImage = slice[k];
if ((slice[k... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.