method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
343931ec-198d-4e0f-b8e6-d7f0cf0574ba | 8 | protected void containerItemSwappingLogic(){
//put stack from one inventory to another
if(secondairyInventory != null)
if(KeyHandler.isValidationKeyPressed())
if(isNotPlayerInventory() && secondairyInventory != null){
System.out.println(slot_index);
if(secondairyInventory.getStackInSlot(slot_index)... |
09241321-58b5-4504-8170-d1b8db270f00 | 4 | public void extractConfig(final String resource, final boolean replace) {
final File config = new File(this.getDataFolder(), resource);
if (config.exists() && !replace) return;
this.getLogger().log(Level.FINE, "Extracting configuration file {1} {0} as {2}", new Object[] { resource, CustomPlugin... |
5441cf19-b73d-447d-9b5d-3d57739de103 | 4 | @Override
public void initProvider(Plugin plugin)
{
this.plugin = plugin;
this.configFile = new File(plugin.getDataFolder(), "mods.yml");
this.config = YamlConfiguration.loadConfiguration(this.configFile);
if (!this.configFile.exists())
{
this.plugin.getLogger().warning("No... |
272e0836-273f-47bd-a889-c54daef3d6fd | 1 | public void testPlus_int() {
Weeks test2 = Weeks.weeks(2);
Weeks result = test2.plus(3);
assertEquals(2, test2.getWeeks());
assertEquals(5, result.getWeeks());
assertEquals(1, Weeks.ONE.plus(0).getWeeks());
try {
Weeks.MAX_VALUE.plus(1);
... |
ace51eb4-2b3d-4d5a-8073-3cc378cd2e7e | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
GroupData other = (GroupData) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
ret... |
60ab3297-ae0a-4616-a5de-8a5252800c67 | 3 | public boolean DiagonalSuperior()
{
boolean validar=false;
for (int i = 1; i < matrizA.length; i++) {
for (int j = 1; j < i; j++) {
if(matrizA[i][j]==0)
{
validar=true;
}
else
{
va... |
6cf9f30f-570a-4d67-9c9e-98cc6ecd9014 | 1 | public void printMapping() {
Logger log = Bukkit.getServer().getLogger();
for (Entry<String, Subcommand> ent : cmdMap.entrySet()) {
log.info(ent.getKey() + " : " + ent.getValue());
}
} |
473d1a4d-8ac7-4609-84c4-3532d92a910d | 3 | @SuppressWarnings("unchecked")
private ArrayList<String> getUniversityShortNames(
HashMap<String, Object> map) {
ArrayList<Object> ids = (ArrayList<Object>) map.get("partnerIds");
ArrayList<String> result = new ArrayList<String>();
for (Object id : ids) {
Object uni = universities.get(id);
if (uni == nu... |
4c417e6b-1f71-417e-8a5c-285ca1b3892c | 9 | public void FillColumn(int columna){ //llenado automatico por columna
for(int y = 0;y<14;y++){ //revisa en una columna desde abajo hacia arriba
String colorpresente = this.blocks[columna][y].getColor(); //obtiene color
if (colorpresente.equals("-") ){ //significa que esta en blanco...hay que reemplazar color
... |
38ac746e-94e3-4ab0-b33d-656441726a48 | 9 | private boolean confirm() {
if (!checkAndSetUid(uidField.getText(), pageComboBox, dialog))
return false;
String s = scriptArea.getText();
if (s != null && !s.trim().equals("")) {
if (!checkBraceBalance(s)) {
JOptionPane.showMessageDialog(dialog, "Unbalanced balances are found.", "Menu text-script pair e... |
a40e5d7b-4887-4dd3-b734-b23ff0351a79 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
HasherTable<K, V> h = (HasherTable<K, V>) obj;
Set<Entry<K, V>> otherSet = h.entrySet();
for (Entry<... |
a6216e57-9f4d-474f-92dd-94091b6ae565 | 9 | public static void main(String... args) throws IOException, DateFormatException, URISyntaxException {
String load = "";
Replacer r = null;
System.out.println("\nYou've just run LogAnalyst v1.0");
if (args.length == 0) {
System.out.println("Default configuration is loaded, si... |
00f59a2e-f690-4dd9-b15e-4761936881b6 | 8 | public boolean checkOut(Book b, Timestamp startTime, int cardNumber, int idNumber) throws Exception {
if(b == null || b.getCurrentQuantity() == 0){
return false;
}
Connection connect = null;
Statement statement = null;
ResultSet resultSet = null;
PreparedStatement preparedStatement = null;
try... |
d2363f02-889a-41af-9b8a-2ede9c41ba64 | 4 | private void loadDatFile() throws IOException {
BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream(inputFile), "GBK"));
String data = null;
int index = 0;
while ((data = br.readLine()) != null) {
// 第一行不要,是中文
if (in... |
d1bd1028-83f7-423e-bf23-3306e0fbfd9e | 0 | public int size() {
return this.instances.size();
} |
6f858b0f-76d3-4d89-8086-76fde93ac676 | 2 | public Expression simplify() {
Expression expr = simplifyAccess();
if (expr != null)
return expr.simplify();
expr = simplifyString();
if (expr != this)
return expr.simplify();
return super.simplify();
} |
5f951409-c648-49a3-bec3-ec4403aa8376 | 9 | private static void reconcileHints(GC gc, int applied, int hints) {
int changes = hints ^ applied;
if ((changes & XOR_MASK) != 0) {
gc.setXORMode((hints & XOR_MASK) != 0);
}
// Check to see if there is anything remaining
changes &= ~XOR_MASK;
if (changes != 0) {
if ((changes & INTERPOLATION_MASK) !=... |
b10f49ce-3aea-4fa3-8c29-13441d1cf984 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
Outliner.documents.addTreeSelectionListener(this);
setEnabled(false);
} |
510ab2f8-0a89-4d15-9cb4-43eccbc02d6b | 8 | @Override
protected void reduce(Text key, Iterable<Text> values, Context context)
throws IOException, InterruptedException {
System.out.println(HeaderType.valueOf(
key.toString().trim().replaceAll("\\ ", "")).toString());
switch (HeaderType.valueOf(
key.toString().trim().replaceAll("\\ ", "")).toS... |
5fa0604d-f777-4ad9-a49d-2476b1d83bf6 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final EmbeddedType other = (EmbeddedType) obj;
if (this.schema != other.schema && (this.schema == null || !this... |
40d1ef3c-bb33-4df3-8b14-c577a29283a9 | 8 | public void initRenderTargets(int[] attachments) {
if (attachments == null)
return;
int[] drawBuffers = new int[id.length];
boolean hasDepth = false;
for (int i = 0; i < id.length; i++) {
if (attachments[i] == GL_DEPTH_ATTACHMENT) {
drawBuffers[i... |
062ed54f-1262-4c38-875c-de5dbafa40b5 | 0 | public void setCalle(String calle) {
addressCompany.setCalle(calle);
} |
45b65c5f-c405-4ac3-b386-8957bba83b00 | 0 | public CFGToPDALLConverter() {
} |
2043e283-055c-4874-8c8f-109046a2ce64 | 5 | public void draw(Graphics2D g) {
for(
int row = rowOffset;
row < rowOffset + numRowsToDraw;
row++) {
if(row >= numRows) break;
for(
int col = colOffset;
col < colOffset + numColsToDraw;
col++) {
if(col >= numCols) break;
if(map[row][col] == 0) continue;
... |
48124b08-56a9-450c-b3a7-58a55375ae61 | 5 | public ActivityItemProperties addActivityItem(ActivityItem actItem) {
// get the dimensions for the component
Dimension activityItemDimens = new Dimension(actItem.getActivityItemDimensions().width,
actItem.getActivityItemDimensions().height) ;
// calculate the ... |
143e0cb4-2ddf-4146-b463-e977e6bf9766 | 9 | private int jjMoveStringLiteralDfa5_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(3, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(4, active0);
return 5;
}
switch(curChar)
{
case 88:
... |
8bdae3eb-80d1-48ac-b074-cbf509747028 | 7 | private JMenu getFileMenu(boolean webstart){
JMenu file = new JMenu("File");
file.setMnemonic('f');
JMenuItem newImageItem = new JMenuItem("New");
newImageItem.setMnemonic('n');
ActionListener newImage = new ActionListener() {
@Override
public void action... |
b044dbe9-4bb6-45b0-9753-d819d3cf91fc | 6 | @Command(aliases = {"list", "l"}, usage = "[page]", flags = "", desc = "Lists all ports", help = "Lists all JumpPorts", min = 0, max = 1)
@CommandPermissions("jumpports.list")
@Console
public static void list(CommandContext args, CommandSender sender)
throws CommandException {
List<JumpP... |
ba807c06-9a58-4080-8644-2d76583475a8 | 3 | public static String string2UnicodeNumber(String s) {
try {
StringBuffer out = new StringBuffer("");
StringBuffer temp = null;
StringBuffer number = null;
byte[] bytes = s.getBytes("unicode");
for (int i = 2; i < bytes.length - 1; i += 2) {
temp = new StringBuffer("&#");
number = new StringBuff... |
d1a8f8b6-e400-4903-a832-31c8f6d4c235 | 6 | public int contains(String std) {
String anterior;
NodoListaDiccionario aux = ultimo;
//Mira si esta std o su anterior
if(std.length()>4) {
while(aux!=null) {
anterior= std.substring(std.length()-2);
if(aux.getPalabra().equals(std))
return aux.getIndex();
else if(aux.getPalabra().equals(a... |
b13f79ed-b2f2-47f0-9a68-486775027fd3 | 4 | private long parseTime(String timeString)
{
long result = 0;
if (classicTime)
{
String[] time = timeString.split(timeDelimiter);
//HOUR, MINUTE, SECOND, MILLISECOND
result = Integer.parseInt(time[0]);
result *= 60; //now in minutes
... |
32756efb-6a39-4be4-8a6e-0f7e68ab0f7a | 1 | private void printPath( String file ) {
fileCount++;
if ( file == null ) {
System.out.println( fileCount + ". MyBatis configuration already exists." );
return;
}
System.out.println( fileCount + ". " + file );
} |
fba7ac11-4ebd-4485-9b4e-cf35ed6a08e9 | 6 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
64e0b9fe-94a6-474d-b386-b3eb4d6a870f | 6 | public void setTime(int h, int m, int s) {
if((h>=0 && h<24) && (m>=0 && m<60) &&
(s>=0 && s<60)) {
hour = h;
minute = m;
second = s;
}
else
throw new IllegalArgumentException(
... |
61e66273-9684-45b6-9332-3d232b19914a | 1 | private boolean jj_3_10() {
if (jj_3R_28()) return true;
return false;
} |
31e98dc7-909e-4510-ab4c-a9419f64c321 | 4 | @Override
public void execute() {
seq(new WalkToSegment(0, 8));
seq(new WalkToSegment(-1, 8));
seq(new WalkToSegment(36, 16));
seqMove(new OverworldInteract(5));
seq(new SkipTextsSegment(4)); // pewter skip text
for (int i=0;i<36;i++) {
seqMove(new PressButton(Move.LEFT), 0);
}
for (int i=0;i<100;i+... |
f38fe8a4-8983-4de8-a5e6-9c8f6ea79be6 | 1 | public static void updateCommandeClient(int idcommandeclient, int identreprise,int idinterlocuteur, Date datecommandeclient,String referencecommandeclient,Float totalhtcommandeclient,Float totalttccommandeclient, Float remisecommandeclient) throws SQLException {
String query = "";
try {
q... |
7b37d302-7bbe-4895-bce5-2f1f57837012 | 8 | public void mouseDown(MouseEvent me) {
guiUsedMouseDown = false;
if (getWindows().mouseDown(me)) {
guiUsedMouseDown = true;
return;
}
int chx = (-getWorld().getScreenX()) + lastmx;
int chy = (-getWorld().getScreenY()) + lastmy;
chx /= 50;
chy /= 50;
if (chx < PavoHelper.getGameWidth(getWorld().ge... |
59c00c8c-13bc-41f8-a2cb-9cd9780a54fd | 5 | public static byte [] generate() {
// create ethernet header
byte [] packet = HeaderGenerator.generateRandomEthernetHeader();
int eProto =
ArrayHelper.extractInteger(packet, ETH_CODE_POS, ETH_CODE_LEN);
// figure out what type of packet should be encapsulated after the
// newly generated et... |
95911b93-e563-4301-88b0-290a3eec0f87 | 1 | @Override
public boolean isObstacle(Element e) {
if (e instanceof Player)
return true;
return false;
} |
4eb4eaee-60c3-474e-8581-f7db7003475c | 8 | public AngryFriend() {
JFrame frame = new JFrame("Start Angry Game");
frame.setLocationRelativeTo(null);
frame.setMinimumSize(new Dimension(300, 400));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (... |
1d3f773a-e589-4ca8-819b-3e35c483b765 | 9 | public List<PfamToGoMapping> parse() throws IOException {
final String error = ForesterUtil.isReadableFile( getInputFile() );
if ( !ForesterUtil.isEmpty( error ) ) {
throw new IOException( error );
}
final BufferedReader br = new BufferedReader( new FileReader( getInputFile()... |
a8b7bfa2-1623-499d-b04e-9a57a318a2a4 | 8 | public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null) return false;
if (obj.getClass() != this.getClass()) return false;
Picture that = (Picture) obj;
if (this.width() != that.width()) return false;
if (this.height() != that.height()) return... |
bcf2e5a6-4aa8-4b0c-aecf-22ad15ae4923 | 0 | public SaltAlgorithmIdentifierType createSaltAlgorithmIdentifierType() {
return new SaltAlgorithmIdentifierType();
} |
eea28e9d-d5f3-4e2c-906c-aaaef52bfc60 | 7 | public void InputSymbol(int input){
for (int i = 0; i < mStates.size(); ++i)
if (mStates.get(i).mUsed && mTransitions.containsKey(mStates.get(i))){
List<Transition> temp = mTransitions.get(mStates.get(i));
for (int j = 0; j < temp.size(); ++j){
if (temp.get(j).mInput == input){
List<StateNFA> te... |
c919fec2-9e0f-4666-9849-e3ebcf8a1470 | 1 | public static String showCommandHistory(boolean direction) {
String cmd = "";
if (!lastCommands.isEmpty()) {
cmd = lastCommands.pop().toString();
}
return cmd.trim();
} |
4fa84ddf-3f59-4bba-bfaf-6979567a4413 | 8 | public static int countNeighbours(boolean [][] world, int col, int row){
int total = 0;
total = getCell(world, col-1, row-1) ? total + 1 : total;
total = getCell(world, col , row-1) ? total + 1 : total;
total = getCell(world, col+1, row-1) ? total + 1 : total;
total = getCell(world, col-1, row ) ? total + 1... |
94bd6af5-506b-480f-9f9d-28edfb96276c | 8 | void fdump(int _depth, Instruction i, boolean clone) {
final String label = i.getByteCode().getName();// InstructionHelper.getLabel(i, false, false, false);
if (i instanceof CloneInstruction) {
fdump(_depth, ((CloneInstruction) i).getReal(), true);
} else {
if (_depth == 0) {
... |
74c05947-e234-4457-8f12-7cff19193ee7 | 8 | public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... |
5f21a6f5-6727-40d6-a1d0-294b76096ee8 | 0 | public void setSenha(String senha) {
this.senha = senha;
} |
910ef0a5-0785-4849-b6e1-dd65dac2e49a | 2 | private static ApparentPlace createApparentPlace(JPLEphemeris ephemeris,
int kBody) {
MovingPoint planet = null;
if (kBody == JPLEphemeris.MOON)
planet = new MoonCentre(ephemeris);
else
planet = new PlanetCentre(ephemeris, kBody);
EarthCentre earth = new EarthCentre(ephemeris);
MovingPoint sun = ... |
f20f752f-dbef-4482-a0e2-cb368a7981f7 | 0 | public Parser(Scanner scanner)
{
this.scanner = scanner;
this.error = new ErrorReport();
initSymbolTable();
} |
2c1377bd-0133-4a73-b347-d654e7f34487 | 1 | Coordinate calcRelativePosition(final Subject subject) {
Coordinate abs = calcAbsPosition(subject);
if (abs.x == 0) {
return abs;
}
final double scale = getRadiusScale(subject);
return new Coordinate(abs.x * scale, abs.y * scale);
} |
8a2f6b87-2b7c-4596-a288-a9d1cc7e64c0 | 1 | public JPanel getUsertileImageframeMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.usermenuImageframeMenu;
} |
287ef7c7-85a2-474d-8e36-6c2bbdbb75e2 | 8 | @Override
public Object evaluate(DeferredObject[] arguments) throws HiveException {
List<?> value_array = arrayOI.getList(arguments[0].get());
List<?> index_array = (List<?>)converter.convert(arguments[1].get());
if (value_array == null || index_array == null) {
return null;
}
// Avoid usi... |
fa7e5418-4d5d-4838-822c-5f97895383a5 | 2 | public Stmt lastStmt() {
final ListIterator iter = stmts.listIterator(stmts.size());
while (iter.hasPrevious()) {
final Stmt s = (Stmt) iter.previous();
if (s instanceof LabelStmt) {
continue;
}
return s;
}
return null;
} |
8154aa41-1e2c-4fd2-a020-a40f657eec33 | 0 | public void addSelectionListener(ConfigurationSelectionListener listener) {
selectionListeners.add(listener);
} |
ff171623-bea5-4a05-b8cd-784f3e30e734 | 4 | public static Fst<Pair<Character, Character>> formTo(CharSequence in,
CharSequence out) {
Fst<Pair<Character, Character>> bla = new Fst<>();
if (in.length() == 0) {
bla.addState(StateFlag.ACCEPT, StateFlag.INITIAL);
return bla;
}
State previous = null;
for (int i = 0; i < in.length(); i++) {
St... |
2cf55760-2b35-463a-bec6-ddce69bb5d85 | 1 | public String getLocationpath(String xpathExpression){
if (xpathExpression.contains("/")){
int pos = xpathExpression.indexOf("/");
return xpathExpression.substring(pos);
}else{
return xpathExpression;
}
} |
b263fde3-9ab6-423b-a9d1-f6beabceba86 | 5 | protected Family findFamily(String xref) {
xref = xref.substring(1, xref.length() - 1);
if (isDebugging())
System.out.print(">>> Looking for family " + xref + " ... ");
Family family = (Family)getObjectByXref(xref);
if (family != null && isDebugging())
System.out.println("found " + family);
... |
08c6369d-6374-4d40-af3a-61a43a787723 | 1 | private double calcMLat () {
double add = 0;
for (int i = 0; i < nbrPoints; i++) {
add = add + positions.get(i).getLatitude();
}
double result = add / nbrPoints;
return (result);
} |
cc40b1a9-d98b-4016-af99-4fb6cad59482 | 4 | public void dispatchCommand(String command) {
if (command == null || command.isEmpty())
throw new IllegalArgumentException("The coommand cannot be null or empty");
String[] args = command.split("\\s+");
String cmd = args[0];
args = StringUtils.removeFirstArg(args);
for (CommandHandler c : _commands) {
... |
c794be29-bf77-4ecd-9ea0-c16df5d70a02 | 0 | private Combination<Colors> generateTargetCombination() {
List<Token<Colors>> targetTokens = new ArrayList<Token<Colors>>();
targetTokens.add(new Token<Colors>(Colors.R));
targetTokens.add(new Token<Colors>(Colors.O));
targetTokens.add(new Token<Colors>(Colors.Y));
targetTokens.add(new Token<Colors>... |
ef15b82c-991d-42ff-9301-61d0ce132a67 | 7 | @Override
public void execute() throws MojoExecutionException {
NodeJsMojoBase.NodeInstallInformation info = super.run(filter);
if (info == null) {
return;
}
for (Task task : tasks) {
try {
if (task.watch) {
addWatchForTask(task);
}
} catch (IOException ex) {
throw new MojoExecution... |
a01f75fc-951d-4100-a41e-e953619a1e26 | 9 | private void button2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button2ActionPerformed
if (order1code2tf.getText().equals("1001"))
{
o1c2destf.setText("Chicken Nugget");
}
if (order1code2tf.getText().equals("1002"))
{
o1c2des... |
4c038841-36c8-44cf-a172-d7bc627d0386 | 6 | public static int getDeltaX(int dir)
{
if(dir == LEFT || dir == UP_LEFT || dir == DOWN_LEFT)
return -1;
if(dir == RIGHT || dir == UP_RIGHT || dir == DOWN_RIGHT)
return 1;
return 0;
} |
f5fd5753-6101-4273-8e31-c3479123c76d | 0 | public Date getDate() {
return date;
} |
4c01e358-409f-4af3-8f48-89c05fbd2a7f | 9 | private void saveAsCSV(final File csvFile, final CSVManager csvManager) {
if(csvFile == null) {
JOptionPane.showMessageDialog(
null, "Fehler in DataViewFrame.saveAsCSV: es wurde keine CSV-Datei übergeben.", "Fehlermeldung", JOptionPane.ERROR_MESSAGE
);
return;
}
if(csvManager == null) {
JOptionPa... |
5cfab785-7966-493a-a10c-517d35a990d4 | 6 | public ResultSet preencherTabela(String Departamento) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_TODOS_PR... |
e3760f5b-cc17-4a8e-a607-d79552acdf34 | 9 | public static void bottomUpRuleInduction(List examples, boolean simplifyRuleP) {
{ List positive = List.newList();
List negative = List.newList();
List allPositive = null;
List allNegative = null;
List rules = List.newList();
Symbol concept = ((TrainingExample)(examples.first())).conce... |
de8540ab-f408-41e3-9c86-e2531e9ffd51 | 6 | public TuringMachineFrame(String title, boolean status, TuringMachine model, TuringMachineMenuPanel view0, TuringMachineLoadPanel view1, TuringMachineStartPanel view2, TuringMachineTransitionPanel view3, TuringMachineInputPanel view4, TuringMachineSimulationPanel view5){
super(title);
isChild = status;
aTuring... |
150a821c-0c70-437c-9e19-a08031339e6c | 2 | public int clockSequence() {
if (version() != 1) {
throw new UnsupportedOperationException("Not a time-based UUID");
}
if (sequence < 0) {
sequence = (int)((leastSigBits & 0x3FFF000000000000L) >>> 48);
}
return sequence;
} |
e4873ae8-7c6e-44f2-a3c6-a57a0c4c5963 | 3 | public Status getStatus() {
int state = alGetSourcei(source, AL_SOURCE_STATE);
switch (state) {
case AL_PLAYING:
return Status.Playing;
case AL_STOPPED:
return Status.Stopped;
case AL_PAUSED:
return Status.Paused;
... |
4577b5c8-295c-4390-8a70-0df7921a8da0 | 2 | @BeforeTest
@Parameters("browser")
public void setUp(String browser) throws Exception
{
if(browser.equalsIgnoreCase("firefox"))
{
app.driver = new FirefoxDriver();
}
else if(browser.equalsIgnoreCase("chrome"))
{
System.setProperty("webdriver.... |
dfceeb69-8553-4239-b48a-9cbcf11710b4 | 3 | void parseMisc() throws java.lang.Exception
{
while (true) {
skipWhitespace();
if (tryRead("<?")) {
parsePI();
} else if (tryRead("<!--")) {
parseComment();
} else {
return;
}
}
} |
34ddbb49-3fac-4650-8b7a-3f31b1f549cf | 7 | public static void loadVocab()
{
System.out.print("Enter the absolute path to where your vocab file will be created.\n >");
String input;
while (true)
{
input = Game.scanner.nextLine();
file = new File(input);
if (file.exists())
break;
else
System.out.println("File not found!");
}
tr... |
e70eff52-ac51-4209-84c8-d25b9df5c6f7 | 9 | protected void recompute() {
// System.out.println("pnCal::recompute: " + yy + ":" + mm + ":" + dd);
if (mm < 0 || mm > 11)
throw new IllegalArgumentException("Month " + mm
+ " bad, must be 0-11");
clearDayActive();
calendar = new GregorianCalendar(yy, mm, dd);
// Compute how much t... |
812f91b7-a4a2-40ac-8f38-e67968511d52 | 8 | public static void nodeToBlockArray( RSTNode n, int nx, int ny, int nsize, BlockStack[] blockStacks, int bx, int by, int bw, int bh, int bo ) {
if( nx >= bx + bw || nx + nsize <= bx || ny >= by + bh || ny + nsize <= by ) return;
switch( n.getNodeType() ) {
case BLOCKSTACK:
int rx = nx - bx;
int ry = ny - by... |
bb2a4241-dbba-4f77-94a9-7335c51d7491 | 3 | private static Object getGtkStyle(Object styleFactory, JComponent component, String regionName) throws Exception {
Class<?> regionClass = Class.forName("javax.swing.plaf.synth.Region");
Field field = regionClass.getField(regionName);
Object region = field.get(regionClass);
Class<?> styleFactoryClass = styleFact... |
d42587d0-78a4-4d58-b2e8-6472f120d219 | 7 | protected DVD readDVD() throws Exception {
if ( mainReadHandle == null ) {
throw new Exception("Read Handle is null.");
}
Read in = mainReadHandle;
if ( !in.nextLine().isEmpty()) {
throw new Exception("Read Error.");
}
if ( !in.nextLine().equals("DVDObjectB")) {
throw new Exception("Read Error.");
... |
440a0360-b16b-4a59-bf8d-5b78b867b1a2 | 7 | public Grid(String name) {
mapName = name;
String fileName = new File("").getAbsolutePath() + "\\readIn\\"
+ mapName + ".txt";
try {
FileReader file = new FileReader(fileName);
Scanner in = new Scanner(file);
gridX = in.nextInt();
gridY = in.nextInt();
in.nextLine();
textGrid = new char[grid... |
3b084893-644c-4dc1-8cda-60813d0f27a6 | 6 | private void loadIniFile() {
if (this.inifile.exists()) {
try {
this.ini = new Ini(this.inifile);
} catch (InvalidFileFormatException e) {
System.out.println("Config.ini Fehler");
} catch (IOException e) {
System.out.println("Config.ini Fehler");
}
} else {
try {
this.createIniFile();... |
1425e0e4-0d9e-4164-9c7c-a4012ae8f8a2 | 1 | @Override
public void mouseDragged(MouseEvent e) {
if (activeMove != null) {
activeX = e.getX();
activeY = e.getY();
} else {
activeX = -1;
activeY = -1;
}
BufferedImage copyImage = new BufferedImage(lastImage.getWidth(), lastImage.getH... |
cbb1f393-2a3e-4cea-aebb-51f1c98016d6 | 6 | void autoFillName(String input, KeyEvent e){
try{
int pos = ((JTextField)e.getSource()).getCaretPosition();
if(pos > 0){
boolean whiteflag = false;
String crumb = "";
String left = input.substring(0,pos);
if(left.indexOf(" ")!=-1){
crumb = input.sub... |
f3cf67d2-9597-4846-91c8-09fda5c48044 | 9 | public static void loadLibraryFromJar(String path) throws IOException {
if (!path.startsWith("/")) {
throw new IllegalArgumentException("The path to be absolute (start with '/').");
}
// Obtain filename from path
String[] parts = path.split("/");
String filename = (parts.length > 1) ? parts[... |
21ee8ef5-fc39-435f-a191-79224e3b9885 | 5 | public Iterable<Periodical> findPeriodicals(SearchFilter filter) {
Statement stmt = null;
List<Periodical> periodicals = new LinkedList<Periodical>();
try {
stmt = con.createStatement();
String constraints = "";
for (String attributeName : filter.getAttributeNames()) {
constraints += attributeName + ... |
303ad09f-f856-4658-923e-d369d53f94dc | 4 | public boolean isLive() {
if(x > Parameter.FRAME_WIDTH || x < 0 || y < 0 || y > Parameter.FRAME_HEIGHT) {
bLive = false;
sv.mls.remove(this);
}
return bLive;
} |
7ea7ba57-40e9-4b01-adde-3395d3137f39 | 5 | public static boolean verifyCellContent(UIObject obj, int rowIndex, int columnIndex, String content){
boolean contentPresent = false;
WebElement element = action(obj);
List<WebElement> rows = element.findElements(By.tagName("tr"));
for(int r=0;r<rows.size();r++){
if(r==rowIndex){
List<WebElement> columns... |
7fda4d8a-9b72-48ca-bcd5-7ba7cedc3198 | 8 | private void readFile() {
if (audioFileSpecified) {
try {
this.is = AudioSystem.getAudioInputStream(this.file);
byte[] tmp = new byte[(int) this.duration * this.sampleSize];
this.is.read(tmp);
this.is.close();
ByteArrayI... |
c0c4c71e-dbe8-4415-a4c9-c19f20f4b590 | 0 | public double getPrecio() {
return precio;
} |
65967417-005a-4820-b115-7328b25bd99f | 8 | public static Class[] getClassesIn(String _package, boolean recursive) throws URISyntaxException, ClassNotFoundException {
List<Class> classes = new Vector<>();
String s = (_package.replace('.', '/'));
if (!s.startsWith("/"))
s = "/" + s;
if (!s.endsWith("/"))
s +... |
b31ab29b-6da1-4daf-9de7-1bbf58196d08 | 6 | private synchronized void checkCompleted(){
for(int i = 0; i < this.blockOffsets.length; i++){
if(!blocks.containsKey(this.blockOffsets[i])){
return;
}
}
if(this.isValid()){
this.completed = true;
this.data = new byte[this.length];
for(int key : this.blocks.keySet()){
Block b = this.blocks.... |
9d74c018-213a-469e-bb9a-5cda345f313b | 4 | public static byte[] decodeImage(BufferedImage img) {
//convert image to byte array
byte[] bImg = getBytes(img);
//offset definieren voor later
int offset = 32;
//retrieve lengths from the first bytes. 0-> 31 bits
int length = 0;
for (int i = 0; i < offset; i++... |
fca08d6e-837f-4359-abbb-63cc6e6d9c95 | 3 | @EventHandler(priority = EventPriority.NORMAL)
public void onBlockBreak(BlockBreakEvent event) {
if (event.getPlayer() != null) {
if (!event.getPlayer().isOp()
&& event.getBlock().getType() != Material.LEAVES) {
event.setCancelled(true);
}
}
} |
6578105b-c933-450b-8dd4-60a0d6355f93 | 5 | public void switcher(){
switch(scene){
case 0:
scene++;
break;
case 1:
scene++;
break;
case 2:
scene++;
break;
case 3:
scene++;
break;
case 4:
gsm.setState(GameStateManager.LEVEL1STATE);
}
} |
0a13b591-0d12-48c2-bd2f-0248682845fd | 7 | public static void main(String args[]) throws Exception {
List<Module> list = new ArrayList<Module>();
Module m1 = new Module(1);
Module m2 = new Module(1);
Module m5 = new Module(2);
Module m3 = new Module(1);
Module m4 = new Module(2);
Module m6 = new Module(3);
list.add(m1);
list.add(m2);
list.ad... |
a66f5dbb-e7be-47c7-b359-3e60e99955b9 | 8 | @Override
public void setTimelineEvent(){
KeyFrame kf = new KeyFrame(Duration.millis(10), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent){
time+=1;
switch(switchInt){
case 1... |
06f1a21d-e4cd-4981-bcfd-037236e09adf | 9 | public void render(Screen screen) {
if (getDir() == 0)
sprite = Sprite.spider_up;
if (getDir() == 1)
sprite = Sprite.spider_right;
if (getDir() == 2)
sprite = Sprite.spider_down;
if (getDir() == 3)
sprite = Sprite.spider_left;
if (dead)
sprite = Sprite.spider_dead;
screen.renderItem(x - 16, y... |
d79361bc-9dd3-41d3-a039-6f05df58dfca | 0 | @Override
public void setPhone(String phone) {
super.setPhone(phone);
} |
45446e88-04a1-4d32-9938-36fada613849 | 4 | @Override
public ColorRGB shade(Raytracer tracer, HitInfo hit) {
ColorRGB totalColor = ColorRGB.BLACK;
for (Light light: hit.getWorld().getLights()) {
Vector3 lightPos = light.Sample();
Vector3 inDirection = lightPos.minus(hit.getHitPoint()).normalized();
double diffuseFactor = inDirection.dot(hit.getN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.