method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7f29ab5e-f085-43d5-a9de-bd539224552a | 0 | public static int getRandomNumber(int min, int max) {
int num = random.nextInt(max);
int mod = num % (max - min);
return mod + min;
} |
28261b61-baed-4616-a82b-9da22fdbe789 | 1 | public final void actualiser() {
try {
remplissageComboBox(lesPraticiens);
indicePraticienCourant = 0;
System.out.println(indicePraticienCourant);
praticienCourant = lesPraticiens.get(indicePraticienCourant);
afficherPraticien(praticienCourant);
... |
dc102dc6-e5af-4c6e-a63b-1fa3f5c2419e | 9 | protected static Ptg calcCoupNum( Ptg[] operands )
{
if( operands.length < 2 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "COUPNUM" );
try
{
GregorianCalendar sDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[0].getValue() );
GregorianCalendar mDa... |
3daa6a7d-ea8f-46e9-b447-abfd6c1927eb | 2 | public void initializeTime(HardwareSet hardwareSet) {
for(HardwareSetAlternative hardwareSetAlternative : hardwareSystem.getHardwareSetAlternatives())
if(hardwareSetAlternative.getHardwareSet().equals(hardwareSet)){
hardwareSetAlternative.initializeTime();
}
} |
69a6b6c9-d676-4874-a769-41acd7e1da7a | 6 | public static int findDepth( String s )
{
int countLeft = 0;
int countLeftTotal = 0;
int countZero = 0;
int depth = -1; // countLeft - 1
for( int i = 0; i < s.length(); i++)
{
char a = s.charAt( i );
switch( a ){
case '0': countZero++; break;
... |
afedf083-7a15-4ef5-886d-f16c4b79d72d | 7 | public static int countCells(Board board, int x, int y, int radius) {
int result = 0;
for (int px = x-radius; px <= x+radius; px++)
if (px >= 0 && px < board.w)
for (int py = y-radius; py <= y+radius; py++)
if (py >= 0 && py < board.h)
if (board.cells[px][py])
result++;
return result;
} |
40171c47-593e-4e04-a62e-0dbaaabce526 | 7 | @Override
public <S> Result<S> find(Class<S> serviceClass)
throws ServiceInstantiationException {
Result<S> result=null;
// S provider=null;
// Scope scope=null;
// If it still doesn't exist, get the provider class, see what scope
// it prefers, and create it in that scope. Syncyhronization should
// onl... |
1a9b44ab-cdaa-4123-8779-cb2eb7a535ad | 5 | @Override
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case VENDOR:
return "Производитель";
case NUMBER:
return "№";
case MODEL:
return "Модель";
case NOTE:
return "Примеч... |
a08eb75a-51fe-4e17-a2d2-0db9a2812708 | 9 | public static boolean equal(boolean[][] a, boolean[][] b) {
if(a != null && b != null) {
if(a.length == b.length) {
for(int i = 0; i < a.length; i++) {
if(a[i].length == b[i].length) {
for(int j = 0; j < a[i].length; j++) {
... |
addf5c85-7632-408c-9ae3-147058c3ed49 | 1 | private static JCheckBox[] getAssetCheckBoxes(AIProject project) {
List<AIAsset> tempAssetsList = project.getAssetsList();
JCheckBox[] assetCheckBoxLabels = new JCheckBox[tempAssetsList.size()];
for (int i = 0; i < tempAssetsList.size(); i++) {
assetCheckBoxLabels[i] = new JCheckBox(tempAssetsList.get... |
aea9339f-31fe-46af-8a65-3ad82c5fec52 | 2 | public void read(String txt) {
if (txt.length() > MAX_TXT_LENGTH) {
Iterator<String> i = splitToChunks(txt).iterator();
while (i.hasNext()) {
playText(i.next());
}
} else {
playText(txt);
}
} |
93dfb93c-e7ce-4bdd-932b-570a38337dc9 | 3 | public void terminated(Pipe pipe_) {
// Remove the pipe from the list; adjust number of matching, active and/or
// eligible pipes accordingly.
if (pipes.indexOf (pipe_) < matching)
matching--;
if (pipes.indexOf (pipe_) < active)
active--;
if (pipes.index... |
60476ee2-89e3-45fc-94e1-a2e9951b2fb9 | 6 | public static void printGrade(double score) {
if(score < 0 || score > 100) {
System.out.println("Invalid Score");
return;
}
if (score >= 90.0) {
System.out.println('A');
} else if(score >= 80.0) {
System.out.println('B');
} else if(score >= 70.0) {
System.out.println('C');
} else if(score ... |
400091d1-b0d8-4b35-85d5-73abfd4f635a | 8 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String ca... |
61619227-48ef-4f57-9c17-26f28c57ac9f | 2 | public void addLast(E e) {
if (e == null)
throw new NullPointerException();
elements[tail] = e;
if ( (tail = (tail + 1) & (elements.length - 1)) == head)
doubleCapacity();
} |
c74ca208-92e1-4fa5-8c51-9a7e6e8f11d8 | 3 | public void add(int x, int y) {
int[] tmp = new int[2];
for(int i = 0; i < index; i++)
if(x < line[i][0] || y < line[index][1]) {
tmp[0] = line[i][0];
tmp[1] = line[i][1];
line[i][0] = x;
line[i][1] = y;
x = tmp[... |
59b729be-f28e-459c-9c4f-d55ea1dda56a | 4 | @Override
public void runStartupChecks() throws EngineException {
Engine eng = FreeForAll.getInstance().getEngineManger().getEngine("Storage");
if (eng != null) {
if (eng instanceof StorageEngine) {
this.SE = (StorageEngine) eng;
}
}
if (SE == null) {
throw new EngineException("Missing Storage -De... |
a7232f42-f73c-424a-866a-7f6054dfd7ff | 7 | @Override
public PilotAction findNextAction(double s_elapsed) {
if (target_unit == null || !target_unit.isInMap() || !target_unit.isHomable() ||
!target_unit.getRoom().equals(target_unit_room)) {
updateTarget();
return PilotAction.MOVE_FORWARD;
}
double angle_to_target = MapUtils.a... |
4458b8ec-24ca-4bbe-b2fd-3c4b46592e66 | 7 | private int BFS(Graph graph, String start, String end) {
int length = 1;
if (start.equals(end))
return 0;
HashSet<String> visited = new HashSet<String>();
HashSet<String> outGoing = new HashSet<String>();
HashSet<String> reaching = new HashSet<String>();
reac... |
cff5abf8-f041-41b6-9548-471a92ee4bb2 | 8 | public List<Component> loadDatabase(){
List<Component> database = new ArrayList<Component>();
try {
File fXmlFile = new File("database.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.pars... |
75707c09-7d28-4fd0-b45d-ba03129a8b16 | 0 | public int getCount() {
return count;
} |
23ec21ee-242a-4562-85b2-1bb5c61d0345 | 9 | @Override
public Object getValueAt(int indiceLinha, int indiceColuna) {
//Verifica o índice da linha e obtém o valor através da posição na lista
RegistroNaoConformidadeApontado registroNaoConformidadeApontado = linhas.get(indiceLinha);
//Verifica o índice da coluna e obtém o valor
... |
532760dd-e962-446f-bc71-fb1b3a38c45d | 9 | public void func_73188_b(int par1, int par2, byte par3ArrayOfByte[], BiomeGenBase par4ArrayOfBiomeGenBase[])
{
for (int i = 0; i < 16; i++)
{
for (int j = 0; j < 16; j++)
{
int k = 1;
int l = -1;
byte byte0 = (byte)Block.whiteSt... |
87fcd66d-dab6-40da-b894-a2fbd5a180b2 | 2 | private void trickleUp(int index) {
int parent = (index - 1) / 2;
BTPosition<T> bottom = heap.get(index);
while (index > 0
&& comp.compare(heap.get(parent).element(), bottom.element()) < 0) {
heap.set(index, heap.get(parent));
index = parent;
parent = (parent - 1) / 2;
}
heap.set(index, bottom)... |
b9bc5b43-c965-4ac4-acd3-d8089ef44d6c | 2 | public static void main (String args[]){
Scanner s = new Scanner(System.in);
System.out.println("Enter with a value!");
while(s.hasNext()){
if(s.hasNextInt()){
System.out.println("Int.:"+s.nextInt());
}else
{
System.out.println("String.:"+s.next());
}
}
System.out.println... |
64dfa130-9fa6-43ff-803b-dc65687f9067 | 3 | private void genererEntete(File fichier)
{
String type ="";
//PROTOCOLE + message réussite AFFICHÉ PLUS HAUT
Date dateM = new Date(fichier.lastModified());
if(fichier.isFile())
{
String extension = (fichier.getName().split("\\."))[1];
type = get... |
63cc75ac-80dc-41ce-8367-248c57732a6f | 7 | public void rankSelection()
{
// calculate fitness, filter invalid elements
List<Individual> okList = new ArrayList<Individual>();
for (Individual ind : individuals) {
if (ind.fitness(MIN_G))
okList.add(ind);
}
// sort in preparation to calculate rank
Collections.sort(okList, new Comparator<Individ... |
1bc0f343-c226-42f7-b2ea-898402b9f290 | 8 | public void disable() {
if(RealWeather.isDebug()) RealWeather.log("Disabling features.");
for (Feature feature : features.values()) {
try {
if(RealWeather.isDebug()) RealWeather.log("DIS: " + feature.getName());
try {
configs.get(feature.ge... |
edb1a3ef-34c6-40fb-a5a0-44b6489de957 | 9 | private double find(int A[], int B[], int l, int r) {
int m = A.length, n = B.length;
if (l > r) {
return find(B, A, Math.max(0, (n - m) / 2), Math.min(B.length - 1, (m + n) / 2));
}
int i = (l + r) / 2;
int j = (m + n) / 2 - i - 1;
int Bj = j < 0 ? Integer.MIN_VALUE : B[j];
int Bj1 = ... |
9c5672d4-dff4-4a7e-819c-c929af15aea8 | 7 | public Tile getCurrentDestination() {
final Tile start = Players.getLocal().getLocation();
int minDist = Integer.MAX_VALUE;
for (Tile t : destinations) {
minDist = Math.min(minDist, MapUtil.dist(start, t));
}
if (minDist > 100)
return null;
int pangle = -1;
for (int i = destinations.length - 1; i >=... |
38f56349-4da3-43a4-8aa4-90803c0c4f16 | 8 | private void initGui() {
getContentPane().setBackground(backgroundColor);
setTitle("BATTLEBOTS ARENA");
ArrayList<Image> icons = new ArrayList<Image>();
icons.add(new ImageIcon(getClass().getResource("icon16.png")).getImage());
icons.add(new ImageIcon(get... |
d813b2c1-cc5c-4a10-8544-7f8af4877d41 | 7 | private HttpURLConnection getFetchConnection(WebThumbFetchRequest webThumbFetchRequest) throws WebThumbException {
Validate.notNull(webThumbFetchRequest, "webThumbFetchRequest is null!");
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Attempting to send webThumbFetchRequest: " + webThumbFetchRequest);
}
W... |
ec9aa1e0-be78-469c-940d-059194336245 | 6 | @Override
public void startTransfer() throws TransferException {
Runnable readRunner = new Runnable() {
public void run() {
try {
logger.debug("Socket ready for read.. " + socket);
logger.debug("Local port:"
+ socket.getLocalSocketAddress().toString());
// 初始化缓冲区和一些变量
byte[] buff =... |
c58ad490-a729-44e8-ac3f-596ad21d4fa4 | 7 | public EncryptCezar(String text, int k) {
this.k = k;
String input = text;
StringBuilder output = new StringBuilder();
for (int i = 0; i < input.length(); ++i) {
char c = input.charAt(i);
if (isEnglish(c)) {
int y = (findInEnglish(c) + k) % nEng;
if (Character.isUpperCase(c)) {
output.appe... |
126f2a4f-d860-47e4-9c79-72d7ae716a4a | 9 | @Test
public void testConstructor_IllegalArgumentException() {
boolean exceptionThrown = false;
try {
new PaymentResponse(null, 1, ServerResponseStatus.SUCCESS, null, "buyer", "seller", Currency.BTC, 12, System.currentTimeMillis());
} catch (IllegalArgumentException e) {
exceptionThrown = true;
}
asse... |
cd2a4a21-9aee-4f84-a5ca-61ece921236b | 0 | public int size( )
{
return manyItems;
} |
936ce243-1e11-4994-bac5-27dc619e9fa6 | 6 | public static void main(String[] args) {
try {
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
File configFile = new File(ClassLoader.getSystemResource(runXMLAUTHORITY).getFile());
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConf... |
59361b57-ae7f-4554-b4b2-03dd9a08c169 | 8 | public static CardCombination getSameCardsOrHighestCard(
ArrayList<Card> tempHandCards) {
CardCombinationEnum cardCombinationEnum = null;
// Sort the given hand cards just to be sure that the order is correct
sortHand(tempHandCards);
// Make a copy of the list, so that the given list can be manipulated
Ar... |
857c6444-4053-4eed-b6f2-6a3a1c436a80 | 6 | public static void main(String[] args) {
int max = (int)(6*Math.pow(9, P));
ArrayList<Integer> ans = new ArrayList<Integer>();
for(int i = 2; i < max; i++) {
int x = i;
ArrayList<Integer> digits = getDigits(i);
while( digits.size() > 0 && x >= 0 )
x -= Math.pow(digits.remove(digits.size()-1), P);
... |
0360f209-65d2-4b9d-9fa2-1f31f8247f0c | 2 | public void borrarRegistrosIndice(String nombreTabla,String indice, int id)
{
try {
this.bd.open();
this.table = this.bd.getTable(nombreTabla);
this.bd.beginTransaction(SqlJetTransactionMode.WRITE);
// Esta función busca por calve primaria aquel id que concue... |
3794caf3-b947-4981-96aa-05de208a3b7f | 2 | public BaseMethodPanel(JFrame frame, QueryDefinition query, T instance) throws MalformedURLException {
super(false);
this.frame = frame;
this.query = query;
this.query.setRequest(instance);
try {
this.setName(query.getName());
this.setLayout(new BorderLayout());
JPanel panel = new JPanel();
... |
576bc93f-cb8e-435c-aeff-7c061e1cd139 | 8 | public static void main(String[] args) throws URISyntaxException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
TestAlgorithm test = new TestAlgorithm();
try {
System.out.println("Please enter algorithm name, file name and minimal support level, separate by space.");
String inpu... |
fac6b01f-2a02-41c8-95b4-c5ae4cde5493 | 8 | public String[][] execSelectQuery(String pSQL){
String SQL = pSQL;
try{
Statement stmt = this.con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery(SQL);
rs.last();
int colu... |
31149fb2-5188-4ee5-a2f1-88e853527764 | 0 | private Set<Card> sixFlushWithStraight() {
return convertToCardSet("JS,4S,8S,3S,9S,TS,7H");
} |
48806886-3a9d-48ef-a07f-9c0dfa0367cb | 8 | public void askClientConnectionToServer(String clientId)
{
try
{
getLogger().info("Demande d'information client : " + clientId);
// On recherche si on a déjà démarré un dialogue avec le client.
boolean alreadyDone = false;
for (ClientDialog dialog : this.dialogs)
{
if (dialog.getClients().size()... |
e85297c9-60c2-4ead-859b-8fb2df4f652a | 0 | public void setPcaGenerico(Integer pcaGenerico) {
this.pcaGenerico = pcaGenerico;
} |
596fcc5d-2a9f-4d6b-89a6-fcaa677fd652 | 3 | public BlockMap(String ref)throws SlickException{
entities = new ArrayList<Object>();
tmap = new TiledMap(ref, "res");
mapWidth = tmap.getWidth() * tmap.getTileWidth();
mapHeight = tmap.getHeight() * tmap.getTileHeight();
for(int x = 0; x < tmap.getWidth(); ++x)
... |
7da434b8-8cee-48b0-beeb-086f8129c8e2 | 5 | public void create_idx( String idxFileName, String indexOnKeyString )
{
if(isReadOnly()) return;
if(canIfNoCdx())
{
order = "[idx]";
Idx = new idx();
try { Idx.fidx = new RandomAccessFile( new File( g_idxname(idxFileName) ), fmode()); }
catch (FileNotFoundException e1) { e1.printStackTrace(); }
try... |
3ecb4d23-e01d-4ead-849c-ad2cdd89389e | 8 | public static HashMap<Integer, Double> getFinalScores(List<TestResult> results){
HashMap<Integer, PriorityQueue<Integer> > id_scores = new HashMap<Integer, PriorityQueue<Integer> >();
for(TestResult res : results) {
PriorityQueue<Integer> queue = null;
if(id_scores.containsKey( res.studentId ) ) {
queue ... |
1b842fd1-376e-4931-bf49-f46c76a3f71a | 1 | public static void print(Vector<MP3> sublist) {
for (Iterator<MP3> it = sublist.iterator(); it.hasNext();) {
MP3 s = it.next();
System.out.println(s.getPath());
}
} |
1e42ce83-2348-4dd6-9438-39184df79604 | 9 | private String decode999( int num ) {
String s = "";
// work out hundreds : numbers 100-900
int n = num % 1000; // extract the first 3 digits from num
if ( n >=100 ) s += units[ n / 100 ] + " hundred";
if ( n>=100 && n % 100 != 0 ) s+= " and ";
// numbers 1-99
n = num % 100; // extract the first... |
82ad2deb-c834-4ad5-80d1-b055276d6403 | 1 | public boolean update(Prestamos p){
PreparedStatement ps;
try {
ps = mycon.prepareStatement(
"UPDATE Prestamos "+
"SET fecha=?, estado=?, id_libro=?, id_usuario=? "+
"WHERE id=?"
);
ps.setDate(1, p.getFecha());
... |
c58293b1-9a7a-4580-98a7-efc78e283afa | 6 | private void createTreeView(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
gridLayout.marginHeight = gridLayout.marginWidth = 2;
gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
composite.setLayout... |
76dd9312-87d5-4683-9267-ad4ceae52434 | 5 | @Override
public void setAttenuation( int model )
{
super.setAttenuation( model );
// make sure we are assigned to a channel:
if( channel != null && channel.attachedSource == this &&
channelOpenAL != null && channelOpenAL.ALSource != null )
{
// attenuatio... |
4b5399c6-04db-427b-bf6b-3b7cb71df14a | 9 | @Override
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
String texto = getText(0, getLength());
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (!Character.isDigit(c)) {
return;
}
... |
fc812ffb-494b-4466-8e27-c94360f9a6c8 | 3 | public void body()
{
int resourceID[] = new int[this.totalResource_];
String resourceName[] = new String[this.totalResource_];
LinkedList resList;
ResourceCharacteristics resChar;
// waiting to get list of resources. Since GridSim package uses
// multi-threaded envi... |
8d0d0347-00f6-42de-a8f3-df2681d5a884 | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Record other = (Record) obj;
if (this.recordId != other.recordId) {
return false;
}
... |
c0b803b2-8a0c-44b8-8a9b-791d1b3577c5 | 0 | public void setId(long Id) {
this.Id = Id;
} |
3b0a16f6-92a3-4026-87c2-a230423a90da | 9 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
String d = jTextField2.getText();
String id = jTextField1.getText();
String tgl1 = String.valueOf(jTable1.getValueAt(0, 4));
int no... |
19b83caf-aa29-4716-ba96-3e50880fe03b | 3 | private boolean inBounds(int y, int x) {
return x >= 0 && y >= 0 && x < BOARD_LENGTH && y < BOARD_LENGTH;
} |
53e19a2c-e415-49b7-a7bb-815e8d6fe3a7 | 1 | @Override
public void play(int objectId) {
AudioChannel channel = getAudioChannel(objectId);
AudioObject object = objects.get(objectId);
int source = channel.source;
alSourcei(source, AL_BUFFER, object.dataId);
alSourcef(source, AL_PITCH, (float) object.pitch);
alSourcef(source, AL_GAIN, (float) object.vol... |
e3198f68-d6e8-43e3-b8a0-1c9a3d0e5e34 | 9 | int insertKeyRehash(long val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... |
b7af6c89-cde1-4bbe-a140-3adaae1689d3 | 8 | private int findBaseHeightForLogo(int target, int associationNameLength) {
int base = 1;
double height = getLogoHeight(associationNameLength, base);
while (height < target) {
base *= 2;
height = getLogoHeight(associationNameLength, base);
LOG.debug(String.form... |
d13a929c-a92d-4501-b763-92273b858b67 | 8 | protected String getGlobalArchiverFlags() {
final StringBuilder builder = new StringBuilder();
if (globalOverrideArchiverFlags == null
|| globalOverrideArchiverFlags.isEmpty()) {
if (parent != null)
builder.append(parent.getGlobalArchiverFlags());
else
builder.append(config.aflags());
} else {
... |
dd7a8fbf-a2f2-4084-be27-785a4fcb690f | 1 | public String selectionSortStable(String s) {
char[] a = s.toCharArray();
for (int i = 0; i < a.length - 1; i++) {
insert(a, i, getMinIndex(a, i));
}
return new String(a);
} |
dda36022-f023-4c9a-b498-ff833f0080b6 | 2 | public static EXIT_COMMAND getCommand(String str) {
for(EXIT_COMMAND exit: EXIT_COMMAND.values()) {
if(exit.cmd.equalsIgnoreCase(str)) {
return exit;
}
}
return CONTINUE;
} |
f0cd4071-0bec-4978-8f5f-a2fa2588b520 | 4 | private final String inlineCommentFilter( String line )
{
//assert !inJavadocComment;
//assert !inMultiLineComment;
if ( line == null || line.equals( "" ) )
{
return "";
}
int index;
if ( ( index = line.indexOf( "//" ) ) >= 0 && !isInsideString( l... |
89583f7a-b0be-4418-b55d-475a7f5380bf | 8 | public boolean move(Direction direction) throws InvalidMoveException {
// Max gameboard positions
int left = 0;
int top = 0;
int bottom = board.length - 1;
int right = board[0].length - 1;
Tokens temp;
switch(direction) {
// Move up
case UP:
if(emptyRow == top) throw new InvalidMoveExcept... |
3f06f1c6-974e-4cfd-8931-72a6f4afbc05 | 1 | public long getAverage() {
long sum = 0;
for (int i = 0; i < duur.size(); i++) {
sum += duur.get(i).longValue();
}
return sum / duur.size();
} |
3f208b86-5769-43f6-adb9-5765d82b49d3 | 4 | protected HsqlDaoBase(HsqlUnitOfWork uow) {
super(uow);
try {
Connection connection = uow.getConnection();
ResultSet rs = connection.getMetaData().getTables(null, null, null, null);
boolean exist = false;
stmt =connection.createStatement();
while(rs.next())
{
if(rs.getString("TABLE... |
a8ca595b-3f7d-4e87-be58-845a9c434ac8 | 0 | public int getMaxFPS() {
return this.maxFPS;
} |
97392668-3429-43d2-b92d-35356ae1dffd | 7 | public SquareType getSquareType(Coord c) {
int squareValue = mat.getSquareValue(c);
if (squareValue == -1) {
return SquareType.OUTSIDE;
}
else if (squareValue == 0) {
return SquareType.OBSTACLE;
}
else if (squareValue == 1) {
return Sq... |
37ab9efb-b359-42f3-b234-297ffcc06144 | 0 | @Override
public void startSetup(Attributes atts) {
JTextArea list = new JTextArea();
list.setRows(4);
list.setColumns(15);
list.setLineWrap(false);
JScrollPane component = new JScrollPane(list);
setComponent(component);
super.startSetup(atts);
list.addFocusListener(new TextAreaListener(list, getPre... |
1c03a175-6972-464a-ace2-4ad937f92797 | 9 | private void run() {
// repita ate que a lista de algum homem esteja vazia ou todos estejam casados
while(!someManListEmpty() && !everyoneEngaged()) {
boolean existFreeMan = true;
// enquanto existir homem solteiro
while(existFreeMan) {
Person currentM... |
c05dc641-8073-4566-b92f-b53f3eea81e9 | 8 | public void keyPressed(KeyEvent e) {
/* Pressing a key in the title screen starts a game */
if (board.titleScreenB) {
board.titleScreenB = false;
return;
}
/* Pressing a key in the win screen or game over screen goes to the title screen */
else if (board.w... |
f46b227b-8257-468e-9290-1c33cb80780d | 9 | public BufferedImage greenRGBFilter() {
this.greenImage = originalImage;
Color actualPixel;
int actualRedValue;
int actualGreenValue;
int actualBlueValue;
float numberOfGreenPixels = 0f;
for (int i = 0; i < originalImage.getWidth(); i++) {
for (int j = 0; j < originalImage.getHeight(); j++) {
actua... |
9fcb405a-ec80-4666-b328-7d572bb2ea17 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Delta other = (Delta) obj;
if (original == null) {
if (other.original != ... |
e58cb028-2856-49a5-81b8-5e729596a15c | 2 | private Object fireReceiveQueryEvent(ReceiveQueryEvent evt) throws Exception {
try {
if (invokeHandler == null) {
throw new Exception("InvokeHandler not assigned on server side.");
}
localConnectionInfo.remove();
localConnectionInfo.set(evt.getConnectionInfo());
return new Ref... |
dca5a859-b597-4971-8f0e-87684193a58d | 9 | private static void begin() {
Scanner sc = new Scanner(System.in);
int nTestCases = Integer.parseInt(sc.nextLine());
sc.nextLine(); // process empty line.
/* @formatter:off
* Decides how to search the word in the matrix.
* 0,1 -> horizontally to the right
* 1,... |
62f008c8-1d7d-4d2e-9d03-e851ecd8b1ee | 9 | @Override
public boolean equals(Object o)
{
if(o == null)
return false;
if(o == this)
return true;
if(!(o instanceof Angebot))
return false;
Angebot a = (Angebot)o;
if(a.getKundeNr()!= kundeNr || a.getNr() != nr || a.getPreis() != preis... |
bae5fcea-2326-4f52-b332-55091a805663 | 2 | @Override
public int compareTo(Node o) {
if (this.evaluation > o.evaluation) {
return 1;
} else if (this.evaluation < o.evaluation) {
return -1;
} else {
return 0;
}
} |
290be67f-2782-4d8e-96be-4888871ef096 | 2 | private void generateWorld()
{
int initSize = 10;
for(int j = initSize/(-2); j < initSize/2.0; j++)
{
for (int k = initSize/(-2); k < initSize/2.0; ++k)
{
chunkLoader.queueLoad(new Point(k, j));
}
}
} |
e810428c-3ec3-4092-9d10-5b2e1ef0fe4a | 0 | public boolean inCheck(Player player) { // Is player's king in check?
return this.fieldInCheck(this.getKingField(player), player);
} |
db1a119c-61da-4539-9d99-76156891ded2 | 4 | protected ArrayList<Coordinate> takeMove(Coordinate xy) {
boolean test = false;
if (test || m_test) {
System.out.println("Othello :: takeMove() BEGIN");
}
/*
if (!isValidMove(xy)) {
throw new IllegalStateException(
"Given move is invalid but should be valid");
}
*/
// I... |
d541e7f3-bbbc-4108-b2a3-bef540eb9c84 | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, Contract__typeInfo)) {
... |
f8b92dca-3af0-4e4b-a14c-ad330c4e77d1 | 5 | public void mouseClicked(MouseEvent e)
{
if (e.getSource() == cur)
{
int s = 20;
int f1 = 8;
int f2 = f1 + (int) (s * 0.6);
Rectangle lRect = new Rectangle(f1, f1, s, s);
Rectangle rRect = new Rectangle(f2, f2, s, s);
if (lRect.contains(e.getPoint()))
{
Color c = JColorChooser.show... |
c8e48730-f136-4c27-9593-7a473be07c18 | 0 | public HelloWorldOGL() throws Exception {
world = new World();
world.setAmbientLight(0, 255, 0);
TextureManager.getInstance().addTexture("box", new Texture("box.jpg"));
box = Primitives.getBox(13f, 2f);
box.setTexture("box");
box.setEnvmapped(Object3D.ENVMAP_ENABLED);
box.build();
world.addObject(box)... |
bb818004-abfc-4c56-ac04-ac9d5b82fe06 | 3 | public void ordena()
{
for (int i=0; i<cads.length - 1; i++)
{
for (int j=0; j<cads.length-1-i; j++)
{
if (cads[j].compareTo(cads[j+1]) > 0)
{
String aux = cads[j];
cads [j] = cads [j+1];
... |
5b668eb4-1beb-494a-a1ac-53f8ffae72a7 | 2 | public void addAll(IntTreeBag addend){
IntBTNode addroot;
if(addend == null){
throw new IllegalArgumentException(" bag is empty");
}
if(root == addend.root){
addroot = IntBTNode.treeCopy(addend.root);
addTree(addroot);
}else{
addTree(addend.root);
... |
2c036d25-b767-4591-a527-3f6f0dbfd524 | 2 | public Set getClassNames()
{
HashSet result = new HashSet();
LongVector v = items;
int size = numOfItems;
for (int i = 1; i < size; ++i) {
String className = ((ConstInfo) v.elementAt(i)).getClassName(this);
if (className != null)
result.add(clas... |
8a8d4502-079d-48e5-88f8-a3b6729d1b9e | 4 | private synchronized void defaultSend(Sim_event ev, int gisID, int statID,
int shutdownID)
{
IO_data io = (IO_data) ev.get_data();
int destId = io.getDestID();
/***** // DEBUG info
System.out.println(super.get_name() + ".defaultSend(): Send to " +
GridS... |
3cd94946-0f86-4e85-b77e-853d9fc511d3 | 1 | private void processFile()
{
if(settings.cur_processor != null)
{
processFileExternal();
}
} |
7fe24330-aca6-4e23-8dfc-207b0c590c25 | 7 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
if(cmd.getName().equalsIgnoreCase("uhc")) {
if (args.length == 0) {
if (!sender.isOp()) {
sender.sendMessage(ChatColor.BOLD + "" + ChatColor.RED + "UltraHardcore: " + ChatColor.RESET + "Custom coded for ThePark");
... |
6ae251ab-b80e-42c7-a28a-f7540f9b9c3d | 5 | private JsonParser moveToPath(String json, String path) {
try {
JsonFactory f = new MappingJsonFactory(createMapper());
JsonParser jp = f.createJsonParser(json);
jp.nextToken(); //go to start_object
if (path == null) return jp;
String pathParts[];
if (path.contains(".")) {
... |
1f12d89d-4869-40fd-b56b-4b42ba367d11 | 6 | protected void controlMovement() {
// Reset movement speed
speedModifier = 1f;
// Basic "run" actions
// Modify the entity's movement speed by 150%
if(Keybind.RUN.held()) {
speedModifier = 1.5f;
}
// Fire a movement event on the player if any movement key presses have occured
if(Keybind.movement()... |
2d460500-2cff-4e5c-9ff9-b31e16093997 | 3 | public void start() {
// A new thread pool is created...
ThreadPoolExecutor executor = testThreadPoolExecutorService
.createNewThreadPool();
executor.allowCoreThreadTimeOut(true);
// Created executor is set to ThreadPoolMonitorService...
threadPoolMonitorService.setExecutor(executor);
// ThreadPoolMo... |
104d3b10-503a-4e81-ade4-732b297f7597 | 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 fe... |
fa4bd41d-f6aa-4d55-b7c9-0d21824d01cf | 8 | public Set<OneMutation> loadMutationList(String fName, int numMutable, boolean PEMcomp) {
BufferedReader bufread = null;
try {
File file = new File(fName);
FileReader fr = new FileReader(file);
bufread = new BufferedReader(fr);
}
catch (FileNotFoundException e) {
System.out.println(" ... no mutat... |
5910e895-1f3e-4e71-9c05-521336d2581a | 9 | public void run()
{
try
{
long outSize = 0;
if (LzmaOutputStream.LZMA_HEADER)
{
final int n = in.read(props, 0, propSize);
if (n != propSize)
{
throw new IOException("input .lzma file is too short... |
8f676550-ca92-419c-a4be-44bb0c3121a0 | 3 | public boolean equals(Object o) {
if (o instanceof Key) {
Key k = (Key) o;
return tag == k.tag && intData == k.intData
&& objData.equals(k.objData);
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.