method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
702bc278-c2b8-4519-a342-59bd0680d77e | 4 | public boolean recordLocalVariables(CodeAttribute ca, int pc)
throws CompileError
{
LocalVariableAttribute va
= (LocalVariableAttribute)
ca.getAttribute(LocalVariableAttribute.tag);
if (va == null)
return false;
int n = va.tableLength();
... |
a56355a1-24f6-4dba-ac33-4c682b34f2e6 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
Physical target=mob;
if((auto)&&(givenTarget!=null))
target=givenTarget;
boolean oldOne=false;
for(final Enumeration<Ability> a=target.effects();a.hasMoreElements();)
{
final Ability A=a.... |
0afffae7-ef4a-4b2c-9536-74d8d0fab8a9 | 6 | public static void main(String[] args) {
//setting up look and feel
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info... |
c68a7fad-48d0-4dd7-af26-b9e32cc963e0 | 8 | public static void delete(File file) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(file));
File tmp = new File(file.getAbsolutePath() + ".tmp");
tmp.createNewFile();
PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(tmp)));
while (true) {
String l... |
9d5d75c0-6bf6-4e6f-851f-9e5f722839c6 | 0 | public HashMap<Class, Counter> getPopulation()
{
return counters;
} |
c74cae31-3686-4cdf-9209-70943b92e3ee | 6 | public static void parseCrsFile(String fileName){
/* Read a course file to see who is in what class and what rooms can be used,
* then create people as dictated. This way, you only need to input class data,
* not individual students and teachers. It also constructs a list of rooms
*... |
9fe447ae-8f12-4e1b-ba5d-bf51545b17ab | 7 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!sender.hasPermission("factoids.util") && sender instanceof Player) {
sender.sendMessage(ChatColor.RED + "You do not have permission to manage factoids!");
return true;
... |
74ea92b1-59cd-4808-b65d-47f2c2162b1c | 8 | public static boolean zuseCheckSumSign(ZuseBinaryFloatingPoint24Bit A, ZuseBinaryFloatingPoint24Bit B) {
return (A.isSign() && B.isSign()) ? true :
(!A.isSign() && !B.isSign()) ? false :
(Math.abs(A.floatValue(false)) >= Math.abs(B.floatValue(false)) && !A.isSign()) ||
(Math.abs(A.floatValue(false)) <= Mat... |
bb70eb30-c909-43cd-bdce-40f255a08d27 | 2 | private void ativaBotoes(String estado){
if(estado.equalsIgnoreCase("inserindo/editando")){
btnCancelar.setEnabled(true);
btnGravar.setEnabled(true);
btnEditar.setEnabled(false);
btnNovo.setEnabled(false);
btnDeletar.setEnabled(false);
btnP... |
06e7af2c-4bdb-4d00-ad6e-fdcdb3d551d2 | 3 | public String receive(){
try{
String input = this.in.readLine(); if (input==null){ System.out.println("Server thread received null string."); return null; }
if (ENCRYPTED) return Encryptor.decrypt(input, 5); //decrypt it 5 times
else return input;
} catch (Exception e... |
7fe7123a-fa97-4f4f-90bd-f8263b8636b0 | 0 | public BinarySearcher() {
// TODO Auto-generated constructor stub
} |
55bd1fc1-baaa-4914-ad74-f827b3039314 | 3 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
ee7af891-358f-4763-85ee-d6a89d212be8 | 0 | private synchronized void setException(final Exception e) {
exception = e;
} |
92c8fa5a-223d-47bd-a898-eace144701ea | 4 | private void setLanguage() {
try {
if(createNewStream) {
//the title if a new stream is created
setTitle(trans.getString("newStream"));
} else if (defaultStream) {
//the title when the default options are editable
setTitle(trans.getString("editDefaultOptions"));
} else i... |
70f6d9f7-126f-468a-8458-dfe02d78f534 | 3 | public void registerTick() {
// count the seconds that have passed
lastTime = curTime;
curTime = System.currentTimeMillis();
totalTime += curTime - lastTime;
if( totalTime > 1000 ) {
totalTime -= 1000;
seconds++;
if(seconds >= 60) {
seconds -= 60;
minutes++;
... |
5b88184d-0bf0-467a-ae63-a4179b57f080 | 8 | public Color convertColor(int ident) {
switch (ident) {
case 0:
return (Color.white);
case 1:
return (Color.cyan);
case 2:
return (Color.yellow);
case 3:
return (Color.magenta);
case 4:
... |
c3d8485f-712a-46fa-a1d6-55d847d83e1f | 9 | public boolean validate_results(ArrayList<String> a)
{
String out="";
if(a.get(0)==null)
{
out+="Input file not set \n";
}
if(a.get(2)==null)
{
out+="Output file not set \n";
//raise error
}
if(a.get(5).matches("yes"))
{
if(a.get(7).length()>0)//width
{
//pass
if(a.get(7).m... |
c0ea74c3-9ddb-4c06-9261-6bba26fc6feb | 1 | public static final String chompFirstSegment(String path){
path = clean(path);
if(path == EMPTY_STRING){
return path;
}
String firstSegment = firstSegment(path);
path = path.substring(firstSegment.length());
return clean(path);
} |
f30589ad-31cc-4916-b48c-2288f602cedf | 1 | public AIConnection(Socket clientSocket){
messages = new ConcurrentLinkedQueue<JSONObject>();
socket = clientSocket;
try {
inputReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}
catch (IOException e){
Debug.error("error creating connection handler: " + e);
}
} |
bf0d457c-99a4-4d56-b5eb-21cda3c362c8 | 2 | public void setCamera(Point cam, Point worldBound) {
//clamp the camera in the world boundaries (offset by panelsize/2 to center it)
//the x is clamped with one screen's width allowed to overhang on either side of the map
int x = clamp(cam.x - worldBound.x/2, - worldBound.x, world.getWidth() *... |
82adf04d-ceaf-4c79-9ed8-a098df01aee5 | 6 | public static void merge(ArrayList<Integer> arr, int left, int center, int right){
int first1 = left;
int last1 = center;
int first2 = center + 1;
int last2 = right;
ArrayList<Integer> b = new ArrayList<Integer>();
while((first1 <= last1) && (first2 <= last2)){
if(arr.get(first1) < arr.get(first2)){
... |
8da87631-d80a-471a-8a5b-fb25013af22e | 1 | public MongoFindTaskParameters(DBCollection collection, DBObject queryDbObject, BeanMapper<?> mapper, int skip,
int limit, DBObject sort, int batchSize) {
int hashCode = 0;
this.collection = collection;
hashCode += collection.hashCode();
this.queryDbObject = queryDbObject;
hashCode += queryDbObject.hashC... |
8f0c299c-a731-4b32-9ad7-50f98599b5c3 | 5 | public void sendPlayerData() {
HashMap<String, Player> players = new HashMap<String, Player>(registry.getPlayerManager().getPlayers());
try {
for (String key : players.keySet()) {
Player p = (Player) players.get(key);
if (p != null) {
UDPPl... |
7e21c83b-40aa-4b56-a262-64caf3bcbfc7 | 0 | public void down(int velocity) {
controls.down(velocity);
} |
f9681468-d530-4e2d-b279-e17b835f939e | 4 | private void initContractsTab() {
Contract contract = new Contract();
jTable_AssetList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
... |
c9bf8ef4-c058-4b4b-a8f4-739e5a1d7b8d | 2 | public void count(String answers, int i) {
if (countABC[charIntMapping.get(answers.charAt(i))] != 0) {
result.add(totalCharacters);
countABC[charIntMapping.get(answers.charAt(i))]--;
if (countABC[charIntMapping.get(answers.charAt(i))] == 0)
totalCharacters--;
... |
313401d0-1ec5-44af-b469-3e31b56c873f | 7 | public static String getSymbolLabel(Integer symbol)
{
if(symbol == SymbolTable.PLUS)
return "+";
else if(symbol == SymbolTable.MINUS)
return "-";
else if(symbol == SymbolTable.MULT)
return "*";
else if(symbol == SymbolTable.DIV)
return "/";
else if(symbol == SymbolTable.OPENP)
return "(";
el... |
4229d057-9b81-42d2-a7cb-7a5515fd2ae6 | 5 | protected double getEdgeDistanceFromNode(int i)
{
double energy = 0.0;
// This function is only performed during fine tuning for performance
if (isOptimizeEdgeDistance && isFineTuning)
{
int[] edges = v[i].relevantEdges;
for (int j = 0; j < edges.length; j++)
{
// Note that the distance value is s... |
d6b681ac-24ff-42f0-be02-ce34ae6bc933 | 5 | public void append(long key, E value) {
if (mSize != 0 && key <= mKeys[mSize - 1]) {
put(key, value);
return;
}
if (mGarbage && mSize >= mKeys.length) {
gc();
}
int pos = mSize;
if (pos >= mKeys.length) {
int n = pos + 1;
... |
b43870ed-3b16-47a2-b7ae-d081492c7f3c | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Station other = (Station) obj;
if (position == null) {
if (other.position != null)
return false;
} else if (!position.equals(other.posi... |
497c669c-a85e-4142-90b0-d1418d83ea44 | 3 | private void processRequest(Sim_event ev)
{
if (ev == null || ev.get_data() == null) {
return;
}
Integer id = (Integer) ev.get_data();
int tag = DataGridTags.INQUIRY_RC_RESULT;
/***** // Debug info
System.out.println(super.get_name() + ".processRequest... |
dc78964b-52b4-4280-8d6f-e49e63aacd32 | 2 | public boolean initialise() {
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://" + host +":" + port + "/"+database, username, password);
return true;
} catch (ClassNotFoundException ex) {
System.out.println("SQL is unable to conect");
} catc... |
4bbf4e09-b417-4692-8425-256f943b2c3e | 4 | public static int firstresult(int i){
if(i == 1)
{
System.out.println("You are caught trying to steal a horse from the stable.");
System.out.println("You ended up being held for an extra day, before selling all your food");
System.out.println("To rent a horse");
... |
f8511558-0118-462e-bd38-9ee8cfd18618 | 8 | public static void removeConnections(BeanInstance instance) {
Vector instancesToRemoveFor = new Vector();
if (instance.getBean() instanceof MetaBean) {
instancesToRemoveFor =
((MetaBean)instance.getBean()).getBeansInSubFlow();
} else {
instancesToRemoveFor.add(instance);
}
... |
2cfc710a-3a45-4ffc-8555-e41ec1103bba | 7 | public static String initializeSymbolEscapeCodeTable(boolean casesensitiveP) {
{ StringBuffer buffer = edu.isi.stella.javalib.Native.makeMutableString(256, Stella.NULL_CHARACTER);
{ int i = Stella.NULL_INTEGER;
int iter000 = 0;
int upperBound000 = 255;
for (;iter000 <= upperBound000;... |
030783e6-d0a7-4785-8c64-51b07c6f55da | 5 | private void playtickSound() {
if (true == playClockSound) {
try {
clip = AudioSystem.getClip();
// getAudioInputStream() also accepts a File or InputStream
AudioInputStream ais = AudioSystem.getAudioInputStream(new File(clockTickSoundPath)... |
912431e8-5cc6-4c52-b5fc-78a52167084f | 5 | public static Point[] generateSpline(final Point[] controls) {
final double degree = controls.length - 1;
final java.util.Vector<Point> spline = new java.util.Vector<Point>();
boolean lastFlag = false;
for (double theta = 0; theta <= 1; theta += 0.01) {
double x = 0;
double y = 0;
... |
cf67969f-ed28-4884-9acc-285277e323fe | 6 | public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if (string... |
060316ac-dcda-47c5-ab16-cf6e70472135 | 8 | public void writeSavedGame( OutputStream out, SavedGameState gameState ) throws IOException {
if ( gameState.getMysteryList().size() > 0 )
log.warn( "The original saved game file contained mystery bytes, which will be omitted in the new file" );
// This should always be 2.
writeInt( out, 2 );
writeBool( o... |
4f4af3f9-6672-4a35-bd88-a8841b0a6faa | 4 | public static OS getOS() {
if (os == null) {
String name = System.getProperty("os.name").toLowerCase();
System.out.println("OS: " + name);
if (name.startsWith("win")) {
os = OS.WINDOWS;
} else if (name.startsWith("mac")) {
os = OS.M... |
dd1bb31e-c965-4ae3-adfa-40c08cf310d7 | 0 | @Override
public void removeAllProperties() {
this.default_values = new HashMap();
this.current_values = new HashMap();
this.filter_chains = new HashMap();
} |
aa08ee49-6619-46f7-9588-6b1b9af1385c | 2 | public static void handleKeyboard(EngineState engineState){
while(Keyboard.next()){
int key = Keyboard.getEventKey();
boolean pressed = Keyboard.getEventKeyState();
if(pressed){
engineState.keyPressed(key);
}else{
engineState.keyRe... |
07e10d4f-41f5-4a7e-9c21-03311e402a35 | 5 | private double simulateHand(ArrayList<Card> holeCards, int iterations, int players) throws Exception {
double wins = 0;
for (int i = 0; i < iterations; i++) {
Deck deck = new Deck();
deck.removeCards(holeCards);
ArrayList<Card> sharedCards = deck.drawCards(5);
ArrayList<Card> sharedAndHoleCards = new Ar... |
3592199a-c072-439b-b620-acd5e75495f6 | 0 | public static void main(String[] args) {
ClassTypeCapture<Building> ctt1 = new ClassTypeCapture<Building>(Building.class);
System.out.println("Building : Building " + ctt1.f(new Building()));
System.out.println("Building : House " + ctt1.f(new House()));
ClassTypeCapture<House> ctt2 = n... |
7a005abc-8fb8-44cb-9578-17a77deed5a2 | 7 | public static int ter(int [] arr, int s, int e, int value){
int m=(s+e)/3;
int m2=2*(s+e)/3;
if(s>=e||e<=s){
return -1;
}
else if(value==arr[m]){
return m;
}
else if(value<arr[m]){
return ter(arr, s, m, value);
... |
b221b1e5-a0cc-4488-918a-83638e2c7c1b | 8 | public int ladderLength(String start, String end, HashSet<String> dict) {
HashSet<String> visited = new HashSet<String>();
LinkedList<String> queue = new LinkedList<String>();
int level = 1;
queue.offer(start);
queue.offer(null);
while(!queue.isEmpty()){
Str... |
91bccd1e-fb61-4e90-91eb-8d5839cd4b3f | 3 | public void accept(Visitor visitor) {
if (visitor.visit(this)) {
if (addr != null) {
addr.accept(visitor);
}
if (chan != null) {
chan.accept(visitor);
}
super.visitContainedObjects(visitor);
visitor.endVisit(this);
}
} |
798c4b6b-c975-41f7-9747-48fd64d5497b | 7 | public void run() {
while (!currentStreet.isExit()) {
//System.out.println(path);
if (!path.isEmpty() && path.getFirst().isMax() && currentStreet.getEnd().numStreets() > 1) {
//System.out.println(currentStreet.getEnd().numStreets());
computeShortestPath(currentStreet.getEnd(), path.getFirst());
Main... |
20261a59-0bbb-4505-b6ef-462195ed52e3 | 3 | public void setAttribute(String key, String value)
{
if (this.attris.containsKey(key))
this.attris.remove(key);
this.attris.put(key, value);
if (key.equals("name"))
{
this.name = value;
if (this.parent != null)
this.path = this.parent.path + ":" + this.name;
else
this.path = this.name;
... |
edb83a8e-d784-4643-acbd-3674f7886ed9 | 6 | public int[] averageColumns() {
long[] sum = new long[columns];
int[] count = new int[columns];
for (int j = 0; j < columns; j++) {
sum[j]=0;
count[j]=0;
}
for (int i = 0; i < row_count; i++) {
for (int j = 0; j < col... |
51cda16c-8143-4d77-848b-bdb15b4ddbb5 | 7 | public ArrayList<Integer> grayCode(int n){
int number = (int)Math.pow(2, n);
ArrayList<Integer> result = new ArrayList<>();
if(n == 0){
result.add(0);
return result;
}
if(n == 1){
result.add(0);result.add(1);
return result;
}
for(int i = 0; i < number; i++){
int[] digits = new int[n]... |
2e6f83e9-6941-4727-a181-e71d115342a8 | 5 | @Override
public void onCommand(Network src, Command com) throws IOException {
switch (com.getType()) {
case HANDSHAKE:
register(src, (Handshake) com);
break;
case MESSAGE:
broadcast(com);
break;
case PRIVATEMESSAGE:
Private... |
1403fbe8-739f-4300-9883-8328f6283b1b | 8 | int deflateParams(int _level, int _strategy) {
int err = Z_OK;
if (_level == Z_DEFAULT_COMPRESSION) {
_level = 6;
}
if (_level < 0 || _level > 9 || _strategy < 0
|| _strategy > Z_HUFFMAN_ONLY) {
return Z_STREAM_ERROR;
}
if (config_table[level].func != config_table[_level].func
&& strm.total_... |
61fc44c0-9af7-4d9e-97ba-e0d1dfcc6d46 | 5 | private Connection makeConnection(final String userLogin, final String passwordLogin) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (final ClassNotFoundException execption) {
execption.printStackTrace();
}
Connection connection = null;
try {
connection = DriverM... |
512a2d63-c488-4a82-b44f-a389603aeae0 | 4 | @Override
public void set(String path, Object value){
if(value == null && cache.containsKey(path)){
cache.remove(path);
modified = true;
}else if(value != null){
if(!value.equals(get(path))){
modified = true;
}
cache.put(path, value);
}
super.set(path, value);
} |
c8d1a27d-4bb4-40aa-ac3b-ec774b26b0f5 | 8 | public static void initFunction(Context cx, Scriptable scope,
NativeFunction function, int type,
boolean fromEvalCode)
{
if (type == FunctionNode.FUNCTION_STATEMENT) {
String name = function.getFunctionName();
if... |
9a036afe-9c58-4029-a12a-657950fd070e | 1 | @Test
public void removerDoisClientes() throws ExceptionGerentePessoa {
Cliente c = setarCliente("João", "000.000.000-00");
faixada.adicionar(c);
Cliente c2 = setarCliente("Carlos","000.000.000-00");
faixada.adicionar(c2);
Assert.assertTrue("Era para ter removido os clientes", faixada.removerCliente("João")&... |
5d249bdc-6830-4d0d-9dda-4b06d7db3b45 | 9 | public static BufferedImage medianFilter(BufferedImage origin) {
int w = origin.getWidth();
int h = origin.getHeight();
int n = 5;
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
for(int x=0; x<w; x++) {
for(int y=0; y<h; y++) {
/*
List<Integer> candidate = new ArrayLi... |
6a97e120-f24e-4ed4-834f-8bd021c5f9d1 | 3 | @Override
public boolean isGameOver() {
boolean gameOver = true;
for (WarMachine w : warMachine) {
if (!w.isVersenkt())
gameOver = false;
}
if (gameOver) {
Regeln.setGameOver();
return true;
} else
return false;
} |
ad4f174c-47e5-4345-bdd0-a986dc12ddf1 | 9 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender.hasPermission("NE.oplist") || sender.isOp() || sender instanceof ConsoleCommandSender) {
if(command.getName().equalsIgnoreCase("Oplist")) {
Set<OfflinePlayer> ops = Bukkit.getOperators();
if(... |
e7e400f0-5c07-40aa-b8db-b20981808cfc | 6 | private Set<TKey<?, ?>> setupGeneralKeys() {
Set<TKey<?, ?>> generalKeys = new LinkedHashSet<>();
generalKeys.add(ProviderKeys.PROVIDER_TYPE);
generalKeys.add(ProviderKeys.COUNTRY);
generalKeys.add(ProviderKeys.IDENTIFIER);
generalKeys.add(ProviderKeys.LANGUAGE);
general... |
1efd24a2-4425-4618-8f50-d4fcfa57f346 | 1 | public ResizingByteBuffer setLength(int targetLength) {
if(targetLength>buf.length) {
buf = Arrays.copyOf(buf, targetLength);
}
this.index=targetLength;
return this;
} |
94e69e2c-7495-4445-9d12-a7b446e2e656 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AccountRoleModel that = (AccountRoleModel) o;
if (id != that.id) return false;
if (role != that.role) return false;
if (userId != that.... |
37429506-edde-4ba3-8604-b8e71bca9466 | 9 | protected Instances[] splitData(Instances data) throws Exception {
// Allocate array of Instances objects
Instances[] subsets = new Instances[m_Prop.length];
for (int i = 0; i < m_Prop.length; i++) {
subsets[i] = new Instances(data, data.numInstances());
}
// Go through the data
for (int... |
4db98bed-4aa6-49ce-a319-8f0ab91b50d5 | 0 | public EntityManager getEm() {
return em;
} |
89719a0c-a362-4cde-afea-2ccbc02d0664 | 3 | public Production[] determinalize(Production production) {
String[] tokens = separateString(production.getRHS());
List list = new ArrayList();
String rhs = "";
for (int i = 0; i < tokens.length; i++) {
if (grammar.isTerminal(tokens[i])) {
String newR = getLeft(tokens[i]);
if (leftAdded)
list.add... |
a435ba69-ebd7-436c-8979-7f733f8b698c | 7 | public static void toggle(CommandSender sender, String [] args){
//team + player + admins + playername + teamname
if(args.length < 2+2){
sender.sendMessage(ErrorMessage.MissingParameters);
}
else{
String playerName = args[3];
String teamPlayer = TeamsManager.getInstance().retrievePlayerTeam(... |
d1d9c319-7c1f-4ab2-a123-e67688526571 | 5 | public void endElement( String uri, String localName, String qName ) throws SAXException {
if( !isTitleParsed && "string".equals( qName ) &&
"lom|general|title|string|".equals( getPath() ) ) {
isTitleParsed = true;
Vector vTitle = (Vector)hTitle.get( language... |
7df67251-6b28-46ac-8fa7-8e38b8d51bc3 | 9 | public void updateButtons() {
if ( cards[0][0].isShowing()){
card1.setText(cards[0][0].getBack());
}
else {
card1.setText(Integer.toString(cards[0][0].getFront()));
}
if ( cards[0][1].isShowing()){
card2.setText(cards[0][1].getBack())... |
c6066238-5eb9-478d-8e4a-86815feab153 | 4 | private int readFully(byte[] b, int offs, int len)
throws BitstreamException
{
int nRead = 0;
try
{
while (len > 0)
{
int bytesread = source.read(b, offs, len);
if (bytesread == -1)
{
while (len-->0)
{
b[offs++] = 0;
}
break;
//throw newBitstreamException(UNEX... |
99aecdf3-b529-4653-a076-b010dd7e7cf6 | 1 | public void shuffle() {
for ( int i = deck.length-1; i > 0; i-- ) {
int rand = (int)(Math.random()*(i+1));
Card temp = deck[i];
deck[i] = deck[rand];
deck[rand] = temp;
}
cardsUsed = 0;
} |
3450165e-11e3-473b-aa1e-b00d8a85f5b0 | 9 | private void initCell(String text){
String splitBy = ",";
String[] cellStuff = text.split(splitBy);
int rowNumber=-1; // value reflects error if not changed in if statements below
int columnNumber=-1; // value reflects error if not changed in if statements below
for(int i = 0; i < cel... |
57165759-a007-4451-9cbf-4561186956d9 | 9 | @SuppressWarnings("unchecked")
static final boolean isStandardProperty(Class clazz) {
return clazz.isPrimitive() ||
clazz.isAssignableFrom(Byte.class) ||
clazz.isAssignableFrom(Short.class) ||
clazz.isAssignableFrom(Integer.class) ||
c... |
5f71ce7e-da57-4312-93f7-13d3925d10d9 | 7 | public void clearKeys() {
if (!modifiersValid)
return;
altDown = false;
ctrlDown = false;
if (lastKeyEvent == null)
return;
if (lastKeyEvent.isShiftDown())
sendScancode(getTime(), RDP_KEYRELEASE, 0x2a); // shift
if (lastKeyEvent.isAltDown() || serverAltDown) {
sendScancode(getTime(), RDP_KEYR... |
1d87ef5f-ed8e-4d24-9d02-d9a442218e3d | 9 | public void startUDPLoop () throws Exception {
m_LoopStarted = true;
try {
m_UDPStreamReceiver.openSocket(m_Timeout);
} catch (SocketException ex) {
Logger.getLogger(UDPStreamReader.class.getName()).log(Level.SEVERE, null, ex);
}
for(;;){
//if... |
3beba21e-fe1d-42ba-bf9b-2179fd6a9474 | 6 | public Pair<NoeudItineraire,ArrayList<PlageHoraire> > genererLivraisonsDepuisXML(List<Noeud> reseau) throws XmlParserException
{
//ouvrirFichier(this.CHARGERLIVRAISONS);
File xml = this.fichierATraiter;
ArrayList<PlageHoraire> listeDePlageHoraire = null;
NoeudItineraire entrepot = null;
Pair<NoeudItineraire... |
02c322c4-d7bc-470f-a238-3ff5db0f2390 | 8 | private static float getUnitFactor(String unit)
{
//byte scale
if(unit.equals("KB"))
return 1/1024;
if(unit.equals("MB"))
return 1;
if(unit.equals("GB"))
return 1024;
if(unit.equals("TB"))
return 1024 * 1024 ;
//freq scale
if(unit.equals("Hz"))
return 1;
if(unit.equals("KHz"))
ret... |
d3adb1aa-7aa4-42c8-9fff-dabe6fc46d02 | 8 | protected Point movingBase(){
// Wall
Point dst = new Point(ctx.my);
dst.diff(Util.getGrabity(ctx.my, new Point(Util.battleFieldWidth,ctx.my.y), WALL_WEIGHT,WALL_DIM,1));
dst.diff(Util.getGrabity(ctx.my, new Point(0,ctx.my.y), WALL_WEIGHT,WALL_DIM,1));
dst.diff(Util.getGrabity(ct... |
fa7ad5db-45bc-4913-bd0a-1491895adcd3 | 4 | private String introduceUser(String input)
{
String userQuestion = "";
if (getChatCount() == 0)
{
myUser.setUserName(input);
userQuestion = "Good name " + myUser.getUserName() + " how old are you?";
}
else if (getChatCount() == 1)
{
int userAge = Integer.parseInt(input);
myUser.setAge(userAge)... |
3a5dbe13-9253-4570-baf8-371a48e78a68 | 6 | public String getProgrammeSemaine(String msg) {
String answer = "";
List<Date> listDates = new ArrayList<Date>(25);
Calendar cal = Calendar.getInstance();
cal.setTime(Calendar.getInstance().getTime());
listDates.add(Calendar.getInstance().getTime());
while (cal.getTime()... |
a514e322-1d27-412b-9700-facde8f08247 | 9 | public static void main(String[] args) {
// A Reader stream to read from the console
BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
System.out.println("Welcome to the new Berlin tax calculator.");
System.out.print("How much did you earn last y... |
fa6147e4-55d5-4607-962a-9c950b70a676 | 0 | public void setSrcTermid(String srcTermid) {
SrcTermid = srcTermid;
} |
469aac3c-a646-456a-9eba-2f04863180af | 4 | public boolean kingMove(int startRow, int startCol, int endRow, int endCol)
{
Piece piece = checker[startRow][startCol];
Piece endTile = checker[endRow][endCol];
if(endTile == null || endTile.alligence != piece.alligence) //only move or move and attack
{
if(Math.abs(endCol-startCol) <= 1 && Math.abs(en... |
b2b479f2-3213-46ca-9967-8e95e3051003 | 1 | public static boolean name(String name){
if(name.matches("[a-zA-Z]{2,30}"))
return true;
return false;
} |
3bd4aa48-9ab0-46c6-b1fd-121ce1517085 | 6 | private void groupStatisticsBD(){
if(!this.dataEntered)throw new IllegalArgumentException("no data has been entered");
this.groupMeansBD = new BigDecimal[this.nGroups]; // group means as BigDecimal
this.groupMeans = new double[this.nGroups]; // group me... |
65b5798f-d86a-48b6-92f6-d2b40defb991 | 5 | public static void update(LauncherAPI api)
{
for (final GameFile file : api.getUpdater().getGameFiles())
{
try
{
file.init();
api.getUpdater().incrementTotalSize(file.getSize());
}
catch (final Exception e)
{... |
68ad89f6-1a11-4e48-9f9c-9c36abdec181 | 6 | private void copyAndFillProjectHeader(XMLStreamReader parser, XMLWriterWrapper writerWrapper, boolean keepPomVersion, POMInfo info, POMInfo original, Dependency parent, String debianPackage) throws XMLStreamException {
XMLStreamWriter writer = writerWrapper.getWriter();
if (parser.getNamespaceCount() ==... |
45acc758-4ff3-4360-a029-87f91d873907 | 5 | public void add(T data) {
if (this.isEmpty())
this.setData(data);
else if (this.getData().compareTo(data) > 0) {
if (this.getLeft() == null)
this.setLeft(insertEmpty(data));
else
this.getLeft().add(data);
} else if (this.getData().compareTo(data) < 0) {
if (this.getRi... |
82fb2cdb-2558-4dab-aa46-56118061e266 | 3 | public List<Player> adminsOnline( World w )
{
List<Player> op = Collections.emptyList();
for ( Player p : getServer().getOnlinePlayers() )
{
if ( p.isOp() || p.hasPermission( "inations.admin" ) )
{
op.add( p );
}
}
return op;
} |
a96509fc-a255-4fbf-9264-374d68ec67e0 | 7 | private void addBoardableProperty(PrivateProperty P, CMObject obj)
{
if(P instanceof BoardableShip)
{
final Item I=((BoardableShip)P).getShipItem();
if(I!=null)
{
final CMObject owner = obj;
if(owner instanceof Clan)
{
Clan C=(Clan)owner;
if(!C.getExtItems().isContent(I))
C.get... |
1605d409-f440-49ec-b228-b00c77effc0e | 2 | private void setJabriscaControllerMenu(JabriscaController listener2,
JMenu menu) {
for (int i = 0; i < menu.getItemCount(); i++) {
JMenuItem comp = menu.getItem(i);
if (comp instanceof JMenu) {
setJabriscaControllerMenu(listener2, (JMenu) comp);
} else {
comp.addActionListener(listener2);
}
}... |
441dac7f-a233-4e4d-8a5b-4c24c148913c | 8 | public static String get_type(int type) {
String name;
switch (type) {
case 0: name="maj"; break;
case 1: name="m"; break;
case 2: name="dim"; break;
case 3: name="dim7"; break;
case 4: name="M7"; break;
case 5: name="m7"; break;
case 6: name="7"; break;
case 7: name="sus4"; break;
default: ... |
6eb8d450-4077-4d35-9176-ee7111ec2ea0 | 7 | public static String getDescriptiveType(Object value) {
if (value == null) {
return null;
}
Class<?> clazz = value.getClass();
if (Proxy.isProxyClass(clazz)) {
StringBuilder result = new StringBuilder(clazz.getName());
result.append(" implementing ");
Class<?>[] ifcs = clazz.getInterfaces();
for ... |
6d472e6f-0a70-4789-b328-d9e390aaf918 | 1 | int getScoreForTeam(Match match, Team team) {
if (match.homeTeam.equals(team)) {
return match.score.ht;
} else {
return match.score.at;
}
} |
86a7f1d0-0697-4f14-ae9f-2c6a60eba8bd | 1 | @Override
public void hitGround(Matter m, double processedTime) {
if (this == m) {
notifyListeners(this, processedTime);
}
} |
d5a42cf4-f219-4e09-ba71-ff0cb72a3ad6 | 7 | public static Set<Railway> getSpanningTree(Set<Mission> missions, Set<Railway> railways, Set<Railway> zeroCostRailways) {
Set<Railway> tree = EnumSet.noneOf(Railway.class);
if(missions.isEmpty())
return tree;
Set<Set<Mission>> missionClusters = clusterMissions(missions);
for (Set<Mission> cluster: missionClu... |
016201ce-4414-46ad-beef-35e38c475c4b | 4 | private boolean canPlaceShip(Ship shipToPlace) {
boolean canPlace = true;
//1. check if its still in the field
if (shipToPlace.getOrientation() == eOrientation.Horizontal) {
canPlace = shipToPlace.getStartPoint().getX() + shipToPlace.getSize() <= width;
} else {
c... |
af5b1d58-00fe-4d65-b56f-c3a8a866d778 | 4 | public static ClientServerThread joinServer(String host, Player player) {
try {
ClientServerThread connection = new ClientServerThread(host, player);
connection.start();
synchronized(connection) {
while (connection.getStatus() != CONNECTING)
... |
35ad9a41-9061-4f6c-9d29-75d75fd0a9cd | 0 | public Drop(int state) {
this.state = state;
} |
cc804030-f259-45bd-bea6-05528bc4b333 | 1 | public Point getToolTipLocation(MouseEvent event) {
try {
return transformFromAutomatonToView(drawer.stateAtPoint(
event.getPoint()).getPoint());
} catch (NullPointerException e) {
return null;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.