method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9f9d1938-c567-4d6a-9123-559eebd9518e | 7 | public NFA(Parser p, EpsilonNFA eNFA){
// Populate new array and figure out which states are initial for NFA
eNFA.Reset();
for (int i = 0; i < eNFA.GetStates().size(); ++i){
StateNFA temp = new StateNFA();
temp.mIsInitial = eNFA.GetStates().get(i).mUsed;
temp.mItem = eNFA.GetStates().get(i).mItem;
tem... |
c85ddca6-a7a5-4298-acda-d7231a9efe8c | 0 | public Filter nand( Filter other )
{
return new Not( and( other ) );
} |
216145c6-55f9-4499-ad7d-212f2b94366e | 4 | public String readMulti(Key key, String valueName) throws RegistryErrorException
{
if(key == null)
throw new NullPointerException("Registry key cannot be null");
if(valueName == null)
throw new NullPointerException("Valuename cannot be null, because the default value is always a STRING! If you wan... |
11d357aa-ac76-4d48-86a9-a95098773d17 | 6 | private static String[] argsEnsureSyntax(String[] argsA) {
String[] argsC; // return value
int qtyTrad = 0; // provisional # occurrences of "--traditional" in given args (oughta be 0 or 1, but we cope with 2+)
for (int iA = 0; iA < argsA.length; iA++) {
if (argsA[iA].equals("--traditional")) {
qtyTrad++;
... |
52f0b214-2272-4fc1-a41d-78acd2c23ecd | 5 | @Override
public void run() {
synchronized (this) {
while (true) {
try {
wait();
} catch (InterruptedException ex) {
System.out.println("ERROR DURMIENDO DISPOSITIVO");
return;
}
... |
820313b9-5441-4987-a109-6c89f780643e | 3 | public PlayerRender() {
Image[] movementUp = null, movementDown = null, movementLeft = null,
movementRight = null, movementUpIdle = null, movementDownIdle = null,
movementLeftIdle = null, movementRightIdle = null,
dashUp = null, dashDown = null, dashLeft = null, dashRight = null, dashIdle = null;
try ... |
6f889b90-4d8b-4e2c-84d9-9bf74b36e05d | 0 | public NPC(boolean player) {
wPlayer = player;
} |
e73d1553-602e-4608-a4f2-38fc72c502c5 | 1 | @RequestMapping(value = "/event-branch-speaker-list/{eventBranchId}", method = RequestMethod.GET)
@ResponseBody
public SpeakerListResponse eventBranchSpeakerList(
@PathVariable(value = "eventBranchId") final String eventBranchIdStr
) {
Boolean success = true;
String errorMessage ... |
010a77b1-f5b3-4145-8c4f-63e5b28b5c37 | 9 | private void readLuminance() {
int type = sourceImage.getType();
if (type == BufferedImage.TYPE_INT_RGB || type == BufferedImage.TYPE_INT_ARGB) {
int[] pixels = (int[]) sourceImage.getData().getDataElements(0, 0, width, height, null);
for (int i = 0; i < picsize; i++) {
int p = pixels[i];
int r = (p &... |
b51a8d7d-9d9c-417b-9f0d-cee1a676f8d0 | 5 | public boolean midiSourcename( String sourcename )
{
if( midiChannel == null || sourcename == null )
return false;
if( midiChannel.getSourcename() == null || sourcename.equals( "" ) )
return false;
if( sourcename.equals( midiChannel.getSourcename() ) )
r... |
18937b92-ddbe-40b4-8cf4-f5ce1c1964e0 | 7 | @Test
public void testIterateActiveLevels() {
ao.setActiveLevels(new ArrayList<ILevel>());
ILevel level = new LevelDecorator() {
@Override
public void conferAward() {
}
@Override
public boolean hasPassedLevel() {
return (... |
6a4e2a86-e44e-48fa-9d4c-2711bee44416 | 2 | void applyUndoSnapshot(OutlineModel owner, RowUndoSnapshot snapshot) {
mOwner = owner;
mParent = snapshot.getParent();
mOpen = snapshot.isOpen();
if (canHaveChildren()) {
mChildren.clear();
for (Row child : snapshot.getChildren()) {
mChildren.add(child);
child.mParent = this;
}
}
} |
bac05dd1-8e6e-45a8-b450-4ffa0f46b004 | 2 | public int compareTo(WeightedDirectedEdge e)
{
if (weight < e.weight)
return -1;
else if (weight > e.weight)
return +1;
else
return 0;
} |
74124641-9d78-4086-b4a5-1b75b14cc19f | 1 | @Override
public boolean won()
{
return playerColor() == lastStanding() || getDay() > 30;
} |
802cf748-fdb1-4d8c-958d-86e380d2468f | 0 | public int getPieceIndex() {
return this.piece;
} |
a77106a6-0d63-4f74-9318-c31dec3f1be5 | 9 | private void gameLoop() {
final double TIME_BETWEEN_UPDATES = 1000 / UPDATES_PER_SECOND;
final int MAX_UPDATES_BEFORE_RENDER = 5;
double lastUpdateTime = System.currentTimeMillis();
double lastRenderTime;
final double TARGET_FPS = 60;
final double TARGET_TIME_BETWEEN_REN... |
94c1b087-ee5a-43f3-9bb3-685bb44e9bf9 | 8 | public static void printKifQuantifiedVariables(Vector variables, boolean includetypesP) {
if (variables == null) {
return;
}
{ OutputStream stream = ((OutputStream)(Logic.$PRINTLOGICALFORMSTREAM$.get()));
stream.nativeStream.print("(");
{ Skolem vbl = null;
Vector vector000 = vari... |
c2451e41-a1c4-43e5-adcf-fcb488e7d515 | 4 | public boolean checkColumn(int col)
{
int i = 0, j = 0, count = 0;
for(j = 0; j < 10; j++)
{
count = 0;
for(i = 0; i < 9; i++)
{
if(j == Integer.parseInt(entries[i][col].getText()) )
{
count++;
}
if(count >= 2)
{
System.out.println("checkColumn() returned false at i: " + i ... |
053d748e-1a74-49ef-ad4c-b722bf7d58aa | 1 | @Test
public void loadSomeArticles() throws Exception {
ArticleLoader loader = new ArticleLoader(path);
List<IArticle> articles = getArticleMocks(10);
loader.load(articles);
Thread.sleep(200);
for (IArticle article : articles) {
verify(article).getResources();
... |
66bc01d4-12ce-4c83-af9d-5e76d5384f58 | 6 | private static void bulkCheckPrices(GameDEUS myDEUS, int testItemNum) {
for (int i = 0; i < myDEUS.getItemList().size(); i++){
Item item = myDEUS.getItemList().get(i);
item.calculateLowestCost();
item.unlock();
}
System.out.println("lowest price bulk fusion ch... |
7db024fb-b886-47ec-a721-0f04bd8ad3d7 | 1 | public void EnterButton()
{
if (!userNameBoxFieldRE.getText().equals(""))
{
String tempName = userNameBoxFieldRE.getText().trim();
ClientGUI.userName = tempName;
loginWindowRE.setVisible(false);
output.println(tempName);
output.flush();
}
else
{
JOptionPane.showMessageDialog(null, "Ente... |
fa2ad4c3-287d-4cf9-90a2-7b529affd7df | 9 | protected void giveExploreXP(final MOB mob, final Room R, int amt)
{
if(((R.roomID().length()>0)
||((R.getGridParent()!=null)&&(R.getGridParent().roomID().length()>0)))
&&(!CMath.bset(R.getArea().flags(),Area.FLAG_INSTANCE_CHILD))
&&(!mob.playerStats().hasVisited(R))
&&(mob.soulMate()==null)
&&(CMLib.flag... |
1084066a-3287-430d-b726-1ab2c04cdca7 | 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... |
8571e987-7d61-4447-ac49-b90808c850c7 | 1 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
Long id = Long.valueOf(params.get("id"));
Venue venue = Venue.findById(id);
if(venue == null) {
rtn.put("rtnCode", this.getRtnCode(201));
return rtn;
}
venue.dele... |
e460027a-c5f1-4874-adf4-9f2579af159c | 0 | private IRemoteServerConnection getRemoteServerConnection() {
return remoteServerConnection;
} |
9eab3dfd-e55c-4aee-a3ff-71aace358d34 | 9 | private char nonZeroDigitToken(PositionTrackingPushbackReader par1PositionTrackingPushbackReader) throws IOException, InvalidSyntaxException
{
char c1 = (char)par1PositionTrackingPushbackReader.read();
char c;
switch (c1)
{
case 49:
case 50:
case ... |
0324b496-fc00-4932-ab98-ea9961014dcb | 8 | private javax.jcr.Node addDirectory(String path) throws RepositoryException {
if ("/".equals(path)) {
return m_session.getRootNode();
}
if (m_session.nodeExists(path)) {
javax.jcr.Node dir = m_session.getNode(path);
if (!dir.isNodeType(CATEGORY_TYPE)) {
throw new RuntimeException("Not a directory: "... |
98885654-c775-4b1a-8926-453f0370eb5f | 4 | public ControlPanel() {
JPanel peoplePanel = new JPanel();
JLabel peopleLabel = new JLabel("People");
JSpinner peopleSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 20, 1));
peopleStatusLabel = new JLabel(" People still to remove");
JPanel taxiPanel = new JPanel();
JLabel taxiLabel = new... |
110ef10d-0424-4de7-af8c-1eb9cc51894f | 5 | public void testListNil1() {
Term x = Query.oneSolution("X = []").get("X");
if (syntax.equals("traditional")) {
assertTrue("empty list is text atom []", x.isAtom() && x.atomType().equals("text") && x.name().equals("[]"));
} else {
assertTrue("empty list is reserved atom []", x.isAtom() && x.atomType().equal... |
0fe2e245-87ca-488f-99b7-557acaaa53fd | 9 | private void gameLoop() {
World.setDefaultThread(Thread.currentThread());
buffer=new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_NORMAL);
buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.setBoundingBoxMode(FrameBuffer.BOUNDINGBOX_NOT_USED);
buffer.optimizeBufferAccess()... |
35d0a832-ec68-4d4a-8c18-dee8d169d926 | 5 | public void actionPerformed(ActionEvent e) {
if ("New".equals(e.getActionCommand())) { //new
createFrame();
}else if ("Close".equals(e.getActionCommand())) {
this.close();
}else if("Closeall".equals(e.getActionCommand())) {
this.closeall();
}el... |
39027667-399e-4d1d-be8e-85cae0b37f84 | 7 | public String createOutput() {
// ************* prepare the temporary tables ***************
// ************ PERFORMANCE WATCH ***************
long perfWatch;
// **********************************************
// get a name for the temporary table
tmpTabl... |
fe892b00-a9fd-4edf-9bfe-bfea7dfe1aeb | 2 | public Boolean dropGraph(String graphURI) {
if(graphURI==null){
log.warning("to be deleted Graph URI is null");
return false;
}
String query = "DROP SILENT GRAPH <"+graphURI+">";
if(autoCommit){
return updateIntern(query, true);
}
this.queries += query+="\n";
return null;
} |
122c4ff1-dfd7-4ebe-854f-3589bdfa5fbf | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AccessModifire that = (AccessModifire) o;
if (idAccessModifire != that.idAccessModifire) return false;
if (name != null ? !name.equals(that.nam... |
df17bbc5-d4e2-4934-85a1-5104998b17b5 | 6 | double rate(Board board)
{
int maxHeight =0;
int minHeight = board.getHeight();
for(int x = 0; x < board.getWidth(); x++)
{
int height = board.getColumnHeight(x);
if(height > maxHeight)
maxHeight = height;
if(height < minHe... |
a14acf23-41d4-458c-b7f8-e40cf0122f4c | 5 | public static void main(String[] args) {
Console console = System.console();
while(true) {
String command = console.readLine("> ");
String[] commandParts = command.split(" ");
if(commandParts.length == 1) { // Reading
doReading(commandParts[0]);
} else {
if(commandParts[1].equals("->"... |
bc9e05f5-e35e-4b67-8dd3-2122579c7201 | 2 | @Override
public String toString()
{
String chaine = "L'equipe est composée de : ";
for (int indice = 0; indice<this.nbPerso; indice++)
{
chaine += this.equipe.get(indice).getType().getNomType().obtenirLabel();
if (indice != this.nbPerso-1)
chaine+=", ";
else
chaine+=".";
}
return chaine;
... |
e422c8c6-a445-45ca-9252-966ea9cef989 | 7 | @Override
public Object run() {
for (Field field : mClass.getDeclaredFields()) {
if ((field.isAnnotationPresent(Localize.class) || field.isAnnotationPresent(Localizations.class)) && (field.getModifiers() & MOD_MASK) == MOD_EXPECTED) {
try {
if (!mIsAccessible || (field.getModifiers() & Modifier.PUBLIC) =... |
12527f2b-d92b-4a2c-bbdc-0ed8aa36f342 | 0 | @Override
public Object getData() {
return data;
} |
5b906117-30a3-4048-84b7-95064dc50b4d | 0 | public RemoteClientCall(String ip, int port) throws UnknownHostException, IOException {
super(new EndPoint(port, ip));
sync = new ConcurrentHashMap<Long, IRemoteCallObject>();
} |
e61557a3-c94d-4524-bcc8-e38a9b2e63bb | 5 | public void cargarTabla(int perfil){
System.out.println("tabla");
String[] columnas = getColumnas();
Class[] tipoDatosColumnas=getTipoColumnas();
Vector<Vector<Object>> contenidoTabla = new Vector();
contenidoTabla = getContenidoTabla(perfi... |
3e2fbf1b-6b04-4028-8a26-31f1f41186e2 | 8 | public AdministrarPregunta(DTO.Pregunta p, int sel) {
initComponents();
setLocationRelativeTo(null);
// archivos arch = new archivos();
this.p = p;
this.seleccion = sel;
/* File ar = new File(p.getUrl(),"descripcion"+p.getCodigo()+".txt");
try {
... |
6fbcf15d-a6eb-49cc-93b6-5865f6350bec | 2 | private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed
UserModel userModel = new UserModel();
String maristID = maristUsernameTextField.getText();
String password = UserModel.encodePassword(new String(passwordTextField.getPassword())... |
436ff6e6-d184-46c7-8a0e-e2c53ba9198d | 3 | public static void changeName() {
System.out.println("We understand that some people suffer from multiple "
+ "personality disorder. Which one are you?");
boolean valid = false;
String playerName = null;
Scanner keyboard = new Scanner(System.in);
while (!valid) ... |
f5bb06c9-0ec8-4414-b3f8-d0583f94051c | 8 | final public void Assignment() throws ParseException {
/*@bgen(jjtree) Assignment */
ASTAssignment jjtn000 = new ASTAssignment(JJTASSIGNMENT);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFir... |
23c948ba-686b-4eac-b5f4-761b3edf414e | 3 | public UserStory(String nom, double charge)
throws IllegalArgumentException
{
if(nom != null && !nom.equals("")){
if(charge > 0){
this.setEtatUserStory(EtatUserStory.PLANIFIEE);
this.setResteAFaire(charge);
}else{
this.setEtatUserStory(EtatUserStory.NOUVELLE);
}
this.setCharge(charge);
... |
9e0f8874-6a74-4ed1-a50e-1b8c92120440 | 7 | private void unzip(String file) {
final File fSourceZip = new File(file);
try {
final String zipPath = file.substring(0, file.length() - 4);
ZipFile zipFile = new ZipFile(fSourceZip);
Enumeration<? extends ZipEntry> e = zipFile.entries();
while (e.hasMoreE... |
2586925f-6262-4b4d-8909-d20bb0b4536a | 5 | public void setProfile(ProfileBean pb) throws Exception{
Connection conn =null;
Statement stmt = null;
int rs;
try{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection(url);
stmt = conn.createStatement();
... |
af17c650-f30e-4a70-9188-62649aef7e54 | 7 | public Element handle(FreeColServer server, Player player,
Connection connection) {
ServerPlayer serverPlayer = server.getPlayer(connection);
Unit unit;
try {
unit = player.getFreeColGameObject(unitId, Unit.class);
} catch (Exception e) {
... |
f81565df-35fa-489a-afcf-a752b15d60c9 | 8 | Edge enter(Node branch) {
Node n;
Edge result = null;
int minSlack = Integer.MAX_VALUE;
boolean incoming = getParentEdge(branch).target != branch;
// searchDirection = !searchDirection;
for (int i = 0; i < graph.nodes.size(); i++) {
if (searchDirection)
n = graph.nodes.getNode(i);
else
n = gra... |
61ddb71a-83ab-4ff0-9511-55b5bc599027 | 7 | private static boolean hasSpecialChars(String input) {
boolean flag = false;
if ((input != null) && (input.length() > 0)) {
char c;
for(int i=0; i<input.length(); i++) {
c = input.charAt(i);
switch(c) {
case '<': flag = true; break;
case '>': flag = true; break;
... |
7c625d61-33ad-4830-8bf3-2d5775c17371 | 3 | public static String toString(JSONObject jo) throws JSONException {
boolean b = false;
Iterator keys = jo.keys();
String string;
StringBuffer sb = new StringBuffer();
while (keys.hasNext()) {
string = keys.next().toString();
if (!jo.isNull(s... |
af552301-d78d-4f2a-8b45-715da6411146 | 9 | @Override
public BasicValue newValue(final Type type) {
if (type == null) {
return BasicValue.UNINITIALIZED_VALUE;
}
boolean isArray = type.getSort() == Type.ARRAY;
if (isArray) {
switch (type.getElementType().getSort()) {
case Type.BOOLEAN:
... |
0dcbb6a6-252f-46c3-a3ef-03eae5935ed6 | 4 | public static void deleteLogFile() {
if(DEBUG) {
File file = new File(LOGFILE);
if(file.exists() && file.isFile()) {
if(file.length() > MAXSIZE ) {
System.out.println("logFile size: " + Long.toString(file.length()));
file.delete();
... |
0b88c772-1b1c-4b34-a786-0c72d9c8b452 | 7 | public void checkSubscription() {
PreparedStatement statement = null;
java.util.Date current = new java.util.Date();
openConnection();
try {
statement = connection.prepareStatement("SELECT subscriptionid, weekday FROM subscriptionplan");
ResultSet res = statement.... |
2cf78871-410a-4f56-aaaf-bce6370ca930 | 8 | public boolean isFinished() {
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols - 1; j++) {
if (board[i][j] * board[i][j + 1] == 0) {
// First return statement
return false;
}
if (board[i][j] == board[i][... |
0f3d94c5-f593-4b33-a688-5d50b07cb446 | 9 | public void actionPerformed(ActionEvent e) {
if(e.getSource()==cl)
{
System.exit(n);
}
if(e.getSource()==gd)
{
JOptionPane.showMessageDialog(null,info);
}
if(e.getSource()==cop)
{
JOptionPane.showMessageDialog(null,"Wha... |
d4c6b2d3-2670-4b0b-bd01-a4bc26bad79e | 2 | public static JSONArray fetchById(final String token, final String objType, final String id) throws IOException {
String url = ApiProperties.get().getUrl() + objType + "/id/" + id;
String obj = fetchData(url).toString();
JSONObject jsonObject = new JSONObject(obj);
JSONArray results = new JSONArray();
if (jso... |
29e5f830-6d32-42a2-a8d8-68706b6a48c8 | 4 | public Matrix subtract(Matrix m) {
if(numRows != m.numRows || numColumns != m.numColumns)
throw new IllegalArgumentException("Incompatible dimensions");
Matrix diff = new Matrix(numRows, numColumns);
for(int i = 0; i < numRows; i++)
for(int j = 0; j < numColumns; j++)
diff.elements[i][j] = elements[i... |
ddf4828d-2624-4fab-b376-7b17b593bbdb | 8 | public static Boolean isPrime(long n) {
if(n < 2) return false;
if(n == 2 || n == 3) return true;
if(n%2 == 0 || n%3 == 0) return false;
long sqrtN = (long)Math.sqrt(n)+1;
for(long i = 6L; i <= sqrtN; i += 6) {
if(n%(i-1) == 0 || n%(i+1) == 0) return false;
}
... |
5d0d7b78-5f5f-44d4-95b6-1388fe045169 | 7 | private void productionSleeveListSelectioner1()
{
try
{
managerStockItem.addObserver(this);
modelStocklist = new StockList2TableModel(managerStockItem.getAll());
tblStockList.setModel(modelStocklist);
managerOrder.addObserver(this);
... |
42626456-7d38-4dd0-8424-8257877835c5 | 9 | public static void main( String[] args ) {
final long clientEthernetAddress = 0x1234566;
final GameClient client = new GameClient();
client.clientEthernetAddress = clientEthernetAddress;
//// Server stuff ////
final QueuelessRealTimeEventSource<DGTimer<?>> evtReg = new QueuelessRealTimeEventSource<DG... |
72a3fe26-9761-41c2-be59-ef36990bc72b | 2 | public static void handleGetDiskSpaceReply(HTSMsg msg, HTSPClient client) {
Collection<String> requiredFields = Arrays.asList(new String[]{"freediskspace","totaldiskspace"});
if (msg.keySet().containsAll(requiredFields)){
//TODO
} else if (msg.get("error") != null){
//TODO
} else{
System.out.println("F... |
9a698996-f098-41ee-9306-f20f1279251e | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
// Define the Bottom Panel
BOTTOM_PANEL.setLayout(new FlowLayout());
BOTTOM_OK.addActionListener(this);
BOTTOM_PANEL.add(BOTTOM_OK);
BOTTOM_CANCEL.addActionListener(this);
BOTTOM_PANEL.add(BOTTOM_CANCEL);
BOTTOM_APPLY.a... |
61b054a8-6282-4dd3-9983-175c4b10b533 | 9 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NullValues nl = (NullValues)obj;
if (!nullValueStrategy.equalsIgnoreCase(nl.getNullValueStrategy())) { return false; }
if (nextCode != nl.getNextCode()... |
e06d4ee7-8023-4a9b-8717-57ec2c3680fa | 9 | public static void calculateMostDesirableSuperregion(BotState state) {
double biggestFractionOwned = 0;
SuperRegion mostDesirableSuperRegion = null;
for (SuperRegion superRegion : state.getVisibleMap().getSuperRegions()) {
if (superRegion.getOwnedFraction() > biggestFractionOwned
&& superRegion.getOwnedFr... |
877a48e0-fca8-4178-bafb-f0ed05fc44e5 | 2 | public void update(){
if(selected){
if(Input.mouse){
setDestination((double) (Input.x + Base.render.xOffset), (double) (Input.y + Base.render.yOffset));
}
}
move();
} |
30f23da0-12c9-460a-b61c-2f569e78516b | 7 | @Override
public void restoreLimb(String limbName)
{
for(int partNum=0;partNum<Race.BODY_PARTS;partNum++)
{
if(injuries[partNum]!=null)
{
for(Pair<String,Integer> part : injuries[partNum])
{
if(part.first.equalsIgnoreCase(limbName))
{
injuries[partNum].remove(part);
if(injuries... |
a308dbfd-0d4a-4327-a43e-b119458bd2b5 | 8 | s_Sub2(OpenGlToolkit var_ha_Sub2, int i, int i_133_, int i_134_, int i_135_,
int[][] is, int[][] is_136_, int i_137_) {
super(i_134_, i_135_, i_137_, is);
do {
try {
((s_Sub2) this).aHa_Sub2_8272 = var_ha_Sub2;
anInt8264 = ((s) this).anInt4588 + -2;
anIntArrayArrayArray8245 = new int[i_134_][i_135_][];... |
9aa95ad7-26c7-43d1-8d99-cb87e685858d | 9 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double a, b, c;
double biggestPerimeter = 0;
boolean triangleIsFound = false;
while (true) {
System.out.println("Enter sides A, B and C of a triangle: ");
a = sc.nextDouble();
b = sc.nextDouble();
c = sc.nextDouble();
... |
ec36a0bf-9720-422a-8575-b14a7587a279 | 6 | private void inJail(PlayerClass pPlayer){
if(pPlayer.addTimeServed()){
pPlayer.setFree();
pPlayer.cout.printTimeServed();
}
else if(pPlayer.getFreedom() > 0){
pPlayer.cout.printFreedom();
pPlayer.setFree();
pPlayer.useFreedom();
}
else{
if(pPlayer.cout.printPrisonBreak()){
pPlayer.account.addBalance... |
0de16959-e533-46a5-baea-8bb16f13426d | 7 | public void render() {
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
int xOffset = player.x - (screen.width / 2);
int yOffset = player.y - (screen.height / 2);
level.renderTiles(screen, xOffset, yOffset);
for (int x = 0; x < level.width; x++) {
i... |
f4c2a8be-eb01-4088-b260-18b31b1312b3 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FertigungsauftragNr that = (FertigungsauftragNr) o;
if (n != null ? !n.equals(that.n) : that.n != null) return false;
return true;
} |
a7606f62-d5f7-4540-bffc-fb0293060e36 | 3 | public void callForObject(MethodInvocation invocation) throws ClassNotFoundException{
// Config();
acxt = new ClassPathXmlApplicationContext("applicationContext.xml");
SpringConsumerBean consumerBean = (SpringConsumerBean)acxt.getBean("springConsumerBean");
Request request = new Request();
Object[] argsObject ... |
dc74f715-e1ee-418e-9259-959bd9dc654c | 5 | Map getAllInterfaces(CtClass clazz, Map map) {
if (map == null)
map = new HashMap();
if (clazz.isInterface())
map.put(clazz.getName(), clazz);
do {
try {
CtClass[] interfaces = clazz.getInterfaces();
for (int i = 0; i < interfa... |
2cb7909a-674f-4aea-a848-593e2d5dbcf2 | 6 | public static void doTheStuff() {
try {
openDatabase();
int input = -1;
while (input != 0) {
System.out.println("Create Items Database: 1\nInsert New Object: 2\nPrint Database: 3\nDelete Database: 6\nExit: 0");
input = scan.nextInt();
... |
5852a124-7f49-4d2d-8a91-605f9936ead1 | 8 | public void suggestAxisPairs(MetaMetrics selectedMetric){
Collections.sort(metricsList, new SortMetrics(selectedMetric));
//instantiate suggested list
suggestedAxisPairList = new ArrayList<AxisPairMetrics>();
// sublist for selecting axis pairs, we want to include the first and last axes but not the interm... |
9535a286-0558-4c2d-a8b8-7821fa8cff3a | 1 | public void mouseReleased(MouseEvent e)
{
//if (e.isPopupTrigger()) Ne marche pas avec le JDK d'IBM
if (e.getButton() == MouseEvent.BUTTON3) {
popupSaveGraphic.show(e.getComponent(), e.getX(), e.getY());
}
} |
c898a7e9-e5ff-4ebf-b5a4-392449900df3 | 8 | @Override
public String addPlayersAndAccountsFromXML(String xmlBuffer, List<PlayerAccount> addAccounts, List<MOB> addMobs, Session S)
{
final List<XMLLibrary.XMLTag> xml=CMLib.xml().parseAllXML(xmlBuffer);
if(xml==null)
return unpackErr("PLAYERs","null 'xml'");
List<XMLLibrary.XMLTag> mV=CMLib.xml().getConte... |
fb15d52f-853d-4e33-abed-7436e3fe2e12 | 9 | private synchronized AffineTransform bufferTransform(){
AffineTransform r=new AffineTransform();
for(int i=0;i<a1.size();i++){
int s1=a1.get(i);Object s2=a2.get(i);Object s3[]=null;
if(s2 instanceof Object[])s3=(Object[])s2;
if(s1==setTransform){r=makeTransform(s2); }
... |
e1d0540f-a1d2-44c0-888b-fd850e2ca33d | 3 | public void actionPerformed(ActionEvent event)
{
JMenuItem itemSelectionne = (JMenuItem) event.getSource();
if (itemSelectionne == this.MenuItemAPropos)
{
JOptionPane.showMessageDialog(this.fenetre, "Une application de jeu Othello codée par DUROT et SILVESTRE", "A propos", JOptionPane.INFORMATION_MESSAGE);
ret... |
32c1a86c-6618-40eb-94c0-8e3f2cac59e8 | 8 | public void ExportToMidi(File filename) {
AtomicBoolean[][] temp;
synchronized(_matrix) {
temp = _matrix.clone();
}
MidiFile mf = new MidiFile(_tempo.get());
mf.progChange(this.getInstrument().getSynthNum());
for (int i = 0;i<COLS;i++) {
int counter = 0;
for (int j=0;j<ROWS;j++) {
if (temp[j... |
ac0f0242-ba1f-4e53-988d-65775e445d98 | 8 | public String execute() {
UserService userService = ServicesFactory.getUserService();
try {
User user = userService.getUserByNameAndPassword(userName, password);
if(user == null){
this.addActionError("user or password error!");
user = userService.getUserByName(userName);
int times = user.getErrorL... |
dcfab44f-4c15-46c7-a472-5ba56390b5fa | 9 | private void postPlugin(final boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBuilder data =... |
a56c2ce1-39d5-4572-a617-9d46a0bfabcb | 7 | public void onBlockHit(EntityPlayer var1, int var2, int var3, int var4, int var5) {
if (var5 == 0) {
--var3;
}
if (var5 == 1) {
++var3;
}
if (var5 == 2) {
--var4;
}
if (var5 == 3) {
++var4;
}
if (... |
b9c744e2-7d5a-4985-af20-548cfb2a709d | 8 | public String parse(String text)
{
if(text.length() != 0)
{
//String lowerCase = text.toLowerCase(); //Convert string to lower case to avoid case mismatches
String lowerCase= text;
//Trim trailing spaces and remove duplicate whitespaces
lowerCase = lowerCase.trim();
Pattern pattern = Pattern.com... |
9ab9a750-d09f-48e6-9cb3-28c6c437fbb5 | 0 | public JSONException syntaxError(String message) {
return new JSONException(message + this.toString());
} |
ee044c52-59ac-4cd8-87c7-34446ce15f12 | 1 | public Builder id(int receivedId) {
if (receivedId < 0) {
log.warn("Wrong ID. receivedId ={}", id);
throw new IllegalArgumentException("Id must be integer value more than 0. Received value = " + receivedId);
}
this.id = receivedId;
return t... |
3aad5d0b-a3b0-4fe9-a14a-a6b565775411 | 9 | protected void readAttribute(String name, int length, ConstantPool cp,
DataInputStream input, int howMuch) throws IOException {
if ((howMuch & KNOWNATTRIBS) != 0 && name.equals("Code")) {
bytecode = new BytecodeInfo(this);
bytecode.read(cp, input);
} else if (name.equals("Exceptions")) {
int count = inp... |
9c9e8d01-6d1f-4b01-87f2-d37fac32c0a4 | 4 | public int get(final int index) {
final int i0 = index >>> 24;
int[][] map1;
if (i0 != 0) {
if (map == null)
return NOT_FOUND;
map1 = map[i0];
if (map1 == null)
return NOT_FOUND;
} else
map1 = map10;
int[] map2 = map1[(index >>> 12) & 0xfff];
if (map2 == null)
return NOT_FOUND;
... |
edfc9804-98fb-44d4-8a7d-84540cb895d2 | 7 | void onResize (Event event) {
clientArea = getClientArea ();
/* vertical scrollbar */
ScrollBar vBar = getVerticalBar ();
if (vBar != null) {
int clientHeight = (clientArea.height - getHeaderHeight ()) / itemHeight;
int thumb = Math.min (clientHeight, itemsCount);
vBar.setThumb (thumb);
vBar.setPageIncremen... |
c8eb9d6c-f0f2-46d2-a5be-24c663eacc0e | 0 | public String getShopUrl() {
return shopUrl;
} |
e33e50ef-fadf-4d54-a431-081aac40a8a2 | 4 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == configButton || e.getSource() == okButton) {
// hides the config dialog
parent.configAction.tap();
}
if(e.getSource() == buildTurretButton){
addTurret();
}
... |
e0e5edef-f88e-4693-8260-52539a93c92b | 5 | private void comparePlayers() {
for (Integer user1 : userRatedMovies.keySet()) {
for (Integer user2 : userRatedMovies.keySet()) {
if (user1 > user2) {
double sim = computeSimilarity(user1, user2);
if (similarities.containsKey(user1)) {
similarities.get(user1).put(user2, sim);
} else {
... |
bb77a369-7a5d-4258-a793-d8036255d5b1 | 2 | public ParticleEmitter(ParticleType type, int x, int y, int lifetime, int amount) {
for (int i = 0; i < amount; i++) {
switch (type) {
default:
/**
* Falls through *
*/
case BASIC:
particles.add(new... |
61668064-4766-4512-aeec-185abc57e5b1 | 3 | @Override
public void writeObject(Product obj) throws IOException {
if(!connectionOutStatus) {
startOutputConnection();
}
if(connectionOutStatus){
try{
os.writeObject(obj);
System.out.println("Das Produkt mit dem Namen : " + obj.getName() + " wurde gespeichert!");
} catch (IOException e)... |
336fccd8-5ac2-4bee-add2-33cf2189c19b | 7 | private int getHeuristicEstimate(State newState) {
int count = 0;
ArrayList<Box> usedBoxes = new ArrayList<Box>();
for (Goal g : level.goals) {
BoxInState bestBox = newState.boxes.get(0);
for (BoxInState b : newState.boxes) {
if (!usedBoxes.contains(b.b) && g.getId() == Character... |
a926cf47-2d00-4221-9822-50e36db8d9b2 | 0 | private long getNextIdConnection() {
final ReentrantLock l = lock;
l.lock();
try {
return ++connectionId;
}
finally {
l.unlock();
}
} |
a5e0aa34-17b2-459f-8b58-baf3b527eb30 | 2 | public void dumpExpression(TabbedPrintWriter writer)
throws java.io.IOException {
subExpressions[0].dumpExpression(writer, 201);
writer.breakOp();
writer.print(" ? ");
int subPriority = 0;
if (!subExpressions[1].getType().getHint()
.isOfType(subExpressions[2].getType())) {
writer.startOp(writer.IMPL... |
843a5a94-6b4d-4621-92d4-89324f9da3c8 | 7 | public void serviceActive(ReceivableService receivableService) {
for(ReceivableEvent receivableEvent : receivableService.getReceivableEvents()) {
Set<ServiceID> serviceIDs = eventID2serviceIDs.get(receivableEvent.getEventType());
if(serviceIDs == null) {
serviceIDs = new HashSet<ServiceID>();
Set<Ser... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.