method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
470d05b2-598b-46dd-a87f-cff6531b4fc1 | 2 | @Override
public void run() {
while (true) {
ball.update();
repaint();
try {
Thread.sleep(170);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
d85042b0-f432-41d7-bab8-776f0fbfc80b | 0 | public void setNombreRol(String nombreRol) {
this.nombreRol = nombreRol;
} |
2287582c-cbed-4097-9018-6340acb664d5 | 3 | private void dropTable(String tableName)
{
boolean ee = false;
try
{
String sql = "drop table " + tableName;
Statement statement = connection.createStatement();
statement.executeUpdate(sql);
}
catch (SQLException e)
{
if(e.getMessage().startsWith("ORA-00942: table or view does not exist"))
... |
8498528d-ffdd-427a-887f-081641459cb3 | 5 | private String getName(final ZipEntry ze) {
String name = ze.getName();
if (isClassEntry(ze)) {
if (inRepresentation != BYTECODE && outRepresentation == BYTECODE) {
name = name.substring(0, name.length() - 4); // .class.xml to
// .class
} else if (inRepresentation == BYTECODE
&& outRepresentation... |
0c1b3a48-d685-4b66-b4ca-9ca8e39ee543 | 6 | public void run() {
try {
BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
while (true) {
ClientCommandInterface cci = null;
if (bis.available() > 0) {
cci = (ClientCommandInterface) ois.readObject();
}... |
81c85ee3-69c6-4ae1-be5e-a63deb1439b9 | 2 | public Weekplanning getWeekplanningByID(int id){
int Wid = 0;
String klusNaam = null;
String monteur = null;
String auto = null;
String datum = null;
try {
this.leesDatabase();
statement = con.createStatement();
output = statement.executeQuery("SELECT * FROM klussen where id='"+ id +"'");
... |
159c8498-c084-4f5b-8d51-c021f4b315e9 | 2 | public void SelectOpt(String OptName) {
for (int i = 0; i < menuOptions.length; i++) {
if (menuOptions[i].name.equals(OptName)) {
wdgmsg(this, "cl", menuOptions[i].num);
break;
}
}
} |
788378ae-297a-4ffa-8114-b17b13f8ef7b | 8 | public void Command(String str, int idUser){
JSONParser parser = new JSONParser();
try{
Object obj = parser.parse(str);
JSONObject jsonObject = (JSONObject) obj;
String packet = (String)jsonObject.get("packet");
System.out.println(packet);
if(p... |
a2491933-899a-48e3-8a3d-5863a950d710 | 1 | @Override
public void writeToDB(MyObjects data) {
for (String line : data.getLines()) {
lines.add(line);
}
} |
862ea87b-9cbb-4964-bcf6-802e8403a684 | 2 | public void removePlayer(Player player) {
List<Player> newPlayers = new ArrayList<Player>();
for (Player player1 : players) {
if (!player1.equals(player)) {
newPlayers.add(player1);
}
}
players = newPlayers;
} |
1f8456aa-33e8-4c78-8ede-5341daf401c8 | 5 | public static boolean choiceyn(String question)
{
Scanner sc = new Scanner(System.in);
@SuppressWarnings("unused")
int rightAnswer = 0;
boolean answer = false;
writed(question);
boolean notfail = true;
// Sålänge man skriver svar som inte godtas kommer loopen köras om
while(notfail)
{
... |
f3621f24-8331-4cbb-ad06-87a1fdd72ada | 9 | @Override
public Object getValueAt(int arg0, int arg1) {
Object o = null;
// pobierz odpowiedni warto z odpowiedniego obiektu na licie
switch (arg1){
case 0: o = listaPN.get(arg0).getNrKT();
break;
case 1: o = listaPN.get(arg0).getNazwaKT();
break;
case 2: o = listaPN.get(arg0).getNume... |
b7e77a79-56df-46e2-8ba7-4f7745997b75 | 3 | private void initGame()
{
// start game
g.start();
// construct panels
topPanel = new JPanel();
scorePanel = new JPanel();
timerPanel = new JPanel();
middlePanel = new JPanel();
leftStPanel = new JPanel();
centerStPanel = new JPanel();
... |
b96161c1-a6a1-4835-9468-ecd3541de2eb | 2 | public Expression addOperand(Expression op) {
for (int i = subExpressions.length; i-- > 0;) {
int opcount = subExpressions[i].getFreeOperandCount();
if (opcount > 0) {
subExpressions[i] = subExpressions[i].addOperand(op);
operandcount += subExpressions[i].getFreeOperandCount()
- opcount;
updat... |
8cf5b047-7882-45fb-810f-2860101dec09 | 4 | boolean contain(int id){
boolean res = false;
Iterator<Integer> clusIt = clusteredData.iterator();
while(clusIt.hasNext() && res == false){
Object item = clusIt.next();
if(item instanceof Integer && item.equals(id))
res = true;
}
return res;
} |
f509b7f9-63a3-4f2c-82f1-cc5fa21b161c | 4 | public boolean checkBounds(int x, int y) {
if (x < 0 || x >= this.x || y < 0 || y >= this.y) {
return false;
}
return true;
} |
ecd4dbe8-0c46-479e-8961-c2dfdb63e84e | 5 | public void mixPotion(int id, int id2) {
for (int j = 0; j < potMixing.length; j++) {
if ((potMixing[j][0] == id && potMixing[j][1] == id) || (potMixing[j][1] == id && potMixing[j][0] == id2)) {
c.getItems().deleteItem(id, c.getItems().getItemSlot(id), 1);
c.getItems().deleteItem(id2, c.getItems().getItemS... |
0ef11dec-6093-4775-b3fe-bade6bba89d0 | 7 | public void actualizaMemoria(ArrayList<Elem> memoria){
// FIXME: Cambiar para que solo actualice las filas modificadas y no todas
// Demasiada carga para el procesador borrar y reimprimir
// Vaciar tabla memoria
while (tablaMem.getRowCount()> 0)
tablaMem.removeRow(0);
// Rellenar
for (int i ... |
00e008eb-5526-439f-a834-8f68fb83f3eb | 2 | @Override
public void validate() {
super.validate();
if( width <= 0 ){
throw new IllegalStateException( "width is <= 0: " + width );
}
if( height <= 0 ){
throw new IllegalStateException( "height is <= 0: " + height );
}
} |
bcb3e1c8-5026-4a20-84f1-2576bc03031f | 9 | public void cardsPlayed(CardSet cards, Player player) throws IllegalMoveException {
if (!trickStarted) {
trickType = cards.getType();
trickStarted = true;
}
if ((trickType != CardSet.STREETBOMB && cards.getType() == CardSet.BOMB)
|| cards.getType() == CardSet.STREETBOMB) {
trickType = cards.getType()... |
f83896db-aba4-4f39-abd8-ee2a38006323 | 9 | private Point multipleClustersCenterCoordinates(int clusters[],int start,int end,int width,
double limit,int grayPixels[],int x0,int y0,int fWidth) {
long centerX[] = new long[nClusters + 2];
long centerY[] = new long[nClusters + 2];
long colors[] = new long[nClusters + 2];
int nrPoints[]... |
54e7dfdd-85ec-4ded-9619-747dfd297c65 | 5 | private void playMovie()
{
String fileName;
if(this.data != null && this.data.isJsonObject() && this.data.getAsJsonObject().has("filePath"))
{
fileName = this.data.getAsJsonObject().get("filePath").getAsString();
}
else
{
fileName = null;
}
if(this.player == null)
{
this.player = new VideoP... |
1c8f14d6-1973-48ab-b290-0c29c661ced8 | 8 | public void move(int m){
if(m==1 && y>0) y-=1;
if(m==2 && x<9) x+=1;
if(m==3 && y<9) y+=1;
if(m==4 && x>0) x-=1;
} |
0e4bf3a2-6b1b-4634-a85d-cb32e8327500 | 0 | public Transition createTransition(State from, State to) {
Transition t = initTransition(from, to);
editTransition(t, null);
//can you say "ugly hack?"
// editTransition(t, new Point((from.getPoint().x+to.getPoint().x)/2, (from.getPoint().y+to.getPoint().y)/2));
return null;
} |
0bfd3ff6-08dd-449f-a9a1-0d81fd5f2144 | 3 | public void propagateBackNN() throws IOException{
double sum = 0;
constructNet(head);
do{
sum=0;
Elem tek=head;
while(tek!=null){
updateIO(tek);
Activation();
Deltas();
Weights();
printIO();
sum += updateError();
tek=tek.sled;
}
//System.out.print("Error: "+sum+"\n");
... |
15886860-36f4-470e-a509-366d2a149b5a | 2 | public boolean isOpen() {
return (parent = script.client.getInterface(parentID)) != null && parent.isValid() && parent.isVisible();
} |
c07799a1-5ea7-4724-acff-63f63dced103 | 6 | @Override
public boolean equals( final Object obj ) {
if( this == obj ) {
return true;
}
if( !super.equals( obj ) ) {
return false;
}
final Note other = (Note) obj;
if( hasContent() != other.hasContent() ) {
return false;
}
else if( !content.equals( other.content ) ) {
return false;
}
... |
5bc60630-c7dd-4781-96fa-5fe644129b7a | 6 | public void update() {
// 重力で下向きに加速度がかかる
vy += Map.GRAVITY;
// x方向の当たり判定
// 移動先座標を求める
double newX = x + vx;
// 移動先座標で衝突するタイルの位置を取得
// x方向だけ考えるのでy座標は変化しないと仮定
Point tile = map.getTileCollision2(this, newX, y);
if (tile == null) {
// 衝突する... |
bd567653-372b-46c4-b1f5-d3960a28f2f0 | 2 | public static Partition getPartition(List<Partition> lop, String name) {
for (Partition p : lop) {
if (p.getName().equals(name)) {
return p;
}
}
return null;
} |
9f0fdfd2-45e2-47d1-a7db-1bc6c071febd | 5 | @Override
public void update(GameContainer container, int delta) throws SlickException {
i = container.getInput();
if (i.isKeyDown(Input.KEY_UP)) {
gc.key_up(delta);
} else if (i.isKeyDown(Input.KEY_DOWN)) {
gc.key_down(delta);
}
if (i.isKeyDown(Input.KEY_RIGHT)) {
gc.key_righ... |
8a6e00af-da15-49cc-a968-4dacf58854cb | 0 | public Hosts getHosts(){
return this.hosts;
} |
dcbcdffc-044e-418a-b9d1-ff9ac33b97d7 | 2 | public static final String[] getOpenableExtensions() {
ArrayList<String> openable = new ArrayList<>();
for (FileType type : TYPES) {
if (type.mAllowOpen) {
openable.add(type.getExtension());
}
}
return openable.toArray(new String[openable.size()]);
} |
759efad0-6120-4a30-b770-c4b3c45d7a67 | 7 | private static void testInvalidNode(ListNode p) {
System.out.println("p.isValidNode() should be false: " + p.isValidNode());
try {
p.item();
System.out.println("p.item() should throw an exception, but didn't.");
} catch (InvalidNodeException lbe) {
System.out.println("p.item() should throw... |
84a404ed-5fd9-4c30-b83b-2a4506e3cb37 | 0 | @Override
public String getName() {
return name;
} |
9abf4223-fa8f-4efd-8aa3-f8f72bd64895 | 6 | private void buildMapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buildMapActionPerformed
int x,y;
try{
x = Integer.valueOf(this.xField.getText());
y = Integer.valueOf(this.yField.getText());
} catch (Exception e){
this.warningsLabel.setText("Mu... |
17ef04cd-5d9e-4519-bfb9-cf98f3fa5396 | 8 | public static void main(String[] args)
{
String filename = "SimpleDynamicScenario.txt";
// String filename = "properties.txt";
String outputPath = "./";
if (args.length >= 2)
{
filename = args[0];
outputPath = args[1];
}
if (args.length > 2)
System.err.println("WARNING: Only two arguments requir... |
0f2e74eb-f1ad-469c-875e-5984b04f9416 | 8 | @Override
public Integer getBooksCount() {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
int booksCount = 0;
try {
conn = dataSource.getConnection();
stmt = conn.prepareStatement("SELECT COUNT(*) FROM BOOK");//查詢筆數
... |
3038a5c9-4a08-485d-8884-bf5355b03377 | 4 | public boolean isLinkingVerbBased(int idx) {
if (idx + 1 > size()) return false;
List<TermPos> phrase = phrases.get(idx + 1);
if (!phrase.get(0).pos.startsWith("VB")) return false;
if (phrase.size() > 1) {
return phrase.get(1).pos.startsWith("RB");
}
if (idx + 2 > size()) return false;
phrase = phra... |
5ce9aece-2a68-4f49-b2d7-1490b9308908 | 5 | public static void main(String[] args) throws Exception {
final int VECTORNUM = 2;
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
String line = null;
do {
System.out.print("Unesite dimenzionalnost vektora (2|3): ");
line = reader.readLine();
} while (!l... |
b2b6be46-0105-4989-b11e-56478f82ddea | 6 | private final void setButtonPositions()
{
if (orientation == HORIZONTAL)
{
double cumulativeWidth = borderSize;
for (int i = 0; i < tButtons.size(); i++)
{
TButton b = tButtons.get(i);
b.setX(cumulativeWidth - (usingScrollBar ? scrollModifier : 0));
cumulativeWi... |
d2932ef8-9798-4483-ac28-e4bcfd00fef4 | 0 | @Bean
public static AspectLogging aspectLogging() {
return new AspectLogging();
} |
42f96342-9436-478c-b25e-143fe29e6bb4 | 3 | private synchronized void resend () throws JMSException {
QueueConnection qc =null;
QueueSession qs =null;
///prova mess
try {
qc = qcf.createQueueConnection();
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
qs = qc.createQueueSession(... |
5751074f-febe-4d16-b21a-e24a7f3de3df | 6 | @Override
public Set<EVDistribution> getInitialCollection(IRestrictionsModel restrictionsModel) {
Set<EVDistribution> initialCollection = new HashSet<>();
int maxEVs = restrictionsModel.getMaxEVs();
int minEVs = restrictionsModel.getMinEVs();
for (Nature nature : restrictionsModel.getAllowedNatures()) {
for... |
20c3e07f-e7a6-4568-ad0e-ef60ddefb268 | 1 | private static int[] generateList(int length) {
int[] list = new int[length];
for (int i = 0; i < list.length; i++) {
list[i] = rand.nextInt(10);
}
return list;
} |
ff840e5d-ef0e-49ed-aac3-8d536c9be64f | 9 | public void mergeBinaryField(FieldInfo fieldInfo, final MergeState mergeState, final List<BinaryDocValues> toMerge, final List<Bits> docsWithField) throws IOException {
addBinaryField(fieldInfo,
new Iterable<BytesRef>() {
@Override
public Iterator<BytesR... |
60ef1108-e0e2-4463-9e8e-8a3bd727e4f0 | 0 | public void deleteMarker(int index)
{
//markerRect.deleteMarker(index);
//repaint();
} |
e0f730b8-86ef-4409-84ed-04ac182c123d | 1 | public State getCurrentState() {
if (this.states.size() < 1) return null;
return this.states.get(this.states.size() - 1);
} |
8a5e9c3e-c062-477a-8e0b-9b45a3f8634f | 8 | private static int countStraights(int length, Card... hand) {
int count = 0;
Map<Integer, Integer> multiplier = new HashMap<>();
List<Card> cards = new ArrayList<>();
int value = -1;
for (Card card : hand) {
if (card.getStraightValue() == value) {
i... |
4667b6a2-a891-4961-8331-173ab45fcd0b | 1 | public static void printList(ArrayList<String> printSum){
for (String string : printSum) {
System.out.print(string + " ");
}
System.out.println();
} |
ae0680b4-34f8-4adf-a4d8-392dbe8a3c1e | 4 | private void checkVictoryConditions() {
int playersRemaining = 0;
Player potentialVictor = null;
for (Player player : players) {
if (!player.isDefeated()) {
playersRemaining++;
potentialVictor = player;
}
}
if (playersRemaining == 1) {
potentialVictor.endTurn();
endMatch(potentialVictor);
... |
5dcf07f9-da7e-4072-ae76-08e30ec7dfaa | 4 | @Override
public int check(String str) {
String portStr = str;
int port = 0;
//check if port number is an int
try {
port = Integer.parseInt(portStr);
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
System.err.println(e.getMessage());
System.exit(1);
}
... |
57acaa0a-4c17-42b3-a297-5be83543a2d9 | 4 | private void drawUnitBuildings(Graphics g) {
int i = 0;
for (Legion l : city.getStationaryArmy().getUnits()) {
for (UnitBuilding b : city.getUnitBuildings()) {
if (l.getType() == b.getUnitType()) {
g.drawString(drawBuilding(city.getBuildings().get(i)), 200, i*100 + 100);
buildingViewBuildin... |
db8cf4ec-3140-424a-bcdf-ceb0d7b61769 | 1 | public boolean hasSimulationLoaded() {
if (sim == null)
return false;
return true;
} |
6f1d1ce9-3f7d-4e26-88b4-7e27efdcf640 | 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 det... |
ae05fdff-c41a-419e-841e-03b258d5610f | 2 | public void visitArithExpr(final ArithExpr expr) {
if (expr.left == from) {
expr.left = (Expr) to;
((Expr) to).setParent(expr);
} else if (expr.right == from) {
expr.right = (Expr) to;
((Expr) to).setParent(expr);
} else {
expr.visitChildren(this);
}
} |
f737231f-ad27-4323-b76b-26568cff4efa | 4 | @Override
public void processDrawing() {
if (rsAlreadyLoaded || loadingError || genericLoadingError) {
showErrorScreen();
return;
}
drawCycle++;
if (!loggedIn)
drawLoginScreen(false);
else
drawGameScreen();
anInt1213 = 0;
} |
89bf62a4-cfc5-44d5-8eb7-1e5752d996f2 | 6 | public void LoadChildDirectory(String folder, String suffix) {
if(folder==null||folder.isEmpty())
return;
int current = m_corpus.getSize();
File dir = new File(folder);
for(File f: dir.listFiles()){
if(f.isFile() && f.getName().endsWith(suffix)){
loadChildDoc(f.getAbsolutePath());
}else if(f.isD... |
2dd11167-4682-4dcd-9417-af9e7e4ea72e | 2 | public void paint(Graphics g, Dimension windowDimension, Point playerPoint){
int worldWindowOffsetX = (int)Math.floor((playerPoint.x/POSITION_MULTIPLYER-windowDimension.width/BLOCK_SIZE/2));
int worldWindowOffsetY = (int)Math.floor((playerPoint.y/POSITION_MULTIPLYER-windowDimension.height/BLOCK_SIZE/2));
int x = ... |
3cb28e71-ced8-40ba-a509-28394ead83fe | 5 | public static final void readWrite(final InputStream remoteInput,
final OutputStream remoteOutput,
final InputStream localInput,
final OutputStream localOutput)
{
Thread reader, writer;
... |
d6e710ac-1a52-4454-aff6-3794627b03ac | 6 | private List<Student> parse(final Document doc) {
final List<Student> students = new Vector<Student>();
if (doc == null) {
return students;
}
final Element root = doc.getDocumentElement();
final NodeList nodeStudents = root.getChildNodes();
if (nodeStudents != null) {
if (nodeStudents.getLength() != ... |
dcc76ab4-6f50-46ed-885f-98b2b42831f5 | 3 | public void setDefault(){
JTextField actual=null;
for(int i=0; i <Interfaz.NUM_COORD;i++)
{
for(int j =0; j<Interfaz.NUM_CARS;j++)
{
actual=txtCars[i][j];
actual.setText(String.valueOf(Interfaz.CARROS_INICIALES[j][i]));
actual.setEditable(true);
}
}
JLabel actual1=null;
for(int ... |
4dc77eea-3b24-43d8-8fb9-4b4d420f33e3 | 8 | public boolean equals(Object o)
{
if (o == null || !(o instanceof Siteswap))
return false;
Siteswap s = (Siteswap)o;
if (!isValid() && !s.isValid())
return true;
if (!isValid() && s.isValid())
return false;
if (isValid() && !s.isValid())
... |
1bd63753-68b8-4243-98f1-21447f0697d6 | 2 | @Override
public void Execute(CommandSender cs, String[] args) {
try {
if(!super.validateInput(args)){
cs.sendMessage(ChatColor.RED + "[FakeLog] You are not allowed to fake " + args[0] + "!");
return;
}
cs.sendMessage(ChatColor.DARK_GREEN + "[FakeLog] Faked the login of " + args[0] + ".");
Bukkit... |
26ad7181-ea2a-43ea-8476-81f860715993 | 9 | private int asrB(int dest, int n) {
clearFlags(SR_N, SR_Z, SR_V, SR_C);
boolean hibitSet = msbSetB(dest);
boolean hasOverflow = false;
int result = dest;
boolean msbSet;
for (int i = 0; i < n; i++) {
msbSet = msbSetB(result);
if (msbSet) setFlags(SR_X, SR_C);
else clearFlags(SR... |
a533b135-4575-498a-a006-a12fd3c01c9a | 0 | @Override
public boolean isInfrastructure() { return true; } |
ed73791e-f181-473a-8bc7-39594611ddb4 | 5 | public byte[] encrypt(byte[] in, byte host) {
int iterations = 1;
int modulo = 0;
if(in.length > 117) {
iterations = (int)Math.ceil(in.length/117);
iterations++;
}
modulo = in.length % 117;
byte[] cipherText = new byte[iterations*128];
PublicKey pubKey = pubKeys.get(host);
if(pubKey != null) {
... |
7abcfa7e-656f-4362-8cdc-4dc0cbedd0d2 | 0 | public int getNumber()
{
return number;
} |
f009d443-9194-4ff2-ad17-3798217ed4fb | 1 | public void start()
{
String name = getAudioFileName();
try
{
InputStream in = getAudioStream();
AudioDevice dev = getAudioDevice();
play(in, dev);
}
catch (JavaLayerException ex)
{
synchronized (System.err)
{
System.err.println("Unable to play "+name);
ex.printStackTrace(System.e... |
f6531d6e-d7f4-467f-9661-e4fa02855908 | 8 | @Override
public void actionPerformed(ActionEvent e) {
//System.out.println("MergeAction");
OutlinerCellRendererImpl textArea = null;
boolean isIconFocused = true;
Component c = (Component) e.getSource();
if (c instanceof OutlineButton) {
textArea = ((OutlineButton) c).renderer;
} else if (c instanc... |
61947e47-9908-4f61-bd43-ad7c6897e105 | 3 | public int aroonLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod;
} |
49cf648c-87e4-4ab2-9fb0-29c858778242 | 6 | public static WeaponType getTypeFromID(int ID) {
switch(ID) {
case 0:
return GAUSS_TURRET;
case 1:
return MINIGUN;
case 2:
return ANTIMATTER_BEAM;
case 3:
return RIFT_JET;
case 4:
return NUKE;
case 5:
return EMP;
default:
return null;
}
} |
5828285e-a51e-4e5e-bcfd-d0bf1a10e959 | 1 | public static JButton createCancelButton(boolean escapeKeyIsTrigger) {
JButton button = new JButton(strings.getString("dialogCancelButton"));
button.setMnemonic(strings.getString("dialogCancelMnemonic").charAt(0));
button.putClientProperty(PROPERTY_OPTION, new Integer(CANCEL_OPTION));
if... |
562608a7-a654-449b-94ed-c67b0017c8b4 | 8 | public ArrayList<Card> createSuggestion() {
ArrayList<Card> suggestion = board.getClone();
ArrayList<Card> theirCards = new ArrayList<Card>();
boolean hasPerson = false;
boolean hasRoom = false;
boolean hasWeapon = false;
for (Card c : suggestion){
Collections.shuffle(suggestion);
if(!(seenCards.conta... |
b780a4ab-76d4-448e-bd29-ea7f1e184561 | 4 | private void copyFile(String file) throws LoaderException {
try {
//copies files from storage to executing directory
File out = new File(file);
if(!out.exists()) {
File original = new File(getClass().getResource(path + file).toURI());
Files.copy(original.toPath(), out.toPath());
}
} catch(URISyn... |
66eb119a-848a-4241-9590-80a87e59aebe | 4 | public void describeTo(Description d) {
String s = ""+type ;
if (quality != ANY && type.form != FORM_COMMODITY) {
s = QUAL_NAMES[(int) (quality + 0.5f)]+" "+s ;
}
if (amount != ANY) s = (I.shorten(amount, 1))+" "+s ;
d.append(s) ;
if (refers != null) {
d.append(" (") ;
d.append... |
69206f25-8451-4a06-b551-e0e7f1c55654 | 2 | private Grid constructGrid(List<String> lines) {
int width = 0, height = lines.size();
for(String line : lines) {
int length = line.length();
width = length > width ? length : width;
}
return new Grid(width, height, false);
} |
de5ae063-7416-49ea-8b2f-acffeadce77d | 0 | private void aliveOrderInit() {
this.aliveOrder = null;
this.rsizone = false;
} |
8ea17908-56ec-4cc6-b50a-7e57dc91c0f2 | 7 | public static void main(String[] args) {
System.out
.println("/===================================================\\\n"
+ "| \\\\ / /\\\\ |–––\\\\ |\n"
+ "| \\\\ /\\\\ / / \\\\ | || |\n"
+ "| \\\\ / \\\\ / /––––\\\\ ... |
1934df4c-6b14-4167-ac37-886f1a44155f | 0 | public FileServerClient(String publisherTopic, String listenerTopic) {
// TODO replace localhost
super(publisherTopic, listenerTopic, "jms.blobTransferPolicy.defaultUploadUrl=http://localhost:8161/fileserver/");
} |
c5bcc596-46df-4d41-a85d-4ec7f2e5eb39 | 0 | public Fraktion getOwner() {
return fraktion;
} |
d996d1aa-f3d7-441e-b594-4abd448427c0 | 6 | public void searchDirectory(File source)
{
File[] listOfFiles = source.listFiles();
if(listOfFiles != null){
for (int i = 0; i < listOfFiles.length; i++)
{
if (listOfFiles[i].isFile())
{
if(isFileSearc... |
04fee9aa-cec1-48aa-8a4f-5b7694abee47 | 7 | public void update(final Observable observable, final Object object) {
final AbstractTraceMessage message = (AbstractTraceMessage) object;
// LOGGER.info(message.getText());
if ((NodeSelectorPanel.isSelected(message.getUrn()))
&& (message.getText().startsWith(prefixUni))) {
// ... |
59213d9a-4283-4946-a144-d26e25980acb | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(mob.fetchEffect(ID())!=null)
{
mob.tell(L("Your health is already linked with someones!"));
r... |
05597861-b734-42b9-9fa7-7ac755046bee | 5 | @Override
public boolean equals(java.lang.Object obj){
if(this == obj) {
return true;
}
if (!(obj instanceof User)) {
return false;
}
User objetother = (User) obj;
if(this.firstname.equals(objetother.firstname)
&& this.surname.e... |
bacb89ca-2fdf-4e0b-89c1-6230ecba70d3 | 1 | static public VerificarEstadoCertificado instancia() {
if (UnicaInstancia == null) {
UnicaInstancia = new VerificarEstadoCertificado();
}
return UnicaInstancia;
} |
5ee0a5c6-ac25-4cb9-8a18-7e3b4a534593 | 4 | public String getRequestMessage(){
if(byteDatas.size() == 1){// 如果长度为1的话
this.message = CoderUtils.decode(ByteBuffer.wrap(byteDatas.get(0)));// 直接处理返回
}else if(byteDatas.size() > 1){
ByteBuffer buffer = null;// 缓冲区
if(this.dataPosition > BUFFER_LIMIT){// 收到的数据超过大小
buffer = ByteBuffer.allocateDirect(I... |
7612e654-f22c-4e4e-b7ee-10d6a54c84d6 | 8 | int depthFirstCutValue(Edge edge, int count) {
Node n = getTreeTail(edge);
setTreeMin(n, count);
int cutvalue = 0;
int multiplier = (edge.target == n) ? 1 : -1;
EdgeList list;
list = n.outgoing;
Edge e;
for (int i = 0; i < list.size(); i++) {
e = list.getEdge(i);
if (e.tree && e != edge) {
co... |
4e27d518-306f-42a1-b568-cdee4d1060b8 | 6 | public ServerSocketHandler(ComsLibAdapter comsLibAdapter) {
this.comsLibAdapter = comsLibAdapter;
comsLibAdapter.addEventListener(new ComsLibAdapterEventListener() {
@Override
public void onEvent(ComsLibAdapterEvent e) {
if (channelCtx == null) {
// don't do anything if the channel hasn't been initia... |
2373a758-05b2-4846-b7c5-11e898981934 | 9 | @Override
public String toString() {
StringBuffer res = new StringBuffer(alternatives[0]);
res.append(" <");
switch (type) {
case KANA:
res.append("子音");
break;
case VOWEL:
res.append("母音");
break;
case KANJI:
res.append("漢字");
break;
case LONG:
res.append("長音");
break;
case NAS... |
78fbf1ca-8d4f-4d78-8bb1-6d3ecdca18a9 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Set<MOB> h=CMLib.combat().properTargets(this,mob,auto);
if(h==null)
{
mob.tell(L("There doesn't appear to be anyone here worth shocking."));
return false;
}
final Room location = m... |
edbc99b8-2c93-4904-93da-21ca2ce2636c | 4 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
M=scanner.nextInt();
S=scanner.nextInt();
T=scanner.nextInt();
if(S==0)
System.out.println("Yes " + 0);
else if(S !=0 && T == 0)
System.out.println("No "+0);
TestMagic(M, 0, 0);
... |
b3d05a2f-f91b-494d-a1db-26da9ce89472 | 7 | @Override
public List<AgenciaFinanciadora> Buscar(AgenciaFinanciadora obj) {
String sql = "select a from AgenciaFinanciadora a";
String filtros = "";
if(obj != null){
if(obj.getId() != null){
filtros += "a.id = " + obj.getId();
}
... |
470a7448-0d1c-4175-8f11-81a724f4fd2e | 5 | private void createPartGraph(Attribute attribute) {
long start = System.nanoTime();
Map<String, Part> parts = new HashMap<>();
for (Attribute child : attribute.getChildren()) {
if (child.getName().equals("PART")) {
parts.put(child.getValue("part"), new Part(child));
}
}
partCount = parts.size... |
56e69a05-efb1-49b7-b58e-a874e77d7f7d | 1 | private void sendMessage(String message, final InetAddress address, final int port) {
message = "/m/" + message;
final byte[] messageBytes = message.getBytes();
sender = new Thread() {
@Override
public void run() {
DatagramPacket packet = new DatagramPacke... |
589c02d9-eb0b-4ba9-87cc-d24200beae47 | 5 | public void setDebuff (int id){
if (id == 0){ //stun
cache = Data.stun;
maxFrame = 6;
}else if (id == 1){ //lightning
cache = Data.air;
maxFrame = 2;
}else if (id == 2){ //freeze
cache = Data.freeze;
maxFra... |
fe83f878-ef7f-4b22-8c12-28aadcecb9c7 | 7 | protected void buildActions() {
btnDelete.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// ask the admin for input on whether to delete or not
int response = JOptionPane.showConfirmDialog(null,
"Would you like to delete currently selected "
... |
86759241-487f-4228-b7b4-3d16e4fc650b | 1 | public String describePath() {
if(parent==null)
return describeNode();
return parent.describePath()+"\\"+describeNode();
} |
bf77a983-024e-4b53-a69c-c31f66dae277 | 8 | public boolean add(String s) {
if (!(s.indexOf('.') > -1));
s = "shrey.number.sense." + s;
Class<?> c = null;
Object object = null;
try {
c = Class.forName(s);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Constructor<?> cons;
try {
cons = c.getConstructor();
} catch (NoSuchM... |
43db339a-4a75-4ce6-8861-556e53150e88 | 6 | private static boolean isLegalCharacter(char c) {
return c >= ' ' && c <= '\177' || c == ' ' || c == '\n' || c == '\t'
|| c == '\243' || c == '\u20AC';
} |
b040ba3d-79a4-4e54-ba68-8656f64d634a | 0 | public String listIncompletedSellers() {
sellers = this.cfService.listIncompletedSellers();
ActionInvocation actionInvocation = ActionContext.getContext()
.getActionInvocation();
actionInvocation.addPreResultListener(new PreResultListener() {
@Override
public void beforeResult(ActionInvocation invocat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.