method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
50d20766-bbb2-41e8-9272-2b6f9b6a0c31 | 8 | public boolean swiftRight(int idUser, boolean pickup) {
int passengers = 0;
int i = 0, j = 0;
Action a;
Action n = new Action(idUser, pickup);
for (i = 0; i < size(); ++i) { //Encontrar la acción
a = get(i);
if (a.idUser == idUser && a.isPickup == pickup) break;
else if (a.isPickup) ++passe... |
e13d9624-af84-4930-acf8-5e2aba50b6e2 | 6 | private void loadObjects(){
FileReader reader = null;
try{
String path = "D:\\SpringProjects\\TheGreyWolves\\FishingBoat\\msmunchen.obj";
if(unit!= null){
if(unit.getType()==TYPE.DESTROER){
path = "D:\\SpringProjects\\TheGreyWolves\\WICK40\\Wick40.obj";
}else if(unit.getType()==TYPE.SUBMAR... |
494d5aa7-ea7b-44d8-bfdd-ad5a8f63241b | 5 | @Override
public void run() {
//Novo scanner usando o teclado como entrada
Scanner scanner = new Scanner(System.in);
try{
while(true){
if(stop)
break;
//operação bloqueante, travar até... |
e05183a1-32f4-45a8-bb43-3401b697efd2 | 2 | public static String read(String filename) {
try {
BufferedReader br = new BufferedReader(new FileReader(filename));
String inputLine;
StringBuffer sb = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
sb.append(inputLine + "\n");
}
br.close();
return sb.toString();
} catch... |
0c8afebb-7b3f-43ca-8fd8-4b2da03aaa0e | 9 | private String valida(HttpServletRequest request, Notas notas) {
String error = null;
String idnota = request.getParameter("idnota");
String idalumno = request.getParameter("idalumno");
String nota = request.getParameter("nota");
Integer idnotax = null;
if (idnota != nul... |
3b18c086-1c24-419f-83b0-eca47be92a1e | 5 | public static boolean index(char[] cs,char[] cl){
if(cs==null||cl==null){
return false;
}
if(cl.length!=cs.length){
return false;
}
boolean res= false;
for(int i=0;i<cl.length;i++){
for(int j=0;j<cs.length;j++){
}
}
return res;
} |
9f2fa1a6-0083-4062-a696-e80bbb757e82 | 9 | public LigneMarqueur compare ( Ligne comparant){
LigneMarqueur liMarq = new LigneMarqueur(taille); // On déclare une liste de marqueurs correspondant à la ligne
boolean[] existeTab = new boolean[taille]; // Ce tableau mettra true si la case correspondant à cet indice est présente. Ce tableau permet de n... |
80380444-feca-4a00-88cb-02c08a51de79 | 3 | public CycAssertion readAssertion()
throws IOException {
CycList formula = null;
Object formulaObject = null;
CycAssertion cycAssertion = null;
formulaObject = readObject();
if (formulaObject.toString().equals("NIL")) {
// bypass invalid assertion mt
readObject();
cycAsse... |
293e0b67-f364-47fb-88d9-bd42c41eaacc | 0 | public static void main(String[] args) {
w = new Worker();
} |
251bc86d-a2f8-41cc-9ff6-302495d3e44e | 8 | public final void start(String[] args, boolean startProcess) {
ArgumentList argumentList = new ArgumentList(args);
// Ist der Parameter vorhanden
if (argumentList.hasArgument("-gui") == false) {
final String errorString = "Der Parameter -gui= wurde nicht angegeben";
JOptionPane.showMessageDialog(null, erro... |
f2ebd012-48ec-4dd3-aefd-977ad7cca6dc | 7 | protected static boolean reportError(final Electronics me, final Software controlI, final MOB mob, final String literalMessage, final String controlMessage)
{
if((mob!=null) && (mob.location()==CMLib.map().roomLocation(me)) && (literalMessage!=null))
mob.tell(literalMessage);
if(controlMessage!=null)
{
if(... |
46204e95-f967-4449-bb3c-a50dc0049220 | 5 | public static Rectangle2D parseNormalisedRectangle(PDFObject obj)
throws IOException {
if (obj != null) {
if (obj.getType() == PDFObject.ARRAY) {
PDFObject bounds[] = obj.getArray();
if (bounds.length == 4) {
final double x0 = bounds[0... |
7f899b4b-55a1-4d2d-a5f1-47d22c47da2c | 1 | private int ensurePositiveCoordinate(int i, int dimension) {
int iPositive = i;
if (iPositive == 0) {
iPositive += dimension;
}
return iPositive;
} |
b09e8ce3-ce8a-4783-98ce-128cc7ab9202 | 6 | @Override
public int awardPoints(boolean[] sv,int objectSize) {
if(objectSize>sv.length){
for (boolean b : sv) {
if(!b) return 0; //If any part is free of the object
}
return 1;
}
else{ //Tracker should catch it
int c = 0;
for (boolean b : sv) {
if(b) c++;
}
return c == objectSi... |
4eee8e17-c3a6-4a91-8428-19ee28a511d8 | 9 | public Updater(Plugin plugin, int id, File file, UpdateType type,
boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile = plugin.getDataFolder().getParentFile... |
447c3868-1035-4be2-9a61-2709bb992cdb | 4 | @EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
//HyperPVP.checkWorlds();
/*if (event.getPlayer().getWorld() == HyperPVP.getDefaultWorld()) {
int max = 66; // 500
int least = -65; // -500
if (event.getTo().getX() > max || event.getTo().getX() < least) {
moveBack("You can't fly any f... |
c0628f57-022e-48f7-a0f7-cdd3a009c310 | 1 | private static void testSuite(){
/* TESTS
x [5,7,4,3,6,9]
x [1,7,5,6,9]
x [3,7,5,2,6]
x [1,7,5,4,6,9]
x [1,2,3,4,5]
x [5,4,3,2,1]
x [2,3,1,7,9,5,8]
x [2,3,1,7,5]
x [1,9,7,10]
x [4,1,3,2]
x [7,1,6,3,2]
x [7,9,6,10,5,8]
*/
int[] hand = new int[]{1,26,27,28,29,30,31,2};
Player[] players = n... |
a51bbfbe-7df7-4df1-b8f7-f72764afa21f | 4 | public int queryReservation(String bookingID)
{
// id[0] = resID, [1] = reservID, [2] = trans ID
int[] id = parseBookingID(bookingID);
if (id == null) {
return GridSimTags.AR_STATUS_ERROR_INVALID_BOOKING_ID;
}
// search from the list first
ARObject obj = ... |
71c07752-6eac-493a-a90c-f075a4bc4360 | 2 | public void setBtn_Std_Fontcolor(int[] fontcolor) {
if ((fontcolor == null) || (fontcolor.length != 4)) {
this.buttonStdFontColor = UIFontInits.STDBUTTON.getColor();
} else {
this.buttonStdFontColor = fontcolor;
}
somethingChanged();
} |
5a535ffc-4513-4cff-9313-d61a55546c04 | 9 | public static ModuleSystemCollection parse(InputStream inputStream) throws SAXException, IOException, ParserConfigurationException{
Document doc = XmlUtil.loadDocument(inputStream);
if(doc != null){
Element root = doc.getDocumentElement();
if(root != null && root.getNodeName().equalsIgnoreCase("ipower") && ro... |
bd8ba92f-484d-4d9e-a6bc-c5a1af855469 | 7 | @Override
public void onCommand(CommandSender sender, Command cmd, String label, String[] arguments)
throws ConsoleOnlyException, InsufficientPermissionException, NotEnoughArgumentsException, PlayerOnlyException, TooManyArgumentsException
{
if(arguments[0].equalsIgnoreCase("reload"))
{
sender.sendMes... |
2b1814ac-4896-4745-b76f-2dd464a438cb | 4 | public String getCurrentPuzzle() {
String currentPuzzle = "";
for(int i = 0; i < 9; i++) {
for(int j = 0; j < 9; j++) {
if(entries[i][j].isEditable()) {
currentPuzzle = currentPuzzle + "E ";
} else {
currentPuzzle = currentPuzzle + "N ";
}
if(entries[i][j].getText().equals("")) {
c... |
5c5e980d-cca4-4f5d-b1f5-7674525b9f71 | 8 | public static boolean setTime (int i_timeTick) {
if (i_timeTick == m_start[m_curTime]) return false;
if ((m_curTime == -1) || (i_timeTick > m_start[m_curTime])) {
while ((m_curTime + 1 < m_nbMoves) && (i_timeTick >= m_start[m_curTime + 1])) {
m_curTime++;
m_label[m_curTime].move(m_angle[m_curTime]);
}... |
171a88d8-5364-440b-a969-e14c1fec55bb | 9 | @Override
public void keyReleased(KeyEvent e) {
if (!view.getNameTextField().getText().equals("")){
boolean unique=true;
String visibility = (String) view.getVisibilityComboBox().getSelectedItem();
Visibility visi;
if (visibility.equals("private")) visi= Visibility.PRIVATE;
else if (visibility.equals(... |
b88dd3b0-af0e-47ab-a50c-16592b7609bb | 5 | private void bash(String cmd, File cwd) {
if (System.getProperty("os.name").startsWith("Windows")) {
println("only works with Unix-shell!");
return;
}
try {
println("Path: " + cwd.getAbsolutePath());
println(cmd);
ProcessBuilder pb = new ProcessBuilder("bash", "-c", cmd);
if (cwd != null) {
... |
9dac071e-b486-4fcd-8a5c-8097e7a97b71 | 6 | private void addNode4everyone(Node n) {
if (n.getType() == NodeType.INPUT) {
if (!inNodes.contains(n)) {
inNodes.add(n);
}
} else if (n.getType() == NodeType.HIDDEN) {
if (!hiddenNodes.contains(n)) {
hiddenNodes.add(n);
}
... |
5199b84f-6add-4473-9ec8-e4bccf6a3249 | 8 | private void paramCompare(Method aMethod, ExprList exprList) {
// Se o metodo nao tiver parametros E nao houver parametros a serem passados
// simplesmente retorno
if (aMethod.getParamList().getSize() == 0 && exprList == null) {
return;
}
// SEM - comparando o NUMERO de parametros passados vs... |
d9fb96fc-dafd-4350-8d49-31734d1df468 | 7 | private static <T extends Comparable<? super T>> int partition(ArrayList<T> list, int start, int end){
int pivPos = bestPivotStrategy(list,start,end);
T pivot = list.get(pivPos);
normalSwap(list, start, pivPos);
int left = start+1;
int right = end;
while(true){
while(left <= right)
if(list.get... |
a920d000-5bac-495e-b2eb-d700cd2adf6b | 0 | public Participant(String id, String name, InetAddress addr, String textColor) {
this.id = id;
this.name = name;
this.addr = addr;
this.textColor = textColor;
lastSignal = System.currentTimeMillis();
} |
1240da30-8dbd-4cd9-b1ba-df1431874e33 | 4 | @SuppressWarnings("unchecked") // guarded by typeToken.equals() call
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
boolean matches = exactType != null
? exactType.equals(type) || matchRawType && exactType.getType() == type.getRawType()
: hierarchyType.isAssignableFrom(ty... |
86814038-7d28-45c1-8236-f6ecc0ed1387 | 8 | private void userHelp (ArrayList < String > command)
{
String topic;
if (command.size () > 1)
{
topic = command.get (1);
}
else
{
topic = "";
}
System.out.println ("");
if (topic.equals (""))
{
System.out.
print ("alarm on|off..............turns audible alarm o... |
c4b8b887-2ae6-400a-b7d6-91dee0cb1212 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Proveedores)) {
return false;
}
Proveedores other = (Proveedores) object;
if ((this.idproveedores == null && ot... |
b2ab36a3-58e6-4393-bbc1-619232246a40 | 4 | public static boolean RectWithRect(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2) {
if (x1 > x2+w2 || x1+w1 < x2 || y1 > y2+h2 || y1+h1 < y2) return false;
return true;
} |
15542040-e751-4eba-912a-d82812264373 | 6 | public String trim() {
int i = 0;
boolean test = true;
for(int j = 0; j < this.number.length(); j++) {
if(this.number.charAt(j) != '0' && this.number.charAt(j) != '\0') {
test = false;
break;
}
}
if(test) {
return new String(new CharNode('0'));
}
for(; i < this.number.length() - 1; ... |
8f71b081-ed19-4370-81b3-f7f924f3b96e | 7 | public static void main(String[] args) throws
InterruptedException {
if (args[0].equals("full") || args[0].equals("more")) {
BookBuilder bb;
if (args[0].equals("full"))
{
try {
ComputationController.launchComputation(args[1],
properties.getReduceOutput());
} catch (Exception e)... |
2e8f3161-880d-4e08-b79b-4b50f8fb0470 | 4 | public static void fillKnapsack(double totalValue, double bagMaxWeight, double itemArray[][], double unitValue[], int itemNumber[], DecimalFormat df){
double[] originalWeight = {itemArray[1][0], itemArray[1][1], itemArray[1][2], itemArray[1][3]};
int limit = 0;
for(int i=0; i<4; i++){
while((itemArray[1][i]) ... |
20ccebd7-bbfe-41b6-a655-eb8ace8a0ccf | 5 | public int getScore(Owner owner){
if (owner==Owner.Neutral) return -1;
int Score = 0;
City tempCity;
Iterator<City> CityIterator = iterator();
while(CityIterator.hasNext()){
tempCity = CityIterator.next();
if (tempCity.getOwner() == owner) Sco... |
5bc5c701-78ee-437a-90b6-6b0165b3fa73 | 2 | protected void paintCenteredText(Graphics2D g2, String s, Rectangle rect,
double fontHeight, Color color)
{
g2 = (Graphics2D) g2.create();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(color);
Rectangl... |
806fc2dd-51dc-419f-9583-2c05ce81dfa5 | 3 | public boolean containsOffset(int offset){
int b = start.getOffset();
int e = end.getOffset();
if ( b<e && offset >= b && offset < e ) return true;
return false;
} |
198a6cd5-ba47-4474-8154-2eece2c1cb76 | 4 | public boolean remove(DataRow row)
{
if(!checkUser())
{
return false;
}
boolean result;
row = addIdentifyingParameters(row);
DataRow removed = new DataRow(row.getTableName() + row.getName());
removed.setTableName("removedData");
removed.add... |
5a441fce-4426-448d-99e8-44c5e0c2622a | 2 | public static boolean isValidResult(Option[] options){
return isSuccessResult(options) || isFailureResult(options) || (isStoppedResult(options));
} |
3d9dc87e-23ca-4168-a71a-5518c941f2fd | 7 | public static void longestName(Scanner scanner, int number) {
String[] strings = new String[number];
int maxLength = 0;
for (int i = 0; i < number; i++) {
System.out.print("Name #" + (i + 1) + ": ");
strings[i] = scanner.nextLine();
if (maxLength < string... |
373ad925-8d81-4939-8ddd-b69d0d7719f2 | 7 | public Object getValueAt(int row, int column) {
switch(column) {
case 0 : return rowHeadings[row];
case 1 :
switch (row) {
case 0 : return statement.getSourceFile().getName();
case 1 : return statement.getLineNo();
... |
fea06e76-73da-4b60-968e-8f597f12f49e | 7 | private void drawFans(Graphics2D g) {
List<Fan> fans = model.getFans();
if (fans.isEmpty())
return;
Stroke oldStroke = g.getStroke();
Color oldColor = g.getColor();
Symbol.FanIcon fanIcon = new Symbol.FanIcon(Color.GRAY, Color.BLACK, false);
synchronized (fans) {
for (Fan f : fans) {
if (f.isVisib... |
adc6cdf3-0877-4f13-b656-acbb62c53816 | 5 | public static int[] selectionSort(int[] array) {
if(array == null || array.length <= 1) {
return array;
}
for(int i = 0; i < array.length; i++) {
int min = array[i];
int index = i;
for(int j = i; j < array.length; j++) {
if(array[j] < min) {
min = array[j];
index = j;
}
}
... |
5ea71494-eeb9-4e58-8deb-c933c057deb4 | 3 | public synchronized void addLobby(GameSettings gs, ClientThread ct) {
Packet answer = null;
if(gs == null || ct == null) {
answer = Packet.getServerErrorPacket();
} else {
lastID++;
Lobby l = new Lobby(lastID, gs, this);
... |
8618dbac-5215-425c-ac14-7eae7be55412 | 3 | public static String StrFill(String fillStr ,String oldStr ,int length ,String place)
{
StringBuffer sb = new StringBuffer();
if("right".equals(place)){
sb.append(oldStr);
}
for(int i=0; i < (length - oldStr.length());i++){
sb.append(fillStr);
}
if("left".equals(place)){
sb.append(oldStr);
}
... |
1ab1c9ee-5f43-4150-a36c-b136a98a046a | 8 | public static <T extends Comparable<T>> BasicNode<T> getParentNodeOrNull(
BasicNode<T> root,
T valueToSearch) {
if (null == root || null == valueToSearch) {
throw new IllegalArgumentException("Root or value to be inserted can not be null.");
}
if (root.getValue().equals(valueToSearch)) {
... |
a7e6a26b-c19a-4195-b19e-b3fa8d22710b | 8 | @Override
public void focusGained(FocusEvent e) {
if(e.getSource()==joinIP && getJoinIP().equals("localhost")) {
joinIP.setText("");
} else if (e.getSource()==hostPort && getJoinPort() == 1234) {
hostPort.setText("");
} else if (e.getSource()==joinPort && getJoinPort() == 1234) {
joinPort.setText("");
... |
8ddc6015-f775-47c6-aa36-08c565976987 | 1 | private static String bindParamIntoQuery(String query, Object parameter) {
try {
String paramAsJson = convertParameter(parameter);
return query.replaceFirst(TOKEN, getMatcherWithEscapedDollar(paramAsJson));
} catch (RuntimeException e) {
return handleInvalidBinding(query, parameter, e);
}
} |
07f980d1-40e4-4f5a-9328-a138d941b52c | 1 | public static boolean GetKeyDown(int keyCode)
{
return GetKey(keyCode) && !m_lastKeys[keyCode];
} |
735a8cd2-5b22-4810-b04e-db5ffc8650ff | 4 | public static void main(String[] args) throws IOException {
int count_success = 0;
int count_failure = 0;
String bucket = getBucket();
Collection<MyTask> collection = new ArrayList<MyTask>();
for (int i = 0; i < NUM_TASKS; i++) {
String uniqueKey = "file-" + UUID.ra... |
54f09d82-2d89-4462-a4e5-b65021e3ce04 | 4 | static public String generalizeWildcard(String s) {
if (s==null)
return "*";
int ix=s.length()-1;
if(ix<=1)
return "*";
while(ix>0 && s.charAt(ix)=='*')
ix--; // skip any * fields starting from the end
return s.substring(0, ix)+"*";
} |
9a5fdfc8-5ff5-42a7-a68e-429a68e71921 | 6 | @Override
public boolean handleLogLevelCommand(String providedCommandLine,
PrintStream outputStream,
IServerStatusInterface targetServerInterface)
{
boolean retVal = false;
String[] commParts = GenericUtilities.splitBySpace(providedCommandLine);
if(commParts != null && commParts.length == 2)
{
Strin... |
02070cb4-9d13-4eb6-8102-26c23d3aa768 | 4 | @Override
public boolean isActive(){
if (context == 0) {
context = -1;
try {
if (getAppletContext() != null)
context = 1;
}catch(Exception e){/**/}
}
if (context == -1)
return active;
return super.isActive();
} |
fc52568d-ed72-4040-8898-bfbfc1d1d49c | 2 | public int changeAce(){
if ((cardValue==11)&&(rank.equalsIgnoreCase("Ace")))
cardValue=1;
return cardValue;
} |
2d1776c2-e8e2-4998-be7d-e16c095ccacd | 2 | public Klus zoekKlus(int id){
Klus antw = null;
for(Klus k: alleKlussen){
if(k.getKlusNummer()==id){
antw = k;
break;
}
}
return antw;
} |
49530f10-9533-4c7a-859e-e1cab43ff99c | 2 | public void clearGrid() {
for (int x = 0; x < 4; x++) {
for (int y = 0; y < 4; y++) {
grid[x][y] = 0;
}
}
} |
899e9e7d-54b2-4290-8307-16f0e2f41ae0 | 0 | @Override
public void newbie() {
log.debug("newbie");
} |
23f6b324-a82a-4fd8-9f83-2b7f2136782d | 4 | private int[] getResList()
{
Object[] resList = super.getLocalResourceList();
int resourceID[] = null;
// if we have any resource
if ((resList != null) && (resList.length != 0))
{
resourceID = new int[resList.length];
for (int x = 0; x < resList.length; x++)
... |
246ce3f3-8026-4df5-a538-c15154697e07 | 7 | public String multiply(String num1, String num2) {
if(num1.equals("0") || num2.equals("0") )return "0";
int R = 200;
int[] mul = new int[R];
int k = R-1, min = Integer.MAX_VALUE;
//multi
for(int i = num2.length()-1; i >= 0; i--){
int a = num2.charAt(i) - '0';
... |
868e558e-0054-491a-8926-b35831dbc871 | 0 | public The5zigModUser(String player) {
this.player = player;
} |
3a92ac11-a9cd-46fa-912f-96342a4f294a | 2 | public static int pointInArray(Point p, ArrayList<PathNode> array) {
for (int c = 0; c < array.size(); c++) {
if (p.equals(array.get(c).getLocation())) {
return c;
}
}
return -1;
} |
24f75c3d-941b-46da-a8ea-1a93c8578e19 | 2 | public float getProcessStatus() {
if (isComplete) return 100f;
if (process == 0) return 0;
return process / (build_time * 1.0f);
} |
4760e26c-07f0-45a1-abb2-dac0ff08ef0a | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point3 other = (Point3) obj;
if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x))
return false;
if (Float.floatToIntBits(y) != Floa... |
13a1a761-c62e-498b-ad6a-73bc12069f38 | 7 | public IntervalManager(List<Interval> inters)
{
intervals = new ArrayList<Interval>();
intervals.addAll(inters);
endPoints = new ArrayList<Endpoint>();
for (int i = 0; i < intervals.size(); ++i)
{
Endpoint endPoint = new Endpoint();
endPoint.type = Endpoint.Type.BEGIN;
endPoint.value = ... |
6b192764-0e67-4d88-b710-ce2beee328c7 | 3 | @Override
public boolean canSeek() {
return this.mAudioInputStream.markSupported() &&
this.mFrameSize != AudioSystem.NOT_SPECIFIED &&
this.mFrameLength != AudioSystem.NOT_SPECIFIED && !this.mClosed;
} |
723a114a-ee09-45f3-b473-e47d37578662 | 9 | @Override
public void run() {
Player player1 = new Player(2000, 0);
Player dealer = new Player(0, 1);
int exit = 0;
int totalPlayer = 0;
int totalDealer = 0;
int moneyBefore = 0;
ArrayList<Card> initialPlayerHand;
ArrayList<Card> initialDealerHand;
... |
9e1fec9d-0bd6-4191-8f88-617032c93368 | 8 | @Override
public void updateBiblio(Bibliothecaire bibliothecaire) throws Exception {
if (bibliothecaire == null) {
throw new NullPointerException("Bibliothecaire null !");
}
if (bibliothecaire.getNom().equals("")) {
throw new Exception("Veuillez renseigner le nom du b... |
3eb2bc69-20ec-46be-a2ed-920856af3721 | 8 | @EventHandler
public void onProxyPing(ProxyPingEvent e) {
PendingConnection c = e.getConnection();
ListenerInfo l = c.getListener();
if (config != null) {
Profile profile = config.findProfile(this, c, l);
if (profile != null) {
ServerPing response = e.... |
9239780c-fca3-4c67-9a07-ab0be5c6f7a0 | 7 | @Override
protected List<ResourceFile> prepareResourceFiles(List<ResourceFile> list) {
if (isInPreEnv) {
// 预发布脚本
List<ResourceFile> preFiles = new ArrayList<ResourceFile>();
// 其他脚本
List<ResourceFile> otherFiles = new ArrayList<ResourceFile>();
//... |
de8cb9e5-c251-486c-874f-c281d1b35f8e | 0 | public YamlPermissionConsole(ConfigurationSection config) {
super("console", config);
} |
4c49fa90-5433-4d77-aa59-52342adcdde0 | 9 | public int uncompress(InputStream in, OutputStream out) throws IOException {
try {
BitInputStream bis = new BitInputStream(in); //compressed file
BitOutputStream bos = new BitOutputStream(out);
int bitMagic = bis.readBits(IHuffConstants.BITS_PER_INT);
if(bitMagi... |
a6ee3b1a-8d71-4e10-b2bc-e8365fed3ef4 | 3 | public static void sort(int[] randomSet)
{
int i = 0;
int m = 0;
while(i < randomSet.length)
{
int j = i + 1;
m = randomSet[i];
while(j < randomSet.length)
... |
e93a763a-29e4-4ed4-8433-5ba4ab2a24d6 | 0 | @Override
public void mouseEntered(MouseEvent e) {} |
4f3d0080-804e-4080-a983-d8f2dae4a892 | 1 | private void fixsize() {
if (res.get() != null) {
Tex tex = res.get().layer(Resource.imgc).tex();
sz = tex.sz().add(shoff);
} else {
sz = new Coord(30, 30);
}
} |
fb14b8eb-d1aa-45c4-8806-d66ef1a6c999 | 4 | public static Object loadData(File inputFile) {
Object returnValue = null;
try {
if (inputFile.exists()) {
if (inputFile.isFile()) {
ObjectInputStream readIn = new ObjectInputStream(new FileInputStream(inputFile));
returnValue = readIn.readObject();
readIn.close();
} else {
System.er... |
c46a3554-ffdf-46cc-aa46-843f31a6db9c | 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... |
0ff06e42-7535-4848-ba97-d502262d8e35 | 6 | final void method3773(int i, Interface11 interface11) {
try {
anInt7617++;
if (i != -1)
aString7845 = null;
if (((OpenGlToolkit) this).aBoolean7815) {
method3782(interface11, 327685);
method3751(interface11, i ^ ~0x4f);
} else {
if (anInt7746 >= 3)
throw new RuntimeException();
if (... |
e1acdd8c-f8f6-442b-91e8-e73f6158203b | 0 | public void setLatitude( double latitude ) {
this.latitude = latitude;
} |
8901f9bb-6c2f-4e93-ab24-194a87002dfe | 2 | protected void loadModules() {
ConcurrentHashMap<String, String> inputProperties = configuration.filter("eva.modules");
Iterator it = inputProperties.entrySet().iterator();
while (it.hasNext()) {
Map.Entry property = (Map.Entry) it.next();
String key = (String) property.... |
e0777909-027d-498c-8aa4-448f5be92b54 | 3 | @Override
public void init() {
Label dakror = new Label(Display.getWidth() / 2 - 768 / 2, Display.getHeight() / 2 - 384 / 2, 768, 384, "");
dakror.setTexture("/graphics/logo/dakror.png");
content.add(dakror);
Label ichmed = new Label(Display.getWidth() / 2 - 768 / 2, Display.getHeight() / 2 - 384 / 2, 768, ... |
e78318b2-425f-4ac8-b891-36ca06b792aa | 2 | public double[] compareCollection(Collection otherCollection) {
int similarSongCount = 0;
HashMap<String, Artist> other = otherCollection.getArtists();
Set<String> keySet = other.keySet();
Iterator i = keySet.iterator();
while(i.hasNext()) {
String tmpName = (String)i.next();
if(artists.containsKey(tmpN... |
62f05ae8-dd6e-48fb-a740-35e326113403 | 7 | @Transactional
public Experiences GetAllExperiencesWithSharedEventsAndUsersMoodEvent(String username) {
Experiences exps = getExperiences(username);
Experiences sharedExps = new Experiences();
User user = getUser(username);
for (Experience experience : exps.getExperiences()) {
if (experience.isShared() && ... |
edec0033-a82e-4e12-9dae-25c5e0d1ab04 | 7 | public void checkCollision() {
for (OperateShape shape : shapes) {
if (shape instanceof Circle) {
for (OperateShape checkShape : shapes) {
event = new CollisionEvent();
if (checkShape instanceof Circle) {
} else if (checkShape instanceof Block) {
} else if (checkShape instanceof Bar) {
... |
f0a2e8f0-a0b5-4621-a9f3-7783bcfa6030 | 4 | public void discoverWeb(String root) {
//BFS algorithm is implemented below
this.queue.add(root);
this.discoveredWebsiteList.add(root);
while (!queue.isEmpty()) {
String v = this.queue.remove();
String rowHtml = readURL(v); // read the html content of the newly found website
String regexp = "htt... |
15e5ea07-d1cd-493f-b821-7f39841641c5 | 5 | private double getEntropy(List<Example> exampleCollection) {
double positiveExampleCount = 0;
double negativeExampleCount = 0;
double q;
for (Example e : exampleCollection) {
if (e.getWinner() == 1) {
positiveExampleCount++;
} else {
negativeExampleCount++;
}
}
if (!((positiveExampleCount... |
bc491f75-5a26-442d-b5c3-25a38a73e131 | 8 | @Override
public void paintComponent(Graphics g){
super.paintComponent(g);
if(nodes.get(0) == null)
{
return;
}
Graphics2D g2 = (Graphics2D)g;
g2.setColor(Color.blue);
int x = 0;
int y = 0;
double xs = (double)(this.getWidth()-b-(no... |
b4ec1e36-916b-496a-aea3-44c20f56bb45 | 8 | private boolean withinBounds(String direction) {
ArrayList<Integer> neighbours = new ArrayList<Integer>(getNeighbours(location, size));
int check = 0;
boolean ret = false;
if(direction.equals("up")){
check = location - size;
if(neighbours.contains(check)){
ret = true;
}
}
if(direction.equ... |
dad19dcf-d878-4966-b58d-963e4a002b24 | 8 | public static List<List<Integer>> combine(int n, int k) {
if (0 == k || k > n) return null;
if (k == n) {
List<List<Integer>> res = new ArrayList<List<Integer>>();
List<Integer> l = new ArrayList<Integer>();
for (int i = 1; i <= n; i++) {
l.add(i);
}
res.add(l);
... |
90477ee1-bb18-4919-9928-41b4778fa6b2 | 2 | @Override
public boolean shouldReact(Message message) {
if(message.text.equals("counter get"))
return true;
try {
getNum(message.text.replaceAll(" ", ""));
return true;
}
catch(NumberFormatException ex) {
return false;
}
} |
294288db-4f62-4039-b11d-e42432f807bc | 7 | private static void test2_3() throws FileNotFoundException {
String test1 = "new game\n"+"examine\n"+"quit\n"+"yes\n";
HashMap<Integer, String> output = new HashMap<Integer, String>();
boolean passed = true;
try {
in = new ByteArrayInputStream(test1.getBytes());
System.setIn(in);
out = new PrintSt... |
903d4e47-9fea-4621-98bb-76bba2de0848 | 1 | public boolean connectServer(int port, String hostIp, String name) {
// 连接服务器
try {
socket = new Socket(hostIp, port);// 根据端口号和服务器ip建立连接
writer = new PrintWriter(socket.getOutputStream());
reader = new BufferedReader(new InputStreamReader(socket
... |
9186bd12-c98d-4548-82b4-87f31afc3c34 | 8 | private void checkStudents(Group newGroup, Group oldGroup)
throws ServerException {
if (log.isDebugEnabled())
log.debug("Method call. Arguments: " + newGroup + " " + oldGroup);
for (Student oldStudent : oldGroup.getStudents()) {
int j = 0;
for (Student newStudent : newGroup.getStudents()) {
if (!old... |
e9c43e04-6407-4a29-a524-0d7f4cee9400 | 5 | public void salvar(String grupo, String nome, String numTelefone) {
telefoneDAO = new TelefoneDAO();
setTelefone(telefone);
if (this.telefone.getCodtelefone() == null) {
try {
telefoneDAO.busca(numTelefone);
JOptionPane.showMessageDialog(null, "Telefon... |
069dced9-ca49-4d43-b3d3-cd076d8c0b2b | 2 | private BSTNode<T> recAdd(T element, BSTNode<T> tree) {
if (tree == null) // insert new element here
tree = new BSTNode<T>(element);
else if (element.compareTo(tree.getInfo()) <= 0) // Add in left subtree
tree.setLeft(recAdd(element, tree.getLeft()));
else ... |
246af3e6-971b-41f4-aaed-d657fde81386 | 3 | @Override
public void process_term (int linger_)
{
if (timer_started) {
io_object.cancel_timer (reconnect_timer_id);
timer_started = false;
}
if (handle_valid) {
io_object.rm_fd (handle);
handle_valid = false;
}
if... |
5bc2bf66-cef6-420b-bcd7-7d58223b562f | 9 | public Icon getIcon() {
if (tile == null) {
return null;
}
else if (!tile.isFaceUp()) {
return ICON_FACE_DOWN;
}
else if (tile instanceof Bear) {
return ICON_BEAR;
}
else if (tile instanceof Duck) {
return ICON_DUCK;
}
else if (tile instanceof Fox) {
ret... |
b3c4de31-b354-465c-8901-2777690ea2e6 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((msg.amITarget(affected))
&&(mobs.contains(msg.source())))
{
if((msg.targetMinor()==CMMsg.TYP_BUY)
||(msg.targetMinor()==CMMsg.TYP_BID)
||(msg.targetMinor()==CMMsg.TYP_SELL)
||(msg.targetMinor()==CMMsg.T... |
779f1c38-1ad2-44e9-b1f1-a950bab5a978 | 3 | public final String getMethodName(int identifier) {
String mname = methods[identifier].getName();
int j = ClassMetaobject.methodPrefixLen;
for (;;) {
char c = mname.charAt(j++);
if (c < '0' || '9' < c)
break;
}
return mname.substring(j);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.