method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9c159994-c1a2-4e55-8751-d004059bb025 | 1 | @Override
public byte[] save(JoeTree tree, DocumentInfo docInfo) {
StringBuffer buf = prepareFile(tree, docInfo);
try {
return buf.toString().getBytes(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_ENCODING_TYPE));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
... |
8efa4561-6d9b-4ce0-b3e5-8f7376fe932f | 8 | private String randomColorGenerator(){
int random = (int) (Math.random() * 8);
String selectedColor;
switch (random) {
case 1:
selectedColor = SELECT_RED;
break;
case 2:
selectedColor = SELECT_GREEN;
break;
case 3:
selectedColor = SELECT_BLUE;
break;
case 4:
selectedColor = SELECT_Y... |
85628889-0bbf-465a-b4be-549f16eca962 | 2 | public int searchType(String type){
for (int i = 0; i<treatmentMeta.size(); i++){
if (type.equals(treatmentMeta.get(i).getType()))
return i;
}
return -1;
} |
e7c65b87-dfa5-4c23-9a3f-c933f90d7be0 | 7 | private synchronized void log_line(String user, String line) {
if (ms.logusrs == null && logfd != null) return;
for (int i = 0; i < ms.logusrs.length; i++) {
if (ms.logusrs[i].equals(user)) {
try {
logfd.write((VT100.strip_all(line) + "\n").getBytes());
} catch (IOException e) {
e.printStackTra... |
dfc95c27-a647-497e-926e-aed6d2d0738d | 8 | public static Object setField(Object o, Field f, String v) throws IllegalArgumentException, IllegalAccessException {
if(f.getType().equals(boolean.class)) {
f.setBoolean(o, Boolean.parseBoolean(v));
} else if (f.getType().equals(byte.class)) {
f.setByte(o, Byte.parseByte(v));
} else if (f.getType().equals(c... |
a3da42ac-4f58-484d-84fb-c6d5336832b9 | 0 | public DigestMethodType createDigestMethodType() {
return new DigestMethodType();
} |
6302063c-e020-431e-80c7-54588abb1e90 | 7 | public void upToNext(){
try {
if(allowedValue == null){
int n = this.getValue();
if(specialValue != null){
for(int i=0; i<specialValue.length; i++){
if(n < specialValue[i] && specialValue[i] % increment == 0){
setNormal();
setText(Integer.toString(specialValue[i]));
return;
}
... |
162fa14f-ff0f-49a4-9ec5-fe8a4835bb18 | 7 | protected void readImage() {
ix = readShort(); // (sub)image position & size
iy = readShort();
iw = readShort();
ih = readShort();
int packed = read();
lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
interlace = (packed & 0x40) != 0; // 2 - inte... |
91df2975-b7d3-4e47-bae6-c7d2e6daaf1b | 9 | private static final void method1546(int[] is, int[] is_1_, int[] is_2_,
byte[] is_3_, int i, int i_4_,
int i_5_) {
int i_6_ = 0;
for (int i_7_ = i; i_7_ <= i_4_; i_7_++) {
for (int i_8_ = 0; i_8_ < i_5_; i_8_++) {
if (is_3_[i_8_] == i_7_) {
is_2_[i_6_] = i_8_;
i_6_++;
}
}
}
fo... |
1ea4ba10-6e37-42e0-8ce6-4dea1b74121c | 2 | protected void checkEntry(Entry<K, V> e) throws InvalidEntryException {
if (e == null || !(e instanceof BSTEntry)) {
throw new InvalidEntryException("Invalid entry");
}
} |
4b13cb78-bf50-4afa-9616-1c46cd03a3d9 | 4 | private void showNetworkMenu(Graphics2D g2, Rectangle d, Font font) {
// Draw subtitle
Font fontC = new Font(FONT_NAME, Font.BOLD, (int) (0.08 * height)); // scale 40/500
Rectangle ds = fontC.getStringBounds("Juego en Red", g2.getFontRenderContext()).getBounds();
g2.setFont(fontC);
... |
d70110b1-8744-42a6-a6d7-f00491a73b4b | 5 | public static void main(String[] args) {
int i = 0;
int sum = 0;
while( i<=100 ) {
sum = sum + i;
i++;
}
System.out.println("sum = " + sum);
////////////////////////////////////////
i = 0;
sum = 0;
while( i<=100 ) {
if( i%2 == 0)
sum = sum + i;
i++;
}
System... |
dd8a0185-9eae-4061-8ebc-d7fc09fd9994 | 6 | public static int spawn_in_out_err(String command, String infile, String outfile, String errfile) {
Process p;
try {
p = Runtime.getRuntime().exec(command);
} catch (IOException e) {
return -1;
}
try {
if (infile != null) {
(new Xfer(new FileInputStream(infile), p.getOutputStream())).start();
... |
5fda8f2e-4eed-4c53-87f6-410632599677 | 3 | public void draw(Graphics g, PositionTransformation pt, boolean highlight){
super.draw(g, pt, highlight);
for(Timer t : this.getTimers()) {
if(t instanceof SmsTimer) {
SmsTimer st = (SmsTimer) t;
if(st.enabled) {
pt.translateToGUIPosition(this.getPosition());
int fromX = pt.guiX, fromY = pt.gui... |
66241f40-7cab-4539-a2c5-cadca38a1089 | 7 | private static boolean isBigger(Context cx, Scriptable scope,
Object x, Object y,
Object cmp, Object[] cmpBuf)
{
if (cmp == null) {
if (cmpBuf != null) Kit.codeBug();
} else {
if (cmpBuf == null || cmpBuf... |
d571a40b-be0b-414d-957e-96ccf6efd482 | 4 | public void guiActionPerformed(int elementId, int action) {
if (elementId == list.getId()) {
switch (action) {
case 0:
System.out.println("Reload");
last();
break;
case 1:
System.out.println("Main Menu");
last();
game.showGui(new GuiMainMenu(game, Game.WIDTH, Game.HEIGHT));
break;... |
da05dd6d-2b01-4b34-a6f3-4f3264ce5bad | 4 | @Test
public void testSetQueueTimeoutErrorIndividual() {
LOGGER.log(Level.INFO, "----- STARTING TEST testSetQueueTimeoutErrorIndividual -----");
String client_hash = "";
String client_hash2 = "";
try {
server2.setUseMessageQueues(true);
} catch (TimeoutException e... |
8515957a-593b-4d51-a679-4aa1f8661593 | 3 | private void transfer(Entry<V>[] newTable) {
Entry[] src = this.table;
int newCapacity = newTable.length;
for (int j = 0; j < src.length; j++) {
Entry e = src[j];
if (e != null) {
src[j] = null;
do {
Entry next = e.next;
int i = indexFor(e.hash, newCapacity);
... |
7d398e32-7f6e-4d4a-b41f-720088683622 | 4 | @Override
protected void reactPressed(MouseEvent event) {
ProgramState curr = StateMachine.getState();
if (curr == ProgramState.EDITING || curr == ProgramState.SONG_PLAYING)
saveSong();
else if (curr == ProgramState.ARR_EDITING
|| curr == ProgramState.ARR_PLAYING)... |
1cc3a91a-0aa1-4386-b108-42f72fb3999d | 6 | public static Cons javaTranslateCodeSignature(Cons signature) {
{ Cons translatedreturntypes = Stella.NIL;
Cons translatedparametertypes = Stella.NIL;
{ Stella_Object returntype = null;
Cons iter000 = ((Cons)(signature.value));
Cons collect000 = null;
for (;!(iter000 == Stella.... |
0ab9aec3-ede0-4892-a1fe-488c0ec0626c | 6 | void parseEntityDecl() throws java.lang.Exception
{
char c;
boolean peFlag = false;
String name, value, notationName, ids[];
// Check for a parameter entity.
requireWhitespace();
if (tryRead('%')) {
peFlag = true;
requireWhitespace();
... |
f42d564c-9151-472b-bc77-bdca9e51c42a | 1 | public void injectMembers(T t) {
try {
field.set(t, logger);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} |
84841979-9e78-49d8-b70d-be0188904db5 | 9 | public static void main(String[] args) throws Exception {
final VirtualSocketAddress serverAddr;
final VirtualSocketAddress clientAddr;
serverAddr = new VirtualSocketAddress("localhost", 50200);
clientAddr = new VirtualSocketAddress("localhost", 50201);
if(virtual) {
host = new VirtualHost("localhost"... |
0de067dd-7741-47dd-92e0-d4a39cd8e304 | 1 | public static Console create() {
if(c == null) {
c = new Console();
c.addScreenItem(new TextFieldInput());
}
return c;
} |
968c0c48-85ab-4941-b6ac-354031390e93 | 7 | public void shiftMainHor(String face) {
main_grid.setColor(color_bg);
if(face.equals("R")) {
shiftLeft(1);
if(user_move) {addMove(26);} //Cancel out moves as just a view rotation
shiftLeft(2);
if(user_move) {addMove(36);} //Cancel out moves as just a view rotation
shiftLeft(3);
i... |
641bc406-3500-4ca4-baa6-5e87282ee8db | 6 | public void setImgPath_SliderMidBtn(Path img, Imagetype type) {
switch (type) {
case DEFAULT:
this.imgSliderMidBtn_Def = handleImage(img, UIResNumbers.SLIDER_MID_DEF.getNum());
if (this.imgSliderMidBtn_Def == null) {
this.imgSliderMidBtn_Def = UIDe... |
8949f272-1e55-46ad-bd68-e04a589339d3 | 4 | public static List<CustomerGroup> formatOutputs(JSONArray results) {
final List<CustomerGroup> ret = new ArrayList<CustomerGroup>();
for (int i = 0; i < results.length(); i++) {
JSONObject r = null;
if (results.get(i) instanceof JSONObject)
r = (JSONObject) results.get(i);
if (r != null) {
final C... |
facfc1eb-2f82-4e14-b56f-2c9caf27fea5 | 9 | public void setElectionColumns3() {
if( chckbxSubstituteColumns.isSelected()) {
chckbxSubstituteColumns.doClick();
}
for( VTD b : featureCollection.vtds) {
b.resetOutcomes();
b.has_election_results = true;
}
for( VTD f : featureCollection.features) {
f.resetOutcomes();
double[] dd = new d... |
5d660485-c014-4dc0-8a11-e3c5830c7024 | 2 | @RequestMapping(value = {"/CuentaBancaria/{idCuentaBancaria}"}, method = RequestMethod.DELETE)
public void delete(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idCuentaBancaria") int idCuentaBancaria) {
try {
noCache(httpServletResponse);
cue... |
083210bb-8398-4d99-8d9c-a6ef493af8a5 | 8 | public static double getDice(String input1, String input2) {
// Verifying the input:
if (input1 == null || input2 == null)
return 0;
// Quick check to catch identical objects:
if (input1 == input2)
return 1;
// avoid exception for single character searche... |
354267d0-cb8e-446b-bbc7-1cc4ff7ffd3b | 1 | public void destroy()
{
int size = fleet.size();
for(int i = 0; i < size; i++)
fleet.remove(0);
} |
f884e120-8864-4dee-97a6-a7733df01c74 | 3 | private boolean isKiosk(final Block block) {
if (!Kiosk.SIGN_BLOCKS.contains(block.getTypeId())) return false;
final Sign state = (Sign) block.getState();
for (final Kiosk kiosk : this.attendant.getKiosks())
if (kiosk.hasTitle(state)) return true;
return false;
} |
7aca8766-0fe2-4866-a574-7448603a4c56 | 6 | public void keyPressed(KeyEvent e)
{
int keycode = e.getKeyCode();
System.out.println("key pressed: ");
switch(keycode)
{
case KeyEvent.VK_UP:
System.out.println("up");
Sounds.move.play();
ShipShopEnginesMenu.moveSelectionOvalUp();
break;
case KeyEvent.VK_DOWN:
System.out.println("down... |
ad922df9-84bb-437a-a15b-65da93aae8a0 | 8 | public static int getTwoWordFreq(Term from , Term to) {
if(from.getMaxPath().getTermNature().frequency==1||
to.getMaxPath().getTermNature().frequency==1){
return 0 ;
}
WoodInterface branch = FOREST ;
String content = from.getName() ;
for (int i = 0; i < content.length(); i++) {
branch = branch.get(c... |
990a0d42-358e-4533-8aec-8cd33fb0eea6 | 0 | public Komputer wydajKomputer(String model){
Komputer komputer = zlozKomputer(model);
komputer.instalowanieOprogramowania();
komputer.pakowanie();
komputer.sprzedawanie();
return komputer;
} |
7d1410ae-d3df-4292-a035-9c9f8d71790a | 1 | public CompareToIntOperator(Type type, boolean greaterOnNaN) {
super(Type.tInt, 0);
compareType = type;
this.allowsNaN = (type == Type.tFloat || type == Type.tDouble);
this.greaterOnNaN = greaterOnNaN;
initOperands(2);
} |
d47467c8-8a7f-4f0c-99a1-f50bb7978a6a | 8 | public char read () throws IOException
{
while (true)
{
int c = In.read();
if (c == -1 || c == 255 && lastcommand == 255)
{
Dump.println("Received character " + c);
throw new IOException();
}
lastcommand = c;
if (c == 10)
{
if (lastcr == 13)
{
lastcr = 0;
continue;
... |
4981a68c-f3fa-4f1d-b53a-ce9accaf1c40 | 4 | protected mxPoint getOriginForCell(Object cell)
{
mxPoint result = origins.get(cell);
if (result == null)
{
mxGraph graph = graphComponent.getGraph();
if (cell != null)
{
result = new mxPoint(getOriginForCell(graph.getModel()
.getParent(cell)));
mxGeometry geo = graph.getCellGeometry(cel... |
1fc6b5be-ea2d-4933-9136-a1632094bdda | 8 | @Override
public void run() {
String responseStr = null;
String strInputMesg = null;
POP3CommandHandler ch = null;
// 初始化pop3 session
initSession();
// pop3服务线程正常启动
sendResponse("+OK pop3 server is ready");
getLogger().info("pop3:建立一个连接" + "(" + pop3ID + "/" + remoteHost + "/" + remoteIP + ")");
//... |
de91cb6b-c849-45a0-b644-278ca6622c49 | 0 | static void handleTCP(Socket clientSocket) throws IOException {
//get socket
Socket connectionSocket = clientSocket;
//input stream from client
BufferedReader inFromClient = new BufferedReader(
new InputStreamReader(connectionSocket.getInputStream()));
//output st... |
35ac3269-c7ce-431e-b863-225f19b9aaf6 | 9 | private void FFT_meth(int dir, double x[], double y[], int n)
{
int nn = 1 << n;
int i2 = nn >> 1;
for (int i = 0, j = 0; i < nn - 1; i += 1)
{
if (i < j)
{
double tx = x[i];
double ty = y[i];
x[i] = x[j];
y[i] = y[j];
x[j] = tx;
y[j] = ty;
}
int k = i2;
while (k <= j)
... |
28e864e4-98aa-477e-9e22-cfb3e9349f4a | 6 | private boolean roleAssignedInProduction(Production production, Person person) {
for (Role role : production.getPlay().getRoles()) {
if (role.getCast() != null) {
if (role.getCast().contains(person)) {
return true;
}
}
}
for (Role role : production.getNonActorRoles()) {
if (role.getCast() !=... |
ad5e008e-e11a-4571-8615-2939474ab047 | 3 | public void setLogLevel(final String name) {
Level level;
try { level = Level.parse(name); } catch (final Exception e) {
level = CustomPlugin.DEFAULT_LOG;
this.getLogger().warning("Log level defaulted to " + level.getName() + "; Unrecognized java.util.logging.Level: " + name + ";... |
365fe4f4-d998-4809-a732-a85dd7af1580 | 7 | private StringParameter buildOption(Object object, Container location, IXMLElement node, final Runnable onUpdate) throws GUIBuilderException {
// TODO Auto-generated method stub
String name=null;
LinkedList options = new LinkedList();
Enumeration children = node.enumerateChildren();
while(children.hasMoreElem... |
a6d36727-98c5-4358-9274-f9ab2c72664c | 7 | @Override
public void enterInput(Board board) {
input = scanner.nextLine();
boardArray = getBoardState(board);
int x = 0, y = 0;
while (true) {
if(input.length()!=3) {
System.out.println("The board Position is already occupied or it is invalid . Please e... |
d592520a-3926-460f-8f24-ac49b15726bc | 6 | public void doAction(){
if (isUserResponded){
String[] oldShopList = GasDecisionProcess.getShopListCopy();
GasDecisionProcess.resetShopList();
ArrayList<String> ans = new ArrayList<String>(4);
if (isChevron) {
GasDecisionProcess.addToShopList(gasS... |
4d9475b7-9683-408f-8818-6a0922d8d8ae | 6 | public static Level getNextLevel(Global global){
int index=0;
for (index=0; index<global.getLevels().size(); index++){
Level level = global.getLevels().get(index);
if (level.equals(global.getCurrent().getCurrentLevel())){
break;
}
}
Level level = null;
if (index==0) level = InitLevel1.loadLeve... |
a07f303f-0ef7-4cf1-922b-767a0aaa4a53 | 0 | @Override
public void configure(Binder binder) {
loadProperties();
Names.bindProperties(binder, properties);
} |
18007080-befd-49c0-9b9f-e40ac918b7d9 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> already <S... |
0cf7cb0f-8cea-41ed-b282-68c67cc008e7 | 4 | public static int doc2pdf(String srcPath, String destPath) {
File file = new File(srcPath);
if (file.exists()) {
ComThread.InitMTA();
ActiveXComponent word = null;
try {
word = new ActiveXComponent("Word.Application");
word.setProperty("Visible", false);
word.setProperty("DisplayAlerts", DISPLA... |
aee7984d-9bc9-42a2-839c-3169d4432d81 | 5 | private void learningFromDBAction() throws SocketException, IOException, ClassNotFoundException {
int k = 0;
String tableName = "";
String result = "";
tableName = this.panelDB.tableText.getText();
if(tableName.equals("")){
JOptionPane.showMessageDialog(this, "Errore! - Inserire il nome della tabe... |
bb2b151b-a3f3-4553-ba0b-ed1e9d8a96ca | 6 | public TetrisPanel()
{
setFocusable(false);
addKeyListener(new KeyListener()
{
public void keyReleased(KeyEvent e) {}
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_LEFT)
move(-1);
else if (e.getKeyCode() == KeyEvent.VK_RIGHT)
move(1);
else if (e.getKeyCode(... |
92727087-fbe8-4971-905d-986d93251ede | 3 | public void init(int[] s, int[] o)
{
int len = start.length;
this.rstart = new int[len];
this.roff = new int[len];
for(int i = 0 ; i < len; i++)
{
this.rstart[i] = Math.max(s[i],start[i]);
this.roff[i] = Math.min(s[i]+o[i], start[i]+shape[i]);
this.roff[i] -= this.rstart[i];
}
this.fjump = ne... |
5f1bcd5d-86a5-4370-91f9-5b7c16fe5f9a | 6 | public static void addSchool() {
System.out.print("Connection add school ... ");
//Connexion à la base
BaseSetting bs = new BaseSetting();
if (bs.testerConnexion()) {
System.out.println("success");
try (Scanner sc = new Scanner(System.in)) {
... |
a34e2d67-acd1-4a55-816d-e620a225bc22 | 4 | public void buildAndAddMeal(String name, double calories, double protein) {
SimpleMealDaoImpl dao = getSimpleMealDaoImpl();
Session session = null;
Transaction tx = null;
SimpleMeal newMeal = new SimpleMeal();
newMeal.setName(name);
newMeal.setCalories(calories);
... |
416aba94-74ba-4572-a208-b2e00f15c4f7 | 5 | int compareto(int[] a, int[] b) {
if (a.length > b.length)
return 1;
if (b.length > a.length)
return -1;
for (int i = 0; i < a.length; i++) {
if (a[i] > b[i])
return 1;
if (b[i] > a[i])
return -1;
}
... |
18218044-4862-425f-b7c1-713c5e721f3b | 4 | protected final JobSchedulerBuilder scheduleJob( Class<? extends Job> jobClass )
{
checkNotNull( jobClass, "Argument 'jobClass' must be not null." );
JobSchedulerBuilder builder = new JobSchedulerBuilder( jobClass );
if ( jobClass.isAnnotationPresent( Scheduled.class ) )
{
... |
e1297001-427f-4d78-856f-d85a07ed7c15 | 3 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
JSONObject jb = new JSONObject();
String userId = request.getParameter("userId");
String dateTimeInMillis = request.getParameter("dateTimeInMillis");
dateToC... |
7ee0e158-9cd2-4ac7-bdb3-db4315f69b8f | 6 | private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
try {
/*
* Validity check
*/
if (!valid()) {
return;
}
DateFormatter df = new DateFormatter(new SimpleDateFormat... |
10c2a38e-6ebb-4602-8a26-56cdbad80e64 | 4 | public static void testSshConsole()
{
SshConsole ssh = new SshConsole();
ssh.init( "10.124.115.213", SshConsole.DEFAULT_PORT, "root", "cscenter" );
ArrayList< String > commands = new ArrayList< String >();
ArrayList< String > returns = null;
commands.add( "echo 'command 1'" );
commands.add( "echo 'command ... |
7bff4e63-8d62-4b5d-aea2-6d4a818237c8 | 8 | private void handleJoin() throws IOException{
String WarIDMsg,ArmyNameMsg,SizeMsg;
List<UnitAndPlace> units = new ArrayList<UnitAndPlace>();
WarIDMsg = br.readLine();
ArmyNameMsg = br.readLine();
SizeMsg = br.readLine();
StringTokenizer warIDTokenizer = new StringTokenizer(WarIDMsg);
StringTokenizer armyN... |
20314779-a13d-4f0a-8d72-bc65af3b491a | 3 | public static int getIntProperty(String key) {
String val = getProperty(key);
if (val == null && PROP_PORT.equals(key)) {
return 80;
}
if (val == null) {
throw new IllegalArgumentException(
"getIntProperty: " + key + " does not exist");
}
return Integer.parseInt(val);
} |
cc6b7a24-20f1-4a03-903e-fba3b72fb88c | 7 | public void paint(Graphics g)
{
super.paint(g);
Graphics2D g2 = (Graphics2D) g;
Dimension d = getSize();
g2.setPaint(Color.red);
int maxDepth = 0;
for(int i = 0; i < nodes.size();i++)
{
if( nodes.get(i).getLevel() > maxDepth)
{
maxDepth = nodes.get(i).getLevel();
}
}... |
1a6ef5e7-d2cf-4943-b81f-7b9db9117c36 | 9 | private int nextNBits(int bitsToGet) {
byte b;
byte next;
byte next2next;
int l = data.length - 1;
int bp = this.bytePointer;
if (fillOrder == 1) {
b = data[bp];
if (bp == l) {
next = 0x00;
next2next = 0x00;
} else if ((bp + 1) == l) {
next = data[bp + 1];
next2next = 0x00;
} e... |
7261b688-9c3c-4636-ba06-d7a700a13686 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final DateRange other = (DateRange) obj;
if (endDate == null) {
if (other... |
14ec5bed-56da-4318-8d23-c174f8908607 | 0 | public String getItemcode() {
return this.itemcode;
} |
1fae0940-ccd0-473e-9a94-26cf07ea15f4 | 3 | public void addLinha(int numLinha) {
int temIgual = 0;
for (Integer numeroDasLinha : numeroDasLinhas) {
if (numeroDasLinha == numLinha) {
temIgual++;
}
}
if (temIgual == 0) {
this.numeroDasLinhas.add(numLinha);
}
} |
736b7c72-6f04-4697-9de3-d3e86c0f56b4 | 7 | protected void initializeCommandTypeInfo()
{
commandTypes = new Integer[] {
new Integer(EVENT_COMMAND__None), // 0;
new Integer(EVENT_COMMAND__EndEvent), // 1 - EVENT_COMMAND__STOP_PROCESSING
new Integer(EVENT_COMMAND__TownEvent), // 2 - EVENT_COMMAND__IDENTIT... |
8d3ad605-2123-4afb-a3f0-9c7d586d3acc | 3 | public void method283(int uid, int y, int orientation2, int off, int arg4, int z, Entity entity, int x, byte objectConfig, int arg9, int orientation1) {
if (entity == null) {
return;
}
WallDecoration wallDecoration = new WallDecoration();
wallDecoration.uid = uid;
wallDecoration.objectConfig = objectConfig... |
abefca2f-cecf-46b3-acea-3d9d346b3a10 | 1 | @Override
public void add(String word) {
Integer entryCount = storage.get(word) == null ? 0 : storage.get(word);
storage.put(word, ++entryCount);
} |
1f9337e5-f3ef-4880-a106-8c034f5b747a | 4 | public void visitFieldInsn(final int opcode, final String owner,
final String name, final String desc) {
switch (opcode) {
case Opcodes.GETSTATIC:
getstatic(owner, name, desc);
break;
case Opcodes.PUTSTATIC:
putstatic(owner, name, desc);
break;
case Opcodes.GETFIELD:
getfield(owner, name, desc... |
43074bf4-40cd-4cb7-81cf-3b3ad63363f6 | 5 | @Override
public void paintComponent(Graphics graphic) {
super.paintComponent(graphic);
Graphics g = backBuffer.getGraphics();
g.setColor(Color.GREEN);
g.fillRect(0, 0, GameData.MINIMAP_WIDTH, GameData.MINIMAP_HEIGTH);
//System.out.println("currentWindowX "+currentWindowX+" c... |
f7b4c692-357b-4612-a3f1-d8d65a1770e8 | 7 | private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
int targetLayer;
String propFunc;
String actFunc;
double[] actParam = new double[5];
try{
//throws NumberFormatException if not a Number.
targetLayer = Integer.parseI... |
6263a70c-3d19-4fe2-b6b0-52edc972650c | 9 | public void build() {
try {
//create package info
PackageInfo pInfo;
PackageName pName = new PackageName(id);
PackageVersion pVer = new PackageVersion(version);
PackageDescription pDesc = new PackageDescription(name);
PackageMaintainer pMai... |
dffcd382-dac0-41c3-9470-4a38f5e0e43d | 4 | public Object decodeToObject( String encodedObject )
{
byte[] objBytes = decode( encodedObject );
java.io.ByteArrayInputStream bais = null;
java.io.ObjectInputStream ois = null;
try
{
bais = new java.io.ByteArrayInputStream( objBytes );
... |
f2979ecf-9b6b-475c-90dc-c8ac973a80fd | 1 | public void stopFadeIn() {
if(fadeIn != null) {
fadeIn.fadeStop();
fadeIn.interrupt();
fadeIn = null;
}
} |
da2da01e-ac0b-4036-8c8a-fa84b345b86c | 7 | private void setExamListPanel() {
getExams();
isPublicButtons = new JButton[exams.size()];
examSelected = new JCheckBox[exams.size()];
examLabels = new JLabel[exams.size()];
for (int i = 1; i < exams.size() + 1; i++) {
sols.Model.Exam exam = exams.get(i - 1);
... |
499f4222-c6da-40b9-b4ef-737de5630ab9 | 3 | public Map<K,V> createMap() {
Class<? extends Map> mapClass = this.model.getClass();
try {
return mapClass.newInstance();
} catch( InstantiationException e ) {
throw new RuntimeException( "Cannot create a new instance from class "+mapClass.getName()+": " + e.getMessage(),
e
);
} catch( Ill... |
d24a7518-4cb9-4e06-90fe-bd21f4b0344a | 9 | void checkURI(URI uri) {
if (!uri.isAbsolute()) {
throw new IllegalArgumentException(uri.toString());
} else if (!uri.getRawSchemeSpecificPart().startsWith("/")) {
throw new IllegalArgumentException(uri.toString());
}
String temp = uri.getScheme();
if (temp == null || !temp.equals("file")) {
throw n... |
28b12bee-1c1d-4050-b604-b2caea9bfdf1 | 3 | @Override
protected void process_activate_read ()
{
if (!in_active && (state == State.active || state == State.pending)) {
in_active = true;
sink.read_activated (this);
}
} |
25872e5b-9a4d-4246-99eb-33d00ac7abb0 | 9 | final String parseConfig(final StringBuilder line, final String section) {
int idx = 0;
if (line.length() == 0) {
return section;
}
while (line.charAt(idx) == ' ') {
++idx;
if (idx == line.length()) {
return section;
}
}
if (line.charAt(idx) == '#') {
// comment -> ignore
line.setLengt... |
573d366b-f1b6-4810-8115-335d9bf17c35 | 4 | private void btnInsertarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInsertarActionPerformed
try{
int numero = Integer.parseInt(txt1.getText());
if(numero>0){
Insertar insertar = new Insertar();
Statement consulta = conexion();
... |
6fee1bb4-0ea9-4250-913e-1e01e8b59067 | 5 | @Override
public ObjectArray<E> subArray(final long pos, final long len) {
if(pos < 0 || len < 0 || len > size() - pos) throw new IndexOutOfBoundsException();
if(len == 0) return empty();
if(len == size()) return this;
return new ObjectArray<E>(root.slice(pos, len).getTree());
} |
7e08260a-4240-415b-8253-62e17b7e0f16 | 8 | @Override
public void executeMsg(Environmental myHost, CMMsg msg)
{
super.executeMsg(myHost, msg);
if(canBeUninvoked() && (invoker()!=null) && (!msg.source().isMonster()) && (msg.source()!=invoker()) && (msg.sourceMinor()==CMMsg.TYP_ENTER))
{
final Physical affected=super.affected;
if(affected != null)
... |
44f52a9d-604c-428b-a263-8b7ea45149ca | 7 | @Override
public int eval(Critter c) {
// TODO implement me!
// returns the boolean value of this expression for Critter c
int value;
if (op.toString().equals("+"))
value = left.eval(c) + right.eval(c);
else if (op.toString().equals("-"))
value = left.eval(c) - right.eval(... |
88ea0844-9b7d-4a3a-bcb5-b88be6ee7bff | 4 | public void draw(Graphics2D g) {
g.drawImage(image, (int)x, (int)y, null);
if(x < 0) {
g.drawImage(image, (int)x + GamePanel.WIDTH, (int)y, null);
}
if(x > 0) {
g.drawImage(image, (int)x - GamePanel.WIDTH, (int)y, null);
}
if(y < 0) {
g.drawImage(image, (int)x, (int)y + GamePanel.HEIGHT, null... |
7a7e0dbd-1a55-450f-8d13-281e663fdd13 | 5 | public void resizeSplit(){
//super.setSize(width, height);
if(myObjects != null && this.tabbed != null){
if(myObjects.size() > 0 && this.tabbed.getTabCount() == 1){
Component cur = this.getActive();
if(cur instanceof MultiplePane){
MultiplePane mult = (MultiplePane)cur;
mult.mySplit.setDividerL... |
86d09817-08ec-4822-9ad0-e44d53ff0c59 | 4 | public boolean isOptOut() {
synchronized (this.optOutLock) {
try {
// Reload the metrics file
this.configuration.load(this.getConfigFile());
}
catch (IOException ex) {
if (this.debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
}
catch (... |
9969bb38-9e29-4ff2-bc9c-82665a02ff10 | 2 | int readVInt() throws IOException {
int i, o = 0, vint = 0;
do {
i = super.read();
if (i < 0) {
throw new EOFException();
}
i &= 0xff;
vint += (i & 0x7f) << (o++ * 7);
} while ((i & 0x80) == 0x80);
return vint;
} |
de3c7607-ef59-4e7f-920a-ec6430d3d6f1 | 8 | private void startSchemaElement(String name, Attributes attrs) {
// if isNewSchemaElement is true tag is new element definition
boolean isNewSchemaDefault = false;
// find out if tag is new element definition
if (name == "xs:element") {
defStack.push(attrs.getValue(0));
if (1 == attrs.getLength()) {
i... |
63284d7a-cddb-4958-ac38-5fe1bc13d050 | 9 | public static void startupWebtoolsSunSystem() {
synchronized (Stella.$BOOTSTRAP_LOCK$) {
if (Stella.currentStartupTimePhaseP(0)) {
if (!(Stella.systemStartedUpP("webtools", "/HTTP/WEBTOOLS"))) {
edu.isi.webtools.StartupWebtoolsSystem.startupWebtoolsSystem();
}
}
if (Stell... |
b157b728-8128-4474-b542-ee648237c304 | 4 | private void saveSpritesheet() {
File file;
int i = 0;
while(true) {
file = new File(App.modelDir, "out/spritesheet"+(i==0?"":"-"+i)+".png");
if(!file.exists()) break;
i++;
}
// save to disk
try {
ImageIO.write(image, "PNG", file);
} catch (IOException e) {
Log.e("Failed to s... |
8e9a6fcf-5464-4a4e-a37a-f142d438cab9 | 5 | private void EscolaSelecionada_LabelPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_EscolaSelecionada_LabelPropertyChange
if(EscolaSelecionada_Label.getText().equals("nenhuma")) {
for(Component component: DadosCampo_Panel.getComponents())
component.setEnabled(fa... |
1007e629-1520-402a-9087-d6fbcea2e69e | 8 | public static void upgradePowers(){
String input = readLine("Would you like to upgrade your powers?(y/n)");
while(!input.equals("n")){
System.out.println("You have " + playerGems + " gems\nChoose one of the following things to upgrade(Or \"n\" to exit)");
int startingHealthCost... |
3d009d79-23fa-484c-812a-298bd6461ea3 | 8 | public static void generateFile(File outputDir, Version version, int rev, String buildDate)
{
String path = PACKAGE_NAME.replaceAll("\\.", "/");
File pkgdir = new File(outputDir, path);
if (!pkgdir.exists()) {
// create the pkg directory
boolean ret = pkgdir.mkdirs();... |
be34b8f4-cc99-475b-b01d-3efa4e9e011e | 4 | public void setValue(double pInputValue)
{
inputValue = pInputValue;
if (inputValue < minValue) {
inputValue = minValue;
}
if (inputValue > maxValue) {
inputValue = maxValue;
}
highestLitLedIndex = (int)((inputValue - minValue) / stepValue) - 1;
if (h... |
aeb9aaeb-8a68-4ef2-a624-18bbbf9fbe15 | 1 | public <T> Integer save(T obj) throws DaoException {
try {
return (Integer) sessionFactory.getCurrentSession().save(obj);
} catch (HibernateException e) {
throw new DaoException();
}
} |
6504bd70-fe5b-4337-b479-6f5d2b411d3c | 6 | protected Boolean navalTransport(Territory territory, List<Territory> alredyCheck){
alredyCheck.add(this);
if(neighbors.contains(territory)){
return true;
}else{
for(Territory terr : neighbors){
if(terr instanceof Water && terr.owner==this.owner && !alredyCheck.contains(terr)){
if(terr.navalTranspo... |
22f54cac-42df-4e24-b107-56407c87325d | 6 | public String suggestions(String s, int caretPos) {
String toReturn = "";
SuperString str = findWordAndPos(s, caretPos);
if (str != null) {
s = str.string;
toReturn = "Sugestions for " + s + ": ";
ArrayList<String> posibilities = trie.getMutations(s);
if (posibilities.size() == 0) {
toReturn += "N... |
37c67385-6cb4-46c9-b787-96e7a69793b8 | 4 | @EventHandler
public void handleFrameInteraction(PlayerInteractEntityEvent event) {
Entity entity = event.getRightClicked();
if (entity instanceof ItemFrame) {
User user = EdgeCoreAPI.userAPI().getUser(event.getPlayer().getName());
if (user != null) {
if (!WorldManager.getInstance().is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.