method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5678a36b-e9bf-4ced-90c1-0470f6d3f295 | 3 | public void setTextCursorsBlank() {
for(slideMediaObject object: mediaObjects){
if(object.getStartTime() <= count){
if(object.isText()){
JPanel textPanel = (JPanel)object.getComponent(0);
textPanel.getComponent(0).setCursor(GUI.blankCursor);
}
}
}
} |
27a91b4c-8b2e-480a-af75-938929031c48 | 3 | protected void interrupt() {
logger.info(Thread.currentThread().getName() + " is interrupted");
if (!Thread.currentThread().isInterrupted()) {
Thread.currentThread().interrupt();
}
ThreadGroup root = Thread.currentThread().getThreadGroup();
Thread[] thds = new Thread[root.activeCount()];
int nthds = root... |
4b524d6e-903a-4ff1-b158-107f010cbb2f | 6 | @EventHandler
public void CaveSpiderResistance(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.getCaveSpiderConfig().getDouble("Cav... |
324e695d-6f32-4f18-b23e-8561422a1c6e | 3 | public void registerScore(Object[] args)
{
int score = (Integer)args[0];
int level = (Integer)args[1];
String name = (String)JOptionPane.showInputDialog(
null,
"Please enter your name for the highscore list:",
"High score",
JOptionPane.INFORMATIO... |
3e77f1d9-51fe-4d29-a627-7309e5784867 | 0 | public DFAEqualityAction(FiniteStateAutomaton automaton,
Environment environment) {
super("Compare Equivalence", null);
this.environment = environment;
/*
* putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke (KeyEvent.VK_R,
* MAIN_MENU_MASK+InputEvent.SHIFT_MASK));
*/
} |
b8b171d6-40c6-4f0a-9f22-7099fd450a7f | 3 | private String getLanguage(HashMap<String, Object> map) {
@SuppressWarnings("unchecked")
ArrayList<String> langs = (ArrayList<String>) map.get("primaryLanguages");
if (langs == null || langs.isEmpty()) return null;
if (langs.size() > 1)
System.err.println("Multiple primary languages " + map);
return langs.... |
3ac8b9b6-cb07-46fc-b37e-ef72474b7206 | 4 | private Time getTimeFromFields() {
int activityId = getSelectedActivity().getIdActivity();
Calendar startTimeCal = getStartTimeFromFields();
Calendar endTimeCal = getEndTimeFromFields();
Timestamp startTime = null;
Timestamp endTime = null;
long duration = -1;
if (startTimeCal != null) {
startTime = ne... |
9560bda0-08c3-44d8-b00a-0af2f15b8765 | 9 | private static Vertex getNext(List<Vertex> vertices, Vertex already)
{
List<Vertex> possi = new ArrayList<Vertex>(vertices.size());
for (int i = 0; i < vertices.size(); i++) {
if ((vertices.get(i).getPathsCount() == 0 || vertices.get(i).getPathsCount()%2 != 0) && already.getId() != vertices.get(i).getId() && !a... |
f5ca033d-18f8-45cd-8952-9b2212b27d6c | 4 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
Consultar_Label = new javax.swing.JLabel();
TabbedPane = new javax.swing.JTabbedPane();
Equipa_Panel = new javax.swing.JPanel();
... |
e455a369-c2d1-4be5-8511-39d3f6f2e3d0 | 4 | public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.jtattoo.plaf.graphite.GraphiteLookAndFeel");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStack... |
2c6fb7fe-77e3-4e6d-bfed-b8b27512ba34 | 3 | @Command(command = "demote",
aliases = {"de"},
arguments = {"target player[s]"},
description = "demotes the target player[s]",
permissions = {"demote"},
consoleOnly = true)
public static boolean demoteFromConsole(CommandSender sender, String targetPlayer) throws EssentialsCommandException {
// make su... |
9352ff36-abca-4520-b330-b88fd2dd3224 | 0 | @Override
public DrawableItem duplicate() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} |
0d2f9254-c613-496b-82c8-f39c986ef61d | 0 | public Document getDocument() {return this.doc;} |
582e2c76-132f-4cd2-8e2b-86b441fa9d7a | 2 | public void move(int x, int y){
if(alive && !hasCollision(this.x+x*speed, this.y+y*speed)){
this.x += x*speed;
this.y += y*speed;
}
} |
bddfda74-7f9f-4ba1-964f-6cb465244132 | 2 | protected void setCurrentState(final StateEnum state, final boolean enterInitialState, final C context) {
execute(new Runnable() {
@Override
public void run() {
if (!enterInitialState) {
StateEnum prevState = context.getState();
if ... |
f9c6c832-522c-4c77-812c-546fd5b8e5d9 | 0 | public void create(String personId, String name, String password) {
this.setPersonId(personId);
this.setName(name);
this.setPassword(password);
} |
d0df675a-cd61-46ed-bbfd-b805938c5285 | 1 | public String toString() {
String print = "";
Binomialnode x = root;
while (x != null) {
print = print + x.printTree(0);
x = x.sibling;
}
return print;
} |
85cecd3f-e569-4bdc-96dd-32c794f25b95 | 5 | public static boolean getGuildInvites(String[] args, CommandSender s){
//Various checks
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you... |
27237fd4-8879-4c97-ad69-12917dfb51ab | 7 | public boolean checkUsername(String username)
{
if(username.isEmpty())
return false;
for(char c : username.toLowerCase().toCharArray())
{
int tmp = c;
if(!(tmp > 96 && tmp < 123) || tmp==230 || tmp==248 || tmp==229) // Checking username letters
return false;
}
return true;
} |
706d19d5-af78-4f11-b42d-c4d66e2a474e | 4 | private static int packet_get_nb_frames(byte[] packet) {
int count = 0;
if (packet.length < 1) {
return -1;
}
count = packet[0]&0x3;
if (count==0)
return 1;
else if (count!=3)
return 2;
else if (packet.length<2)
retu... |
842e3fa2-fb2f-4240-9b63-502dbcc0a320 | 2 | public void setActiveLayer(int i) {
if (i < 0 || i >= layers.size()) {
return;
}
activeLayer = i;
curLayer = layers.get(i);
callListenersLayerChange();
} |
13e1d93e-8f5b-40db-9f01-82c32405e5f1 | 3 | @Override
public void acceptDraggableObject(DraggableObject object)
{
if(object instanceof DraggableObjectEntity)
{
DraggableObjectEntity fileobj = ((DraggableObjectEntity)object);
if(fileobj.uuid != null)
{
if(!fileobj.uuid.trim().equals(""))
{
setData(editor.getMap().getEntityList().getEnt... |
9b5e15b9-6ee9-48ba-8890-ad30589fc0ef | 0 | @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public void addTravelTrip(TravelTrip travelTrip) {
travelTripDao.register(travelTrip);
} |
a16d0379-d424-4d74-8563-686e0d2a58fb | 2 | @ChattingAnnotation(feature="None", type="Method")
public void buzz() {
final int lX = f.getLocationOnScreen().x;
final int lY = f.getLocationOnScreen().y;
System.out.println(lX + "+" + lY);
try {
for (int i = 0; i < 20; i++) {
Thread.sleep(10);
f.setLocation(lX, lY + 5);
Thread.sleep(10);
f... |
fff63539-e6a7-469d-bccf-0b5b5bed6282 | 3 | @SuppressWarnings("unchecked")
public Extensions deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
JsonObject o = json.getAsJsonObject();
Extensions extensions = new Extensions();
for (Map.Entry<String, JsonElement> entry : o.entrySet()) {
... |
9474cb1a-c36d-4be5-951c-c260e85aa908 | 0 | public void clickChooseCharacters(Scanner kb, ArrayList<MainMenuHeroSlot> heroies) {
System.out.println("You have already chosen your characters");
} |
e1173ae0-8fc5-49c0-b1ac-3e1affd83773 | 6 | public static void main(String[] args) {
int i, j; // Initialize local variable i
Scanner input = new Scanner(System.in);
System.out.println("\nEnter lenght of first array: "); // allow user
// input
int SIZE = input.nextInt();
int[] array = new int[SIZE];
System.out.println("\nEnter ele... |
b7cbf7ba-65ef-4a14-8549-82aaaa2c17d4 | 4 | @Override
public int getGrade(Node<T> n) {
if (safety && !contains(n)) {
throw new NodeNotFoundException();
} else if (n == null) {
return 0;
}
int c = 0;
Iterator<Node<T>> children = children(n);
while (children.hasNext()) {
children.next();
c++;
}
return c;
} |
63434fe4-c66d-4c92-a8e7-c7cd6eb97deb | 5 | private boolean isHorizontallyOccupied(HantoCell from, HantoCell to){
boolean isOccupied = true;
if (to.getX() < from.getX()){
for (int i = from.getX() - 1; i > to.getX(); i--){
if (findCell(i, to.getY()) == null){
isOccupied = false;
break;
}
}
} else {
for (int i = from.getX() + 1;... |
ae9e183a-c4f3-4947-ad7f-526e7dfee4f0 | 3 | public void findSweetSpots()
{
int x,y;
for(y=0;y<matrix.length;y++)
{
for(x=0;x<matrix[y].length;x++)
{
if(matrix[y][x]==matrixMax)
{
pathRek(x,y,"");
}
}
}
} |
534742b6-10e2-4fc7-907e-a70da78cfdc7 | 4 | public boolean collision(double x, double y) {
boolean solid = false;
for (int c = 0; c < 4; c++) {
double xt = (x - c % 2 * 16) / 16;
double yt = (y - c / 2 * 16) / 16;
int ix = (int) Math.ceil(xt);
int iy = (int) Math.ceil(yt);
if (c % 2 == 0) ix = (int) Math.floor(xt);
if (c / 2 == 0) iy = (int... |
603074e0-6c32-4d7f-afbc-014281a4db8d | 1 | @Test
public void testSimple() {
final long[] times = new long[51];
final long target_median = 90;
final long margin_of_error = 10;
final Properties config = new Properties();
config.setProperty("median_latency", "" + target_median);
final Filter f = new WanFilter(new... |
f1bc7612-b1bb-4210-ad0d-3014cc6ac0a2 | 3 | public final int getNameCount() {
return this.filename == null ? 0 : this.dirs == null ? this.filename
.equals("/") ? 0 : 1 : this.dirs.length + 1;
} |
a32ab8eb-6d27-44c8-a491-d49a51e65cfb | 8 | public QRDecomposition (Matrix A) {
// Initialize.
QR = A.getArrayCopy();
m = A.getRowDimension();
n = A.getColumnDimension();
Rdiag = new double[n];
// Main loop.
for (int k = 0; k < n; k++) {
// Compute 2-norm of k-th column without under/overflow.
double n... |
7e18e282-0835-4a30-9127-ab6babe81227 | 8 | @Override
public Element generateDataElement(LauncherAction action) {
JavaAppDesc desc = (JavaAppDesc)action.getLaunchDesc();
org.w3c.dom.Element e = createInitialElement(desc);
//Main Class
e.setAttribute("main-class", desc.getMainClass());
//Arguments
String... |
44c10576-33ab-4b53-ae24-54501d371f98 | 4 | private long persistLegal(Legal legal, String table) throws SQLException {
Connection connection = null;
PreparedStatement preparedStatement = null;
String insertSQL = "INSERT INTO " + table
+ "(bank_account,TIN,company_name,company_address) VALUES"
+ "(?,?,?,?)";
try {
connection = provider.getCo... |
692de45a-b5ce-432a-9cf4-87cef591694e | 3 | public static byte[] hexToBytes(String str) {
if (str == null) {
return null;
} else if (str.length() < 2) {
return null;
} else {
int len = str.length() / 2;
byte[] buffer = new byte[len];
for (int i = 0; i < len; i++) {
buffer[i] = (byte) Integer.parseInt(
str.substring(i * 2, i * 2 + 2... |
333ecc84-9f72-41d8-b852-955420185efc | 8 | private void setDoubleDown() {
switch(playerTurn) {
case(1):
if (canPlayer1DD) {
canPlayer1DD = false;
dd.setVisible(true);
}
else
dd.setVisible(false);
break;
case(2):
if (canPlayer2DD) {
canPlayer2DD = false;
dd.setVisible(true);
}
else
dd.setVisible(false);
... |
7da4899f-9b54-42cc-99cc-a5e60f80c8f4 | 3 | private void getPoints() {
Random rd = new Random();
int chance;
for (int i = -this.radius; i < this.radius; i++) {
for (int j = -this.radius; j < this.radius; j++) {
chance = rd.nextInt(100) - Math.abs(i - j) - Math.abs(i + j) - Math.abs(i) - Math.abs(j) + radius;
... |
9106490d-5366-43d6-9154-579a8a68ad60 | 3 | public boolean DestructPlugin(Session Session, String Name)
{
int Count = Plugins.size();
for(HabboPlugin Plugin : Plugins)
{
try
{
if (Plugin.GrabName().equalsIgnoreCase(Name))
{
Grizzly.WriteOut(Plugin.GrabName() + " has been destructed by " + Session.GrabHabbo().Username);
Pl... |
6d9b46ab-15e9-43d0-855b-3614f02358c5 | 9 | public void addOpdrachtenFromFileToDB() {
con = createConnection();
ResultSet rs = null;
try {
List<Opdracht> opdrachtenLijst = leesOpdrachtenVanBestand();
for (Opdracht opdr : opdrachtenLijst) {
pst = con
.prepareStatement("select idOpdrachtSoorten from opdrachtsoorten where OpdrachtSoortenNaam... |
4f5f229e-ab0a-4413-96ba-1222e8d0fe55 | 5 | @Override
public Screen respondToInput(KeyEvent key) {
char c = key.getKeyChar();
Item[] items = this.player.getInventory().getItems();
if (letters.indexOf(c) > -1 && items.length > letters.indexOf(c) && items[letters.indexOf(c)] != null && isAcceptable(items[letters.indexOf(c)])) {
return use(items[letters.i... |
078dccb7-6b03-49e6-a8c9-051bf52c5a43 | 2 | public void remove(Object o) {
for (int i = 0; i < size(); i++) {
if (list.get(i).getReturnValue().equals(o)) {
list.remove(i);
}
}
} |
c21fa011-f3eb-4831-b92c-c30cf0b9f5e6 | 5 | public void initPublishSubscriber(final int periodMs){
Thread thread = new Thread() {
public void run() {
PortReadingResult or;
// check if the observer is still there
// we have no more than 1 observer
while(countObservers()>0){
try {
or = readData();
while(or.getStatus() == Outp... |
9a17b83a-56d8-4644-bb79-53f7912dfdef | 7 | public ListNode removeNthFromEnd(ListNode head, int n)
{
if (n < 1) {
throw new IllegalArgumentException("n cannot be smaller than 1");
}
if (head == null) {
return null;
}
int headStartCounter = 0;
ListNode remove = null;
for (ListNode lead = head; lead != null; lead = lead.next)
{
if (hea... |
545c5bf6-2d0c-418f-87a4-7f2f55beb4f5 | 4 | private int compareAddresses( InetAddress first,
InetAddress second ) {
if( first.equals(second) )
return 0; // equal
byte[] bytesA = first.getAddress();
byte[] bytesB = second.getAddress();
if( bytesA.length != bytesB.length )
return bytesA.length - bytesB.length; // not equal
int cmp;
for(... |
58e7b5cc-761e-4b43-8552-68f73bf2458c | 2 | public static void handleEnableAsyncMetadataReply(HTSMsg msg, HTSPClient client) {
Collection<String> requiredFields = Arrays.asList(new String[]{});
if (msg.keySet().containsAll(requiredFields)){
//TODO
} else if (msg.get("error") != null){
//TODO
} else{
System.out.println("Faulty reply");
}
} |
dd57a821-f1cb-4914-a803-284ad4c2cae5 | 2 | @Override
public void run() {
String str;
while(isConected){
try {
str = in.readLine().replace(";;", "\n");
request = (Map<String, Object>) yaml.load(str);
ActionDispatch.analize(request);
} catch (Exception e) {
// TODO Автоматически созданный блок catch
e.printStackTrace();
}
}... |
464ba100-260f-4341-be80-d13e39ac164a | 7 | public boolean isVerticalCombo(int x, int y, Orb[][] arr) {
int verCount = 0;
for (int j = 1; ((y + j) < Y && arr[y + j][x] != null)
&& arr[y][x].color == arr[y + j][x].color; j++)
verCount++;
for (int j = -1; ((y + j) >= 0 && arr[y + j][x] != null)
&& arr[y][x].color ... |
69f97888-2fef-4ab9-8dd0-6f5f4502cd77 | 0 | public static void outLog(String data){
// BatchOS.outLog(data, true);
} |
bad5516e-189d-45f6-a6e0-d64db18271ec | 4 | public boolean isValidField(char row, byte column)
{
if(row >= 97 && row <= 104 && column <= 7 && column >= 0)
{
return true;
}
return false;
} |
3f641b46-19e3-4143-8908-5b47ba3a8f26 | 5 | @Override
public Vector3 color(Scene scene, Ray ray) {
Vector3 color = defaultColor;
Collision collision = trace(scene, ray);
if (collision != null) {
Vector3 collisionPoint = ray.getFrom().add(ray.getDirection().multiply(collision.getDistance()));
... |
91f08f00-2a2f-4631-8c4d-9680c7d4c92d | 6 | * @param options
* @return Demon
*/
public static Demon defineDemon(String name, Cons options) {
{ Demon demon = Demon.newDemon();
PropertyList plist = PropertyList.newPropertyList();
Cons conslist = Stella.NIL;
Demon olddemon = null;
boolean activateP = false;
{ Stella_Object... |
827ce5d7-4530-4f67-940d-7054fc7bfab2 | 2 | public boolean deleteRow(int row) {
if (row < 0 || row > data.size() - 2)
return false;
data.remove(row);
fireTableRowsDeleted(row, row);
return true;
} |
57c3ef3a-fbc7-475d-9b06-88508dc94a99 | 8 | public void leavePercentageOutSplit(String filename, int percentage, boolean random) {
List<UserData> trainLines = new ArrayList<UserData>();
List<UserData> testLines = new ArrayList<UserData>();
Set<Integer> indices = new HashSet<Integer>();
int currentUser = -1, userIndex = -1, userSize = -1;
for (int i = 0... |
70b41bd0-084a-45b1-ae43-ea04c6212a45 | 4 | private static void processWorkflowDirectory(final File workflowsDirectory, final Map<File, AnalysisData> processedWorkflows) {
final File workflowReportFile = new File(workflowsDirectory, "report.xml");
if (workflowReportFile.exists() && workflowReportFile.isFile()) {
//System.out .println("Azotyzing: " + workf... |
29de4000-5b3f-48ac-a328-e084376381c8 | 3 | private static void playRound() {
battles++;
if (hands[0].handSize() == 0 || hands[1].handSize() == 0) {
gameOver = true;
} else {
for (int i = 0; i < hands.length; i++) {
stacks[i].put(hands[i].get());
}
compareStacks();
System.out.println("Player 0 has " + hands[0].handSize() + " Player 1 has... |
98a79fc3-6c47-4154-ad53-1daa10569156 | 7 | public String saveConfigSectionWithComments(ConfigurationSection section, boolean depth) {
StringBuilder builder = new StringBuilder();
for (Iterator<Map.Entry<String, Object>> i = section.getValues(false).entrySet().iterator(); i.hasNext();) {
Map.Entry<String, Object> entry = i.next();
... |
6cfaf26e-2b78-4fd7-9bcf-66272373e947 | 5 | public void setFontProperties(Properties fontProperties)
throws IllegalArgumentException {
String errorString = "Error parsing font properties ";
try {
fontList = new ArrayList<Object[]>(150);
Enumeration fonts = fontProperties.propertyNames();
String name... |
cad4eaa7-b542-4948-a203-8bc399019eb4 | 4 | public static void removeOpponentCaptures(Board board, int opponent, int x, int y) {
int boardSize = board.boardSize;
if (x > 0) {
removeIfCaptured(board, opponent, x - 1, y);
}
if (x < boardSize - 1) {
removeIfCaptured(board, opponent, x + 1, y);
}
if (y > 0) {
removeIfCaptured(board, opponent, x,... |
e83785f4-57f7-44f1-a6aa-393c526d869e | 4 | private DrivingLicense(PersonName driversName, Date dateOfBirth,
LicenseNumber licenseNumber, Date dateOfIssue, boolean isFullLicense){
if (driversName.toString().isEmpty())
throw new IllegalArgumentException("The drivers name is null");
this.driversName = driversNam... |
1e1feab0-6229-4d7d-b4f2-53abdd05905c | 3 | private ArraySchema parseArraySchema(JsonNode rawSchema, URL schemaLocation) {
ArraySchema result = new ArraySchema();
JsonNode rawItems = rawSchema.get("items");
if (rawItems != null) {
result.setItems(parse(rawItems, schemaLocation));
}
JsonNode rawMinItems = rawSch... |
4c0b7630-8598-440d-8d67-5754b2119ae2 | 3 | public String layer_string()
{
switch (h_layer)
{
case 1:
return "I";
case 2:
return "II";
case 3:
return "III";
}
return null;
} |
03bb60e8-1a81-4a7d-895c-1849a167ade6 | 9 | private DisplayMode getBestDisplayMode() {
DisplayMode[] program_displays = { new DisplayMode(640 , 480, DisplayMode.BIT_DEPTH_MULTI, DisplayMode.REFRESH_RATE_UNKNOWN),
new DisplayMode(800 , 600, DisplayMode.BIT_DEPTH_MULTI, DisplayMode.REFRESH_RATE_UNKNOWN),
... |
45009860-088d-44bd-ab31-2a915edcb257 | 5 | @Override
public boolean exportFile(String name, String path, Pattern pattern) {
try{
System.out.println("test 1" + pattern);
FileWriter fw = new FileWriter("" + path + "\\name" + ".txt");
PrintWriter pw = new PrintWriter(fw);
pw.println("patNam_" + pattern.ge... |
e4681f7b-8188-4363-86ca-5a09d87596d9 | 5 | private String getClassLocation() {
final Class cls = getClass();
URL result = null;
final String clsAsResource = cls.getName().replace('.','/').concat(".class");
final ProtectionDomain pd = cls.getProtectionDomain();
// java.lang.Class contract does n... |
8e241ec7-2693-4c9a-9d0b-a3c795d29bf6 | 9 | public XYSeriesCollection createFinalRobustnessDataset(Map<Integer, List<Double>> robustnessHistory) {
final XYSeriesCollection dataset = new XYSeriesCollection();
List<SummaryStatistics> sumValues = new LinkedList<>();
SummaryStatistics meanRobustness = new SummaryStatistics();
for (Int... |
9875c286-5b38-4109-8c22-ed518cd643bc | 0 | public void setDetermineImageNumber(boolean newValue)
{
determineNumberOfImages = newValue;
} |
fcb481c2-5e62-4055-a8bc-539b757b3a2b | 5 | public void init(String cifra_de_bloco, String padding_str) {
try {
//Algoritmo de criptografia/modo de operacao de cifra de bloco/preenchimento
ecipher = Cipher.getInstance(cifra_de_bloco + "/" + this.mode + "/"+padding_str); //classe para criptografia
dcipher = Cipher.getI... |
9cc8f6ef-649d-4d6b-b546-5d1509965819 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return super.okMessage(myHost,msg);
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(CMath.bset(msg.targetMajor(),CMMsg.MASK_MALICIOUS))
&&(msg.targetMinor()==CMMsg.TYP_CAST_SPELL)
&... |
319cc4b5-8879-4395-b5bc-0d1a0c6fe966 | 8 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
servletResponse.setContentType("text/html");
String path = ((HttpServletRequest) servletRequest).getRequestURI();
//If not in a prote... |
15f83bfb-3205-4f64-b9e8-784af38fc8f7 | 2 | public void addFreq(String word) {
if (mFreq < Integer.MAX_VALUE) mFreq++;
if (Character.isUpperCase(word.charAt(0))) mCapitalFreq++;
} |
7a7fbe64-f3bd-47fd-b2dd-9252981f9a3e | 9 | public void run(CommandSender sender, String[] args) {
if(args.length == 0) {
sender.sendMessage(ChatColor.RED + "You didn't enter a group.");
return;
}
String g = args[0];
if(args.length < 2) {
if(SettingsManager.getInstance().getGroup(g) != null) {
if(SettingsManager.getInstance().getGroup(... |
f1a63ee9-c906-4970-b1ec-802c70f9e247 | 6 | public static void main(String args[]){
String keyPairs[];
String keys[];
HashTable tbl=new HashTable();
long start=System.currentTimeMillis();
BufferedReader br = null;
BufferedReader br1 = null;
try {
String sCurrentLine;
String inputLine ="";
br = new BufferedReader(new FileReader("E:/In... |
66575ace-86cb-4da5-8f23-d486701950be | 4 | public void addPerso(String nomType, String nom, int age) throws ClassePersonnageManquanteException {
Personnage nouveauPerso;
// On fait des "if" car le switch case avec String n'est pas accepté
if(nomType.equals("Mage")) {
nouveauPerso = new Mage(nom, age);
this.addPersonnage(nouveauPerso);
} else if(no... |
09c5efab-d142-41d5-b254-b3757ba31214 | 6 | public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' ... |
d79c0de0-6ba2-490b-9f2f-ede4b8777798 | 1 | private void startFactory() {
try {
this.factory = factoryClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
} |
5358b4de-7508-47ef-b881-f09c344ed030 | 0 | @Test
public void validationNegativeWithStringTest() {
view.getNumberOfPointsTextField().setText("aaa");
view.getNumberOfPointsTextField().getInputVerifier().verify(view.getNumberOfPointsTextField());
assertFalse(view.getDrawButton().isEnabled());
} |
c7ed78fd-4875-4645-8acd-bf3692c46052 | 8 | public int GetRunAnim(int id)
{
if(id == 4151) // whip
{
return 1661;
}
if(id == 8447) // cat toy
{
return 1661;
}
if(id == 6818) // bow-sword
{
return 744;
}
if(id == 4734 || id == 837) // karils x bow
{
return 2077;
}
if(id == 4153) // maul
{
return 1664;
}
if(id == 1419) // scythe
{
return 1664;
}
if(id == 7449) //... |
491392dd-6c05-46ec-80e9-b85689294dea | 1 | private static CycFormulaSentence makeCycLSentence(String query, CycAccess access) {
try {
return CycLParserUtil.parseCycLSentence(query, true, access);
} catch (Exception e) {
throw new RuntimeException(e);
}
} |
86a53669-e144-4bd2-8c18-713b22b20a85 | 1 | private double getExpectedScore() {
double expected = 0;
for (int i = 0; i < NFRUIT; i++) {
expected += (mExpDistrib[i] * mPreferences[i]);
}
expected*=bowlSize;
return expected;
} |
8d33a377-016c-456f-a490-f01f81c3a30d | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TwoCitiesSolution other = (TwoCitiesSolution) obj;
if (A == null) {
if (o... |
e8482813-adbe-4b1a-90af-e6a3649ddda1 | 8 | private void findInfo() {
String line = "";
try {
while( (line = buffer.readLine()) != null) {
if( line.contains(name) ) {
while( line.contains(" ") ) {
line = line.substring(line.indexOf(" ")+1);
}
this.infoClass.setName(line.substring(0, line.length()-1));
}
else if( line.... |
ac5a7042-75de-4a3a-9d55-6f73ec108f03 | 0 | public void mouseMoved(MouseEvent e) {
} |
6cb37d2b-3d7d-42de-b02b-b5d430cdc500 | 4 | public final int getMethodIndex(String originalName, Class[] argTypes)
throws NoSuchMethodException
{
Method[] mthds = getReflectiveMethods();
for (int i = 0; i < mthds.length; i++) {
if (mthds[i] == null)
continue;
// check name and parameter types m... |
a904b751-cc2f-4398-ae18-f947cb838ac4 | 3 | public void majInfos() {
int i;
int nb;
try {
i = territoire.getOccupant().getJoueur().getIndice();
}
catch (Exception e) {
i = Game.JOUEUR_BACKGROUND.length - 1;
}
nb = territoire.getNbUnite();
if( territoire.getOccupant() != null && territoire.getOccupant().isEnDeclin() ){
tx.setBack... |
99460aa0-fff9-41a6-ae51-f291b39497f4 | 3 | public void setAspect(String s) throws ADataException{
if (s == null) throw new ADataException();
if (!(isValidAspect(s) || s.equals(DOUBT))) throw new ADataException();
this.aspect = s;
} |
b55bc662-fb3d-4078-be96-4870f9f4af4d | 3 | boolean SOUTHdiagnoalHasCraftedBlock(Location startLocation)
{
boolean res = false;
// Check SOUTH 45 degrees =========================================================
// Check if there is a valid crafted ceiling block in 45 degrees upwards to the player within given distance
Location check... |
1a8f5e03-41f5-4cda-9b56-5592b76e0252 | 7 | @Override
public void mouseClicked(MouseEvent e)
{
if (SwingUtilities.isLeftMouseButton(e))
{
if (e.getComponent().equals(circle))
{
square.setSelected(false);
ground.setSelected(false);
if (circle.isSelected())
... |
5243db30-3f20-4640-9f85-a3879be29eda | 7 | private void doExchangeBasket() throws InterruptedException {
int memberCount = otapiJNI.OTAPI_Basic_Basket_GetMemberCount(assetID);
boolean bSure = true;
if (otapiJNI.OTAPI_Basic_GetNym_TransactionNumCount(serverID, nymID) < (2+memberCount)) {
bSure = Helpers.getTransactionNumbers... |
5b88972f-09b3-4b20-91a5-3b4cc4b3b3db | 6 | private Server serverStart(int firstPort) throws IOException {
int port, tries;
if (firstPort < 0) {
port = FreeCol.getDefaultPort();
tries = 10;
} else {
port = firstPort;
tries = 1;
}
logger.finest("serverStart(" + firstPort + ") ... |
389f227e-9a0e-44c9-be61-54e30322036c | 6 | @Override
public Object getValueAt(int row, int col)
{
{
ProductionOrder po = Porder.get(row);
switch (col)
{
case 0:
return po.getID();
case 1:
return po.getPOrder();
case 2:
... |
512edb53-5494-405f-a491-c14aa48f6de8 | 9 | public String strStr(String haystack, String needle) {
if (haystack == null || haystack.length() == 0) {
if (needle == null || needle.length() == 0) {
return haystack;
}
return null;
}
char[] s = haystack.toCharArray(), p = needle.toCharArray()... |
bb902c9c-2c4e-4484-bdc1-9b7b9977be0e | 6 | public void start() {
try {
preStartup();
running = true;
long lr = System.currentTimeMillis();
long lu = lr;
while (isRunning()) {
boolean updated = false;
if (shouldUpdate(lu)) {
int d = (int) (Syst... |
a3025ef9-61d4-4392-8deb-94640487cd0f | 2 | public static double asec(double a){
if(a<1.0D && a>-1.0D) throw new IllegalArgumentException("asec argument (" + a + ") must be >= 1 or <= -1");
return Math.acos(1.0/a);
} |
669ae4f8-3eb0-42c7-a206-edd143728f2f | 8 | @Override
protected List< ? extends Component> createBrickComponents() {
List<Component> components = new ArrayList<Component>();
JPanel wrapper = new JPanel();
String tooltip = getTooltip();
// label
if ( control.getLabel() != null ) {
label = new JLabel();
... |
b94eb028-9878-4ac2-9036-4137f9efdd80 | 0 | @Override
public final int getCounterwidth() {
return (int)Math.ceil(Calc.log(getMax()+1,2));
} |
ecdbaf3c-9fc4-45e2-846a-d95f16c73c9f | 5 | private void load() {
// Load main model, if file is present
boolean haveOldData = false;
File file = settings.getStaticFile();
try {
FileInputStream reader = new FileInputStream(file);
XmlModelAdapter xml = new XmlModelAdapter();
xml.readModel(reader, model);
reader.close();
haveOldData = true;
... |
b65cb139-9091-4cba-97c0-e948febd66be | 3 | private void deleteTeam()
{
clear();
System.out.println("Delete Team:");
System.out.println();
try
{
int matchCount = matchmgr.showCount();
int teamCount = teammgr.showCount();
int maxMatchID = matchmgr.maxMatchId();
ArrayList<... |
6d0ea3a3-2e67-4a03-b31a-7cf59c40b941 | 2 | @Override
public void dispose() {
display.dispose();
while(display.isCreated()) {
try {
Thread.sleep(100);
} catch(final InterruptedException e) {
}
}
stop();
super.dispose();
System.exit(0);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.