method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
28b9c42a-3359-40d2-afd5-65fbc7168625 | 6 | public void layout(double r, double midTheta, double span)
{
//Is distance from a corner of the alloted space of a vertex to the center.
double diagonalLength = Math.sqrt(Math.pow(vertexDim.getHeight(), 2) + Math.pow(vertexDim.getWidth(), 2))
+ vertexBuffer;
if (size() == 0)
return;
if (size()... |
3c47fcac-38ec-4b76-8a9c-77466d1e55cf | 4 | @Override
public Consulta listByIdInsert(int codigo) {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Consulta c = new Consulta();
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(LISTBYIDINSERT);... |
af04fbe2-be7e-4242-8898-750e5a8f0725 | 0 | public void doAnswer(AnswerSide answerSide){} |
e8beb9dc-01c4-4cf0-a4e9-9ce0641d2939 | 3 | public static ReferenceUnit addReferenceUnit(String name, String typeName, String systemName) {
ReferenceUnit createdUnit = null;
if(!listUnits.containsKey(name) && listTypes.containsKey(typeName) && listSystems.containsKey(systemName)) {
Type type = listTypes.get(t... |
76c19a14-b634-4034-a843-577dad261b0d | 8 | private void merge(int[] theArray, int[] leftArray, int[] rightArray, SorterParams.SortDirection sortDir)
{
int i = 0;
int l = 0;
int r = 0;
//merge smaller element into resulting array
while(l < leftArray.length && r < rightArray.length)
{
if(sortDir == ... |
7bca03d3-214c-4ede-9a74-2187b9b3bcf2 | 0 | public Circulo(double x, double y, double raio) {
super(x, y);
this.raio = raio;
} |
0ff4e23f-b022-4a15-a2a4-3106a2a4043e | 7 | public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNextInt()) {
int n = scanner.nextInt();
int m = scanner.nextInt();
scanner.nextLine();
String word = scanner.nextLine();
char[][] matrix = new... |
7ca382a3-55f5-41cb-adbc-9e3673c8dc28 | 0 | public void setCurrentLineNumber(int currentLineNumber) {
this.currentLineNumber = currentLineNumber;
} |
e575b68c-8d14-4383-afdb-60fd1cbb6f90 | 4 | public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
if (item instanceof ToolItem) {
ToolItem tool = (ToolItem) item;
if (tool.type == ToolType.shovel) {
if (player.payStamina(5)) {
// level.setTile(xt, yt, Tile.infiniteFall, 0);
int count = random.nextIn... |
c2ed47b1-e0a0-49bd-add4-ed978ce507a2 | 6 | public boolean UpdateWindow()
{
try
{
DisplayMode dm = null;
DisplayMode[] dms = Display.getAvailableDisplayModes();
for (int i = 0; i < dms.length; i++)
{
if (dms[i].getWidth() == mWindowWidth
&& dms[i].getHeight() == mWindowHeight)
{
dm = dms[i];
break;
}
}
... |
29b48e8d-b354-42bc-8018-2dd22cfb63a5 | 8 | public static Field findField(Class<?> clazz, String field, Class<?> type, int index) {
int temp = index;
for (Field f : clazz.getDeclaredFields())
if ((field == null || f.getName().equals(field)) && type.isAssignableFrom(f.getType()) && temp-- <= 0)
return f;
if (cla... |
4e305a76-17ed-4cfb-a845-4dc5ecdb5442 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SymbolClass)) return false;
if (!super.equals(o)) return false;
SymbolClass that = (SymbolClass) o;
if (isExcludeSymbol != that.isExcludeSymbol) return false;
if (componentSym... |
f1791e1d-d0b0-471f-b4be-73e7957cc805 | 6 | public static boolean unzipFile( String zipFile, String destinationDir ) {
// Try to create the required directories and exit if it fails.
File dstDir = new File( destinationDir );
if( !dstDir.exists() && !dstDir.mkdirs() ) {
System.err.println( "Could not create directory: " + desti... |
bc0aace4-4d72-4f13-a9dc-9d67029abbd1 | 2 | public synchronized JSONObject read() throws IOException, ProtocolException {
String line = connection.readLine();
JSONObject obj = null;
if(line == null){
return null;
}
try {
obj = new JSONObject(line);
return obj;
}
catch (JSONException e){
throw new ProtocolException("Invalid packet recei... |
47e82d49-4da2-40d9-a693-f4acf9038446 | 8 | private void createPixels(int drawingAreaPixels[], byte charPixels[], int color, int pixel, int offset, int width, int height, int unknown1, int unknown2) {
int l1 = -(width >> 2);
width = -(width & 3);
for (int i2 = -height; i2 < 0; i2++) {
for (int j2 = l1; j2 < 0; j2++) {
if (charPixels[pixel++] != 0) {... |
438276ef-acaa-4d42-83e0-fc4e6fb7b503 | 1 | public void test_printParseShortNameWithAutoLookup() {
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd HH:mm ").appendTimeZoneShortName(null);
DateTimeFormatter f = bld.toFormatter().withLocale(Locale.ENGLISH);
assertEquals(true, f.is... |
063ab9ef-6be5-4680-8278-32e6fd90809d | 9 | public void mostrar() {
this.limpiarPantalla();
int choosen = 0;
int espaciado= 60;
Scanner in = new Scanner(this.in);
Cadena base = new Cadena();
if (!this.getTitulo().equals("")) {
int ancho_titulo = this.titulo.length();
ancho_titulo = ancho_... |
33617aea-5ea3-470f-92f0-d3760a9d67ab | 2 | @Override
public String getTransactionId() {
String id = null;
switch(this.getTransactionIDMode()) {
case Random:
long val = this.rand.nextLong();
val = Math.abs(val);
super.setTransactionId(Long.toString(val));
case Static:
id = super.getTransactionId();
break;
default: break;
}
... |
bc5e834e-59d4-4930-96fa-b41eb6bbfc72 | 9 | public boolean RemoveFranchise(int ID)
throws UnauthorizedUserException, BadConnectionException, DoubleEntryException
{
PreparedStatement pStmnt = null;
// cannot delete Franchise Number 1
if(ID == 1)
throw(new UnauthorizedUserException("AccessDenied"));
... |
ddf01193-c135-4ed1-a3bb-ebddb6797ab3 | 5 | public void watch( Source source )
{
// make sure the source exists:
if( source == null )
return;
// make sure we aren't already watching this source:
if( streamingSources.contains( source ) )
return;
ListIterator<Source> iter;
... |
d4002d4b-603e-4179-8b68-699350d1fe34 | 3 | public boolean load(String audiofile) {
try {
setFilename(audiofile);
sample = AudioSystem.getAudioInputStream(getURL(filename));
clip.open(sample);
return true;
} catch (IOException e) {
System.out.println("Error en " + e.toString());
... |
3432746e-8dbf-49d9-9724-6a217f68d907 | 9 | private boolean association(MouseEvent e,int i){
boolean ordre;
// Je determine l'equation de la droite :
// On commence par p :
double p = ((double) model.getAssociationList().get(i).getLast().getY()-model.getAssociationList().get(i).getFirst().getY())/((double) model.getAssociationList().get(i).ge... |
61b1fdb5-c671-4b5c-b2e7-a6546d0778d2 | 8 | protected void _run() {
Map<String,VersionedValue> copy=new HashMap<>(counters);
int len=copy.size();
String[] names=new String[len];
long[] values=new long[len], versions=new long[len];
int index=0;
for(Map.Entry<String,VersionedValue> entry: copy... |
cb75b9e9-aacb-4fea-a589-eac87d8d25ff | 1 | public void bindEngine(GameEngine engine) {
for (Player player : players) {
player.setGameEngine(engine);
}
} |
01836570-5da0-4d04-abc1-df00c13945af | 2 | public void scrollData(int value)
{
for (int i = 0; i < mRows; i++)
{
if (i >= mServerData.length)
{
mData[i][0] = "";
mData[i][1] = "";
mData[i][2] = "";
}
else
{
mData[i][0] = mServerData[value + i][0];
mData[i][1] = mServerData[value + i][1];
mData[i][2] = mServerData[valu... |
5c6d1bf2-072d-49cd-8c42-a379469e95b5 | 9 | public static void main(final String[] args) {
InetAddress IPAddress = null;
Integer port = null;
final String username;
final ClientSocket con;
int messageNumber = 0;
System.out.println("client starting...");
while (IPAddress == null) {
final Strin... |
60a6e830-82e5-4971-abfc-096e94aa99a5 | 2 | public <T> SocialCommunity<T> getSocialCommunityInstance(T object) {
try {
@SuppressWarnings("unchecked")
SocialCommunity<T> instance = (SocialCommunity<T>) this.clazz
.newInstance();
instance.setAdaptableObject(object);
return instance;
} catch (InstantiationException e) {
Throwables.propagate(... |
4b43e798-ff5a-4840-be2a-6b8aeeafea55 | 2 | public static int diffCount(String s1, String s2) {
int minLen = Math.min(s1.length(), s2.length());
int count = 0;
for (int j = 0; j < minLen; j++)
if (s1.charAt(j) != s2.charAt(j)) count++;
return count;
} |
6c5aa24b-6a4e-4ba2-bc57-6635aa097a2e | 2 | public static LabFactory createInstance()
{
final LabFactoryProperties factoryProperties = new LabFactoryProperties();
final String systemProperty = System.getProperty(SYSTEM_PROPERTY_FACTORY);
if (systemProperty != null && !systemProperty.isEmpty())
{
factoryProperties.setFactoryClassName(systemProperty);
}
... |
da3853cb-b0a2-4461-ad00-1f2e622fcf79 | 8 | public boolean isPalindrome(String inputString) {
inputString = inputString.toLowerCase(); //since its case insensitive
//An empty string is a palindrome
if (inputString == null || inputString.length() == 0)
return true;
int low = 0;
int high = inputString.length()-1... |
90fddbc4-6bad-49cd-b7ca-c9d9678feb84 | 1 | protected void setPlayerAtRandomLocation(Player player) {
String pname = player.getName();
DodgeballPlayer p = mm.getMinigamePlayer(pname);
DodgeballTeam t = p.getTeam();
CubeSerializable a = t == TEAM_1 ? TEAM_1_AREA : TEAM_2_AREA;
LocationSerializable maxl = a.maxPoint;
... |
bd26ac2e-7990-418a-b4d3-ca2be2069112 | 8 | private void displayNetworkInfo(){
ArrayList<Node> nodes=currentNetwork.getAllNodes();
//nodes=Node.sort(nodes);
for(int i=0;i<nodes.size();i++){
String output="";
if(nodes.get(i)instanceof InputNeuron_Add){
output="InputNeuron :: ";
}else if(node... |
af1064e6-2194-4027-b77e-1dad2aa66391 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Ground other = (Ground) obj;
if (!Arrays.deepEquals(grid, other.grid))
return false;
if (higherLeftPoint == null) {
if (other.higherLeftP... |
c881471a-d9c8-4832-aaf5-e54c2924d72e | 0 | public Snapshot(Collection<String> stations) {
this.stations = stations;
} |
9f016b90-f487-4fcf-8e3f-2196620b7a41 | 7 | @Override
public void onLoaded(Bitmap image, boolean fromMemory, boolean fromDisk) {
super.onLoaded(image, fromMemory, fromDisk);
if (isOutOfMemory()) {
// TODO: pass bitmap decoding options, make several attempts
}
ImageView imageView = getImageView();
if (imag... |
1045e70d-868c-489f-94f4-c0ab9bec6226 | 1 | public byte[] encodeConnect(Map<String, Object> params) throws EncodingException, NotImplementedException
{
List<Byte> result = new ArrayList<Byte>();
writeStringAMF0(result, "connect");
writeIntAMF0(result, 1); // invokeId
// Write params
result.add((byte)0x11); // AMF3 object
result.add((byte)0x09); //... |
5e7b1be2-319e-4b33-bc44-2a13c9b017d2 | 0 | public Socket getSocket(){
return socket;
} |
75606076-599f-4a06-b34a-7b4f4980b9f3 | 0 | public void addCompetitors(AntBrain brain) {
antBrains.add(brain);
} |
18029989-5b1c-4b3d-8b6f-16611508c903 | 9 | private void genericScoreRecursive(HashSet<BoardPosition> searched,
HashSet<BoardPosition> toSearch,
ArrayList<Meeple> meeplesOnFeature, Object[] featureProperties) {
// Take a position from the toSearch map to search.
Iterator<BoardPosition> toSearchIterator = toSearch.iterator();
BoardPosition boardPosit... |
a76fe454-8385-47c4-ace0-0061846ef1a0 | 9 | protected Instances determineOutputFormat(Instances inputFormat)
throws Exception {
Instances data;
Instances result;
FastVector atts;
FastVector values;
HashSet hash;
int i;
int n;
boolean isDate;
Instance inst;
Vector sorted;
m_Cols.setUpper(inputFormat.numAt... |
19e93d17-b1c7-4187-81e1-57d44c2273dd | 6 | public int largestPalindrome() {
//create a list of palindromes that are the result of a product of 2 3-digit numbers
ArrayList<Integer> palindromes = new ArrayList<Integer>();
int largestPalindrome = 0;
int theNumber = 0;
for (int first = 999; first > 99; first--) {
for (int second = 999; second > 99; ... |
29eb3768-5315-4548-930f-4a4b47888f9a | 1 | public ArrayList<T> toArrayList()
{
ArrayList<T> rs = new ArrayList<T>();
for(T item : this._source)
{
rs.add(item);
}
return rs;
} |
03cadd8f-5b79-4b97-bf95-a40ce4b18651 | 1 | private static void write(String root, Object x) {
YamlConfiguration config = load();
config.set(root, x);
try {
config.save(file);
} catch (IOException e) {
e.printStackTrace();
}
} |
61724e37-c2ee-4458-b816-d195f4e4cf49 | 0 | @Override
public String toString() {
return "Member [email=" + email + ", id=" + id + ", password="
+ password + ", realname=" + realname + ", regip=" + regip
+ ", regtime=" + regtime + ", sex=" + sex + ", sno=" + sno
+ ", university=" + university + ", username=" + username + "]";
} |
8b1a5345-84ff-4224-abca-2086f3e6fd96 | 8 | public boolean decode(final ByteBuffer buffer) {
if (!headerDecoder.isFullHeader(buffer)) {
return false;
}
final int start = buffer.position();
headerDecoder.parse(buffer);
final int payloadLength = headerDecoder.getPayloadLength();
if (!isFullPayload(buffer, payloadLength)) { // including terminating... |
e1eaad68-8919-4f45-8547-033154351403 | 0 | public Fibonacci() { super("Fibonacci Calculator"); } |
7c172769-1bba-4b3b-b084-c802062b9774 | 1 | public CrawlerConfigurationBuilder withDownloader(final Downloader downloader) {
if (downloader == null) {
throw new IllegalArgumentException("downloader cannot be null");
}
configuration.downloader(downloader);
return this;
} |
21eb5894-70b2-42e2-95a3-db1327ef2dfd | 6 | @Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... |
0566059b-c2ff-4e0a-ad24-92fd1b7325eb | 8 | private void persist(PersistAction persistAction, String successMessage) {
if (selected != null) {
this.setEmbeddableKeys();
try {
if (persistAction != PersistAction.DELETE) {
this.ejbFacade.edit(selected);
} else {
... |
32f28734-a4da-4f61-b143-f575dcc4f20c | 9 | private synchronized String handleRecv(){
int n = getNo();
HashMap<String,Integer> messages = new HashMap<String,Integer>();
ArrayList<Integer> nodes = new ArrayList<Integer>(n);
A: for ( int i = 0 ; i < n-F -1; i++ ){
while( vals.peek()!= null && i < getNo()-F -1){
try{
Utils.out(pid,"waiting")... |
dc854dbe-cde0-42db-9cc5-5f28e2d49537 | 7 | public void removeNullElements() throws ConfigurationChangeException {
// alle Elemente aus der Menge holen einschließlich der nicht aktuellen (versionierten)
final List<NonMutableElement> nonMutableElements = getNonMutableElements();
for(Iterator<NonMutableElement> iterator = nonMutableElements.iterator(); itera... |
27bc2a3e-1590-4fe3-88c3-6ab591687f42 | 1 | private String makeSHA1Hash(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("SHA1");
md.reset();
byte[] buffer = input.getBytes();
md.update(buffer);
byte[] digest = md.digest();
String hexStr = "";
for (int i = 0; i < digest.length; i++) {
hexStr +=... |
86156109-2bd5-4888-8452-58e9223821d4 | 0 | public int getYearsExperience() {
return YearsExperience;
} |
5c7bfea6-c701-4830-be69-f68e8ea276c8 | 0 | public byte getBitsPerSample() {
return bitsPerSample;
} |
d992b2f2-4f1e-4d13-b819-9d45f5496a76 | 2 | static double[][] cofactor(double[][] A){
double[][] B = new double[A.length][A.length];
for(int i = 0; i < A.length; i++){
for(int j = 0; j < A.length; j++){
B[i][j] = Math.pow(-1,i+j)*det(minor(A,i,j));
}
}
return B;
} |
4388999a-c347-4c2f-9285-a42f8d717eb9 | 2 | public ACSView(ACSModel mod){
model = mod;
trayIcon = null;
// Set Default Look and Feel
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e){
System.err.println("Could not set look and feel for MCView");
}
setMinimumSize(new Dimension(418, 280));
... |
2ae3eb94-d0ad-4183-ae42-3d48474ad471 | 5 | public int[] mergeTwoArrays(int[] A, int[] B) {
int[] C = new int[A.length + B.length];
int i = 0, j = 0, k = 0;
while (i < A.length && j < B.length) {
if (A[i] <= B[j]) {
C[k] = A[i];
i++;
} else {
C[k] = B[j];
j++;
}
k++;
}
while (i < A.length) {
C[k] = A[i];
i++;
k++;
... |
e774eaea-f1cc-44bb-af5c-808038a786bd | 4 | @Override
protected void run() {
long startTime = System.currentTimeMillis();
long elapsedTime = 1;
SimmulatedAnnealing sa = (SimmulatedAnnealing) algorithms.get("SA");
int sameCounter = 0;
sa.run();
runBestIndividual = sa.getBestIndividual();
System.out.println();
boolean reset = false... |
13beb100-1cae-42ac-9eb4-a0b5c63c7baf | 3 | public DataStructures createMeasureKit(int indexElement){
DataStructures outData;
MeasureKitType measureKit;
if(inData.getFromKit(indexElement).getClass() == Integer[].class){
measureKit = new MeasureKitInteger(inData);
measureKit.createFrom(indexElement,numberOfPoints)... |
1e5f50bc-4f75-4791-a945-aa71e84f8127 | 2 | public final synchronized BigInteger readBigInteger(){
this.inputType = true;
String word="";
BigInteger big = null;
if(!this.testFullLineT) this.enterLine();
word = nextWord();
if(!eof)big = new BigInteger(word.trim());
... |
cd28bec0-89c3-43ff-96fa-467aba79c800 | 8 | public List<List<Integer>> threeSum(int[] num) {
Arrays.sort(num);
int sum = 0;
int start = 0;
int front = 1;
int end = num.length - 1;
int cal = 0;
List<List<Integer>> result = new ArrayList<List<Integer>>();
List<Integer> temp;
while (front < end) {
cal = sum - num[start];
if (start > 0 && num... |
61712ea1-3815-473d-ad23-49d045bf33cd | 0 | public String getImagen() {
return imagen;
} |
7c5de578-88c4-4c12-8aaa-925c9a14f649 | 6 | public static boolean setupPool(BreedingPool o, boolean init) {
JPanel mainPanel = new JPanel();
JRadioButton[] but = new JRadioButton[PoolType.values().length];
boolean ret = false;
mainPanel.setLayout(new GridLayout(4, 1));
mainPanel.setPreferredSize(new Dimension(150, 150));
ButtonGroup bg = new Bu... |
6ce53511-8db7-4e86-ab93-14fc5dfa8e58 | 7 | public int evalRPN(String[] tokens) {
int result = 0;
if (tokens.length == 0) {
return result;
}
//get all operatores
String operators = "+-*/";
//build a stack to store the records
Stack<String> stack = new Stack<>();
//go through all the to... |
7ac0b072-c1dd-422d-ba77-7b3864b446a7 | 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... |
3ec875e6-1fc3-4ecc-9c8c-27574c7188f6 | 3 | public boolean clearPathBetween(Field from, Field to) {
if (from.inSameFileAs(to)) {
return this.clearPathInFileBetween(from, to);
} else if (from.inSameRankAs(to)) {
return this.clearPathInRankBetween(from, to);
} else if (from.inDiagonalPathWith(to)) {
return this.clearPathInDiagonalBetween(from, to);
... |
73722498-c890-4300-9484-35c7d65e1e88 | 4 | public boolean isNull(String str) {
boolean bl = false;
if (str.equals(null) || str == null || str.equals(Const.strnull) || str.equals(Const.str_null)){
bl = false;
} else {
bl = true;
}
return bl;
} |
b7f4e844-6341-421d-8097-3823e73bae01 | 6 | public MySmartCarTester() throws Exception
{
super(inputCount, outputCount, new IMyNeuronFunction<Double>()
{
@Override
public Double process(List<Double> inData, List<Double> weights, Double threshold) throws Exception
{
if(inData.size()!=weights.... |
5363398f-217e-422c-bd16-ea0eff728410 | 1 | public void testParseStandardFail1() {
PeriodFormatter parser = ISOPeriodFormat.standard();
try {
parser.parsePeriod("P1Y2S");
fail();
} catch (IllegalArgumentException ex) {}
} |
d20ee404-4b7b-431e-a6a3-2d225b3463b1 | 9 | public LABELTEST() {
super("Image Labeler");
initComponents();
// This code sets the behavour when the application is closing
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(Win... |
14095072-2a1b-4ba9-be19-7ee5294a3bd7 | 5 | private static void save(Manager manager, File file)
{
try
{
File newFile = new File(file.getAbsolutePath() + ".new");
File bakFile = new File(file.getAbsolutePath() + ".bak");
manager.save(newFile);
if (bakFile.exists())
{
bakFile.delete();
}
if (file.exists() && !file.renam... |
f055172a-8713-45d5-8a08-0e7f9a4c0a01 | 5 | @EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.isCancelled() || (event.getCurrentItem() == null) || !(event.getWhoClicked() instanceof Player)) return;
Player player = (Player) event.getWhoClicked();
if (this.manager.isDeincartItem(event.getCurrentItem()) || this.manager.isRout... |
9782f3f5-d044-4c2b-a2c5-96c0e4914edc | 1 | public Set propagateUsage() {
used = new SimpleSet();
used.addAll(getDeclarables());
StructuredBlock[] subs = getSubBlocks();
Set allUse = new SimpleSet();
allUse.addAll(used);
for (int i = 0; i < subs.length; i++) {
Set childUse = subs[i].propagateUsage();
/*
* All variables used in more than one... |
f325bd78-d347-47cf-a2e1-6d5b91a96157 | 3 | @Override
public void reactToChanges(ObservationEvent ev) {
if (ev instanceof ValidationEvent) {
ValidationEvent event = (ValidationEvent) ev;
OptionModel om = Minesweeper.getInstance().getOptionPanel();
if(event.getValidate()){
GameDifficulty gD = ngp.get... |
03695d17-55c2-4c30-8f6d-4fef60810134 | 0 | public Proffession(int type) {
this.setType(type);
this.setHeldRsrceType();
} |
693bd879-edef-46bf-9d8f-2643db50bf76 | 0 | public Bus(int speed, Queue []inputBuffers, Queue []outputBuffers)
{
//passes the constructor values to the base class SwitchingFabric
super(speed, inputBuffers, outputBuffers, VERTICALBUSES);
//indicate has no memory
hasMemory = false;
//set the recent bus, because ... |
edd02450-2e9c-4527-9201-ccf828105058 | 5 | public static boolean isCheckmate(){
int kingXCoor, kingYCoor;
kingXCoor = getXOfKing(userColor);
kingYCoor = getYOfKing(userColor);
if (isChecked(userColor, kingXCoor, kingYCoor, true)){
if (!canMove(userColor, kingXCoor, kingYCoor)){
if (debugMode){
System.out.println("KING CANNOT MOVE");
}
... |
2a91e5bb-fd30-46b6-8c87-95921b2847f4 | 1 | public RemotePlayer createRemotePlayer(int hp, int level, String name)
{
RemotePlayer newPlayer = new RemotePlayer(playerCanvas);
Sprite newSprite = new Sprite();
URL spriteURL = null;
try
{
spriteURL = this.getClass().getClassLoader().getResource("sprites/sprite_fr1.png");
newSprite._setSpriteImage(... |
fd29db8b-15f1-4470-a865-c8ebd7100bc9 | 7 | private void jBInserirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBInserirActionPerformed
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException ex) {
Logger.getLogger(JanelaCadastroFornecedor.class.getName()).log(Lev... |
8fed411b-6823-4ef6-b3bd-f0643d6c7ea5 | 4 | private static void displayLogin(BufferedReader reader, VideoStore videoStore) {
try {
String username = "";
String password = "";
while (username.isEmpty()) {
System.out.println("Please enter your username:");
username = reader.readLine();
... |
ad082aa7-1fc0-4cba-ab47-aee563489989 | 9 | private void decodeHeader(BufferedReader in, Properties pre,
Properties parms, Properties header) throws InterruptedException {
try {
// Read the request line
headLine = in.readLine();
// System.out.println(inLine);
if (headLine == null)
return;
StringTokenizer st = new StringTokenizer(headLine)... |
a08f22f4-7683-4b34-994b-de6a968ffc80 | 7 | @Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final Token other = (Token) o... |
4ccccff2-d4db-40b1-bcc2-093bf856fb03 | 0 | @Override
public boolean supportsAttributes() {return false;} |
5523fa92-b6e6-4d9a-bd9a-d9d4e423b0c0 | 6 | public boolean connecter(String login, String mdp) {
String req = "select * from Utilisateur where login like '"+login+"' and mdp like '"+mdp+"'";
ResultSet res;
try {
res = gestionUniversite.Connexion.getInstance().getStatement().executeQuery(req);
int i = 0;
... |
8a5ff62f-f8ff-41a7-9405-d6552efe91b9 | 9 | private void DoSimplePolygons() {
int i = 0;
while(i < m_PolyOuts.size()) {
OutRec outrec = m_PolyOuts.get(i++);
OutPt op = outrec.pts;
if(op == null)
continue;
do // for each Pt in Polygon until duplicate found do ...
{
OutPt op2 = op.next;
while(op2 != outrec.pts) {
if(PointsEqual(... |
f2d36817-56fd-4009-9fab-34d900ac33b3 | 3 | private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
String text = txtBuscar.getText().toString();
LibrosCRUD pdao = new LibrosCRUD(MyConnection.getConnection());
ArrayList<Libros> rows = new ArrayList<>();
Libros p;
i... |
4ce1cb52-e353-415c-97ac-ae1428d2a5b5 | 7 | static void dradb4(int ido, int l1, float[] cc, float[] ch, float[] wa1,
int index1, float[] wa2, int index2, float[] wa3, int index3) {
int i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8;
float ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
t0 = l1 * ido;
t... |
1e950d48-2664-48ca-9ad4-b99054398727 | 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... |
2c884149-c172-4338-98bf-272dc95f5baa | 0 | public void setDescription(String description) {
this.description = description;
} |
9eb877cb-3d3e-4206-a621-6564703e2cff | 7 | public MovieData queryMovieDetailData(MovieData data) {
String filmId = data.atMovieFilmId;
String url = "http://app.atmovies.com.tw/movie/movie.cfm?action=filmdata&film_id=" + filmId;
String date = null;
String length = null;
try {
String result = this.sendGet(url);
... |
5423d89d-1c1b-4de6-aba4-fc0f08d45d16 | 0 | @Override
public void onDisable() {
// plugin disable stuff
getLogger().info(NAME + " is disabled!");
} |
2c57abec-84ce-42c3-b73b-e623daac18f7 | 1 | @Override
public void in() throws Exception {
if (fa.getData() == null) {
throw new ComponentException("Not connected: " + toString());
}
// async call
// Object val = fa.getData().getValue0();
Object val = fa.getData().getShadow();
// fire only if there i... |
a3092553-fe11-4b9b-8af9-733704ccdea1 | 1 | public static void log(Object str) {
if (logToConsole) {
System.out.println(str.toString());
}
} |
27856e84-8d33-4681-b2d9-a6ca35b2b78d | 5 | private static Sample read_xm_sample( byte[] sample_headers, int sample_idx, DataInput data_input ) throws IOException {
int header_offset, sample_length, loop_start, loop_length;
int flags, in_idx, out_idx, sam, last_sam;
int fine_tune, relative_note;
boolean sixteen_bit, ping_pong;
byte[] raw_sample_data;
... |
9cffe06d-23ec-420f-a319-90d1a3d5c653 | 5 | public String toString()
{
String ret = "Resource '"+FileName+"'";
if( wreck )
{
ret+=" wreck, error: ";
switch( error )
{
case 0 : ret+="no error... O.o ? Passible global engine error! Communicate with the developer."; break;
case 1 : ret+="File not found!"; break;
default: ret+=getError... |
dab417e4-a11c-4989-ac7c-e9dbab192f60 | 7 | public static void main(String[] args) {
print = false;
int mode = 0; // 0 = vsRandom -- 1 = vsOldVersion -- 2 = vsHuman
int juegos = 100;
PerformanceSystem oldVersionPlayer = null;
try {
while(true){
switch (mode){
... |
4b2fb6da-69f3-401a-86a8-052c862c7d47 | 4 | public void puddle(int X, int Y, int R)
{
// long time = System.nanoTime();
for (int i1 = Math.max(X-(R+1),0); i1 < Math.min(X+(R+1),w); i1 ++)
{
for (int i2 = Math.max(Y-(R+1),0); i2 < Math.min(Y+(R+1),h); i2 ++)
{
if (Math.... |
0d068826-311c-4df2-a292-ed4dd58897f1 | 4 | public boolean isValidPosition(int x, int y)
{
if (x < 1) return false;
if (y < 1) return false;
if (x > size) return false;
if (y > size) return false;
return true;
} |
5e9933e9-51b2-4ef8-b60d-eb3f5f30b473 | 3 | public static char[] toCharA(byte[] data) {
if (data == null || data.length % 2 != 0) return null;
// ----------
char[] chrs = new char[data.length / 2];
for (int i = 0; i < chrs.length; i++) {
chrs[i] = toChar( new byte[] {
data[(i*2)],
data[(i*2)+1],
} )... |
b26a4e0e-aea1-4d64-bcef-ba9cc23c57b3 | 4 | public static void writeFile(String fileName) {
if (fileName == null) // Go back to reading standard output
writeStandardOutput();
else {
PrintWriter newout;
try {
newout = new PrintWriter(new FileWriter(fileName));
}
catch (Exception e) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.